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
Modifier and TypeClassDescriptionstatic class
static enum
static interface
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.UIContextActions
UIContextActions.Action
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected boolean
protected boolean
protected int
protected UIInputBox.FillStyle
protected boolean
protected boolean
protected boolean
Fields inherited from class heronarts.glx.ui.component.UIParameterComponent
DEFAULT_HEIGHT, useCommandEngine
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 TypeMethodDescriptionprotected void
decrementValue
(KeyEvent keyEvent) Subclasses may optionally override to decrement value in response to arrows.void
edit()
void
protected void
editAppend
(String append) protected String
protected String
protected double
protected String
protected abstract String
protected void
incrementMouseValue
(MouseEvent mouseEvent, int offset) Subclasses may optionally implement to change value based upon mouse click+drag in the box.protected void
incrementValue
(KeyEvent keyEvent) Subclasses may optionally override to decrement value in response to arrows.boolean
boolean
protected abstract boolean
isValidCharacter
(char keyChar) protected void
onBlur()
Subclasses override when element loses focusprotected void
Subclasses should override this method to perform their drawing functions.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 fieldprotected void
onEditChange
(String editBuffer) Subclasses may override to handle editing changesprotected void
Subclasses may override to handle when an edit is finishedprotected void
onKeyPressed
(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key eventsprotected void
onMouseDragged
(MouseEvent mouseEvent, float mx, float my, float dx, float dy) Subclasses override to receive mouse eventsprotected void
onMousePressed
(MouseEvent mouseEvent, float mx, float my) Subclasses override to receive mouse eventsprotected void
onMouseReleased
(MouseEvent mouseEvent, float mx, float my) Subclasses override to receive mouse eventsprotected abstract void
saveEditBuffer
(String editBuffer) setEditable
(boolean editable) setEnabled
(boolean enabled) setMouseEditable
(boolean mouseEditable) setProgressColor
(boolean hasProgressColor) setProgressColor
(int progressColor) setProgressColor
(UIColor progressColor) protected void
setValueCommand
(double value) Methods inherited from class heronarts.glx.ui.component.UIParameterComponent
getContextActions, getOscAddress, getParameter, setEnableContextActions, setModulationRangeCommand, setNormalizedCommand, setUseCommandEngine
Methods inherited from class heronarts.glx.ui.UI2dComponent
addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, addToContainer, assertValidContainer, clipTextToWidth, clipTextToWidth, contains, dbch, drawBackground, drawBorder, drawFocus, 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, 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, vgRoundedRect
Methods inherited from class heronarts.glx.ui.UIObject
addListener, addListener, addLoopTask, blur, bringToFront, dispose, focus, getDescription, getFocusedChild, getLX, getUI, hasDirectFocus, hasFocus, isVisible, loop, onFocus, onUIResize, removeLoopTask, requireUIThread, setConsumeMousePress, setDebugId, toggleVisible, toString
Methods inherited from class heronarts.glx.ui.UIEventHandler
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:UIObject
Subclasses override when element loses focus -
getFillWidthNormalized
protected double getFillWidthNormalized() -
onDraw
Description copied from class:UI2dComponent
Subclasses should override this method to perform their drawing functions.- Overrides:
onDraw
in 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:UIEventHandler
Subclasses override to receive key events- Overrides:
onKeyPressed
in 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:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMousePressed
in classUIParameterComponent
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinate
-
onMouseReleased
Description copied from class:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMouseReleased
in classUIParameterComponent
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinate
-
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
-