Package ca.odell.glazedlists.swing
Interface AdvancedListSelectionModel<E>
-
- All Superinterfaces:
javax.swing.ListSelectionModel
- All Known Implementing Classes:
DefaultEventSelectionModel,EventSelectionModel
public interface AdvancedListSelectionModel<E> extends javax.swing.ListSelectionModelAdvancedListSelectionModelis an interface defining additional methods for selection management beyond the standardListSelectionModel.- Author:
- Holger Brands
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddValidSelectionMatcher(Matcher<E> validSelectionMatcher)Add a matcher which decides when source elements are valid for selection.voiddispose()Releases the resources consumed by thisAdvancedListSelectionModelso that it may eventually be garbage collected.EventList<E>getDeselected()Gets anEventListthat contains only deselected values and modifies the source list on mutation.booleangetEnabled()Returns whether the EventSelectionModel is editable or not.EventList<E>getSelected()Gets anEventListthat contains only selected values and modifies the source list on mutation.EventList<E>getTogglingDeselected()Gets anEventListthat contains only deselected values and modifies the selection state on mutation.EventList<E>getTogglingSelected()Gets anEventListthat contains only selected values and modifies the selection state on mutation.voidinvertSelection()Inverts the current selection.voidremoveValidSelectionMatcher(Matcher<E> validSelectionMatcher)Remove a matcher which decides when source elements are valid for selection.voidsetEnabled(boolean enabled)Set the EventSelectionModel as editable or not.-
Methods inherited from interface javax.swing.ListSelectionModel
addListSelectionListener, addSelectionInterval, clearSelection, getAnchorSelectionIndex, getLeadSelectionIndex, getMaxSelectionIndex, getMinSelectionIndex, getSelectedIndices, getSelectedItemsCount, getSelectionMode, getValueIsAdjusting, insertIndexInterval, isSelectedIndex, isSelectionEmpty, removeIndexInterval, removeListSelectionListener, removeSelectionInterval, setAnchorSelectionIndex, setLeadSelectionIndex, setSelectionInterval, setSelectionMode, setValueIsAdjusting
-
-
-
-
Method Detail
-
getSelected
EventList<E> getSelected()
Gets anEventListthat 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 anEventListthat 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 anIllegalArgumentExceptionis thrown.
-
getDeselected
EventList<E> getDeselected()
Gets anEventListthat 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 anEventListthat 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 anIllegalArgumentExceptionis 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 thisAdvancedListSelectionModelso that it may eventually be garbage collected.An
AdvancedListSelectionModelwill be garbage collected without a call todispose(), but not before its sourceEventListis garbage collected. By callingdispose(), you allow theAdvancedListSelectionModelto be garbage collected before its sourceEventList. This is necessary for situations where anAdvancedListSelectionModelis short-lived but its sourceEventListis long-lived.Warning: It is an error to call any method on a
AdvancedListSelectionModelafter it has been disposed.
-
-