Package com.simsilica.lemur
Class Action
java.lang.Object
com.simsilica.lemur.Action
- All Implemented Interfaces:
Command<Button>
,VersionedObject<Action>
- Direct Known Subclasses:
CallMethodAction
,EmptyAction
A combination of a command and some attributes
that define what the GUI element should look like.
The action is versioned so that GUI elements can
automatically update themselves as these attributes
are changed. This is similar to Swing's Action.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAction()
Action
(String name, GuiComponent icon) Action
(String name, GuiComponent icon, boolean enabled) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Creates a new VersionedReference that can be used to monitor when this object changes.abstract void
Subclasses must override this to perform the action.getIcon()
getName()
Returns the object that is being versioned.<T> T
Returns a previously set value from this action or null if the property has not been set.<T> T
Returns a previously set value from this action or defaultValue if the property has not been set.long
Returns the current version of the versioned object.protected void
boolean
boolean
void
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
(GuiComponent component) Sets the icon that will be used as the icon in wrapping Action GUI elements.void
setLargeIcon
(GuiComponent component) Sets the icon that will be used as the icon in wrapping Action GUI elements.void
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.toString()
-
Field Details
-
KEY_ENABLED
- See Also:
-
KEY_NAME
- See Also:
-
KEY_ICON
- See Also:
-
KEY_LARGE_ICON
- See Also:
-
KEY_SHORT_DESCRIPTION
- See Also:
-
KEY_SELECTED
- See Also:
-
-
Constructor Details
-
Action
public Action() -
Action
-
Action
-
Action
-
-
Method Details
-
execute
Subclasses must override this to perform the action. -
setEnabled
public void setEnabled(boolean b) Sets the enabled/disabled state of this action. Action GUI elements that support being disabled will adhere to this state. -
isEnabled
public boolean isEnabled() -
setSelected
public void setSelected(boolean b) Sets the selected/deselected state of this action. Action GUI elements that support selection (checkboxes) will adhere to this state and reflect it back into the action itself. -
isSelected
public boolean isSelected() -
setName
Sets the name of the action that will be used as the label in wrapping Action GUI elements. -
getName
-
setIcon
Sets the icon that will be used as the icon in wrapping Action GUI elements. This is used when a smaller icon is needed or when there is no large icon specified. -
getIcon
-
setLargeIcon
Sets the icon that will be used as the icon in wrapping Action GUI elements. ActionButton will use this as its icon if specified. getLargeIcon() defaults to getIcon() when not set. -
getLargeIcon
-
putValue
Sets a general value onto this action that other action users or custom GUI elements can reference. -
getValue
Returns a previously set value from this action or null if the property has not been set. -
getValue
Returns a previously set value from this action or defaultValue if the property has not been set. -
incrementVersion
protected void incrementVersion() -
getVersion
public long getVersion()Description copied from interface:VersionedObject
Returns the current version of the versioned object.- Specified by:
getVersion
in interfaceVersionedObject<Action>
-
getObject
Description copied from interface:VersionedObject
Returns the object that is being versioned.- Specified by:
getObject
in interfaceVersionedObject<Action>
-
createReference
Description copied from interface:VersionedObject
Creates a new VersionedReference that can be used to monitor when this object changes.- Specified by:
createReference
in interfaceVersionedObject<Action>
-
appendFields
-
toString
-