|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jgoodies.binding.extras.ListModelHolder
public final class ListModelHolder
A ValueHolder implementation that holds instances of
ListModel and that is a ListModel itself.
Note: This class is not yet part of the binary Binding library; it comes with the Binding distributions as an extra. The API is work in progress and may change without notice; this class may even be completely removed from future distributions. If you want to use this class, you may consider copying it into your codebase.
| Field Summary | |
|---|---|
protected javax.swing.event.EventListenerList |
listenerList
|
| Constructor Summary | |
|---|---|
ListModelHolder(javax.swing.ListModel listModel)
Constructs a ListModelHolder on the given ListModel. |
|
| Method Summary | |
|---|---|
void |
addListDataListener(javax.swing.event.ListDataListener l)
Adds a listener to the list that's notified each time a change to the data model occurs. |
void |
addValueChangeListener(java.beans.PropertyChangeListener listener)
Adds the given PropertyChangeListener that will be notified if the value has
been changed. |
java.lang.Object |
getElementAt(int index)
Returns the value at the specified index, or null if the current value is
null |
javax.swing.event.ListDataListener[] |
getListDataListeners()
Returns an array of all the list data listeners registered on this ArrayListModel. |
int |
getSize()
Returns the length of the list or 0 if there's no list. |
java.lang.Object |
getValue()
Returns the observed value. |
void |
removeListDataListener(javax.swing.event.ListDataListener l)
Removes a listener from the list that's notified each time a change to the data model occurs. |
void |
removeValueChangeListener(java.beans.PropertyChangeListener listener)
Removes the given PropertyChangeListener. |
void |
setListModel(javax.swing.ListModel newListModel)
Sets a new list model and notifies any registered value listeners if it has changed. |
void |
setValue(java.lang.Object newValue)
Sets a new value and notifies any registered value listeners if the value has changed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected javax.swing.event.EventListenerList listenerList
| Constructor Detail |
|---|
public ListModelHolder(javax.swing.ListModel listModel)
ListModelHolder on the given ListModel.
listModel - the initial list model| Method Detail |
|---|
public java.lang.Object getValue()
getValue in interface com.jgoodies.binding.value.ValueModelpublic void setValue(java.lang.Object newValue)
setValue in interface com.jgoodies.binding.value.ValueModelnewValue - the ListModel to be set
java.lang.ClassCastException - if the new value is not a ListModelpublic void setListModel(javax.swing.ListModel newListModel)
newListModel - the ListModel to be setpublic void addValueChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener that will be notified if the value has
been changed.
Changes in the value are checked using == not #equals. This
ensures that this class' internal ListDataListener can be moved properly
whenever the ListModel instance changes.
addValueChangeListener in interface com.jgoodies.binding.value.ValueModellistener - the listener to be addedExtendedPropertyChangeSupportpublic void removeValueChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener.
removeValueChangeListener in interface com.jgoodies.binding.value.ValueModellistener - the listener to be removedpublic void addListDataListener(javax.swing.event.ListDataListener l)
addListDataListener in interface javax.swing.ListModell - the ListDataListener to be addedpublic void removeListDataListener(javax.swing.event.ListDataListener l)
removeListDataListener in interface javax.swing.ListModell - the ListDataListener to be removedpublic java.lang.Object getElementAt(int index)
null if the current value is
null
getElementAt in interface javax.swing.ListModelindex - the requested index
index or null if the current value is
nullpublic int getSize()
getSize in interface javax.swing.ListModelpublic javax.swing.event.ListDataListener[] getListDataListeners()
ArrayListModel.
ListDataListeners, or an empty array if no list
data listeners are currently registeredaddListDataListener(ListDataListener),
removeListDataListener(ListDataListener)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||