Class UIItemList.BasicList

All Implemented Interfaces:
UIItemList, UIContainer, UIFocus, UIKeyFocus, UIMouseFocus, UITabFocus, LXLoopTask, Iterable<UIObject>
Enclosing interface:
UIItemList

public static class UIItemList.BasicList extends UI2dContainer implements UIItemList, UIFocus
  • Constructor Details

    • BasicList

      public BasicList(UI ui, float x, float y, float w, float h)
  • Method Details

    • setFocusIndex

      public UIItemList setFocusIndex(int focusIndex)
      Description copied from interface: UIItemList
      Sets the index of the focused item in the list. Checks the bounds and adjusts the scroll position if necessary.
      Specified by:
      setFocusIndex in interface UIItemList
      Parameters:
      focusIndex - Index of item to focus
      Returns:
      this
    • getFocusedIndex

      public int getFocusedIndex()
      Description copied from interface: UIItemList
      Returns the index of the currently focused item in the list
      Specified by:
      getFocusedIndex in interface UIItemList
      Returns:
      Index of focused item
    • getFocusedItem

      public UIItemList.Item getFocusedItem()
      Description copied from interface: UIItemList
      Retrieves the currently focused item in the list.
      Specified by:
      getFocusedItem in interface UIItemList
      Returns:
      Focused item, or null if none is focused
    • addSection

      public UIItemList addSection(UIItemList.Section section)
      Description copied from interface: UIItemList
      Add a section to the list
      Specified by:
      addSection in interface UIItemList
      Parameters:
      section - Section
      Returns:
      this
    • addItem

      public UIItemList addItem(int index, UIItemList.Item item)
      Description copied from interface: UIItemList
      Adds an item to the list at the given index
      Specified by:
      addItem in interface UIItemList
      Parameters:
      index - Index to add the item at
      item - Item to add
      Returns:
      this
    • addItem

      public UIItemList addItem(UIItemList.Item item)
      Description copied from interface: UIItemList
      Adds an item to the list
      Specified by:
      addItem in interface UIItemList
      Parameters:
      item - Item to add
      Returns:
      this
    • moveItem

      public UIItemList moveItem(UIItemList.Item item, int index)
      Description copied from interface: UIItemList
      Moves an item to another location in the list
      Specified by:
      moveItem in interface UIItemList
      Parameters:
      item - Item to move
      index - Index to move to
      Returns:
      this
    • removeItem

      public UIItemList removeItem(UIItemList.Item item)
      Description copied from interface: UIItemList
      Removes an item from the list
      Specified by:
      removeItem in interface UIItemList
      Parameters:
      item - Item to remove
      Returns:
      this
    • setItems

      public UIItemList setItems(List<? extends UIItemList.Item> items)
      Description copied from interface: UIItemList
      Sets the items in the list and redraws it
      Specified by:
      setItems in interface UIItemList
      Parameters:
      items - Items
      Returns:
      this
    • clearItems

      public UIItemList clearItems()
      Description copied from interface: UIItemList
      Clears all items in the list
      Specified by:
      clearItems in interface UIItemList
      Returns:
      this
    • getItems

      public List<? extends UIItemList.Item> getItems()
      Description copied from interface: UIItemList
      Get the items in the list
      Specified by:
      getItems in interface UIItemList
      Returns:
      list of items
    • setSingleClickActivate

      public UIItemList setSingleClickActivate(boolean singleClickActivate)
      Description copied from interface: UIItemList
      Sets whether single-clicks on an item should activate them. Default behavior requires double-click or ENTER keypress
      Specified by:
      setSingleClickActivate in interface UIItemList
      Parameters:
      singleClickActivate - Whether to activate on a single click
      Returns:
      this
    • setShowCheckboxes

      public UIItemList setShowCheckboxes(boolean showCheckboxes)
      Description copied from interface: UIItemList
      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.
      Specified by:
      setShowCheckboxes in interface UIItemList
      Parameters:
      showCheckboxes - Whether to show checkboxes
      Returns:
      this
    • setRenamable

      public UIItemList setRenamable(boolean isRenamable)
      Description copied from interface: UIItemList
      Sets whether renaming items is allowed
      Specified by:
      setRenamable in interface UIItemList
      Parameters:
      isRenamable - If items may be renamed
      Returns:
      this
    • isRenaming

      public boolean isRenaming()
      Description copied from interface: UIItemList
      Whether this control is in the midst of an item rename operation
      Specified by:
      isRenaming in interface UIItemList
      Returns:
      True if an item is being renamed
    • getRenameBuffer

      public String getRenameBuffer()
      Description copied from interface: UIItemList
      Gets the current value in the rename buffer for copy/paste
      Specified by:
      getRenameBuffer in interface UIItemList
      Returns:
      Rename buffer segment
    • renameAppend

      public void renameAppend(String append)
      Description copied from interface: UIItemList
      Appends a string to the active rename buffer
      Specified by:
      renameAppend in interface UIItemList
      Parameters:
      append - Value to append to the rename buffer
    • setMomentary

      public UIItemList setMomentary(boolean momentary)
      Description copied from interface: UIItemList
      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.
      Specified by:
      setMomentary in interface UIItemList
      Parameters:
      momentary - Whether items are momentary
      Returns:
      this
    • setReorderable

      public UIItemList setReorderable(boolean reorderable)
      Description copied from interface: UIItemList
      Sets whether the list is reorderable. If so, then pressing the modifier key with the up or down arrows will reorder the items.
      Specified by:
      setReorderable in interface UIItemList
      Parameters:
      reorderable - Whether items are reorderable
      Returns:
      this
    • setDeletable

      public UIItemList setDeletable(boolean deletable)
      Description copied from interface: UIItemList
      Sets whether items in the list are deletable. If so, then pressing the delete key will delete the focused item.
      Specified by:
      setDeletable in interface UIItemList
      Parameters:
      deletable - Whether items are deletable
      Returns:
      this
    • setFilter

      public UIItemList setFilter(String filter)
      Description copied from interface: UIItemList
      Filter the items in the list by a String, resulting list will only show items that contains the filter string
      Specified by:
      setFilter in interface UIItemList
      Parameters:
      filter - Filter string
      Returns:
      this
    • setControlSurfaceFocus

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

      public UIItemList addListener(UIItemList.Listener listener)
      Description copied from interface: UIItemList
      Adds a listener to receive notifications about list operations
      Specified by:
      addListener in interface UIItemList
      Parameters:
      listener - Listener
      Returns:
      this
    • removeListener

      public UIItemList removeListener(UIItemList.Listener listener)
      Description copied from interface: UIItemList
      Removes a listener from receiving notifications about list operations
      Specified by:
      removeListener in interface UIItemList
      Parameters:
      listener - Listener
      Returns:
      this
    • drawFocus

      public void drawFocus(UI ui, VGraphics vg)
      Description copied from class: UI2dComponent
      Draws focus on this object. May be overridden by subclasses to provide custom focus-drawing behavior.
      Overrides:
      drawFocus in class UI2dComponent
      Parameters:
      ui - UI
      vg - VGraphics
    • onDraw

      public void onDraw(UI ui, VGraphics vg)
      Description copied from class: UI2dComponent
      Subclasses should override this method to perform their drawing functions.
      Overrides:
      onDraw in class UI2dContainer
      Parameters:
      ui - UI context
      vg - Graphics context
    • onMouseDragged

      public void onMouseDragged(MouseEvent mouseEvent, float mx, float my, float dx, float dy)
      Description copied from class: UIEventHandler
      Subclasses override to receive mouse events
      Overrides:
      onMouseDragged in class UIEventHandler
      Parameters:
      mouseEvent - Mouse event
      mx - x-coordinate
      my - y-coordinate
      dx - movement in x
      dy - movement in y
    • onMousePressed

      public void onMousePressed(MouseEvent mouseEvent, float mx, float my)
      Description copied from class: UIEventHandler
      Subclasses override to receive mouse events
      Overrides:
      onMousePressed in class UIEventHandler
      Parameters:
      mouseEvent - Mouse event
      mx - x-coordinate
      my - y-coordinate
    • onMouseReleased

      public void onMouseReleased(MouseEvent mouseEvent, float mx, float my)
      Description copied from class: UIEventHandler
      Subclasses override to receive mouse events
      Overrides:
      onMouseReleased in class UIEventHandler
      Parameters:
      mouseEvent - Mouse event
      mx - x-coordinate
      my - y-coordinate
    • onBlur

      public void onBlur()
      Description copied from class: UIObject
      Subclasses override when element loses focus
      Overrides:
      onBlur in class UIObject
    • onKeyPressed

      public void onKeyPressed(KeyEvent keyEvent, char keyChar, int keyCode)
      Description copied from class: UIEventHandler
      Subclasses override to receive key events
      Overrides:
      onKeyPressed in class UI2dContainer
      Parameters:
      keyEvent - Key event
      keyChar - Key character
      keyCode - Key code value
    • onKeyReleased

      public void onKeyReleased(KeyEvent keyEvent, char keyChar, int keyCode)
      Description copied from class: UIEventHandler
      Subclasses override to receive key events
      Overrides:
      onKeyReleased in class UIEventHandler
      Parameters:
      keyEvent - Key event
      keyChar - Key character
      keyCode - Key code value
    • onFocus

      public void onFocus(Event event)
      Description copied from class: UIObject
      Subclasses override when element is focused
      Overrides:
      onFocus in class UIObject
      Parameters:
      event - Event that caused the focus to occur