public class Select<V> extends UiElement implements Actionable, FlexUiElement
UiElement with preset options. Uses left/right buttons to change
the selection.| Modifier and Type | Field and Description |
|---|---|
protected SelectRenderNode |
renderNode |
deferredLayout, deferredRender, deferredUpdate, effects, height, styleId, visibility, width, x, y, zIndex| Constructor and Description |
|---|
Select()
Constructor.
|
Select(float x,
float y,
float width,
float height)
Constructor
|
Select(java.lang.String id)
Constructor
|
Select(java.lang.String id,
float x,
float y,
float width,
float height)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addActionListener(ActionListener listener) |
void |
addOption(SelectOption<V> option)
Adds a selectable option to this
Select |
SelectOption<V> |
addOption(java.lang.String label,
V value)
Adds a selectable option to this
Select |
void |
attach(ParentRenderNode<?,?> parentRenderNode)
Attaches a
RenderNode for this element to a parent
RenderNode |
void |
detach(ParentRenderNode<?,?> parentRenderNode)
Detaches this element's
RenderNode from a parent
RenderNode |
Color |
getDisabledTextColor() |
Color |
getEnabledTextColor() |
java.lang.String |
getFlexLayout()
Returns the currently used flex layout
|
java.lang.String |
getLeftButtonText() |
SelectOption<V> |
getOption(int index)
Returns the option at the specified index
|
int |
getRenderHeight()
Returns the height this element is currently rendering at
|
int |
getRenderWidth()
Returns the width this element is currently rendering at
|
int |
getRenderX()
Returns X coordinate of where this element is currently rendering
|
int |
getRenderY()
Returns Y coordinate of where this element is currently rendering
|
java.lang.String |
getRightButtonText() |
int |
getSelectedIndex()
Returns the index of the currently selected option
|
java.lang.String |
getSelectedLabel()
Returns the label of the currently selected option
|
SelectOption<V> |
getSelectedOption()
Returns the currently selected option
|
V |
getSelectedValue()
Returns the value of the currently selected option
|
StyleRule |
getStyleRule() |
int |
getTotalOptions()
Returns the total amount of options
|
void |
invokeBeginHover()
Triggers the begin hover event
|
void |
invokeEndHover()
Triggers the end hover event
|
boolean |
isEnabled() |
boolean |
isFlexLayout()
Returns if this
UiElement is using a flex layout |
boolean |
isInitialLayoutOccurred() |
boolean |
isInitialUpdateOccurred() |
boolean |
isRenderNodeDirty() |
void |
nextOption()
Changes the current selection to the next available option.
|
void |
notifyActionListenersOfBeginEvent(EventTrigger eventTrigger,
EventTriggerParams eventTriggerParams) |
void |
notifyActionListenersOfEndEvent(EventTrigger eventTrigger,
EventTriggerParams eventTriggerParams) |
void |
previousOption()
Changes the current selection to the option before the currently selected
option.
|
void |
removeActionListener(ActionListener listener) |
void |
removeOption(SelectOption<V> option)
Removes a selectable option from this
Select |
boolean |
removeOptionByLabel(java.lang.String label)
Removes a selectable option from this
Select based on the
option's label |
boolean |
removeOptionByValue(V value)
Removes a selectable option from this
Select based on the
option's value |
void |
setDisabledTextColor(Color disabledTextColor) |
void |
setEnabled(boolean enabled) |
void |
setEnabledTextColor(Color enabledTextColor) |
void |
setFlex(float x,
float y,
float width,
float height)
Equivalent to
UiElement.set(float, float, float, float) for usage with flex layout |
void |
setFlexLayout(java.lang.String flexLayout)
Sets the current flex layout
|
void |
setHeightFlex(float height)
Equivalent to
UiElement.setHeight(float) for usage with flex layout |
void |
setLeftButtonText(java.lang.String leftButtonText) |
void |
setRenderNodeDirty() |
void |
setRightButtonText(java.lang.String rightButtonText) |
void |
setSelectedIndex(int index)
Sets the index of the currently selected option
|
void |
setStyleId(java.lang.String styleId)
Sets the style if for this
UiElement |
void |
setVisibility(Visibility visibility)
Sets the current
Visibility of this UiElement |
void |
setWidthFlex(float width)
Equivalent to
UiElement.setWidth(float) for usage with flex layout |
void |
setXFlex(float x)
Equivalent to
UiElement.setX(float) for usage with flex layout |
void |
setXYFlex(float x,
float y)
Equivalent to
UiElement.setXY(float, float) for usage with flex layout |
void |
setYFlex(float y)
Equivalent to
UiElement.setY(float) for usage with flex layout |
void |
setZIndex(int zIndex)
Sets the Z index of this
UiElement. |
void |
syncWithUpdate(UiContainerRenderTree rootNode)
Syncs data between the
UiElement and RenderNode during update |
addEffectListener, addHoverListener, addNodeStateListener, alignAbove, alignBelow, alignEdgeToEdge, alignLeftOf, alignRightOf, applyEffect, deferUntilLayout, deferUntilLayout, deferUntilRender, deferUntilRender, deferUntilUpdate, deferUntilUpdate, deferUntilUpdate, deferUntilUpdate, equals, getContentHeight, getContentWidth, getElementById, getHeight, getId, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getStyleId, getVisibility, getWidth, getX, getY, getZIndex, hashCode, isDebugEnabled, isInitialised, notifyEffectListenersOnFinished, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, notifyNodeStateListeners, removeEffectListener, removeHoverListener, removeNodeStateListener, set, setContentHeight, setContentWidth, setDebugEnabled, setHeight, setHeightToContentHeightOf, setHeightToHeightOf, setWidth, setWidthToContentWidthOf, setWidthToWidthOf, setX, setXY, setY, snapTo, snapTo, syncWithLayout, syncWithRenderclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddHoverListener, getId, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, removeHoverListenerprotected SelectRenderNode renderNode
public Select()
Selectpublic Select(java.lang.String id)
id - The unique ID for this Selectpublic Select(float x,
float y,
float width,
float height)
x - The x coordinate of this element relative to its parenty - The y coordinate of this element relative to its parentwidth - The width of this elementheight - The height of this elementpublic Select(java.lang.String id,
float x,
float y,
float width,
float height)
id - The unique ID for this element (if null an ID will be generated)x - The x coordinate of this element relative to its parenty - The y coordinate of this element relative to its parentwidth - The width of this elementheight - The height of this elementpublic void attach(ParentRenderNode<?,?> parentRenderNode)
UiElementRenderNode for this element to a parent
RenderNodeattach in class UiElementparentRenderNode - The parent RenderNode to attach topublic void detach(ParentRenderNode<?,?> parentRenderNode)
UiElementRenderNode from a parent
RenderNodedetach in class UiElementparentRenderNode - The parent RenderNode to detach frompublic void invokeBeginHover()
HoverableinvokeBeginHover in interface Hoverablepublic void invokeEndHover()
HoverableinvokeEndHover in interface Hoverablepublic void setVisibility(Visibility visibility)
UiElementVisibility of this UiElementsetVisibility in class UiElementvisibility - The Visibility to setpublic void setStyleId(java.lang.String styleId)
UiElementUiElementsetStyleId in class UiElementstyleId - The style id to setpublic void syncWithUpdate(UiContainerRenderTree rootNode)
UiElementUiElement and RenderNode during updatesyncWithUpdate in class UiElementpublic SelectOption<V> addOption(java.lang.String label, V value)
Selectlabel - The visible text of the optionvalue - The value of the optionSelectOption that was generatedpublic void addOption(SelectOption<V> option)
Selectoption - The SelectOption to addpublic void removeOption(SelectOption<V> option)
Selectoption - The SelectOption to removepublic boolean removeOptionByLabel(java.lang.String label)
Select based on the
option's labellabel - The label to search forpublic boolean removeOptionByValue(V value)
Select based on the
option's valuevalue - The value to search forpublic SelectOption<V> getOption(int index)
index - The index to getSelectOption instancepublic SelectOption<V> getSelectedOption()
SelectOptionpublic java.lang.String getSelectedLabel()
public V getSelectedValue()
public int getTotalOptions()
public int getSelectedIndex()
public void setSelectedIndex(int index)
index - The index to set as selectedpublic void nextOption()
public void previousOption()
public void notifyActionListenersOfBeginEvent(EventTrigger eventTrigger, EventTriggerParams eventTriggerParams)
notifyActionListenersOfBeginEvent in interface Actionablepublic void notifyActionListenersOfEndEvent(EventTrigger eventTrigger, EventTriggerParams eventTriggerParams)
notifyActionListenersOfEndEvent in interface Actionablepublic void addActionListener(ActionListener listener)
addActionListener in interface Actionablepublic void removeActionListener(ActionListener listener)
removeActionListener in interface Actionablepublic boolean isEnabled()
isEnabled in interface Actionablepublic void setEnabled(boolean enabled)
setEnabled in interface Actionablepublic void setZIndex(int zIndex)
UiElementUiElement. Elements will be rendered on
different Z layers in ascending Z order (negatives values first, positive values last)public StyleRule getStyleRule()
getStyleRule in class UiElementpublic java.lang.String getFlexLayout()
FlexUiElementgetFlexLayout in interface FlexUiElementpublic void setFlexLayout(java.lang.String flexLayout)
FlexUiElementsetFlexLayout in interface FlexUiElementflexLayout - see: FlexLayoutRulesetpublic Color getEnabledTextColor()
public void setEnabledTextColor(Color enabledTextColor)
public Color getDisabledTextColor()
public void setDisabledTextColor(Color disabledTextColor)
public java.lang.String getLeftButtonText()
public void setLeftButtonText(java.lang.String leftButtonText)
public java.lang.String getRightButtonText()
public void setRightButtonText(java.lang.String rightButtonText)
public boolean isRenderNodeDirty()
isRenderNodeDirty in class UiElementpublic void setRenderNodeDirty()
setRenderNodeDirty in class UiElementpublic boolean isInitialLayoutOccurred()
isInitialLayoutOccurred in class UiElementpublic boolean isInitialUpdateOccurred()
isInitialUpdateOccurred in class UiElementpublic int getRenderX()
UiElementgetRenderX in class UiElementInteger.MIN_VALUE if not renderingpublic int getRenderY()
UiElementgetRenderY in class UiElementInteger.MIN_VALUE if not renderingpublic int getRenderWidth()
UiElementgetRenderWidth in class UiElementpublic int getRenderHeight()
UiElementgetRenderHeight in class UiElementpublic boolean isFlexLayout()
UiElementUiElement is using a flex layoutisFlexLayout in interface FlexUiElementisFlexLayout in class UiElementpublic void setFlex(float x,
float y,
float width,
float height)
UiElement.set(float, float, float, float) for usage with flex layoutx - The x coordinate (in pixels) relative to its parenty - The y coordinate (in pixels) relative to its parentwidth - The width in pixelsheight - The height in pixelspublic void setXYFlex(float x,
float y)
UiElement.setXY(float, float) for usage with flex layoutx - The x coordinate (in pixels) relative to its parenty - The y coordinate (in pixels) relative to its parentpublic void setXFlex(float x)
UiElement.setX(float) for usage with flex layoutx - The x coordinate (in pixels) relative to its parentpublic void setYFlex(float y)
UiElement.setY(float) for usage with flex layouty - The y coordinate (in pixels) relative to its parentpublic void setWidthFlex(float width)
UiElement.setWidth(float) for usage with flex layoutwidth - The width in pixelspublic void setHeightFlex(float height)
UiElement.setHeight(float) for usage with flex layoutheight - The height in pixels