| java.lang.Object com.jgoodies.binding.adapter.SingleListSelectionAdapter
SingleListSelectionAdapter | final public class SingleListSelectionAdapter implements ListSelectionModel(Code) | | A
ListSelectionModel implementation that has the list index
bound to a
ValueModel . Therefore this class supports only
the SINGLE_SELECTION mode where only one list index
can be selected at a time. In this mode the setSelectionInterval
and addSelectionInterval methods are equivalent, and only
the second index argument (the "lead index") is used.
Example:
SelectionInList selectionInList = new SelectionInList(...);
JList list = new JList();
list.setModel(selectionInList);
list.setSelectionModel(new SingleListSelectionAdapter(
selectionInList.getSelectionIndexHolder()));
author: Karsten Lentzsch author: Jeanette Winzenburg version: $Revision: 1.8 $ See Also: ValueModel See Also: javax.swing.JList See Also: javax.swing.JTable |
SingleListSelectionAdapter | public SingleListSelectionAdapter(ValueModel selectionIndexHolder)(Code) | | Constructs a SingleListSelectionAdapter with
the given selection index holder.
Parameters: selectionIndexHolder - holds the selection index |
addSelectionInterval | public void addSelectionInterval(int index0, int index1)(Code) | | Sets the selection interval using the given indices.
If this represents a change to the current selection, then
notify each ListSelectionListener. Note that index0 doesn't have
to be less than or equal to index1.
Parameters: index0 - one end of the interval. Parameters: index1 - other end of the interval See Also: SingleListSelectionAdapter.addListSelectionListener(ListSelectionListener) |
insertIndexInterval | public void insertIndexInterval(int index, int length, boolean before)(Code) | | Inserts length indices beginning before/after index. If the value
This method is typically called to synchronize the selection model
with a corresponding change in the data model.
Parameters: index - the index to start the insertion Parameters: length - the length of the inserted interval Parameters: before - true to insert before the start index |
isSelectionEmpty | public boolean isSelectionEmpty()(Code) | | Returns true if no index is selected.
true if no index is selected |
removeSelectionInterval | public void removeSelectionInterval(int index0, int index1)(Code) | | Clears the selection if it is equals to index0. Since this model
supports only a single selection index, the index1 can be ignored
for the selection.
If this represents a change to the current selection, then
notify each ListSelectionListener. Note that index0 doesn't have
to be less than or equal to index1.
Parameters: index0 - one end of the interval. Parameters: index1 - other end of the interval See Also: SingleListSelectionAdapter.addListSelectionListener(ListSelectionListener) |
setSelectionInterval | public void setSelectionInterval(int index0, int index1)(Code) | | Sets the selection index to index1 . Since this model
supports only a single selection index, the index0 is ignored.
This is the behavior the DefaultListSelectionModel
uses in single selection mode.
If this represents a change to the current selection, then
notify each ListSelectionListener. Note that index0 doesn't have
to be less than or equal to index1.
Parameters: index0 - one end of the interval. Parameters: index1 - other end of the interval See Also: SingleListSelectionAdapter.addListSelectionListener(ListSelectionListener) |
setSelectionMode | public void setSelectionMode(int selectionMode)(Code) | | Sets the selection mode. Only SINGLE_SELECTION is allowed
in this implementation. Other modes are not supported and will throw
an IllegalArgumentException .
With SINGLE_SELECTION only one list index
can be selected at a time. In this mode the setSelectionInterval
and addSelectionInterval methods are equivalent, and only
the second index argument (the "lead index") is used.
Parameters: selectionMode - the mode to be set See Also: SingleListSelectionAdapter.getSelectionMode() See Also: javax.swing.ListSelectionModel.setSelectionMode(int) |
setValueIsAdjusting | public void setValueIsAdjusting(boolean newValueIsAdjusting)(Code) | | This property is true if upcoming changes to the value
of the model should be considered a single event. For example
if the model is being updated in response to a user drag,
the value of the valueIsAdjusting property will be set to true
when the drag is initiated and be set to false when
the drag is finished. This property allows listeners to
to update only when a change has been finalized, rather
than always handling all of the intermediate values.
Parameters: newValueIsAdjusting - The new value of the property. See Also: SingleListSelectionAdapter.getValueIsAdjusting() |
|
|