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.ProgressIndicatorNested 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 static final intprotected static final intprotected LXNormalizedParameterprotected LXParameter.Polaritystatic final intFields inherited from class heronarts.glx.ui.component.UIInputBox
editable, editing, fillColor, fillStyle, hasFill, mouseEditable, returnKeyEditFields 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.voiddispose()static voiddrawParameterLabel(UI ui, VGraphics vg, UI2dComponent component, String labelText) protected doubleObjects are encouraged to override this method providing a helpful String displayed to the user explaining the function of this UI component.static StringgetDescription(LXParameter parameter) protected UIColorgetFocusColor(UI ui) static intgetModulatedValueColor(int baseColor) Given a base color for a control, return the color used to display the modulated component of its value.protected Stringprotected voidincrementValue(KeyEvent keyEvent) Subclasses may optionally override to decrement value in response to arrows.booleanbooleanprotected booleanprotected booleanisValidCharacter(char keyChar) protected booleanprotected voidonBlur()Subclasses override when element loses focusonCopy()protected voidSubclasses should override this method to perform their drawing functions.protected voidonKeyPressed(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key eventsprotected voidonKeyReleased(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key 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 eventsvoidonParameterChanged(LXParameter parameter) Invoked when the value of a parameter is changed.voidonPaste(LXClipboardItem item) protected voidsaveEditBuffer(String editBuffer) setEditable(boolean editable) setEnabled(boolean enabled) protected UIParameterControlsetNormalized(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, setValueCommandMethods inherited from class heronarts.glx.ui.component.UIParameterComponent
getContextActions, getOscAddress, 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, 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, focus, 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, 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:
setEnabledin classUIInputBox
-
getDescription
-
getDescription
Description copied from class:UIObjectObjects 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:
getDescriptionin classUIObject- Returns:
- Helpful contextual string explaining function of this element
-
isEnabled
public boolean isEnabled()- Overrides:
isEnabledin classUIInputBox
-
setEditable
- Overrides:
setEditablein classUIInputBox
-
setShowLabel
-
isShowLabel
public boolean isShowLabel() -
setLabel
-
getFocusColor
- Overrides:
getFocusColorin classUI2dComponent
-
onParameterChanged
Description copied from interface:LXParameterListenerInvoked when the value of a parameter is changed.- Specified by:
onParameterChangedin interfaceLXParameterListener- Parameters:
parameter- The parameter that has changed its value
-
getBaseNormalized
protected double getBaseNormalized() -
setNormalized
-
getParameter
- Specified by:
getParameterin classUIParameterComponent
-
setPolarity
-
setParameter
-
getValueString
- Specified by:
getValueStringin classUIInputBox
-
isWrappable
protected boolean isWrappable() -
isValidCharacter
protected boolean isValidCharacter(char keyChar) - Specified by:
isValidCharacterin classUIInputBox
-
saveEditBuffer
- Specified by:
saveEditBufferin classUIInputBox
-
onDraw
Description copied from class:UI2dComponentSubclasses should override this method to perform their drawing functions.- Overrides:
onDrawin classUIInputBox- Parameters:
ui- UI contextvg- Graphics context
-
drawParameterLabel
public static void drawParameterLabel(UI ui, VGraphics vg, UI2dComponent component, String labelText) -
isTriggerParameter
protected boolean isTriggerParameter() -
decrementValue
Subclasses may optionally override to decrement value in response to arrows. Decrement is invoked for the left or down arrow keys.- Overrides:
decrementValuein 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:
incrementValuein classUIInputBox- Parameters:
keyEvent- Key event in response to
-
onKeyPressed
Description copied from class:UIEventHandlerSubclasses override to receive key events- Overrides:
onKeyPressedin classUIInputBox- 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
-
onMousePressed
Description copied from class:UIEventHandlerSubclasses override to receive mouse events- Overrides:
onMousePressedin classUIInputBox- Parameters:
mouseEvent- Mouse eventmx- x-coordinatemy- y-coordinate
-
onMouseReleased
Description copied from class:UIEventHandlerSubclasses override to receive mouse events- Overrides:
onMouseReleasedin classUIInputBox- Parameters:
mouseEvent- Mouse eventmx- x-coordinatemy- y-coordinate
-
onBlur
protected void onBlur()Description copied from class:UIObjectSubclasses override when element loses focus- Overrides:
onBlurin classUIInputBox
-
getControlTarget
- Specified by:
getControlTargetin interfaceUIControlTarget
-
getModulationSource
- Specified by:
getModulationSourcein interfaceUIModulationSource
-
getModulationTarget
- Specified by:
getModulationTargetin interfaceUIModulationTarget
-
getModulatedValueColor
public static 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()
-