V - The class name of the view component being initialised.public class ViewInitialiser<V> extends Object
updater used to update UI containers with data from
JavaBean objects.
Copyright 2006 Sans Pareil Technologies, Inc.
| Modifier and Type | Field and Description |
|---|---|
protected Field |
controller
The controller associated with the view.
|
protected V |
view
The object that is being initialised.
|
| Constructor and Description |
|---|
ViewInitialiser(V view)
Create a new instance for the specified view.
|
| Modifier and Type | Method and Description |
|---|---|
void |
init()
Initialise all the components declared in
view that may be
automatically initialised. |
protected ActionListener |
initActionListener(Field field)
Return an action listener instance based upon the annotation for the
specified field.
|
protected void |
initButton(String name,
Field field)
Initialise a
Button component along with its
style and action listener. |
protected void |
initLabel(String name,
Field field)
Create and configure a
Label component for
associating with the specified field. |
protected void |
initListBox(String name,
Field field)
Initialise a
SelectField component. |
protected void |
initListModel(Field field,
AbstractListComponent component)
Initialise the
ListModel for the specified
list component. |
protected void |
initSelectField(String name,
Field field)
Initialise a
ListBox component. |
protected void |
initTable(String name,
Field field)
Initialise a
Table component along with
its associated TableModel and a
TableNavigation component if appropriate. |
protected void |
initTextArea(String name,
Field field)
Initialise a
TextArea component along with
its associated style if any. |
protected void |
initTextField(String name,
Field field)
Initialise
TextField component along with its
associated action listener if any. |
protected boolean |
isPrimitive(String name)
Check the specified class name to see if it represents a primitive
type.
|
protected void |
setStyle(Component component,
String name,
Field field)
Set the style for the specified component based upon annotations
provided.
|
protected V view
protected Field controller
public void init()
throws BindingException
view that may be
automatically initialised.BindingException - If errors are encountered while initialising
the components.protected void initButton(String name, Field field) throws Throwable
Button component along with its
style and action listener.protected void initLabel(String name, Field field) throws Throwable
Label component for
associating with the specified field. If the label component is
marked as mandatory, then the Default.Bold.Label style
name is assigned, otherwise the behaviour of Utilities.createLabel( String, String ) is maintained.
Note: This method depends upon naming convention. It is
expected that the label field is named with a Label
suffix to the component the label is associated with. This convention
is used to fetch localised properties based on the name of the
associated component and not the label itself. Following this
convention also enables annotation only the associated component and
not the label also.
protected void initSelectField(String name, Field field) throws Throwable
ListBox component.name - The name of the field in view that is to be
initialised.field - The field in the view that is to be initialised.Throwable - If errors are encountered while initialising the
listBox field.initListModel(java.lang.reflect.Field, nextapp.echo.app.list.AbstractListComponent)protected void initListBox(String name, Field field) throws Throwable
SelectField component.name - The name of the field in view that is to be
initialised.field - The field in the view that is to be initialised.Throwable - If errors are encountered while initialising the
listBox field.initListModel(java.lang.reflect.Field, nextapp.echo.app.list.AbstractListComponent)protected void initTable(String name, Field field) throws Throwable
Table component along with
its associated TableModel and a
TableNavigation component if appropriate.protected void initTextArea(String name, Field field) throws Throwable
TextArea component along with
its associated style if any.protected void initTextField(String name, Field field) throws Throwable
TextField component along with its
associated action listener if any.protected void setStyle(Component component, String name, Field field) throws Throwable
protected ActionListener initActionListener(Field field) throws Throwable
field - The field for which the action listener is to be attached.Throwable - If errors are encountered while initialising the
action listener.protected void initListModel(Field field, AbstractListComponent component) throws Throwable
ListModel for the specified
list component.protected boolean isPrimitive(String name)
name - The name of the class to check.true if the name represents a primitive
type.