|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jzeno.echo.databinding.BoundListModel
public final class BoundListModel
Implementation of the ListModel that can be bound to a list of domain model javabeans. It is typically used in components like the DynaListBox. It allows you to specify which property on each individual model bean is used to visualize the beans in a list. You can do this by using setLabelProperty() . The list of javabeans are specified through the setList() method.
Constructor Summary | |
---|---|
BoundListModel()
Default constructor. |
|
BoundListModel(java.util.Collection list,
java.lang.String labelProperty)
A shortcut constructor that allows you to specify the list of javabeans and the labelproperty to use for representation in the user interface. |
Method Summary | |
---|---|
void |
addListDataListener(ListDataListener l)
A method for registering ListDataListeners. |
protected void |
fireContentsChanged(java.lang.Object source,
int index0,
int index1)
|
java.lang.Object |
get(int index)
Retrieves one of the javabeans based on it's index in the list of beans. |
java.util.Comparator |
getComparator()
|
Decorator |
getDecorator()
|
java.lang.String |
getEmptySelectionLabel()
|
protected java.lang.String |
getLabelForBean(java.lang.Object bean)
Internal helper operation that retrieves the visual text that represents one of the javabeans. |
java.lang.String |
getLabelProperty()
Gets the property of the java beans in the list, that is used for visualisation. |
java.util.List |
getList()
|
java.lang.String |
getNullLabel()
Gets the null label. |
void |
removeListDataListener(ListDataListener l)
A method for unregistering ListDataListeners. |
void |
setComparator(java.util.Comparator comparator)
|
void |
setDecorator(Decorator decorator)
A decorator can be used to process the visualisation of the label. |
void |
setEmptySelectionLabel(java.lang.String emptySelectionLabel)
Sets the label to visualize if the list of javabeans that was set, is empty. |
void |
setLabelProperty(java.lang.String labelProperty)
Sets the property that will be used for visualizing the javabeans. |
void |
setList(java.util.List list)
Sets the list of javabeans to be visualized. |
void |
setNullLabel(java.lang.String nullLabel)
The nullLabel is the label that will be in the list of possible options (at the top) that corresponds to a selection of null. |
int |
size()
Retrieves the number of elements in the list as returned by getList(), and as accessible through get(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BoundListModel()
Default constructor. If you use this constructor the label-property and the list of javabeans must be specified by calling the right methods after construction.
public BoundListModel(java.util.Collection list, java.lang.String labelProperty)
A shortcut constructor that allows you to specify the list of javabeans and the labelproperty to use for representation in the user interface.
list
- the list of javabeans.labelProperty
- the property on each individual model javabean to use for
visualisation.Method Detail |
---|
public void addListDataListener(ListDataListener l)
A method for registering ListDataListeners. It is not recomended to provide your own listeners. In essence the databound components in jZeno will take care of the details of updating the model/etc...
A concrete example is the fact that a DynaListBox component is itself the ListDataListener for the model it uses.
addListDataListener
in interface ListModel
l
- The ListDataListener
to be added.public void removeListDataListener(ListDataListener l)
A method for unregistering ListDataListeners. It is not recomended to register/unregister your own listeners.
removeListDataListener
in interface ListModel
l
- The ListDataListener
to be removed.protected void fireContentsChanged(java.lang.Object source, int index0, int index1)
public java.lang.Object get(int index)
Retrieves one of the javabeans based on it's index in the list of beans.
It is important to realize that if the nullLabel property is specified, that the list of javabeans is extended with an object to represent that null selection, and that this selection will be index 0 in the list. Hence all indexes will have shifted with 1 index.
If the emptySelectionLabel property is set, and the list of javabenas that is set (@see setList()) is empty, then the list returned by getList() will contain 1 item. And the operation will succeed for index 0 !
get
in interface ListModel
index
- the index to retrieve.
protected java.lang.String getLabelForBean(java.lang.Object bean)
Internal helper operation that retrieves the visual text that represents one of the javabeans.
bean
- the bean for which to determine the visual label.
public int size()
Retrieves the number of elements in the list as returned by getList(), and as accessible through get().
It is important to realize the effect of a nullLabel. The nullLabel will add an item to this list !
size
in interface ListModel
public java.lang.String getLabelProperty()
Gets the property of the java beans in the list, that is used for visualisation.
public void setLabelProperty(java.lang.String labelProperty)
Sets the property that will be used for visualizing the javabeans.
public java.util.List getList()
public void setList(java.util.List list)
Sets the list of javabeans to be visualized.
public Decorator getDecorator()
public void setDecorator(Decorator decorator)
A decorator can be used to process the visualisation of the label.
The object passed into this decorator depends on the labelProperty.
It is also important to realize that the object passed to the decorator can potentially be the nullLabel !
public java.lang.String getNullLabel()
Gets the null label.
public void setNullLabel(java.lang.String nullLabel)
The nullLabel is the label that will be in the list of possible options (at the top) that corresponds to a selection of null.
E.g. a DynaListBox will write a null
to the databound
property if it is selected. The otherway around means that this label
will be selected by default of the databound property is null
.
public java.lang.String getEmptySelectionLabel()
public void setEmptySelectionLabel(java.lang.String emptySelectionLabel)
Sets the label to visualize if the list of javabeans that was set, is empty.
public void setComparator(java.util.Comparator comparator)
public java.util.Comparator getComparator()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |