Interface Selectable
- All Known Subinterfaces:
ListSelectionHandler<E>,SelectableList<E>,SelectableProperties
public interface Selectable
Interface to describe selection related actions of objects containing a list
of selectable items.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumEnum to describe selection related actions. -
Method Summary
Modifier and TypeMethodDescriptiondefault intgetSourceIndex(int index) Returns the source index of an index transformation for the given index.default voidInvert the selection status of all items.booleanisSelected(int index) Returns true, iff the item at the given index is selected.default voidselect(int index, Selectable.Action action) Set the selection status of item at index according to the given action.default voidSet all items selected.default voidselectAll(Selectable.Action action) Set the selection status of all list items according to the given action.default voidselectAll(IntFunction<Selectable.Action> function) Set the selection status of all list items according to the given function.default voidSet all items unselected.default voidselectRange(int from, int to, @Nullable Selectable.Action action) Select the list items in the range[from, to[according to the given action.voidselectRange(int from, int to, @Nullable IntFunction<@Nullable Selectable.Action> function) Select the list items in the range[from, to[according to the given function.default voidselectRange(int from, int to, @Nullable IntPredicate predicate) Select the list items in the range[from, to[according to the given function.default voidselectRangeBidirectional(int from, int to, boolean value) Select the list items in the closed range betweenfromandtowith possiblyto < from.default voidselectRangeBidirectional(int from, int to, Selectable.Action action) Select the list items in the closed range betweenfromandtowith possiblyto < from.default voidsetSelected(int index, boolean value) Set the selection status of item at index to value.intsize()Return the number of list items.
-
Method Details
-
size
int size()Return the number of list items.- Returns:
- the number of list items
-
getSourceIndex
default int getSourceIndex(int index) Returns the source index of an index transformation for the given index.- Parameters:
index- the given index- Returns:
- the source index of an index transformation for the given index. The default implementation assumes the identity transformation, that is it returns the given index.
-
isSelected
boolean isSelected(int index) Returns true, iff the item at the given index is selected.- Parameters:
index- the given index- Returns:
- true, iff the item at the given index is selected
-
selectRange
Select the list items in the range[from, to[according to the given action. The indices work like:for (int i = from; i < to; i++)- Parameters:
from- the beginning of the index range (including)to- the end of the index range (excluding)action- the selection action to apply,nullis a no-op
-
selectRange
Select the list items in the range[from, to[according to the given function. The whole function as well as individual function values can benulland work as a no-op. The indices work like:for (int i = from; i < to; i++)- Parameters:
from- the beginning of the index range (including)to- the end of the index range (excluding)predicate- the selection action to apply,nullis a no-op- Since:
- 2.1
-
selectRange
Select the list items in the range[from, to[according to the given function. The whole function as well as individual function values can benulland work as a no-op. The indices work like:for (int i = from; i < to; i++)- Parameters:
from- the beginning of the index range (including)to- the end of the index range (excluding)function- the selection action to apply,nullis a no-op- Since:
- 2.1
-
selectRangeBidirectional
Select the list items in the closed range betweenfromandtowith possiblyto < from. The indices work like:for (int i = min(from, to); i ≤ max(from, to); i++)- Parameters:
from- the beginning of the index range (including)to- the end of the index range (including)action- the selection action to apply
-
selectRangeBidirectional
default void selectRangeBidirectional(int from, int to, boolean value) Select the list items in the closed range betweenfromandtowith possiblyto < from. The indices work like:for (int i = min(from, to); i ≤ max(from, to); i++)- Parameters:
from- the beginning of the index range (including)to- the end of the index range (including)value- the given value
-
setSelected
default void setSelected(int index, boolean value) Set the selection status of item at index to value.- Parameters:
index- the given indexvalue- the given value
-
select
Set the selection status of item at index according to the given action.- Parameters:
index- the given indexaction- the given action
-
selectAll
Set the selection status of all list items according to the given function.- Parameters:
function- the given index to action function- Since:
- 2.1
-
selectAll
Set the selection status of all list items according to the given action.- Parameters:
action- the given action
-
selectAll
default void selectAll()Set all items selected. -
selectNone
default void selectNone()Set all items unselected. -
invertSelection
default void invertSelection()Invert the selection status of all items.
-