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 |
effects, styleId, visibility, zIndex| 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 |
getLayout() |
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() |
void |
notifyActionListenersOfEndEvent() |
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 |
setLayout(LayoutRuleset layoutRuleset) |
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, equals, getElementById, getId, getStyleId, getVisibility, getZIndex, hashCode, isDebugEnabled, notifyEffectListenersOnFinished, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, removeEffectListener, removeHoverListener, setDebugEnabledclone, 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 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 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 syncWithRenderNode()
UiElementUiElement and RenderNodesyncWithRenderNode 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> 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()
notifyActionListenersOfBeginEvent in interface Actionablepublic void notifyActionListenersOfEndEvent()
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 LayoutRuleset getLayout()
public void setLayout(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)