DefaultEventSelectionModel instead. This class will be removed in the GL
2.0 release. The wrapping of the source list with an EDT safe list has been
determined to be undesirable (it is better for the user to provide their own EDT
safe list).public final class EventSelectionModel<E> extends java.lang.Object implements AdvancedListSelectionModel<E>
EventSelectionModel is a class that performs two simulaneous
services. It is a ListSelectionModel to provide selection tracking for a
JTable. It is also a EventList that contains the table's selection.
As elements are selected or deselected, the EventList aspect of this
EventSelectionModel changes. Changes to that List will change the
source EventList. To modify only the selection, use the
ListSelectionModel's methods.
Alongside MULTIPLE_INTERVAL_SELECTION, this ListSelectionModel
supports an additional selection mode.
MULTIPLE_INTERVAL_SELECTION_DEFENSIVE is a new selection mode.
It is identical to MULTIPLE_INTERVAL_SELECTION in every way but
one. When a row is inserted immediately before a selected row in the
MULTIPLE_INTERVAL_SELECTION mode, it becomes selected. But in
the MULTIPLE_INTERVAL_SELECTION_DEFENSIVE mode, it does not
become selected. To set this mode, use
setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE).
| Modifier and Type | Field and Description |
|---|---|
protected TransformedList<E,E> |
swingThreadSource
Deprecated.
the proxy moves events to the Swing Event Dispatch thread
|
| Constructor and Description |
|---|
EventSelectionModel(EventList<E> source)
Deprecated.
Creates a new selection model that also presents a list of the selection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListSelectionListener(javax.swing.event.ListSelectionListener listener)
Deprecated.
Add a listener to the list that's notified each time a change to
the selection occurs.
|
void |
addSelectionInterval(int index0,
int index1)
Deprecated.
Change the selection to be the set union of the current selection and the indices between index0 and index1 inclusive
|
void |
addValidSelectionMatcher(Matcher<E> validSelectionMatcher)
Deprecated.
Add a matcher which decides when source elements are valid for selection.
|
void |
clearSelection()
Deprecated.
Change the selection to the empty set.
|
void |
dispose()
Deprecated.
Releases the resources consumed by this
EventSelectionModel so that it
may eventually be garbage collected. |
int |
getAnchorSelectionIndex()
Deprecated.
Return the first index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().
|
EventList<E> |
getDeselected()
Deprecated.
Gets an
EventList that contains only deselected values and
modifies the source list on mutation. |
boolean |
getEnabled()
Deprecated.
Returns whether the EventSelectionModel is editable or not.
|
EventList<E> |
getEventList()
Deprecated.
As of 2005/02/18, the naming of this method became
ambiguous. Please use
getSelected(). |
int |
getLeadSelectionIndex()
Deprecated.
Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().
|
javax.swing.ListSelectionModel |
getListSelectionModel()
Deprecated.
As of 2004/11/26, the
EventSelectionModel implements
ListSelectionModel directly. |
int |
getMaxSelectionIndex()
Deprecated.
Gets the index of the last selected element.
|
int |
getMinSelectionIndex()
Deprecated.
Gets the index of the first selected element.
|
EventList<E> |
getSelected()
Deprecated.
Gets an
EventList that contains only selected
values and modifies the source list on mutation. |
int |
getSelectionMode()
Deprecated.
Returns the current selection mode.
|
EventList<E> |
getTogglingDeselected()
Deprecated.
Gets an
EventList that contains only deselected values and
modifies the selection state on mutation. |
EventList<E> |
getTogglingSelected()
Deprecated.
Gets an
EventList that contains only selected
values and modifies the selection state on mutation. |
boolean |
getValueIsAdjusting()
Deprecated.
Returns true if the value is undergoing a series of changes.
|
void |
insertIndexInterval(int index,
int length,
boolean before)
Deprecated.
Insert length indices beginning before/after index.
|
void |
invertSelection()
Deprecated.
Inverts the current selection.
|
boolean |
isSelectedIndex(int index)
Deprecated.
Returns true if the specified index is selected.
|
boolean |
isSelectionEmpty()
Deprecated.
Returns true if no indices are selected.
|
void |
removeIndexInterval(int index0,
int index1)
Deprecated.
Remove the indices in the interval index0,index1 (inclusive) from the selection model.
|
void |
removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
Deprecated.
Remove a listener from the list that's notified each time a change to the selection occurs.
|
void |
removeSelectionInterval(int index0,
int index1)
Deprecated.
Change the selection to be the set difference of the current selection and the indices between index0 and index1 inclusive.
|
void |
removeValidSelectionMatcher(Matcher<E> validSelectionMatcher)
Deprecated.
Remove a matcher which decides when source elements are valid for selection.
|
void |
setAnchorSelectionIndex(int anchorSelectionIndex)
Deprecated.
Set the anchor selection index.
|
void |
setEnabled(boolean enabled)
Deprecated.
Set the EventSelectionModel as editable or not.
|
void |
setLeadSelectionIndex(int leadSelectionIndex)
Deprecated.
Set the lead selection index.
|
void |
setSelectionInterval(int index0,
int index1)
Deprecated.
Change the selection to be between index0 and index1 inclusive.
|
void |
setSelectionMode(int selectionMode)
Deprecated.
Set the selection mode.
|
void |
setValueIsAdjusting(boolean valueIsAdjusting)
Deprecated.
This property is true if upcoming changes to the value of the model should be considered a single event.
|
java.lang.String |
toString()
Deprecated.
|
protected TransformedList<E,E> swingThreadSource
public EventSelectionModel(EventList<E> source)
EventSelectionModel listens to this EventList in order
to adjust selection when the EventList is modified. For example,
when an element is added to the EventList, this may offset the
selection of the following elements.source - the EventList whose selection will be managed. This should
be the same EventList passed to the constructor of your
EventTableModel or EventListModel.public void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
for() through the changed range without
also verifying that each row is still in the table.addListSelectionListener in interface javax.swing.ListSelectionModelpublic void addSelectionInterval(int index0,
int index1)
addSelectionInterval in interface javax.swing.ListSelectionModelpublic void addValidSelectionMatcher(Matcher<E> validSelectionMatcher)
addValidSelectionMatcher in interface AdvancedListSelectionModel<E>validSelectionMatcher - returns true if a source element
can be selected; false otherwisepublic void clearSelection()
clearSelection in interface javax.swing.ListSelectionModelpublic void dispose()
EventSelectionModel so that it
may eventually be garbage collected.
An EventSelectionModel will be garbage collected without a call to
dispose(), but not before its source EventList is garbage
collected. By calling dispose(), you allow the EventSelectionModel
to be garbage collected before its source EventList. This is
necessary for situations where an EventSelectionModel is short-lived but
its source EventList is long-lived.
Warning: It is an error
to call any method on a EventSelectionModel after it has been disposed.
dispose in interface AdvancedListSelectionModel<E>public int getAnchorSelectionIndex()
getAnchorSelectionIndex in interface javax.swing.ListSelectionModelpublic EventList<E> getDeselected()
EventList that contains only deselected values and
modifies the source list on mutation.
Adding and removing items from this list performs the same operation on
the source list.getDeselected in interface AdvancedListSelectionModel<E>public boolean getEnabled()
getEnabled in interface AdvancedListSelectionModel<E>public EventList<E> getEventList()
getSelected().public int getLeadSelectionIndex()
getLeadSelectionIndex in interface javax.swing.ListSelectionModelpublic javax.swing.ListSelectionModel getListSelectionModel()
EventSelectionModel implements
ListSelectionModel directly.public int getMaxSelectionIndex()
getMaxSelectionIndex in interface javax.swing.ListSelectionModelpublic int getMinSelectionIndex()
getMinSelectionIndex in interface javax.swing.ListSelectionModelpublic EventList<E> getSelected()
EventList that contains only selected
values and modifies the source list on mutation.
Adding and removing items from this list performs the same operation on
the source list.getSelected in interface AdvancedListSelectionModel<E>public int getSelectionMode()
getSelectionMode in interface javax.swing.ListSelectionModelpublic EventList<E> getTogglingDeselected()
EventList that contains only deselected values and
modifies the selection state on mutation.
Adding an item to this list deselects it and removing an item selects it.
If an item not in the source list is added an
IllegalArgumentException is throwngetTogglingDeselected in interface AdvancedListSelectionModel<E>public EventList<E> getTogglingSelected()
EventList that contains only selected
values and modifies the selection state on mutation.
Adding an item to this list selects it and removing an item deselects it.
If an item not in the source list is added an
IllegalArgumentException is thrown.getTogglingSelected in interface AdvancedListSelectionModel<E>public boolean getValueIsAdjusting()
getValueIsAdjusting in interface javax.swing.ListSelectionModelpublic void insertIndexInterval(int index,
int length,
boolean before)
insertIndexInterval in interface javax.swing.ListSelectionModelpublic void invertSelection()
invertSelection in interface AdvancedListSelectionModel<E>public boolean isSelectedIndex(int index)
isSelectedIndex in interface javax.swing.ListSelectionModelpublic boolean isSelectionEmpty()
isSelectionEmpty in interface javax.swing.ListSelectionModelpublic void removeIndexInterval(int index0,
int index1)
removeIndexInterval in interface javax.swing.ListSelectionModelpublic void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
removeListSelectionListener in interface javax.swing.ListSelectionModelpublic void removeSelectionInterval(int index0,
int index1)
removeSelectionInterval in interface javax.swing.ListSelectionModelpublic void removeValidSelectionMatcher(Matcher<E> validSelectionMatcher)
removeValidSelectionMatcher in interface AdvancedListSelectionModel<E>validSelectionMatcher - returns true if a source element
can be selected; false otherwisepublic void setAnchorSelectionIndex(int anchorSelectionIndex)
setAnchorSelectionIndex in interface javax.swing.ListSelectionModelpublic void setEnabled(boolean enabled)
Note that this will also disable the selection from being modified programatically. Therefore you must use setEnabled(true) to modify the selection in code.
setEnabled in interface AdvancedListSelectionModel<E>public void setLeadSelectionIndex(int leadSelectionIndex)
setLeadSelectionIndex in interface javax.swing.ListSelectionModelpublic void setSelectionInterval(int index0,
int index1)
First this calculates the smallest range where changes occur. This includes the union of the selection range before and the selection range specified. It then walks through the change and sets each index as selected or not based on whether the index is in the new range. Finally it fires events to both the listening lists and selection listeners about what changes happened.
If the selection does not change, this will not fire any events.
setSelectionInterval in interface javax.swing.ListSelectionModelpublic void setSelectionMode(int selectionMode)
setSelectionMode in interface javax.swing.ListSelectionModelpublic void setValueIsAdjusting(boolean valueIsAdjusting)
setValueIsAdjusting in interface javax.swing.ListSelectionModelpublic java.lang.String toString()
toString in class java.lang.ObjectGlazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by buildd at 2016-02-14 5:12