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
Nested ClassesModifier and TypeInterfaceDescriptionstatic classstatic classstatic classInterface to which items in the list must conformstatic interfacestatic classstatic classA section is an item in the list that indents the items beneath it. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
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 listintReturns 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/pasteReturn the list of selected items.booleanWhether this control is in the midst of an item rename operationmoveItem(UIItemList.Item item, int index) Moves an item to another location in the listdefault voidonDelete(List<UIItemList.Item> items) removeItem(UIItemList.Item item) Removes an item from the listremoveListener(UIItemList.Listener listener) Removes a listener from receiving notifications about list operationsvoidrenameAppend(String append) Appends a string to the active rename buffersetControlSurfaceFocus(boolean hasFocus, 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.setFocusItem(UIItemList.Item item) Sets the focused item.setItems(List<? extends UIItemList.Item> items) Sets the items in the list and redraws itsetMomentary(boolean momentary) Sets whether the item list is momentary.setMultiSelection(boolean hasMultiSelection) Sets whether multiple items in the list may be selected at once forsetRenamable(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.
-
Field Details
-
PADDING
static final int PADDING- See Also:
-
SCROLL_BAR_WIDTH
static final int SCROLL_BAR_WIDTH- See Also:
-
ROW_HEIGHT
static final int ROW_HEIGHT- See Also:
-
ROW_MARGIN
static final int ROW_MARGIN- See Also:
-
ROW_SPACING
static final int ROW_SPACING- See Also:
-
CHECKBOX_SIZE
static final int CHECKBOX_SIZE- See Also:
-
SECTION_CHEVRON_WIDTH
static final int SECTION_CHEVRON_WIDTH- See Also:
-
-
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
-
setFocusItem
Sets the focused item. Checks the bounds and adjusts the scroll position if necessary.- Parameters:
item- Item to focus- Returns:
- this
-
getSelectedItems
List<UIItemList.Item> getSelectedItems()Return the list of selected items. Only supported on lists for which setMultiSelection(true) was called.- Returns:
- List of selected items
-
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
-
setMultiSelection
Sets whether multiple items in the list may be selected at once for- Parameters:
hasMultiSelection- Whether multiple items can be selected at once- Returns:
- this
-
onDelete
-
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:
hasFocus- If there is control surface focuscolor- 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
-