public class Select<V> extends UiElement implements Actionable
UiElement
with preset options. Uses left/right buttons to change
the selection.Modifier and Type | Field and Description |
---|---|
protected SelectRenderNode |
renderNode |
Constructor and Description |
---|
Select()
Constructor.
|
Select(java.lang.String id)
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 |
com.badlogic.gdx.graphics.Color |
getDisabledTextColor() |
com.badlogic.gdx.graphics.Color |
getEnabledTextColor() |
LayoutRuleset |
getHorizontalLayout() |
java.lang.String |
getLeftButtonText() |
SelectOption<V> |
getOption(int index)
Returns the option at the specified index
|
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
|
int |
getTotalOptions()
Returns the total amount of options
|
boolean |
isEnabled() |
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(com.badlogic.gdx.graphics.Color disabledTextColor) |
void |
setEnabled(boolean enabled) |
void |
setEnabledTextColor(com.badlogic.gdx.graphics.Color enabledTextColor) |
void |
setHorizontalLayout(LayoutRuleset layoutRuleset) |
void |
setHorizontalLayout(java.lang.String layoutRuleset) |
void |
setLeftButtonText(java.lang.String leftButtonText) |
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 |
setZIndex(int zIndex)
Sets the Z index of this
UiElement . |
void |
syncWithRenderNode()
Syncs data between the
UiElement and RenderNode |
addEffectListener, addHoverListener, applyEffect, defer, defer, equals, getElementById, getId, getStyleId, getVisibility, getZIndex, hashCode, isDebugEnabled, notifyEffectListenersOnFinished, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, processDeferred, removeEffectListener, removeHoverListener, setDebugEnabled
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addHoverListener, getId, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, removeHoverListener
protected SelectRenderNode renderNode
public Select()
Select
public Select(java.lang.String id)
id
- The unique ID for this Select
public void attach(ParentRenderNode<?,?> parentRenderNode)
UiElement
RenderNode
for this element to a parent
RenderNode
attach
in class UiElement
parentRenderNode
- The parent RenderNode
to attach topublic void detach(ParentRenderNode<?,?> parentRenderNode)
UiElement
RenderNode
from a parent
RenderNode
detach
in class UiElement
parentRenderNode
- The parent RenderNode
to detach frompublic void setVisibility(Visibility visibility)
UiElement
Visibility
of this UiElement
setVisibility
in class UiElement
visibility
- The Visibility
to setpublic void setStyleId(java.lang.String styleId)
UiElement
UiElement
setStyleId
in class UiElement
styleId
- The style id to setpublic void syncWithRenderNode()
UiElement
UiElement
and RenderNode
syncWithRenderNode
in class UiElement
public SelectOption<V> addOption(java.lang.String label, V value)
Select
label
- The visible text of the optionvalue
- The value of the optionSelectOption
that was generatedpublic void addOption(SelectOption<V> option)
Select
option
- The SelectOption
to addpublic void removeOption(SelectOption<V> option)
Select
option
- 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()
SelectOption
public 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 Actionable
public void notifyActionListenersOfEndEvent(EventTrigger eventTrigger, EventTriggerParams eventTriggerParams)
notifyActionListenersOfEndEvent
in interface Actionable
public void addActionListener(ActionListener listener)
addActionListener
in interface Actionable
public void removeActionListener(ActionListener listener)
removeActionListener
in interface Actionable
public boolean isEnabled()
isEnabled
in interface Actionable
public void setEnabled(boolean enabled)
setEnabled
in interface Actionable
public void setZIndex(int zIndex)
UiElement
UiElement
. Elements will be rendered on
different Z layers in ascending Z order (negatives values first, positive values last)public LayoutRuleset getHorizontalLayout()
public void setHorizontalLayout(java.lang.String layoutRuleset)
public void setHorizontalLayout(LayoutRuleset layoutRuleset)
public com.badlogic.gdx.graphics.Color getEnabledTextColor()
public void setEnabledTextColor(com.badlogic.gdx.graphics.Color enabledTextColor)
public com.badlogic.gdx.graphics.Color getDisabledTextColor()
public void setDisabledTextColor(com.badlogic.gdx.graphics.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)