Gridarta Editor
net.sf.gridarta.utils.ActionUtils Class Reference

Utility class implementing Action related functions. More...

+ Collaboration diagram for net.sf.gridarta.utils.ActionUtils:

Static Public Member Functions

static String getActionCategory (@NotNull final Action action)
 Returns an Action's category. More...
 
static String getActionDescription (@NotNull final Action action)
 Returns the description for an Action. More...
 
static Icon getActionIcon (@NotNull final Action action)
 Returns an Icon associated with the action. More...
 
static String getActionId (@NotNull final Action action)
 Returns an Action's ID string. More...
 
static String getActionName (@NotNull final Action action)
 Returns the name of an Action. More...
 
static KeyStroke getAlternativeShortcut (@NotNull final Action action)
 Returns the alternative shortcut of an Action. More...
 
static KeyStroke getShortcut (@NotNull final Action action)
 Returns the shortcut of an Action. More...
 
static String getShortcutDescription (@NotNull final Action action, @NotNull final String key)
 Returns a description of the shortcut of an Action. More...
 
static Action newAction (@NotNull final ActionBuilder actionBuilder, @NotNull final String category, @NotNull final EditorAction editorAction, @NotNull final String key)
 Creates a new Action instance. More...
 
static Action newToggleAction (@NotNull final ActionBuilder actionBuilder, @NotNull final String category, @NotNull final EditorAction editorAction, @NotNull final String key)
 Creates a new Action instance. More...
 
static void setActionShortcut (@NotNull final Action action, @Nullable final KeyStroke shortcut)
 Sets the shortcut of an Action. More...
 

Static Public Attributes

static final String DEFAULT_ACCELERATOR_KEY = "DefaultAcceleratorKey"
 Action key to store the default shortcut. More...
 
static final String NO_SHORTCUT = "none"
 The shortcut description for actions without shortcuts. More...
 

Private Member Functions

 ActionUtils ()
 Private construct to prevent instantiation. More...
 

Static Private Member Functions

static KeyStroke getShortcut (@NotNull final Action action, @NotNull final String key)
 Returns the shortcut of an Action. More...
 
static String getStringValue (@NotNull final Action action, @NotNull final String key)
 Returns an Action's value as a string. More...
 

Static Private Attributes

static final String CATEGORY = "Category"
 Action key for the action's category. More...
 
static final String UNDEFINED_CATEGORY = "Other"
 Category value for Actions not defining a CATEGORY. More...
 

Detailed Description

Utility class implementing Action related functions.

Author
Andreas Kirschbaum

Definition at line 33 of file ActionUtils.java.

Constructor & Destructor Documentation

◆ ActionUtils()

net.sf.gridarta.utils.ActionUtils.ActionUtils ( )
private

Private construct to prevent instantiation.

Definition at line 63 of file ActionUtils.java.

Member Function Documentation

◆ getActionCategory()

static String net.sf.gridarta.utils.ActionUtils.getActionCategory ( @NotNull final Action  action)
static

Returns an Action's category.

Parameters
actionthe action
Returns
the category

Definition at line 243 of file ActionUtils.java.

References net.sf.gridarta.utils.ActionUtils.getStringValue(), and net.sf.gridarta.utils.ActionUtils.UNDEFINED_CATEGORY.

Referenced by net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.createNodes(), and net.sf.gridarta.gui.dialog.shortcuts.KeyStrokeDialog.updateKeyStroke().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActionDescription()

static String net.sf.gridarta.utils.ActionUtils.getActionDescription ( @NotNull final Action  action)
static

Returns the description for an Action.

Parameters
actionthe action
Returns
the description

Definition at line 108 of file ActionUtils.java.

References net.sf.gridarta.utils.ActionUtils.getStringValue().

