Class SelectionProperty<I,S>
java.lang.Object
dev.prozilla.pine.common.property.VariableProperty<S>
dev.prozilla.pine.common.property.MutableProperty<S>
dev.prozilla.pine.common.property.observable.ObservableProperty<S>
dev.prozilla.pine.common.property.selection.SelectionProperty<I,S>
- Type Parameters:
I- The type of selectable items.S- The type of the selection.
- All Implemented Interfaces:
Destructible
- Direct Known Subclasses:
SingleSelectionProperty
Represents a selection of items from a list.
-
Field Summary
FieldsFields inherited from class dev.prozilla.pine.common.property.observable.ObservableProperty
loggerFields inherited from class dev.prozilla.pine.common.property.VariableProperty
random -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetItem(int index) Returns the item at the given index based on the wrap mode.intgetItems()Returns an unmodifiable clone of the list of items.booleanremoveItem(I item) voidSelects the first item.abstract booleanselectIndex(int index) Selects an item from the list of items at a given index.booleanselectItem(I item) Selects an item from the list of items.voidSelects the last item.abstract voidSelects the next item.abstract voidSelects the previous item.voidsetWrapMode(WrapMode wrapMode) inttransformIndex(int index) Transforms an index based on the wrap mode.Methods inherited from class dev.prozilla.pine.common.property.observable.ObservableProperty
addObserver, destroy, getLogger, onValueChange, read, removeObserver, setLoggerMethods inherited from class dev.prozilla.pine.common.property.MutableProperty
getValue, setValueMethods inherited from class dev.prozilla.pine.common.property.VariableProperty
exists, hasValue
-
Field Details
-
items
-
wrapMode
-
-
Constructor Details
-
SelectionProperty
-
-
Method Details
-
getItems
Returns an unmodifiable clone of the list of items.- Returns:
- A clone of the list of items.
-
getItemCount
public int getItemCount() -
addItem
-
removeItem
-
selectItem
Selects an item from the list of items.- Parameters:
item- The item to select- Returns:
falseif the item was already selected.- Throws:
IllegalArgumentException- If the item is not in the list of items.
-
selectIndex
public abstract boolean selectIndex(int index) Selects an item from the list of items at a given index.- Parameters:
index- The index of the item to select- Returns:
falseif the item was already selected.
-
selectFirst
public void selectFirst()Selects the first item. -
selectLast
public void selectLast()Selects the last item. -
selectPrevious
public abstract void selectPrevious()Selects the previous item. -
selectNext
public abstract void selectNext()Selects the next item. -
getItem
Returns the item at the given index based on the wrap mode.- Parameters:
index- The index of the item- Returns:
- The item at the given index or
nullif there is no corresponding item.
-
transformIndex
public int transformIndex(int index) Transforms an index based on the wrap mode.- Parameters:
index- The index to transform- Returns:
- The transformed index.
-
setWrapMode
-