Interface SelectableList<E>
- Type Parameters:
E
- the list element type
- All Superinterfaces:
Collection<E>
,Iterable<E>
,List<E>
,Observable
,ObservableList<E>
,Selectable
Interface describing a list with individually selectable items.
- See Also:
SelectableListFactory
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.bernd_michaely.common.desktop.fx.collections.selection.Selectable
Selectable.Action
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
addSelectionListener(SelectionChangeListener<? super E> selectionChangeListener)
Adds a given selection listener.void
addSelectionListener(SelectionChangeListener<? super E> selectionChangeListener, boolean requestSingleChangeEvents)
Adds a given selection listener.void
Starts a series of selections.void
Ends a series of selections.int
Returns the number of selected items.boolean
removeSelectionListener(SelectionChangeListener<? super E> selectionChangeListener)
Removes a given selection listener.Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
Methods inherited from interface javafx.beans.Observable
addListener, removeListener
Methods inherited from interface javafx.collections.ObservableList
addAll, addListener, filtered, remove, removeAll, removeListener, retainAll, setAll, setAll, sorted, sorted
Methods inherited from interface de.bernd_michaely.common.desktop.fx.collections.selection.Selectable
getSourceIndex, invertSelection, isSelected, select, selectAll, selectAll, selectNone, selectRange, selectRangeBidirectional, selectRangeBidirectional, setSelected, size
-
Method Details
-
beginSelectionChange
void beginSelectionChange()Starts a series of selections. The call of this method must be paired with a call toendSelectionChange()
, ideally inside a try-finally-block. Selection changes may be nested.- See Also:
SelectionChangeListener
-
endSelectionChange
void endSelectionChange()Ends a series of selections.- Throws:
IllegalStateException
- if this method is not called properly paired withbeginSelectionChange()
- See Also:
beginSelectionChange()
,SelectionChangeListener
-
getNumSelected
int getNumSelected()Returns the number of selected items.- Returns:
- the number of selected items
-
addSelectionListener
Adds a given selection listener. Selection changes of index ranges will be combined into a single change event.- Parameters:
selectionChangeListener
- the given selection listener- Throws:
NullPointerException
- if the given listener is null
-
addSelectionListener
void addSelectionListener(SelectionChangeListener<? super E> selectionChangeListener, boolean requestSingleChangeEvents)Adds a given selection listener.- Parameters:
selectionChangeListener
- the given selection listenerrequestSingleChangeEvents
- if true, a change event will be generated for each single selection change, e.g. range selections will not be optimized to a single [from,to] range change- Throws:
NullPointerException
- if the given listener is null
-
removeSelectionListener
Removes a given selection listener.- Parameters:
selectionChangeListener
- the given selection listener- Returns:
- true, iff the listener was present before
- Throws:
NullPointerException
- if the given listener is null
-