Package heronarts.glx.ui.component
Class UIInputBox
java.lang.Object
heronarts.glx.ui.UIEventHandler
heronarts.glx.ui.UIObject
heronarts.glx.ui.UI2dComponent
heronarts.glx.ui.component.UIParameterComponent
heronarts.glx.ui.component.UIInputBox
- All Implemented Interfaces:
UIContextActions,UIFocus,UIKeyFocus,UIMouseFocus,UITabFocus,LXLoopTask
- Direct Known Subclasses:
UINumberBox,UIParameterControl,UITextBox
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumstatic interfaceNested classes/interfaces inherited from class heronarts.glx.ui.UI2dComponent
UI2dComponent.Scissor, UI2dComponent.Scissored, UI2dComponent.UIDragReorderNested classes/interfaces inherited from interface heronarts.glx.ui.UIContextActions
UIContextActions.Action, UIContextActions.ContextAction -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected booleanprotected intprotected UIInputBox.FillStyleprotected booleanprotected booleanprotected booleanFields inherited from class heronarts.glx.ui.component.UIParameterComponent
DEFAULT_HEIGHT, useCommandEngineFields 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 TypeMethodDescriptionprotected voiddecrementValue(KeyEvent keyEvent) Subclasses may optionally override to decrement value in response to arrows.voidedit()voidprotected voideditAppend(String append) protected Stringprotected Stringprotected doubleprotected Stringprotected abstract Stringprotected voidincrementMouseValue(MouseEvent mouseEvent, int offset) Subclasses may optionally implement to change value based upon mouse click+drag in the box.protected voidincrementValue(KeyEvent keyEvent) Subclasses may optionally override to decrement value in response to arrows.booleanbooleanprotected abstract booleanisValidCharacter(char keyChar) protected voidonBlur()Subclasses override when element loses focusprotected voidSubclasses should override this method to perform their drawing functions.static voidonDrawText(UI ui, VGraphics vg, UIInputBox.EditState editState, String rawString, boolean cursor, VGraphics.Align textAlignHorizontal, float x, float y, float width, float height, float availableWidth) Horrendous helper method to render an editable text fieldprotected voidonEditChange(String editBuffer) Subclasses may override to handle editing changesprotected voidSubclasses may override to handle when an edit is finishedprotected voidonKeyPressed(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key eventsprotected voidonMouseDragged(MouseEvent mouseEvent, float mx, float my, float dx, float dy) Subclasses override to receive mouse eventsprotected voidonMousePressed(MouseEvent mouseEvent, float mx, float my) Subclasses override to receive mouse eventsprotected voidonMouseReleased(MouseEvent mouseEvent, float mx, float my) Subclasses override to receive mouse eventsprotected abstract voidsaveEditBuffer(String editBuffer) setEditable(boolean editable) setEnabled(boolean enabled) setMouseEditable(boolean mouseEditable) setProgressColor(boolean hasProgressColor) setProgressColor(int progressColor) setProgressColor(UIColor progressColor) protected voidsetValueCommand(double value) Methods inherited from class heronarts.glx.ui.component.UIParameterComponent
getContextActions, getOscAddress, getParameter, setEnableContextActions, setModulationRangeCommand, setNormalizedCommand, setUseCommandEngineMethods inherited from class heronarts.glx.ui.UI2dComponent
addAfterSibling, addBeforeSibling, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, assertValidContainer, clipTextToWidth, clipTextToWidth, contains, dbch, drawBackground, drawBorder, drawComponentBackground, drawFocus, 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, onResize, 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, onFocus, onUIResize, removeLoopTask, requireUIThread, setConsumeMousePress, setDebugId, setMouseCursor, toggleVisible, toStringMethods inherited from class heronarts.glx.ui.UIEventHandler
onGamepadAxisChanged, onGamepadButtonPressed, onGamepadButtonReleased, onKeyReleased, onMouseMoved, onMouseOut, onMouseOver, onMouseScroll
-
Field Details
-
enabled
protected boolean enabled -
editable
protected boolean editable -
mouseEditable
protected boolean mouseEditable -
returnKeyEdit
protected boolean returnKeyEdit -
editing
protected volatile boolean editing -
hasFill
protected boolean hasFill -
fillColor
protected int fillColor -
fillStyle
-
-
Constructor Details
-
UIInputBox
protected UIInputBox() -
UIInputBox
protected UIInputBox(float x, float y, float w, float h)
-
-
Method Details
-
setProgressColor
-
setProgressColor
-
setProgressColor
-
setProgressIndicator
-
disableReturnKeyEdit
-
enableReturnKeyEdit
-
disableImmediateEdit
-
enableImmediateEdit
-
disableImmediateAppend
-
enableImmediateAppend
-
getValueString
-
saveEditBuffer
-
getEditBuffer
-
getEditRange
-
onEditChange
Subclasses may override to handle editing changes- Parameters:
editBuffer- New value being actively edited
-
onEditFinished
protected void onEditFinished()Subclasses may override to handle when an edit is finished -
isEditable
public boolean isEditable() -
setEditable
-
setMouseEditable
-
isEnabled
public boolean isEnabled() -
setEnabled
-
edit
public void edit() -
edit
-
editAppend
-
getInitialEditBufferValue
-
onBlur
protected void onBlur()Description copied from class:UIObjectSubclasses override when element loses focus -
getFillWidthNormalized
protected double getFillWidthNormalized() -
onDraw
Description copied from class:UI2dComponentSubclasses should override this method to perform their drawing functions.- Overrides:
onDrawin classUI2dComponent- Parameters:
ui- UI contextvg- Graphics context
-
onDrawText
public static void onDrawText(UI ui, VGraphics vg, UIInputBox.EditState editState, String rawString, boolean cursor, VGraphics.Align textAlignHorizontal, float x, float y, float width, float height, float availableWidth) Horrendous helper method to render an editable text field- Parameters:
ui- UI contextvg- VGraphics objecteditState- The editing staterawString- Raw string to rendercursor- Whether to draw cursortextAlignHorizontal-x- X offsety- Y offsetwidth- Available width from xheight- Available height from yavailableWidth-
-
isValidCharacter
protected abstract boolean isValidCharacter(char keyChar) -
decrementValue
Subclasses may optionally override to decrement value in response to arrows. Decrement is invoked for the left or down arrow keys.- Parameters:
keyEvent- Key event
-
incrementValue
Subclasses may optionally override to decrement value in response to arrows. Increment is invoked for the right or up keys.- Parameters:
keyEvent- Key event
-
onKeyPressed
Description copied from class:UIEventHandlerSubclasses override to receive key events- Overrides:
onKeyPressedin classUIEventHandler- Parameters:
keyEvent- Key eventkeyChar- Key characterkeyCode- Key code value
-
incrementMouseValue
Subclasses may optionally implement to change value based upon mouse click+drag in the box.- Parameters:
mouseEvent- Mouse eventoffset- Units of mouse movement, positive or negative
-
setValueCommand
protected void setValueCommand(double value) -
onMousePressed
Description copied from class:UIEventHandlerSubclasses override to receive mouse events- Overrides:
onMousePressedin classUIParameterComponent- Parameters:
mouseEvent- Mouse eventmx- x-coordinatemy- y-coordinate
-
onMouseReleased
Description copied from class:UIEventHandlerSubclasses override to receive mouse events- Overrides:
onMouseReleasedin classUIParameterComponent- Parameters:
mouseEvent- Mouse eventmx- x-coordinatemy- y-coordinate
-
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
-