Class SingleSelectionProperty<T>
java.lang.Object
dev.prozilla.pine.common.property.VariableProperty<T>
dev.prozilla.pine.common.property.MutableProperty<T>
dev.prozilla.pine.common.property.observable.ObservableProperty<T>
dev.prozilla.pine.common.property.selection.SelectionProperty<T,T>
dev.prozilla.pine.common.property.selection.SingleSelectionProperty<T>
- All Implemented Interfaces:
Destructible
Represents a selection of zero or one item(s) from a list.
-
Field Summary
Fields inherited from class dev.prozilla.pine.common.property.selection.SelectionProperty
items, wrapModeFields 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 TypeMethodDescriptionbooleanintbooleanbooleanisItemSelected(T item) booleanremoveItem(T item) booleanselectIndex(int index) Selects an item from the list of items at a given index.booleanselectItem(T item) Selects an item from the list of items.voidSelects the next item.voidSelects the previous item.booleanSets the value of this property.Methods inherited from class dev.prozilla.pine.common.property.selection.SelectionProperty
addItem, getItem, getItemCount, getItems, selectFirst, selectLast, setWrapMode, transformIndexMethods 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
getValueMethods inherited from class dev.prozilla.pine.common.property.VariableProperty
exists, hasValue
-
Constructor Details
-
SingleSelectionProperty
public SingleSelectionProperty() -
SingleSelectionProperty
-
SingleSelectionProperty
-
-
Method Details
-
removeItem
- Overrides:
removeItemin classSelectionProperty<T,T>
-
setValue
Description copied from class:MutablePropertySets the value of this property.- Overrides:
setValuein classMutableProperty<T>- Parameters:
value- The new value- Returns:
trueif the value was changed.
-
selectItem
Description copied from class:SelectionPropertySelects an item from the list of items.- Overrides:
selectItemin classSelectionProperty<T,T> - 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.
-
selectPrevious
public void selectPrevious()Description copied from class:SelectionPropertySelects the previous item.- Specified by:
selectPreviousin classSelectionProperty<T,T>
-
selectNext
public void selectNext()Description copied from class:SelectionPropertySelects the next item.- Specified by:
selectNextin classSelectionProperty<T,T>
-
selectIndex
public boolean selectIndex(int index) Description copied from class:SelectionPropertySelects an item from the list of items at a given index.- Specified by:
selectIndexin classSelectionProperty<T,T> - Parameters:
index- The index of the item to select- Returns:
falseif the item was already selected.
-
clearSelection
public boolean clearSelection() -
getSelectedItem
-
getSelectedIndex
public int getSelectedIndex() -
isItemSelected
-
isAnyItemSelected
public boolean isAnyItemSelected()
-