Package heronarts.glx.ui.component
Class UIItemList.ScrollList
java.lang.Object
heronarts.glx.ui.UIEventHandler
heronarts.glx.ui.UIObject
heronarts.glx.ui.UI2dComponent
heronarts.glx.ui.UI2dContainer
heronarts.glx.ui.component.UIItemList.ScrollList
- All Implemented Interfaces:
UIItemList
,UIContainer
,UIFocus
,UIKeyFocus
,UIMouseFocus
,UITabFocus
,LXLoopTask
,Iterable<UIObject>
- Direct Known Subclasses:
UIContentPicker.UIContentList
,UIPatternList
- Enclosing interface:
- UIItemList
-
Nested Class Summary
Nested classes/interfaces inherited from class heronarts.glx.ui.UI2dContainer
UI2dContainer.ArrowKeyFocus, UI2dContainer.Layout, UI2dContainer.Position
Nested classes/interfaces inherited from class heronarts.glx.ui.UI2dComponent
UI2dComponent.Scissor, UI2dComponent.Scissored, UI2dComponent.UIDragReorder
Nested classes/interfaces inherited from interface heronarts.glx.ui.component.UIItemList
UIItemList.BasicList, UIItemList.Impl, UIItemList.Item, UIItemList.Listener, UIItemList.ScrollList, UIItemList.Section
-
Field Summary
Fields inherited from class heronarts.glx.ui.UI2dComponent
debug, debugName, height, marginBottom, marginLeft, marginRight, marginTop, redraw, scissor, textAlignHorizontal, textAlignVertical, textOffsetX, textOffsetY, width, x, y
-
Constructor Summary
-
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 listvoid
Draws focus on this object.int
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/pastefloat
Returns the height of scrolling content.float
boolean
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 listvoid
onBlur()
Subclasses override when element loses focusvoid
Subclasses should override this method to perform their drawing functions.void
Subclasses override when element is focusedvoid
onKeyPressed
(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key eventsvoid
onKeyReleased
(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key eventsvoid
onMouseDragged
(MouseEvent mouseEvent, float mx, float my, float dx, float dy) Subclasses override to receive mouse eventsvoid
onMousePressed
(MouseEvent mouseEvent, float mx, float my) Subclasses override to receive mouse eventsvoid
onMouseReleased
(MouseEvent mouseEvent, float mx, float my) Subclasses override to receive mouse eventsprotected void
onMouseScroll
(MouseEvent mouseEvent, float mx, float my, float dx, float dy) Subclasses override to receive mouse eventsprotected void
onResize()
Subclasses may override this method, invoked when the component is resizedremoveItem
(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 buffersetContentSize
(float w, float h) setControlSurfaceFocus
(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.setScrollHeight
(float scrollHeight) setScrollY
(float scrollY) 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.Methods inherited from class heronarts.glx.ui.UI2dContainer
addChildren, addTopLevelComponent, getBottomPadding, getChild, getChildren, getContentHeight, getContentTarget, getContentWidth, getLeftPadding, getRightPadding, getScrollWidth, getTopPadding, hasDragToReorder, iterator, newHorizontalContainer, newHorizontalContainer, newHorizontalContainer, newVerticalContainer, newVerticalContainer, newVerticalContainer, onReflow, reflow, removeAllChildren, removeAllChildren, setArrowKeyFocus, setChildMargin, setChildSpacing, setChildSpacing, setContentHeight, setContentTarget, setContentWidth, setDragToReorder, setLayout, setLayout, setMinHeight, setMinWidth, setPadding, setPadding, setPadding
Methods inherited from class heronarts.glx.ui.UI2dComponent
addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, assertValidContainer, clipTextToWidth, clipTextToWidth, contains, dbch, drawBackground, drawBorder, drawFocusCorners, drawFocusCorners, drawParentBackground, getAbsoluteX, getAbsoluteY, getBackgroundColor, getBorderColor, getBorderWeight, getContainer, getDebugClassHierarchy, getDebugClassHierarchy, getFocusColor, getFocusSize, getFont, getFontColor, getHeight, getMappableParameter, getNextSibling, getParent, getPrevSibling, getWidth, getX, getY, hasBackground, hasBorder, hasFont, hasFontColor, isMappable, redraw, removeFromContainer, removeFromContainer, setBackground, setBackgroundColor, setBackgroundColor, setBorder, setBorderColor, setBorderColor, setBorderRounding, setBorderRounding, setBorderWeight, setBottomMargin, setContainerIndex, setContainerPosition, setDebug, setDebug, setDescription, setFocusBackground, setFocusBackgroundColor, setFocusBackgroundColor, setFocusColor, setFocusColor, setFocusCorners, setFont, setFontColor, setFontColor, setFontColor, setHeight, setLeftMargin, setMappable, setMargin, setMargin, setMargin, setPosition, setPosition, setPosition, setPosition, setRightMargin, setSize, setTextAlignment, setTextAlignment, setTextOffset, setTopMargin, setVisible, setWidth, setX, setY, vgRoundedRect, vgRoundedRect, vgRoundedRect
Methods inherited from class heronarts.glx.ui.UIObject
addListener, addListener, addLoopTask, blur, bringToFront, dispose, focus, getDescription, getFocusedChild, getLX, getUI, hasDirectFocus, hasFocus, isVisible, loop, onUIResize, removeLoopTask, requireUIThread, setConsumeMousePress, setDebugId, toggleVisible, toString
Methods inherited from class heronarts.glx.ui.UIEventHandler
onMouseMoved, onMouseOut, onMouseOver
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ScrollList
-
-
Method Details
-
setContentSize
- Overrides:
setContentSize
in classUI2dContainer
-
setScrollHeight
-
getScrollHeight
public float getScrollHeight()Description copied from class:UI2dContainer
Returns the height of scrolling content. By default this is the same as the height of the container itself, but if the container scrolls then the scroll height may be a larger value.- Overrides:
getScrollHeight
in classUI2dContainer
- Returns:
- Height of scrollable content
-
onResize
protected void onResize()Description copied from class:UI2dComponent
Subclasses may override this method, invoked when the component is resized- Overrides:
onResize
in classUI2dComponent
-
getScrollY
public float getScrollY() -
setScrollY
-
setFocusIndex
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 interfaceUIItemList
- 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 interfaceUIItemList
- Returns:
- Index of focused item
-
getFocusedItem
Description copied from interface:UIItemList
Retrieves the currently focused item in the list.- Specified by:
getFocusedItem
in interfaceUIItemList
- Returns:
- Focused item, or null if none is focused
-
addSection
Description copied from interface:UIItemList
Add a section to the list- Specified by:
addSection
in interfaceUIItemList
- Parameters:
section
- Section- Returns:
- this
-
addItem
Description copied from interface:UIItemList
Adds an item to the list at the given index- Specified by:
addItem
in interfaceUIItemList
- Parameters:
index
- Index to add the item atitem
- Item to add- Returns:
- this
-
addItem
Description copied from interface:UIItemList
Adds an item to the list- Specified by:
addItem
in interfaceUIItemList
- Parameters:
item
- Item to add- Returns:
- this
-
moveItem
Description copied from interface:UIItemList
Moves an item to another location in the list- Specified by:
moveItem
in interfaceUIItemList
- Parameters:
item
- Item to moveindex
- Index to move to- Returns:
- this
-
removeItem
Description copied from interface:UIItemList
Removes an item from the list- Specified by:
removeItem
in interfaceUIItemList
- Parameters:
item
- Item to remove- Returns:
- this
-
setItems
Description copied from interface:UIItemList
Sets the items in the list and redraws it- Specified by:
setItems
in interfaceUIItemList
- Parameters:
items
- Items- Returns:
- this
-
clearItems
Description copied from interface:UIItemList
Clears all items in the list- Specified by:
clearItems
in interfaceUIItemList
- Returns:
- this
-
getItems
Description copied from interface:UIItemList
Get the items in the list- Specified by:
getItems
in interfaceUIItemList
- Returns:
- list of items
-
setSingleClickActivate
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 interfaceUIItemList
- Parameters:
singleClickActivate
- Whether to activate on a single click- Returns:
- this
-
setShowCheckboxes
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 interfaceUIItemList
- Parameters:
showCheckboxes
- Whether to show checkboxes- Returns:
- this
-
setRenamable
Description copied from interface:UIItemList
Sets whether renaming items is allowed- Specified by:
setRenamable
in interfaceUIItemList
- 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 interfaceUIItemList
- Returns:
- True if an item is being renamed
-
getRenameBuffer
Description copied from interface:UIItemList
Gets the current value in the rename buffer for copy/paste- Specified by:
getRenameBuffer
in interfaceUIItemList
- Returns:
- Rename buffer segment
-
renameAppend
Description copied from interface:UIItemList
Appends a string to the active rename buffer- Specified by:
renameAppend
in interfaceUIItemList
- Parameters:
append
- Value to append to the rename buffer
-
setMomentary
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 interfaceUIItemList
- Parameters:
momentary
- Whether items are momentary- Returns:
- this
-
setReorderable
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 interfaceUIItemList
- Parameters:
reorderable
- Whether items are reorderable- Returns:
- this
-
setDeletable
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 interfaceUIItemList
- Parameters:
deletable
- Whether items are deletable- Returns:
- this
-
setFilter
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 interfaceUIItemList
- Parameters:
filter
- Filter string- Returns:
- this
-
setControlSurfaceFocus
Description copied from interface:UIItemList
Sets a control focus range that is highlighted in the list- Specified by:
setControlSurfaceFocus
in interfaceUIItemList
- Parameters:
index
- Start of the surface focuslength
- Length of the surface focus blockcolor
- Color to show focus with- Returns:
- this
-
addListener
Description copied from interface:UIItemList
Adds a listener to receive notifications about list operations- Specified by:
addListener
in interfaceUIItemList
- Parameters:
listener
- Listener- Returns:
- this
-
removeListener
Description copied from interface:UIItemList
Removes a listener from receiving notifications about list operations- Specified by:
removeListener
in interfaceUIItemList
- Parameters:
listener
- Listener- Returns:
- this
-
drawFocus
Description copied from class:UI2dComponent
Draws focus on this object. May be overridden by subclasses to provide custom focus-drawing behavior.- Overrides:
drawFocus
in classUI2dComponent
- Parameters:
ui
- UIvg
- VGraphics
-
onDraw
Description copied from class:UI2dComponent
Subclasses should override this method to perform their drawing functions.- Overrides:
onDraw
in classUI2dContainer
- Parameters:
ui
- UI contextvg
- Graphics context
-
onMouseDragged
Description copied from class:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMouseDragged
in classUIEventHandler
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinatedx
- movement in xdy
- movement in y
-
onMousePressed
Description copied from class:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMousePressed
in classUIEventHandler
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinate
-
onMouseReleased
Description copied from class:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMouseReleased
in classUIEventHandler
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinate
-
onBlur
public void onBlur()Description copied from class:UIObject
Subclasses override when element loses focus -
onKeyPressed
Description copied from class:UIEventHandler
Subclasses override to receive key events- Overrides:
onKeyPressed
in classUI2dContainer
- Parameters:
keyEvent
- Key eventkeyChar
- Key characterkeyCode
- Key code value
-
onKeyReleased
Description copied from class:UIEventHandler
Subclasses override to receive key events- Overrides:
onKeyReleased
in classUIEventHandler
- Parameters:
keyEvent
- Key eventkeyChar
- Key characterkeyCode
- Key code value
-
onFocus
Description copied from class:UIObject
Subclasses override when element is focused -
onMouseScroll
Description copied from class:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMouseScroll
in classUIEventHandler
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinatedx
- Amount of horizontal scrolldy
- Amount of vertical scroll
-