ca.odell.glazedlists.swing
Interface AdvancedListSelectionModel<E>

All Superinterfaces:
ListSelectionModel
All Known Implementing Classes:
DefaultEventSelectionModel, EventSelectionModel

public interface AdvancedListSelectionModel<E>
extends ListSelectionModel

AdvancedListSelectionModel is an interface defining additional methods for selection management beyond the standard ListSelectionModel.

Author:
Holger Brands

Field Summary
 
Fields inherited from interface javax.swing.ListSelectionModel
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
 
Method Summary
 void addValidSelectionMatcher(Matcher<E> validSelectionMatcher)
          Add a matcher which decides when source elements are valid for selection.
 void dispose()
          Releases the resources consumed by this AdvancedListSelectionModel so that it may eventually be garbage collected.
 EventList<E> getDeselected()
          Gets an EventList that contains only deselected values and modifies the source list on mutation.
 boolean getEnabled()
          Returns whether the EventSelectionModel is editable or not.
 EventList<E> getSelected()
          Gets an EventList that contains only selected values and modifies the source list on mutation.
 EventList<E> getTogglingDeselected()
          Gets an EventList that contains only deselected values and modifies the selection state on mutation.
 EventList<E> getTogglingSelected()
          Gets an EventList that contains only selected values and modifies the selection state on mutation.
 void invertSelection()
          Inverts the current selection.
 void removeValidSelectionMatcher(Matcher<E> validSelectionMatcher)
          Remove a matcher which decides when source elements are valid for selection.
 void setEnabled(boolean enabled)
          Set the EventSelectionModel as editable or not.
 
Methods inherited from interface javax.swing.ListSelectionModel
addListSelectionListener, addSelectionInterval, clearSelection, getAnchorSelectionIndex, getLeadSelectionIndex, getMaxSelectionIndex, getMinSelectionIndex, getSelectionMode, getValueIsAdjusting, insertIndexInterval, isSelectedIndex, isSelectionEmpty, removeIndexInterval, removeListSelectionListener, removeSelectionInterval, setAnchorSelectionIndex, setLeadSelectionIndex, setSelectionInterval, setSelectionMode, setValueIsAdjusting
 

Method Detail

getSelected

EventList<E> getSelected()
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.


getTogglingSelected

EventList<E> getTogglingSelected()
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.


getDeselected

EventList<E> getDeselected()
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.


getTogglingDeselected

EventList<E> getTogglingDeselected()
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


setEnabled

void setEnabled(boolean enabled)
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.


getEnabled

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


addValidSelectionMatcher

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

Parameters:
validSelectionMatcher - returns true if a source element can be selected; false otherwise

removeValidSelectionMatcher

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

Parameters:
validSelectionMatcher - returns true if a source element can be selected; false otherwise

invertSelection

void invertSelection()
Inverts the current selection.


dispose

void dispose()
Releases the resources consumed by this AdvancedListSelectionModel so that it may eventually be garbage collected.

An AdvancedListSelectionModel will be garbage collected without a call to dispose(), but not before its source EventList is garbage collected. By calling dispose(), you allow the AdvancedListSelectionModel to be garbage collected before its source EventList. This is necessary for situations where an AdvancedListSelectionModel is short-lived but its source EventList is long-lived.

Warning: It is an error to call any method on a AdvancedListSelectionModel after it has been disposed.



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