M - The class type of the model of the viewN - Any object that is a JavaFx2 NodeC - The class type of the controller of the viewpublic abstract class AbstractView<M extends Model,N extends Node,C extends Controller<?,?>> extends Object implements View<M,N,C>
| Modifier and Type | Field and Description |
|---|---|
private static String |
BASE_ANNOTATION_NAME
The base name of all JRebirth Annotation.
|
private Object |
callbackObject
The callback object to use for annotation event handler.
|
private C |
controller
The view controller.
|
private Pane |
errorNode
The error node used if an error occurred.
|
private static JRLogger |
LOGGER
The class logger.
|
private M |
model
The view model.
|
private N |
rootNode
The root node of this view.
|
| Constructor and Description |
|---|
AbstractView(M model)
Default Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
addHandler(Animation animation,
Annotation annotation)
Add an event handler on the given animation according to annotation OnFinished.
|
private void |
addHandler(Node node,
Annotation annotation)
Add an event handler on the given node according to annotation OnXxxxx.
|
protected void |
buildController()
Build the view controller.
|
private void |
buildErrorNode(CoreException ce)
Build the errorNode to display the error taht occured.
|
protected N |
buildRootNode()
Build the root node.
|
protected void |
finalize() |
C |
getController()
Return the view controller.
|
Pane |
getErrorNode()
Return the error node.
|
M |
getModel()
Return the view model.
|
N |
getRootNode()
Return the view root node.
|
abstract void |
hide()
Handle custom tasks to do when the view is closed or hidden.
|
protected void |
initInternalView()
Initialize the view.
|
protected abstract void |
initView()
Custom method used to initialize components.
|
void |
prepare()
Prepare the view by creating all visual nodes.
|
private void |
processAnnotations(Field property)
Process all OnXxxx Annotation to attach event handler on this field.
|
private void |
processFields()
Process all fields' annotations to auto-link them with event handler.
|
private void |
processViewAnnotation()
Process view annotation.
|
abstract void |
reload()
Handle custom tasks to do at each rendering of the view (re-display).
|
abstract void |
start()
Handle custom tasks to do the first time after creation of the view.
|
private static final JRLogger LOGGER
private static final String BASE_ANNOTATION_NAME
private transient C extends Controller<?,?> controller
private transient Pane errorNode
private Object callbackObject
public AbstractView(M model)
model - the dedicated view modelprivate void buildErrorNode(CoreException ce)
ce - the CoreException to displaypublic void prepare()
throws CoreException
prepare in interface View<M extends Model,N extends Node,C extends Controller<?,?>>CoreException - if the preparation failsprivate void processViewAnnotation()
private void processFields()
throws CoreException
CoreException - if annotation processing failsprivate void processAnnotations(Field property) throws CoreException
property - the field to analyzeCoreException - if annotation processing failsprivate void addHandler(Node node, Annotation annotation) throws CoreException
node - the graphical node, must be not nullannotation - the OnXxxx annotationCoreException - if an error occurred while linking the event handlerprivate void addHandler(Animation animation, Annotation annotation) throws CoreException
animation - the animation, must be not nullannotation - the OnXxxx annotation (only OnFinished is supported)CoreException - if an error occurred while linking the event handlerpublic abstract void start()
public abstract void reload()
public abstract void hide()
protected N buildRootNode() throws CoreException
CoreException - if introspection failsprotected void buildController()
throws CoreException
CoreException - if introspection failspublic final M getModel()
public final C getController()
getController in interface View<M extends Model,N extends Node,C extends Controller<?,?>>public final N getRootNode()
getRootNode in interface View<M extends Model,N extends Node,C extends Controller<?,?>>public final Pane getErrorNode()
getErrorNode in interface View<M extends Model,N extends Node,C extends Controller<?,?>>protected final void initInternalView()
initView() method to setup your view.protected abstract void initView()
Copyright © 2011–2014 JRebirth OSS. All rights reserved.