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.ListSelectionModel
AdvancedListSelectionModel
is 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 void
addValidSelectionMatcher(Matcher<E> validSelectionMatcher)
Add a matcher which decides when source elements are valid for selection.void
dispose()
Releases the resources consumed by thisAdvancedListSelectionModel
so that it may eventually be garbage collected.EventList<E>
getDeselected()
Gets anEventList
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 anEventList
that contains only selected values and modifies the source list on mutation.EventList<E>
getTogglingDeselected()
Gets anEventList
that contains only deselected values and modifies the selection state on mutation.EventList<E>
getTogglingSelected()
Gets anEventList
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, getSelectedIndices, getSelectedItemsCount, getSelectionMode, getValueIsAdjusting, insertIndexInterval, isSelectedIndex, isSelectionEmpty, removeIndexInterval, removeListSelectionListener, removeSelectionInterval, setAnchorSelectionIndex, setLeadSelectionIndex, setSelectionInterval, setSelectionMode, setValueIsAdjusting
-
-
-
-
Method Detail
-
getSelected
EventList<E> getSelected()
Gets anEventList
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 anEventList
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 anIllegalArgumentException
is thrown.
-
getDeselected
EventList<E> getDeselected()
Gets anEventList
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 anEventList
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 anIllegalArgumentException
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 thisAdvancedListSelectionModel
so that it may eventually be garbage collected.An
AdvancedListSelectionModel
will be garbage collected without a call todispose()
, but not before its sourceEventList
is garbage collected. By callingdispose()
, you allow theAdvancedListSelectionModel
to be garbage collected before its sourceEventList
. This is necessary for situations where anAdvancedListSelectionModel
is short-lived but its sourceEventList
is long-lived.Warning: It is an error to call any method on a
AdvancedListSelectionModel
after it has been disposed.
-
-