Package heronarts.glx.ui.component
Interface UIItemList
- All Known Implementing Classes:
UIContentPicker.UIContentList
,UIItemList.BasicList
,UIItemList.ScrollList
,UIPatternList
public interface UIItemList
An ItemList is a scrollable list of elements with a focus state
and action handling when the elements are focused or clicked on.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
static class
static class
Interface to which items in the list must conformstatic interface
static class
static class
A section is an item in the list that indents the items beneath it. -
Method Summary
Modifier and TypeMethodDescriptionaddItem
(int index, UIItemList.Item item) Adds an item to the list at the given indexaddItem
(UIItemList.Item item) Adds an item to the listaddListener
(UIItemList.Listener listener) Adds a listener to receive notifications about list operationsaddSection
(UIItemList.Section section) Add a section to the listClears all items in the listint
Returns the index of the currently focused item in the listRetrieves the currently focused item in the list.List<? extends UIItemList.Item>
getItems()
Get the items in the listGets the current value in the rename buffer for copy/pasteboolean
Whether this control is in the midst of an item rename operationmoveItem
(UIItemList.Item item, int index) Moves an item to another location in the listremoveItem
(UIItemList.Item item) Removes an item from the listremoveListener
(UIItemList.Listener listener) Removes a listener from receiving notifications about list operationsvoid
renameAppend
(String append) Appends a string to the active rename buffersetControlSurfaceFocus
(int index, int length, UIColor color) Sets a control focus range that is highlighted in the listsetDeletable
(boolean deletable) Sets whether items in the list are deletable.Filter the items in the list by a String, resulting list will only show items that contains the filter stringsetFocusIndex
(int focusIndex) Sets the index of the focused item in the list.setItems
(List<? extends UIItemList.Item> items) Sets the items in the list and redraws itsetMomentary
(boolean momentary) Sets whether the item list is momentary.setRenamable
(boolean isRenamable) Sets whether renaming items is allowedsetReorderable
(boolean reorderable) Sets whether the list is reorderable.setShowCheckboxes
(boolean showCheckboxes) Sets whether a column of checkboxes should be shown on the item list, to the left of the labels.setSingleClickActivate
(boolean singleClickActivate) Sets whether single-clicks on an item should activate them.
-
Method Details
-
setFocusIndex
Sets the index of the focused item in the list. Checks the bounds and adjusts the scroll position if necessary.- Parameters:
focusIndex
- Index of item to focus- Returns:
- this
-
getFocusedIndex
int getFocusedIndex()Returns the index of the currently focused item in the list- Returns:
- Index of focused item
-
getFocusedItem
UIItemList.Item getFocusedItem()Retrieves the currently focused item in the list.- Returns:
- Focused item, or null if none is focused
-
addItem
Adds an item to the list- Parameters:
item
- Item to add- Returns:
- this
-
addItem
Adds an item to the list at the given index- Parameters:
index
- Index to add the item atitem
- Item to add- Returns:
- this
-
removeItem
Removes an item from the list- Parameters:
item
- Item to remove- Returns:
- this
-
moveItem
Moves an item to another location in the list- Parameters:
item
- Item to moveindex
- Index to move to- Returns:
- this
-
setItems
Sets the items in the list and redraws it- Parameters:
items
- Items- Returns:
- this
-
clearItems
UIItemList clearItems()Clears all items in the list- Returns:
- this
-
getItems
List<? extends UIItemList.Item> getItems()Get the items in the list- Returns:
- list of items
-
addSection
Add a section to the list- Parameters:
section
- Section- Returns:
- this
-
setSingleClickActivate
Sets whether single-clicks on an item should activate them. Default behavior requires double-click or ENTER keypress- Parameters:
singleClickActivate
- Whether to activate on a single click- Returns:
- this
-
setShowCheckboxes
Sets whether a column of checkboxes should be shown on the item list, to the left of the labels. Useful for a secondary selection state.- Parameters:
showCheckboxes
- Whether to show checkboxes- Returns:
- this
-
setRenamable
Sets whether renaming items is allowed- Parameters:
isRenamable
- If items may be renamed- Returns:
- this
-
isRenaming
boolean isRenaming()Whether this control is in the midst of an item rename operation- Returns:
- True if an item is being renamed
-
getRenameBuffer
String getRenameBuffer()Gets the current value in the rename buffer for copy/paste- Returns:
- Rename buffer segment
-
renameAppend
Appends a string to the active rename buffer- Parameters:
append
- Value to append to the rename buffer
-
setMomentary
Sets whether the item list is momentary. If so, then clicking on an item or pressing ENTER/SPACE sends a deactivate action after the click ends.- Parameters:
momentary
- Whether items are momentary- Returns:
- this
-
setReorderable
Sets whether the list is reorderable. If so, then pressing the modifier key with the up or down arrows will reorder the items.- Parameters:
reorderable
- Whether items are reorderable- Returns:
- this
-
setDeletable
Sets whether items in the list are deletable. If so, then pressing the delete key will delete the focused item.- Parameters:
deletable
- Whether items are deletable- Returns:
- this
-
setFilter
Filter the items in the list by a String, resulting list will only show items that contains the filter string- Parameters:
filter
- Filter string- Returns:
- this
-
setControlSurfaceFocus
Sets a control focus range that is highlighted in the list- Parameters:
index
- Start of the surface focuslength
- Length of the surface focus blockcolor
- Color to show focus with- Returns:
- this
-
addListener
Adds a listener to receive notifications about list operations- Parameters:
listener
- Listener- Returns:
- this
-
removeListener
Removes a listener from receiving notifications about list operations- Parameters:
listener
- Listener- Returns:
- this
-