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.
  • Method Details

    • setFocusIndex

      UIItemList setFocusIndex(int focusIndex)
      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

      UIItemList addItem(UIItemList.Item item)
      Adds an item to the list
      Parameters:
      item - Item to add
      Returns:
      this
    • addItem

      UIItemList addItem(int index, UIItemList.Item item)
      Adds an item to the list at the given index
      Parameters:
      index - Index to add the item at
      item - Item to add
      Returns:
      this
    • removeItem

      UIItemList removeItem(UIItemList.Item item)
      Removes an item from the list
      Parameters:
      item - Item to remove
      Returns:
      this
    • moveItem

      UIItemList moveItem(UIItemList.Item item, int index)
      Moves an item to another location in the list
      Parameters:
      item - Item to move
      index - Index to move to
      Returns:
      this
    • setItems

      UIItemList setItems(List<? extends UIItemList.Item> items)
      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

      UIItemList addSection(UIItemList.Section section)
      Add a section to the list
      Parameters:
      section - Section
      Returns:
      this
    • setSingleClickActivate

      UIItemList setSingleClickActivate(boolean singleClickActivate)
      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

      UIItemList setShowCheckboxes(boolean showCheckboxes)
      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

      UIItemList setRenamable(boolean isRenamable)
      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

      void renameAppend(String append)
      Appends a string to the active rename buffer
      Parameters:
      append - Value to append to the rename buffer
    • setMomentary

      UIItemList setMomentary(boolean momentary)
      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

      UIItemList setReorderable(boolean reorderable)
      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

      UIItemList setDeletable(boolean deletable)
      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

      UIItemList setFilter(String filter)
      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

      UIItemList setControlSurfaceFocus(int index, int length, UIColor color)
      Sets a control focus range that is highlighted in the list
      Parameters:
      index - Start of the surface focus
      length - Length of the surface focus block
      color - Color to show focus with
      Returns:
      this
    • addListener

      UIItemList addListener(UIItemList.Listener listener)
      Adds a listener to receive notifications about list operations
      Parameters:
      listener - Listener
      Returns:
      this
    • removeListener

      UIItemList removeListener(UIItemList.Listener listener)
      Removes a listener from receiving notifications about list operations
      Parameters:
      listener - Listener
      Returns:
      this