public abstract class Action extends java.lang.Object implements com.simsilica.lemur.core.VersionedObject<Action>, com.simsilica.lemur.Command<com.simsilica.lemur.Button>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
KEY_ENABLED |
static java.lang.String |
KEY_ICON |
static java.lang.String |
KEY_LARGE_ICON |
static java.lang.String |
KEY_NAME |
static java.lang.String |
KEY_SELECTED |
static java.lang.String |
KEY_SHORT_DESCRIPTION |
Constructor and Description |
---|
Action() |
Action(java.lang.String name) |
Action(java.lang.String name,
com.simsilica.lemur.core.GuiComponent icon) |
Action(java.lang.String name,
com.simsilica.lemur.core.GuiComponent icon,
boolean enabled) |
Modifier and Type | Method and Description |
---|---|
protected void |
appendFields(java.lang.StringBuilder sb) |
com.simsilica.lemur.core.VersionedReference<Action> |
createReference() |
abstract void |
execute(com.simsilica.lemur.Button source)
Subclasses must override this to perform the action.
|
com.simsilica.lemur.core.GuiComponent |
getIcon() |
com.simsilica.lemur.core.GuiComponent |
getLargeIcon() |
java.lang.String |
getName() |
Action |
getObject() |
<T> T |
getValue(java.lang.String key)
Returns a previously set value from this action or
null if the property has not been set.
|
<T> T |
getValue(java.lang.String key,
T defaultValue)
Returns a previously set value from this action or
defaultValue if the property has not been set.
|
long |
getVersion() |
protected void |
incrementVersion() |
boolean |
isEnabled() |
boolean |
isSelected() |
void |
putValue(java.lang.String key,
java.lang.Object value)
Sets a general value onto this action that other
action users or custom GUI elements can reference.
|
void |
setEnabled(boolean b)
Sets the enabled/disabled state of this action.
|
void |
setIcon(com.simsilica.lemur.core.GuiComponent component)
Sets the icon that will be used as the icon
in wrapping Action GUI elements.
|
void |
setLargeIcon(com.simsilica.lemur.core.GuiComponent component)
Sets the icon that will be used as the icon
in wrapping Action GUI elements.
|
void |
setName(java.lang.String name)
Sets the name of the action that will be used as the
label in wrapping Action GUI elements.
|
void |
setSelected(boolean b)
Sets the selected/deselected state of this action.
|
java.lang.String |
toString() |
public static final java.lang.String KEY_ENABLED
public static final java.lang.String KEY_NAME
public static final java.lang.String KEY_ICON
public static final java.lang.String KEY_LARGE_ICON
public static final java.lang.String KEY_SHORT_DESCRIPTION
public static final java.lang.String KEY_SELECTED
public Action()
public Action(java.lang.String name)
public Action(java.lang.String name, com.simsilica.lemur.core.GuiComponent icon)
public Action(java.lang.String name, com.simsilica.lemur.core.GuiComponent icon, boolean enabled)
public abstract void execute(com.simsilica.lemur.Button source)
execute
in interface com.simsilica.lemur.Command<com.simsilica.lemur.Button>
public void setEnabled(boolean b)
public boolean isEnabled()
public void setSelected(boolean b)
public boolean isSelected()
public void setName(java.lang.String name)
public java.lang.String getName()
public void setIcon(com.simsilica.lemur.core.GuiComponent component)
public com.simsilica.lemur.core.GuiComponent getIcon()
public void setLargeIcon(com.simsilica.lemur.core.GuiComponent component)
public com.simsilica.lemur.core.GuiComponent getLargeIcon()
public void putValue(java.lang.String key, java.lang.Object value)
public <T> T getValue(java.lang.String key)
public <T> T getValue(java.lang.String key, T defaultValue)
protected void incrementVersion()
public long getVersion()
getVersion
in interface com.simsilica.lemur.core.VersionedObject<Action>
public Action getObject()
getObject
in interface com.simsilica.lemur.core.VersionedObject<Action>
public com.simsilica.lemur.core.VersionedReference<Action> createReference()
createReference
in interface com.simsilica.lemur.core.VersionedObject<Action>
protected void appendFields(java.lang.StringBuilder sb)
public java.lang.String toString()
toString
in class java.lang.Object