|
|||||||||
| Home >> All >> com >> jgoodies >> binding >> [ extras overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.jgoodies.binding.extras
Class ListModelHolder

java.lang.Objectcom.jgoodies.binding.extras.ListModelHolder
- All Implemented Interfaces:
- javax.swing.ListModel
- public final class ListModelHolder
- extends java.lang.Object
- implements javax.swing.ListModel
- extends java.lang.Object
A com.jgoodies.binding.value.ValueHolder implementation that holds
instances of javax.swing.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.
- Version:
- $Revision: 1.8 $
| Nested Class Summary | |
private class |
ListModelHolder.ListDataChangeHandler
|
| Field Summary | |
private ExtendedPropertyChangeSupport |
changeSupport
If any PropertyChangeListeners have been registered,
the changeSupport field describes them. |
private ListModelHolder.ListDataChangeHandler |
listDataChangeHandler
Holds the change handler that fires changes is the underlying list model changes. |
protected javax.swing.event.EventListenerList |
listenerList
|
private javax.swing.ListModel |
listModel
Holds the list model value. |
private static java.lang.String |
PROPERTYNAME_VALUE
The name of the bound property value. |
| 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. |
private void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property. |
void |
addValueChangeListener(java.beans.PropertyChangeListener listener)
Adds the given PropertyChangeListener that
will be notified if the value has been changed. |
private void |
fireContentsChanged(int index0,
int index1)
This method must be called after one or more elements of the list change. |
private void |
fireIntervalAdded(int index0,
int index1)
This method must be called after one or more elements are added to the model. |
private void |
fireIntervalRemoved(int index0,
int index1)
This method must be called after one or more elements are removed from the model. |
private void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Support for reporting bound property changes for Object properties. |
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. |
private void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list for a specific property. |
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 |
PROPERTYNAME_VALUE
private static final java.lang.String PROPERTYNAME_VALUE
- The name of the bound property value.
listDataChangeHandler
private final ListModelHolder.ListDataChangeHandler listDataChangeHandler
- Holds the change handler that fires changes is the underlying
list model changes.
changeSupport
private ExtendedPropertyChangeSupport changeSupport
- If any
PropertyChangeListenershave been registered, thechangeSupportfield describes them.
listModel
private javax.swing.ListModel listModel
- Holds the list model value.
listenerList
protected javax.swing.event.EventListenerList listenerList
| Constructor Detail |
ListModelHolder
public ListModelHolder(javax.swing.ListModel listModel)
- Constructs a
ListModelHolderon the givenListModel.
| Method Detail |
getValue
public java.lang.Object getValue()
- Returns the observed value. In case of a write-only value,
implementors may choose to either reject this operation or
to do nothing.
setValue
public void setValue(java.lang.Object newValue)
- Sets a new value and notifies any registered value listeners
if the value has changed.
setListModel
public void setListModel(javax.swing.ListModel newListModel)
- Sets a new list model and notifies any registered value listeners
if it has changed.
addValueChangeListener
public void addValueChangeListener(java.beans.PropertyChangeListener listener)
- Adds the given
PropertyChangeListenerthat will be notified if the value has been changed.Changes in the value are checked using
==not#equals. This ensures that this class' internalListDataListenercan be moved properly whenever theListModelinstance changes.
removeValueChangeListener
public void removeValueChangeListener(java.beans.PropertyChangeListener listener)
- Removes the given
PropertyChangeListener.
addPropertyChangeListener
private final void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
- Adds a PropertyChangeListener to the listener list for a specific
property. The specified property may be user-defined.
Note that if this Model is inheriting a bound property, then no event will be fired in response to a change in the inherited property.
If listener is
null, no exception is thrown and no action is performed.The
ExtendedPropertyChangeSupportinstance created here is configured to check value changes using==, not#equals. This ensures that this class' internalListDataListenercan be moved properly whenever theListModelinstance changes.
removePropertyChangeListener
private final void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
- Removes a PropertyChangeListener from the listener list for a specific
property. This method should be used to remove PropertyChangeListeners
that were registered for a specific bound property.
If listener is
null, no exception is thrown and no action is performed.
firePropertyChange
private void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
- Support for reporting bound property changes for Object properties.
This method can be called when a bound property has changed and it will
send the appropriate PropertyChangeEvent to any registered
PropertyChangeListeners.
addListDataListener
public 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.
- Specified by:
addListDataListenerin interfacejavax.swing.ListModel
removeListDataListener
public 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.
- Specified by:
removeListDataListenerin interfacejavax.swing.ListModel
getElementAt
public java.lang.Object getElementAt(int index)
- Returns the value at the specified index, or
nullif the current value isnull- Specified by:
getElementAtin interfacejavax.swing.ListModel
getSize
public int getSize()
- Returns the length of the list or 0 if there's no list.
- Specified by:
getSizein interfacejavax.swing.ListModel
getListDataListeners
public javax.swing.event.ListDataListener[] getListDataListeners()
- Returns an array of all the list data listeners
registered on this
ArrayListModel.
fireContentsChanged
private void fireContentsChanged(int index0,
int index1)
- This method must be called after one or more elements
of the list change. The changed elements
are specified by the closed interval index0, index1 -- the end points
are included. Note that index0 need not be less than or equal to index1.
fireIntervalAdded
private void fireIntervalAdded(int index0,
int index1)
- This method must be called after one or more elements
are added to the model. The new elements
are specified by a closed interval index0, index1 -- the end points
are included. Note that index0 need not be less than or equal to index1.
fireIntervalRemoved
private void fireIntervalRemoved(int index0,
int index1)
- This method must be called after one or more elements
are removed from the model.
index0andindex1are the end points of the interval that's been removed. Note thatindex0need not be less than or equal toindex1.
|
|||||||||
| Home >> All >> com >> jgoodies >> binding >> [ extras overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.jgoodies.binding.extras.ListModelHolder