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 voidCreates a new VersionedReference that can be used to monitor when this object changes.abstract voidSubclasses must override this to perform the action.getIcon()getName()Returns the object that is being versioned.<T> TReturns a previously set value from this action or null if the property has not been set.<T> TReturns a previously set value from this action or defaultValue if the property has not been set.longReturns the current version of the versioned object.protected voidbooleanbooleanvoidSets a general value onto this action that other action users or custom GUI elements can reference.voidsetEnabled(boolean b) Sets the enabled/disabled state of this action.voidsetIcon(GuiComponent component) Sets the icon that will be used as the icon in wrapping Action GUI elements.voidsetLargeIcon(GuiComponent component) Sets the icon that will be used as the icon in wrapping Action GUI elements.voidSets the name of the action that will be used as the label in wrapping Action GUI elements.voidsetSelected(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:VersionedObjectReturns the current version of the versioned object.- Specified by:
getVersionin interfaceVersionedObject<Action>
-
getObject
Description copied from interface:VersionedObjectReturns the object that is being versioned.- Specified by:
getObjectin interfaceVersionedObject<Action>
-
createReference
Description copied from interface:VersionedObjectCreates a new VersionedReference that can be used to monitor when this object changes.- Specified by:
createReferencein interfaceVersionedObject<Action>
-
appendFields
-
toString
-