Class BasicAction
java.lang.Object
com.levigo.jadice.web.client.util.action.BasicAction
- All Implemented Interfaces:
Action
A simple
Action
which is not registered in an action registry. This action can be used
for dynamic content without keystrokes like AnnotationPropertyEditor
s, buttons in widgets or
sub-menu buttons.-
Constructor Summary
ConstructorsConstructorDescriptionBasicAction
(String label, StateIcon stateIcon, Command command) Create a newBasicAction
with the given parameterBasicAction
(String label, StateIcon icon, Command command, boolean closeOnExecution) Create a newBasicAction
with the given parameterBasicAction
(String label, String description, StateIcon icon, Command command) Create a newBasicAction
with the given parameterBasicAction
(String label, String description, StateIcon icon, Command command, boolean closeOnExecution) Create a newBasicAction
with the given parameter -
Method Summary
Modifier and TypeMethodDescriptionReturns the accelerator key stroke (e.g.Returns a second, alternative accelerator key stroke for this action.boolean
If this action is contained in anContextMenu
, this value indicates whether the context menu should be closed after executing the command contained in this action.Returns theCommand
for this action.The context this action is bound to.Returns the description of the action which should be displayed when hovering over the GUI component containing this action.getIcon()
Returns theStateIcon
for this action.getLabel()
Returns the label of the action which should be displayed in the toolbar or context menu.void
setAlternativeAcceleratorKey
(KeyStroke alternativeKeyStroke) Sets the givenKeyStroke
to this action as an alternative KeyStroke.void
setCommand
(Command command) Should be only used for sub-menu actions.
-
Constructor Details
-
BasicAction
Create a newBasicAction
with the given parameter- Parameters:
label
- the displayed name; it is also used as hover descriptionstateIcon
- the icon which should be displayedcommand
- the command which should be executed
-
BasicAction
Create a newBasicAction
with the given parameter- Parameters:
label
- the displayed namedescription
- the hover descriptionicon
- the icon which should be displayedcommand
- the command which should be executed
-
BasicAction
Create a newBasicAction
with the given parameter- Parameters:
label
- the displayed name; it is also used as hover descriptionicon
- the icon which should be displayedcommand
- the command which should be executedcloseOnExecution
- whether the containing menu should be closed after executing the command
-
BasicAction
public BasicAction(String label, String description, StateIcon icon, Command command, boolean closeOnExecution) Create a newBasicAction
with the given parameter- Parameters:
label
- the displayed namedescription
- the hover descriptionicon
- the icon which should be displayedcommand
- the command which should be executedcloseOnExecution
- whether the containing menu should be closed after executing the command
-
-
Method Details
-
getLabel
Description copied from interface:Action
Returns the label of the action which should be displayed in the toolbar or context menu. -
getDescription
Description copied from interface:Action
Returns the description of the action which should be displayed when hovering over the GUI component containing this action.- Specified by:
getDescription
in interfaceAction
- Returns:
- the description
-
getIcon
Description copied from interface:Action
Returns theStateIcon
for this action. -
getCommand
Description copied from interface:Action
Returns theCommand
for this action.- Specified by:
getCommand
in interfaceAction
- Returns:
- the command
-
getAcceleratorKey
Description copied from interface:Action
Returns the accelerator key stroke (e.g. CTRL + S) for this action.- Specified by:
getAcceleratorKey
in interfaceAction
- Returns:
- the accelerator key; null if undefined
-
getAlternativeAcceleratorKey
Description copied from interface:Action
Returns a second, alternative accelerator key stroke for this action.- Specified by:
getAlternativeAcceleratorKey
in interfaceAction
- Returns:
- the accelerator key; null if undefined
-
setAlternativeAcceleratorKey
Description copied from interface:Action
Sets the givenKeyStroke
to this action as an alternative KeyStroke. Resetting the KeyStroke is not supported.- Specified by:
setAlternativeAcceleratorKey
in interfaceAction
- Parameters:
alternativeKeyStroke
- the alternative KeyStroke
-
getCloseOnExecution
public boolean getCloseOnExecution()Description copied from interface:Action
If this action is contained in anContextMenu
, this value indicates whether the context menu should be closed after executing the command contained in this action.- Specified by:
getCloseOnExecution
in interfaceAction
- Returns:
- whether the context menu should be closed or not
-
getContext
Description copied from interface:Action
The context this action is bound to.- Specified by:
getContext
in interfaceAction
- Returns:
- the context objects used to execute the command
-
setCommand
Description copied from interface:Action
Should be only used for sub-menu actions. TheCommand
is set by the button.- Specified by:
setCommand
in interfaceAction
- Parameters:
command
- the open sub-menu command
-