Referenced by net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.createPanel(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.updateSelectedAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActionIcon()

static Icon net.sf.gridarta.utils.ActionUtils.getActionIcon ( @NotNull final Action  action)
static

Returns an Icon associated with the action.

Parameters
actionthe action
Returns
the icon or
null

Definition at line 182 of file ActionUtils.java.

Referenced by net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.createPanel().

+ Here is the caller graph for this function:

◆ getActionId()

static String net.sf.gridarta.utils.ActionUtils.getActionId ( @NotNull final Action  action)
static

Returns an Action's ID string.

Parameters
actionthe action
Returns
the ID string
Exceptions
IllegalArgumentExceptionif the action does not define an ID string

Definition at line 94 of file ActionUtils.java.

References net.sf.gridarta.utils.ActionUtils.getStringValue().

Referenced by net.sf.gridarta.gui.utils.SwingUtils.addAction(), net.sf.gridarta.gui.utils.MenuUtils.findMenu(), net.sf.gridarta.utils.ActionUtils.getActionName(), net.sf.gridarta.gui.dialog.shortcuts.ShortcutsManager.isValidAction(), net.sf.gridarta.gui.dialog.shortcuts.ShortcutsManager.loadShortcuts(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsManager.saveShortcuts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActionName()

static String net.sf.gridarta.utils.ActionUtils.getActionName ( @NotNull final Action  action)
static

Returns the name of an Action.

Parameters
actionthe action
Returns
the name

Definition at line 72 of file ActionUtils.java.

References net.sf.gridarta.utils.ActionUtils.getActionId(), and net.sf.gridarta.utils.ActionUtils.getStringValue().

Referenced by net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getTitle(), net.sf.gridarta.gui.dialog.shortcuts.ShortcutsManager.loadShortcuts(), and net.sf.gridarta.gui.dialog.shortcuts.KeyStrokeDialog.updateKeyStroke().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAlternativeShortcut()

static KeyStroke net.sf.gridarta.utils.ActionUtils.getAlternativeShortcut ( @NotNull final Action  action)
static

Returns the alternative shortcut of an Action.

Parameters
actionthe action
Returns
the alternative shortcut or
null

Definition at line 138 of file ActionUtils.java.

References net.sf.gridarta.utils.ActionUtils.getShortcut().

Referenced by net.sf.gridarta.gui.map.mapview.DefaultMapView< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.installAccelerator().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getShortcut() [1/2]

◆ getShortcut() [2/2]

static KeyStroke net.sf.gridarta.utils.ActionUtils.getShortcut ( @NotNull final Action  action,
@NotNull final String  key 
)
staticprivate

Returns the shortcut of an Action.

Parameters
actionthe action
keythe action key to query
Returns
the shortcut or
null

Definition at line 149 of file ActionUtils.java.

◆ getShortcutDescription()

static String net.sf.gridarta.utils.ActionUtils.getShortcutDescription ( @NotNull final Action  action,
@NotNull final String  key 
)
static

Returns a description of the shortcut of an Action.

Returns NO_SHORTCUT if the action defines no shortcut.

Parameters
actionthe action
keythe action key to query
Returns
the description

Definition at line 171 of file ActionUtils.java.

References net.sf.gridarta.utils.ActionUtils.getShortcut(), and net.sf.gridarta.utils.ActionUtils.NO_SHORTCUT.

Referenced by net.sf.gridarta.gui.dialog.shortcuts.ShortcutsManager.saveShortcuts(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.updateSelectedAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStringValue()

static String net.sf.gridarta.utils.ActionUtils.getStringValue ( @NotNull final Action  action,
@NotNull final String  key 
)
staticprivate

Returns an Action's value as a string.

Parameters
actionthe action
keythe key to query
Returns
the value as a string or
null
if no such key is defined of if the value is not a string

Definition at line 195 of file ActionUtils.java.

Referenced by net.sf.gridarta.utils.ActionUtils.getActionCategory(), net.sf.gridarta.utils.ActionUtils.getActionDescription(), net.sf.gridarta.utils.ActionUtils.getActionId(), and net.sf.gridarta.utils.ActionUtils.getActionName().

+ Here is the caller graph for this function:

◆ newAction()

static Action net.sf.gridarta.utils.ActionUtils.newAction ( @NotNull final ActionBuilder  actionBuilder,
@NotNull final String  category,
@NotNull final EditorAction  editorAction,
@NotNull final String  key 
)
static

Creates a new Action instance.

It is basically the same as ActionBuilder#createAction(boolean, String, Object) except that the category is set.

Parameters
actionBuilderthe action builder to use
categorythe category to set
editorActionthe object which defines the action method
keythe action's key
Returns
the new action

Definition at line 212 of file ActionUtils.java.

Referenced by net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.createAction(), and net.sf.gridarta.gui.dialog.plugin.PluginController<?, ?, ?>.createRunAction().

+ Here is the caller graph for this function:

◆ newToggleAction()

static Action net.sf.gridarta.utils.ActionUtils.newToggleAction ( @NotNull final ActionBuilder  actionBuilder,
@NotNull final String  category,
@NotNull final EditorAction  editorAction,
@NotNull final String  key 
)
static

Creates a new Action instance.

It is basically the same as ActionBuilder#createToggle(boolean, String, Object) except that the category is set.

Parameters
actionBuilderthe action builder to use
categorythe category to set
editorActionthe object which defines the action method
keythe action's key
Returns
the new action

Definition at line 230 of file ActionUtils.java.

Referenced by net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.createToggleAction().

+ Here is the caller graph for this function:

◆ setActionShortcut()

static void net.sf.gridarta.utils.ActionUtils.setActionShortcut ( @NotNull final Action  action,
@Nullable final KeyStroke  shortcut 
)
static

Sets the shortcut of an Action.

Parameters
actionthe action
shortcutthe shortcut or
null
to remove it

Definition at line 159 of file ActionUtils.java.

Referenced by net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.shortcutsSetShortcut(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.shortcutsUnsetShortcut().

+ Here is the caller graph for this function:

Member Data Documentation

◆ CATEGORY

final String net.sf.gridarta.utils.ActionUtils.CATEGORY = "Category"
staticprivate

Action key for the action's category.

Definition at line 39 of file ActionUtils.java.

◆ DEFAULT_ACCELERATOR_KEY

final String net.sf.gridarta.utils.ActionUtils.DEFAULT_ACCELERATOR_KEY = "DefaultAcceleratorKey"
static

◆ NO_SHORTCUT

final String net.sf.gridarta.utils.ActionUtils.NO_SHORTCUT = "none"
static

The shortcut description for actions without shortcuts.

Definition at line 52 of file ActionUtils.java.

Referenced by net.sf.gridarta.utils.ActionUtils.getShortcutDescription(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsManager.loadShortcuts().

◆ UNDEFINED_CATEGORY

final String net.sf.gridarta.utils.ActionUtils.UNDEFINED_CATEGORY = "Other"
staticprivate

Category value for Actions not defining a CATEGORY.

Definition at line 46 of file ActionUtils.java.

Referenced by net.sf.gridarta.utils.ActionUtils.getActionCategory().


The documentation for this class was generated from the following file: