Package heronarts.glx.ui.component
Class UIParameterControl
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
heronarts.glx.ui.component.UIParameterControl
- All Implemented Interfaces:
UIContextActions
,UIControlTarget
,UICopy
,UIFocus
,UIKeyFocus
,UIModulationSource
,UIModulationTarget
,UIMouseFocus
,UIPaste
,UITabFocus
,LXLoopTask
,LXParameterListener
- Direct Known Subclasses:
UICompoundParameterControl
,UISwitch
public abstract class UIParameterControl
extends UIInputBox
implements UIControlTarget, UIModulationTarget, UIModulationSource, LXParameterListener, UICopy, UIPaste
-
Nested Class Summary
Nested classes/interfaces inherited from class heronarts.glx.ui.component.UIInputBox
UIInputBox.EditState, UIInputBox.FillStyle, UIInputBox.ProgressIndicator
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 static final int
protected static final int
protected LXNormalizedParameter
protected LXParameter.Polarity
static final int
Fields inherited from class heronarts.glx.ui.component.UIInputBox
editable, editing, fillColor, fillStyle, hasFill, mouseEditable, returnKeyEdit
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
dispose()
static void
drawParameterLabel
(UI ui, VGraphics vg, UI2dComponent component, String labelText) protected double
Objects are encouraged to override this method providing a helpful String displayed to the user explaining the function of this UI component.static String
getDescription
(LXParameter parameter) protected UIColor
getFocusColor
(UI ui) int
getModulatedValueColor
(int baseColor) Given a base color for a control, return the color used to display the modulated component of its value.protected String
protected void
incrementValue
(KeyEvent keyEvent) Subclasses may optionally override to decrement value in response to arrows.boolean
boolean
protected boolean
isValidCharacter
(char keyChar) protected boolean
protected void
onBlur()
Subclasses override when element loses focusonCopy()
protected void
Subclasses should override this method to perform their drawing functions.protected void
onKeyPressed
(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key eventsprotected void
onKeyReleased
(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key 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 eventsvoid
onParameterChanged
(LXParameter parameter) Invoked when the value of a parameter is changed.void
onPaste
(LXClipboardItem item) protected void
saveEditBuffer
(String editBuffer) setEditable
(boolean editable) setEnabled
(boolean enabled) protected UIParameterControl
setNormalized
(double normalized) setParameter
(LXNormalizedParameter parameter) setPolarity
(LXParameter.Polarity polarity) setShowLabel
(boolean showLabel) Methods inherited from class heronarts.glx.ui.component.UIInputBox
disableImmediateAppend, disableImmediateEdit, disableReturnKeyEdit, edit, edit, editAppend, enableImmediateAppend, enableImmediateEdit, enableReturnKeyEdit, getEditBuffer, getEditRange, getFillWidthNormalized, getInitialEditBufferValue, incrementMouseValue, isEditable, onDrawText, onEditChange, onEditFinished, onMouseDragged, setMouseEditable, setProgressColor, setProgressColor, setProgressColor, setProgressIndicator, setValueCommand
Methods inherited from class heronarts.glx.ui.component.UIParameterComponent
getContextActions, getOscAddress, 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, 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, focus, getFocusedChild, getLX, getUI, hasDirectFocus, hasFocus, isVisible, loop, onFocus, onUIResize, removeLoopTask, requireUIThread, setConsumeMousePress, setDebugId, toggleVisible, toString
Methods inherited from class heronarts.glx.ui.UIEventHandler
onMouseMoved, onMouseOut, onMouseOver, onMouseScroll
-
Field Details
-
LABEL_MARGIN
protected static final int LABEL_MARGIN- See Also:
-
LABEL_HEIGHT
protected static final int LABEL_HEIGHT- See Also:
-
TEXT_MARGIN
public static final int TEXT_MARGIN- See Also:
-
parameter
-
polarity
-
enabled
protected boolean enabled -
keyEditable
protected boolean keyEditable
-
-
Constructor Details
-
UIParameterControl
protected UIParameterControl(float x, float y, float w, float h)
-
-
Method Details
-
setEnabled
- Overrides:
setEnabled
in classUIInputBox
-
getDescription
-
getDescription
Description copied from class:UIObject
Objects are encouraged to override this method providing a helpful String displayed to the user explaining the function of this UI component. If no help is available, return null rather than an empty String.- Overrides:
getDescription
in classUIObject
- Returns:
- Helpful contextual string explaining function of this element
-
isEnabled
public boolean isEnabled()- Overrides:
isEnabled
in classUIInputBox
-
setEditable
- Overrides:
setEditable
in classUIInputBox
-
setShowLabel
-
isShowLabel
public boolean isShowLabel() -
setLabel
-
getFocusColor
- Overrides:
getFocusColor
in classUI2dComponent
-
onParameterChanged
Description copied from interface:LXParameterListener
Invoked when the value of a parameter is changed.- Specified by:
onParameterChanged
in interfaceLXParameterListener
- Parameters:
parameter
- The parameter that has changed its value
-
getBaseNormalized
protected double getBaseNormalized() -
setNormalized
-
getParameter
- Specified by:
getParameter
in classUIParameterComponent
-
setPolarity
-
setParameter
-
getValueString
- Specified by:
getValueString
in classUIInputBox
-
isWrappable
protected boolean isWrappable() -
isValidCharacter
protected boolean isValidCharacter(char keyChar) - Specified by:
isValidCharacter
in classUIInputBox
-
saveEditBuffer
- Specified by:
saveEditBuffer
in classUIInputBox
-
onDraw
Description copied from class:UI2dComponent
Subclasses should override this method to perform their drawing functions.- Overrides:
onDraw
in classUIInputBox
- Parameters:
ui
- UI contextvg
- Graphics context
-
drawParameterLabel
public static void drawParameterLabel(UI ui, VGraphics vg, UI2dComponent component, String labelText) -
decrementValue
Subclasses may optionally override to decrement value in response to arrows. Decrement is invoked for the left or down arrow keys.- Overrides:
decrementValue
in classUIInputBox
- Parameters:
keyEvent
- Key event in response to
-
incrementValue
Subclasses may optionally override to decrement value in response to arrows. Increment is invoked for the right or up keys.- Overrides:
incrementValue
in classUIInputBox
- Parameters:
keyEvent
- Key event in response to
-
onKeyPressed
Description copied from class:UIEventHandler
Subclasses override to receive key events- Overrides:
onKeyPressed
in classUIInputBox
- 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
-
onMousePressed
Description copied from class:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMousePressed
in classUIInputBox
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinate
-
onMouseReleased
Description copied from class:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMouseReleased
in classUIInputBox
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinate
-
onBlur
protected void onBlur()Description copied from class:UIObject
Subclasses override when element loses focus- Overrides:
onBlur
in classUIInputBox
-
getControlTarget
- Specified by:
getControlTarget
in interfaceUIControlTarget
-
getModulationSource
- Specified by:
getModulationSource
in interfaceUIModulationSource
-
getModulationTarget
- Specified by:
getModulationTarget
in interfaceUIModulationTarget
-
getModulatedValueColor
public int getModulatedValueColor(int baseColor) Given a base color for a control, return the color used to display the modulated component of its value. Currently, just dims the base color.- Parameters:
baseColor
- Base color to determine modulated color from- Returns:
- Color to use for modulated value
-
onCopy
-
onPaste
-
dispose
public void dispose()
-