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.PositionNested classes/interfaces inherited from class heronarts.glx.ui.UI2dComponent
UI2dComponent.Scissor, UI2dComponent.Scissored, UI2dComponent.UIDragReorderNested 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.UI2dContainer
bottomPadding, childSpacingX, childSpacingY, leftPadding, rightPadding, topPaddingFields inherited from class heronarts.glx.ui.UI2dComponent
borderRoundingBottomLeft, borderRoundingBottomRight, borderRoundingTopLeft, borderRoundingTopRight, debug, debugName, hasBorderRounding, height, marginBottom, marginLeft, marginRight, marginTop, redraw, scissor, textAlignHorizontal, textAlignVertical, textOffsetX, textOffsetY, width, x, y -
Constructor Summary
Constructors -
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 listvoiddrawBorder(UI ui, VGraphics vg) voidDraws focus on this object.intReturns 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/pastefloatReturns the height of scrolling content.floatbooleanWhether this control is in the midst of an item rename operationmoveItem(UIItemList.Item item, int index) Moves an item to another location in the listvoidonBlur()Subclasses override when element loses focusvoidSubclasses should override this method to perform their drawing functions.voidSubclasses override when element is focusedvoidonKeyPressed(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key eventsvoidonKeyReleased(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key eventsvoidonMouseDragged(MouseEvent mouseEvent, float mx, float my, float dx, float dy) Subclasses override to receive mouse eventsvoidonMousePressed(MouseEvent mouseEvent, float mx, float my) Subclasses override to receive mouse eventsvoidonMouseReleased(MouseEvent mouseEvent, float mx, float my) Subclasses override to receive mouse eventsprotected voidonMouseScroll(MouseEvent mouseEvent, float mx, float my, float dx, float dy) Subclasses override to receive mouse eventsprotected voidonResize()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 operationsvoidrenameAppend(String append) Appends a string to the active rename buffersetContentSize(float w, float h) setControlSurfaceFocus(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 focusItem) 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.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, getChildSpacingX, getChildSpacingY, getContentHeight, getContentTarget, getContentWidth, getLeftPadding, getRightPadding, getScrollWidth, getTopPadding, hasDragToReorder, isEmpty, iterator, newHorizontalContainer, newHorizontalContainer, newHorizontalContainer, newVerticalContainer, newVerticalContainer, newVerticalContainer, onReflow, reflow, removeAllChildren, removeAllChildren, setArrowKeyFocus, setChildMargin, setChildSpacing, setChildSpacing, setChildSpacingX, setChildSpacingY, setContentHeight, setContentTarget, setContentWidth, setDragToReorder, setLayout, setLayout, setMinHeight, setMinWidth, setPadding, setPadding, setPaddingMethods inherited from class heronarts.glx.ui.UI2dComponent
addAfterSibling, addBeforeSibling, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, assertValidContainer, clipTextToWidth, clipTextToWidth, contains, dbch, drawBackground, drawComponentBackground, drawFocusCorners, drawFocusCorners, drawParentBackground, getAbsoluteX, getAbsoluteY, getBackgroundColor, getBorderColor, getBorderWeight, getBottomMargin, getContainer, getDebugClassHierarchy, getDebugClassHierarchy, getFocusColor, getFocusSize, getFont, getFontColor, getHeight, getLeftMargin, getMappableParameter, getNextSibling, getNextSibling, getParent, getPrevSibling, getPrevSibling, getRightMargin, getTopMargin, 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, vgRoundedRectMethods inherited from class heronarts.glx.ui.UIObject
addListener, addListener, addLoopTask, addLoopTask, blur, bringToFront, dispose, focus, getDescription, getFocusedChild, getLX, getUI, hasDirectFocus, hasFocus, isVisible, isVisible, loop, onUIResize, removeLoopTask, requireUIThread, setConsumeMousePress, setDebugId, setMouseCursor, toggleVisible, toStringMethods inherited from class heronarts.glx.ui.UIEventHandler
onGamepadAxisChanged, onGamepadButtonPressed, onGamepadButtonReleased, onMouseMoved, onMouseOut, onMouseOverMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ScrollList
-
-
Method Details
-
setContentSize
- Overrides:
setContentSizein classUI2dContainer
-
setScrollHeight
-
getScrollHeight
public float getScrollHeight()Description copied from class:UI2dContainerReturns 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:
getScrollHeightin classUI2dContainer- Returns:
- Height of scrollable content
-
onResize
protected void onResize()Description copied from class:UI2dComponentSubclasses may override this method, invoked when the component is resized- Overrides:
onResizein classUI2dComponent
-
getScrollY
public float getScrollY() -
setScrollY
-
setFocusIndex
Description copied from interface:UIItemListSets the index of the focused item in the list. Checks the bounds and adjusts the scroll position if necessary.- Specified by:
setFocusIndexin interfaceUIItemList- Parameters:
focusIndex- Index of item to focus- Returns:
- this
-
getFocusedIndex
public int getFocusedIndex()Description copied from interface:UIItemListReturns the index of the currently focused item in the list- Specified by:
getFocusedIndexin interfaceUIItemList- Returns:
- Index of focused item
-
setFocusItem
Description copied from interface:UIItemListSets the focused item. Checks the bounds and adjusts the scroll position if necessary.- Specified by:
setFocusItemin interfaceUIItemList- Parameters:
focusItem- Item to focus- Returns:
- this
-
getFocusedItem
Description copied from interface:UIItemListRetrieves the currently focused item in the list.- Specified by:
getFocusedItemin interfaceUIItemList- Returns:
- Focused item, or null if none is focused
-
addSection
Description copied from interface:UIItemListAdd a section to the list- Specified by:
addSectionin interfaceUIItemList- Parameters:
section- Section- Returns:
- this
-
addItem
Description copied from interface:UIItemListAdds an item to the list at the given index- Specified by:
addItemin interfaceUIItemList- Parameters:
index- Index to add the item atitem- Item to add- Returns:
- this
-
addItem
Description copied from interface:UIItemListAdds an item to the list- Specified by:
addItemin interfaceUIItemList- Parameters:
item- Item to add- Returns:
- this
-
moveItem
Description copied from interface:UIItemListMoves an item to another location in the list- Specified by:
moveItemin interfaceUIItemList- Parameters:
item- Item to moveindex- Index to move to- Returns:
- this
-
removeItem
Description copied from interface:UIItemListRemoves an item from the list- Specified by:
removeItemin interfaceUIItemList- Parameters:
item- Item to remove- Returns:
- this
-
setItems
Description copied from interface:UIItemListSets the items in the list and redraws it- Specified by:
setItemsin interfaceUIItemList- Parameters:
items- Items- Returns:
- this
-
clearItems
Description copied from interface:UIItemListClears all items in the list- Specified by:
clearItemsin interfaceUIItemList- Returns:
- this
-
getItems
Description copied from interface:UIItemListGet the items in the list- Specified by:
getItemsin interfaceUIItemList- Returns:
- list of items
-
setSingleClickActivate
Description copied from interface:UIItemListSets whether single-clicks on an item should activate them. Default behavior requires double-click or ENTER keypress- Specified by:
setSingleClickActivatein interfaceUIItemList- Parameters:
singleClickActivate- Whether to activate on a single click- Returns:
- this
-
setShowCheckboxes
Description copied from interface:UIItemListSets 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:
setShowCheckboxesin interfaceUIItemList- Parameters:
showCheckboxes- Whether to show checkboxes- Returns:
- this
-
setRenamable
Description copied from interface:UIItemListSets whether renaming items is allowed- Specified by:
setRenamablein interfaceUIItemList- Parameters:
isRenamable- If items may be renamed- Returns:
- this
-
isRenaming
public boolean isRenaming()Description copied from interface:UIItemListWhether this control is in the midst of an item rename operation- Specified by:
isRenamingin interfaceUIItemList- Returns:
- True if an item is being renamed
-
getRenameBuffer
Description copied from interface:UIItemListGets the current value in the rename buffer for copy/paste- Specified by:
getRenameBufferin interfaceUIItemList- Returns:
- Rename buffer segment
-
renameAppend
Description copied from interface:UIItemListAppends a string to the active rename buffer- Specified by:
renameAppendin interfaceUIItemList- Parameters:
append- Value to append to the rename buffer
-
setMomentary
Description copied from interface:UIItemListSets 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:
setMomentaryin interfaceUIItemList- Parameters:
momentary- Whether items are momentary- Returns:
- this
-
setReorderable
Description copied from interface:UIItemListSets whether the list is reorderable. If so, then pressing the modifier key with the up or down arrows will reorder the items.- Specified by:
setReorderablein interfaceUIItemList- Parameters:
reorderable- Whether items are reorderable- Returns:
- this
-
setDeletable
Description copied from interface:UIItemListSets whether items in the list are deletable. If so, then pressing the delete key will delete the focused item.- Specified by:
setDeletablein interfaceUIItemList- Parameters:
deletable- Whether items are deletable- Returns:
- this
-
setFilter
Description copied from interface:UIItemListFilter the items in the list by a String, resulting list will only show items that contains the filter string- Specified by:
setFilterin interfaceUIItemList- Parameters:
filter- Filter string- Returns:
- this
-
setControlSurfaceFocus
Description copied from interface:UIItemListSets a control focus range that is highlighted in the list- Specified by:
setControlSurfaceFocusin interfaceUIItemList- Parameters:
hasFocus- If there is control surface focuscolor- Color to show focus with- Returns:
- this
-
addListener
Description copied from interface:UIItemListAdds a listener to receive notifications about list operations- Specified by:
addListenerin interfaceUIItemList- Parameters:
listener- Listener- Returns:
- this
-
removeListener
Description copied from interface:UIItemListRemoves a listener from receiving notifications about list operations- Specified by:
removeListenerin interfaceUIItemList- Parameters:
listener- Listener- Returns:
- this
-
drawFocus
Description copied from class:UI2dComponentDraws focus on this object. May be overridden by subclasses to provide custom focus-drawing behavior.- Overrides:
drawFocusin classUI2dComponent- Parameters:
ui- UIvg- VGraphics
-
onDraw
Description copied from class:UI2dComponentSubclasses should override this method to perform their drawing functions.- Overrides:
onDrawin classUI2dContainer- Parameters:
ui- UI contextvg- Graphics context
-
drawBorder
- Overrides:
drawBorderin classUI2dComponent
-
onMouseDragged
Description copied from class:UIEventHandlerSubclasses override to receive mouse events- Overrides:
onMouseDraggedin classUIEventHandler- Parameters:
mouseEvent- Mouse eventmx- x-coordinatemy- y-coordinatedx- movement in xdy- movement in y
-
onMousePressed
Description copied from class:UIEventHandlerSubclasses override to receive mouse events- Overrides:
onMousePressedin classUIEventHandler- Parameters:
mouseEvent- Mouse eventmx- x-coordinatemy- y-coordinate
-
onMouseReleased
Description copied from class:UIEventHandlerSubclasses override to receive mouse events- Overrides:
onMouseReleasedin classUIEventHandler- Parameters:
mouseEvent- Mouse eventmx- x-coordinatemy- y-coordinate
-
onBlur
public void onBlur()Description copied from class:UIObjectSubclasses override when element loses focus -
onKeyPressed
Description copied from class:UIEventHandlerSubclasses override to receive key events- Overrides:
onKeyPressedin classUI2dContainer- Parameters:
keyEvent- Key eventkeyChar- Key characterkeyCode- Key code value
-
onKeyReleased
Description copied from class:UIEventHandlerSubclasses override to receive key events- Overrides:
onKeyReleasedin classUIEventHandler- Parameters:
keyEvent- Key eventkeyChar- Key characterkeyCode- Key code value
-
onFocus
Description copied from class:UIObjectSubclasses override when element is focused -
onMouseScroll
Description copied from class:UIEventHandlerSubclasses override to receive mouse events- Overrides:
onMouseScrollin classUIEventHandler- Parameters:
mouseEvent- Mouse eventmx- x-coordinatemy- y-coordinatedx- Amount of horizontal scrolldy- Amount of vertical scroll
-