ca.odell.glazedlists.swing
Class EventSelectionModel<E>

java.lang.Object
  extended by ca.odell.glazedlists.swing.EventSelectionModel<E>
All Implemented Interfaces:
AdvancedListSelectionModel<E>, ListSelectionModel

Deprecated. Use 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 Object
implements AdvancedListSelectionModel<E>

An 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).

Author:
Jesse Wilson
See Also:
Bug 39, Bug 61, Bug 76, Bug 108, Bug 110, Bug 112, Bug 222

Field Summary
protected  TransformedList<E,E> swingThreadSource
          Deprecated. the proxy moves events to the Swing Event Dispatch thread
 
Fields inherited from interface javax.swing.ListSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
 
Constructor Summary
EventSelectionModel(EventList<E> source)
          Deprecated. Creates a new selection model that also presents a list of the selection.
 
Method Summary
 void addListSelectionListener(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().
 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(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.
 String toString()
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

swingThreadSource

protected TransformedList<E,E> swingThreadSource
Deprecated. 
the proxy moves events to the Swing Event Dispatch thread

Constructor Detail

EventSelectionModel

public EventSelectionModel(EventList<E> source)
Deprecated. 
Creates a new selection model that also presents a list of the selection. The 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.

Parameters:
source - the EventList whose selection will be managed. This should be the same EventList passed to the constructor of your EventTableModel or EventListModel.
Method Detail

addListSelectionListener

public void addListSelectionListener(ListSelectionListener listener)
Deprecated. 
Add a listener to the list that's notified each time a change to the selection occurs. Note that the change events fired by this class may include rows that have been removed from the table. For this reason it is advised not to for() through the changed range without also verifying that each row is still in the table.

Specified by:
addListSelectionListener in interface ListSelectionModel

addSelectionInterval

public 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

Specified by:
addSelectionInterval in interface ListSelectionModel

addValidSelectionMatcher

public void addValidSelectionMatcher(Matcher<E> validSelectionMatcher)
Deprecated. 
Add a matcher which decides when source elements are valid for selection.

Specified by:
addValidSelectionMatcher in interface AdvancedListSelectionModel<E>
Parameters:
validSelectionMatcher - returns true if a source element can be selected; false otherwise

clearSelection

public void clearSelection()
Deprecated. 
Change the selection to the empty set.

Specified by:
clearSelection in interface ListSelectionModel

dispose

public void dispose()
Deprecated. 
Releases the resources consumed by this 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.

Specified by:
dispose in interface AdvancedListSelectionModel<E>

getAnchorSelectionIndex

public int getAnchorSelectionIndex()
Deprecated. 
Return the first index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().

Specified by:
getAnchorSelectionIndex in interface ListSelectionModel

getDeselected

public EventList<E> getDeselected()
Deprecated. 
Gets an 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.

Specified by:
getDeselected in interface AdvancedListSelectionModel<E>

getEnabled

public boolean getEnabled()
Deprecated. 
Returns whether the EventSelectionModel is editable or not.

Specified by:
getEnabled in interface AdvancedListSelectionModel<E>

getEventList

public EventList<E> getEventList()
Deprecated. As of 2005/02/18, the naming of this method became ambiguous. Please use getSelected().

Gets the event list that always contains the current selection.


getLeadSelectionIndex

public int getLeadSelectionIndex()
Deprecated. 
Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().

Specified by:
getLeadSelectionIndex in interface ListSelectionModel

getListSelectionModel

public ListSelectionModel getListSelectionModel()
Deprecated. As of 2004/11/26, the EventSelectionModel implements ListSelectionModel directly.

Gets the selection model that provides selection management for a table.


getMaxSelectionIndex

public int getMaxSelectionIndex()
Deprecated. 
Gets the index of the last selected element.

Specified by:
getMaxSelectionIndex in interface ListSelectionModel

getMinSelectionIndex

public int getMinSelectionIndex()
Deprecated. 
Gets the index of the first selected element.

Specified by:
getMinSelectionIndex in interface ListSelectionModel

getSelected

public EventList<E> getSelected()
Deprecated. 
Gets an 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.

Specified by:
getSelected in interface AdvancedListSelectionModel<E>

getSelectionMode

public int getSelectionMode()
Deprecated. 
Returns the current selection mode.

Specified by:
getSelectionMode in interface ListSelectionModel

getTogglingDeselected

public EventList<E> getTogglingDeselected()
Deprecated. 
Gets an 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 thrown

Specified by:
getTogglingDeselected in interface AdvancedListSelectionModel<E>

getTogglingSelected

public EventList<E> getTogglingSelected()
Deprecated. 
Gets an 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.

Specified by:
getTogglingSelected in interface AdvancedListSelectionModel<E>

getValueIsAdjusting

public boolean getValueIsAdjusting()
Deprecated. 
Returns true if the value is undergoing a series of changes.

Specified by:
getValueIsAdjusting in interface ListSelectionModel

insertIndexInterval

public void insertIndexInterval(int index,
                                int length,
                                boolean before)
Deprecated. 
Insert length indices beginning before/after index.

Specified by:
insertIndexInterval in interface ListSelectionModel

invertSelection

public void invertSelection()
Deprecated. 
Inverts the current selection.

Specified by:
invertSelection in interface AdvancedListSelectionModel<E>

isSelectedIndex

public boolean isSelectedIndex(int index)
Deprecated. 
Returns true if the specified index is selected. If the specified index has not been seen before, this will return false. This is in the case where the table painting and selection have fallen out of sync. Usually in this case there is an update event waiting in the event queue that notifies this model of the change in table size.

Specified by:
isSelectedIndex in interface ListSelectionModel

isSelectionEmpty

public boolean isSelectionEmpty()
Deprecated. 
Returns true if no indices are selected.

Specified by:
isSelectionEmpty in interface ListSelectionModel

removeIndexInterval

public void removeIndexInterval(int index0,
                                int index1)
Deprecated. 
Remove the indices in the interval index0,index1 (inclusive) from the selection model.

Specified by:
removeIndexInterval in interface ListSelectionModel

removeListSelectionListener

public void removeListSelectionListener(ListSelectionListener listener)
Deprecated. 
Remove a listener from the list that's notified each time a change to the selection occurs.

Specified by:
removeListSelectionListener in interface ListSelectionModel

removeSelectionInterval

public 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.

Specified by:
removeSelectionInterval in interface ListSelectionModel

removeValidSelectionMatcher

public void removeValidSelectionMatcher(Matcher<E> validSelectionMatcher)
Deprecated. 
Remove a matcher which decides when source elements are valid for selection.

Specified by:
removeValidSelectionMatcher in interface AdvancedListSelectionModel<E>
Parameters:
validSelectionMatcher - returns true if a source element can be selected; false otherwise

setAnchorSelectionIndex

public void setAnchorSelectionIndex(int anchorSelectionIndex)
Deprecated. 
Set the anchor selection index.

Specified by:
setAnchorSelectionIndex in interface ListSelectionModel

setEnabled

public void setEnabled(boolean enabled)
Deprecated. 
Set the EventSelectionModel as editable or not. This means that the user cannot manipulate the selection by clicking. The selection can still be changed as the source list changes.

Note that this will also disable the selection from being modified programatically. Therefore you must use setEnabled(true) to modify the selection in code.

Specified by:
setEnabled in interface AdvancedListSelectionModel<E>

setLeadSelectionIndex

public void setLeadSelectionIndex(int leadSelectionIndex)
Deprecated. 
Set the lead selection index.

Specified by:
setLeadSelectionIndex in interface ListSelectionModel

setSelectionInterval

public void setSelectionInterval(int index0,
                                 int index1)
Deprecated. 
Change the selection to be between index0 and index1 inclusive.

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.

Specified by:
setSelectionInterval in interface ListSelectionModel

setSelectionMode

public void setSelectionMode(int selectionMode)
Deprecated. 
Set the selection mode.

Specified by:
setSelectionMode in interface ListSelectionModel

setValueIsAdjusting

public void setValueIsAdjusting(boolean valueIsAdjusting)
Deprecated. 
This property is true if upcoming changes to the value of the model should be considered a single event.

Specified by:
setValueIsAdjusting in interface ListSelectionModel

toString

public String toString()
Deprecated. 

Overrides:
toString in class Object


Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by hbrands at 2013-02-12 20:58