Gridarta Editor
net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog Class Reference
+ Inheritance diagram for net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog:
+ Collaboration diagram for net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog:

Public Member Functions

void setValue (@Nullable final Object newValue)
 
void shortcutsDefaults ()
 Action method for restore to defaults. More...
 
 ShortcutsDialog (@NotNull final Component parentComponent, @NotNull final ShortcutsManager shortcutsManager)
 Creates a new instance. More...
 
void shortcutsOkay ()
 Action method for okay. More...
 
void shortcutsSetShortcut ()
 The action method for the "set shortcut" button. More...
 
void shortcutsUnsetShortcut ()
 The action method for the "set shortcut" button. More...
 
void showDialog (@NotNull final Component parentComponent)
 Opens the dialog. More...
 

Private Member Functions

void createNodes (@NotNull final DefaultMutableTreeNode root)
 Creates nodes for all actions. More...
 
JPanel createPanel ()
 Creates the GUI. More...
 
Action getUnsetShortcutEnabled ()
 Returns whether "unset shortcut" is enabled. More...
 
void setSelectedAction (@Nullable final Action selectedAction)
 Updates the selected action. More...
 
void updateSelectedAction ()
 Updates the information shown for the selected action. More...
 

Static Private Member Functions

static void addNode (@NotNull final DefaultMutableTreeNode root, @NotNull final CharSequence category, @NotNull final Action action)
 Adds an Action to a branch node. More...
 
static Action getAction (@Nullable final Object node)
 Returns the Action for a node in the action tree. More...
 
static int getInsertionIndex (@NotNull final TreeNode parentNode, @NotNull final TreeNode childNode)
 Returns the index to insert a new child node into a parent node. More...
 
static DefaultMutableTreeNode getOrCreateChildNode (@NotNull final MutableTreeNode root, @NotNull final String subCategory)
 Returns a child node by category name. More...
 
static DefaultMutableTreeNode getOrCreateNodeForCategory (@NotNull final DefaultMutableTreeNode root, @NotNull final CharSequence category)
 Returns the branch DefaultMutableTreeNode for a given category. More...
 
static String getTitle (@NotNull final TreeNode node)
 Returns the category for a node in the action tree. More...
 
static void insertChildNode (@NotNull final MutableTreeNode branchNode, @NotNull final MutableTreeNode childNode)
 Inserts a new child node into a branch node. More...
 

Private Attributes

final JTextArea actionDescription = new JTextArea()
 The description of the selected action. More...
 
final JTextArea actionShortcut = new JTextArea()
 The shortcut of the selected action. More...
 
final JTree actionsTree
 The JTree showing all actions. More...
 
final Action aSetShortcut = ACTION_BUILDER.createAction(false, "shortcutsSetShortcut", this)
 The Action for the "set shortcut" button. More...
 
final Action aUnsetShortcut = ACTION_BUILDER.createAction(false, "shortcutsUnsetShortcut", this)
 The Action for the "unset shortcut" button. More...
 
final JDialog dialog
 The JDialog instance. More...
 
final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "shortcutsOkay", this))
 The JButton for ok. More...
 
Action selectedAction
 The selected Action or. More...
 
final ShortcutsManager shortcutsManager
 The ShortcutsManager to affect. More...
 

Static Private Attributes

static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
 The ActionBuilder. More...
 
static final String ACTION_PREFIX = "2"
 Prefix for internal action names. More...
 
static final String CATEGORY_PREFIX = "1"
 Prefix for internal category names. More...
 
static final Pattern PATTERN_CATEGORIES = StringUtils.PATTERN_COMMA
 The Pattern to split a list of action categories. More...
 
static final Pattern PATTERN_SUB_CATEGORIES = StringUtils.PATTERN_SLASH
 The Pattern to split a category into sub-categories. More...
 
static final long serialVersionUID = 1L
 The serial Version UID. More...
 

Detailed Description

Definition at line 65 of file ShortcutsDialog.java.

Constructor & Destructor Documentation

◆ ShortcutsDialog()

net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.ShortcutsDialog ( @NotNull final Component  parentComponent,
@NotNull final ShortcutsManager  shortcutsManager 
)

Member Function Documentation

◆ addNode()

static void net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.addNode ( @NotNull final DefaultMutableTreeNode  root,
@NotNull final CharSequence  category,
@NotNull final Action  action 
)
staticprivate

Adds an Action to a branch node.

Parameters
rootthe root node
categorythe category to add to
actionthe action to add

Definition at line 420 of file ShortcutsDialog.java.

References net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getOrCreateNodeForCategory(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.insertChildNode().

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

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

◆ createNodes()

void net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.createNodes ( @NotNull final DefaultMutableTreeNode  root)
private

◆ createPanel()

◆ getAction()

static Action net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getAction ( @Nullable final Object  node)
staticprivate

Returns the Action for a node in the action tree.

Parameters
nodethe node
Returns
the action or
null

Definition at line 503 of file ShortcutsDialog.java.

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

+ Here is the caller graph for this function:

◆ getInsertionIndex()

static int net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getInsertionIndex ( @NotNull final TreeNode  parentNode,
@NotNull final TreeNode  childNode 
)
staticprivate

Returns the index to insert a new child node into a parent node.

Parameters
parentNodethe parent node
childNodethe child node
Returns
the insertion index

Definition at line 479 of file ShortcutsDialog.java.

References net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getTitle().

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

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

◆ getOrCreateChildNode()

static DefaultMutableTreeNode net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getOrCreateChildNode ( @NotNull final MutableTreeNode  root,
@NotNull final String  subCategory 
)
staticprivate

Returns a child node by category name.

Parameters
rootthe root node
subCategorythe node name
Returns
the child node

Definition at line 448 of file ShortcutsDialog.java.

References net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.CATEGORY_PREFIX, net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getTitle(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.insertChildNode().

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

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

◆ getOrCreateNodeForCategory()

static DefaultMutableTreeNode net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getOrCreateNodeForCategory ( @NotNull final DefaultMutableTreeNode  root,
@NotNull final CharSequence  category 
)
staticprivate

Returns the branch DefaultMutableTreeNode for a given category.

Parameters
rootthe root node to start from
categorythe category
Returns
the branch node for the category

Definition at line 433 of file ShortcutsDialog.java.

References net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getOrCreateChildNode(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.PATTERN_SUB_CATEGORIES.

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

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

◆ getTitle()

static String net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getTitle ( @NotNull final TreeNode  node)
staticprivate

Returns the category for a node in the action tree.

Parameters
nodethe node
Returns
the category or
null

Definition at line 523 of file ShortcutsDialog.java.

References net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.ACTION_PREFIX, net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.CATEGORY_PREFIX, and net.sf.gridarta.utils.ActionUtils.getActionName().

Referenced by net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getInsertionIndex(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getOrCreateChildNode().

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

◆ getUnsetShortcutEnabled()

Action net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getUnsetShortcutEnabled ( )
private

Returns whether "unset shortcut" is enabled.

Returns
the action to affect if enabled or
null

Definition at line 573 of file ShortcutsDialog.java.

References net.sf.gridarta.utils.ActionUtils.getShortcut(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.selectedAction.

Referenced by net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.shortcutsUnsetShortcut(), 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:

◆ insertChildNode()

static void net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.insertChildNode ( @NotNull final MutableTreeNode  branchNode,
@NotNull final MutableTreeNode  childNode 
)
staticprivate

Inserts a new child node into a branch node.

Parameters
branchNodethe branch node
childNodethe child node

Definition at line 469 of file ShortcutsDialog.java.

References net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getInsertionIndex().

Referenced by net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.addNode(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getOrCreateChildNode().

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

◆ setSelectedAction()

void net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.setSelectedAction ( @Nullable final Action  selectedAction)
private

Updates the selected action.

Parameters
selectedActionthe new selected action

Definition at line 549 of file ShortcutsDialog.java.

References net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.selectedAction, and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.updateSelectedAction().

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

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

◆ setValue()

void net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.setValue ( @Nullable final Object  newValue)

Definition at line 394 of file ShortcutsDialog.java.

References net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.dialog.

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

+ Here is the caller graph for this function:

◆ shortcutsDefaults()

◆ shortcutsOkay()

void net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.shortcutsOkay ( )

Action method for okay.

Definition at line 377 of file ShortcutsDialog.java.

References net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.okButton, and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.setValue().

+ Here is the call graph for this function:

◆ shortcutsSetShortcut()

◆ shortcutsUnsetShortcut()

◆ showDialog()

void net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.showDialog ( @NotNull final Component  parentComponent)

Opens the dialog.

Returns when the dialog has been dismissed.

Parameters
parentComponentthe parent component for the dialog

Definition at line 208 of file ShortcutsDialog.java.

References net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.actionsTree, net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.dialog, and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.updateSelectedAction().

Referenced by net.sf.gridarta.gui.dialog.shortcuts.ShortcutsManager.showShortcutsDialog().

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

◆ updateSelectedAction()

Member Data Documentation

◆ ACTION_BUILDER

final ActionBuilder net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
staticprivate

◆ ACTION_PREFIX

final String net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.ACTION_PREFIX = "2"
staticprivate

Prefix for internal action names.

Used only for sorting tree nodes.

Definition at line 82 of file ShortcutsDialog.java.

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

◆ actionDescription

final JTextArea net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.actionDescription = new JTextArea()
private

◆ actionShortcut

final JTextArea net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.actionShortcut = new JTextArea()
private

◆ actionsTree

final JTree net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.actionsTree
private
Initial value:
= new JTree() {
private static final long serialVersionUID = 1L;
@Override
public String convertValueToText(final Object value, final boolean selected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
final Action action = getAction(value);
if (action != null) {
return ActionUtils.getActionName(action);
}
return super.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
}
}

The JTree showing all actions.

@serial

Definition at line 141 of file ShortcutsDialog.java.

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

◆ aSetShortcut

final Action net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.aSetShortcut = ACTION_BUILDER.createAction(false, "shortcutsSetShortcut", this)
private

◆ aUnsetShortcut

final Action net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.aUnsetShortcut = ACTION_BUILDER.createAction(false, "shortcutsUnsetShortcut", this)
private

◆ CATEGORY_PREFIX

final String net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.CATEGORY_PREFIX = "1"
staticprivate

Prefix for internal category names.

Used only for sorting tree nodes.

Definition at line 76 of file ShortcutsDialog.java.

Referenced by net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getOrCreateChildNode(), and net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getTitle().

◆ dialog

◆ okButton

final JButton net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.okButton = new JButton(ACTION_BUILDER.createAction(false, "shortcutsOkay", this))
private

◆ PATTERN_CATEGORIES

final Pattern net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.PATTERN_CATEGORIES = StringUtils.PATTERN_COMMA
staticprivate

The Pattern to split a list of action categories.

Definition at line 100 of file ShortcutsDialog.java.

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

◆ PATTERN_SUB_CATEGORIES

final Pattern net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.PATTERN_SUB_CATEGORIES = StringUtils.PATTERN_SLASH
staticprivate

The Pattern to split a category into sub-categories.

Definition at line 106 of file ShortcutsDialog.java.

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

◆ selectedAction

◆ serialVersionUID

final long net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.serialVersionUID = 1L
staticprivate

The serial Version UID.

Definition at line 70 of file ShortcutsDialog.java.

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

◆ shortcutsManager


The documentation for this class was generated from the following file:
net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.serialVersionUID
static final long serialVersionUID
The serial Version UID.
Definition: ShortcutsDialog.java:70
net.sf.gridarta.gui.dialog.shortcuts.ShortcutsDialog.getAction
static Action getAction(@Nullable final Object node)
Returns the Action for a node in the action tree.
Definition: ShortcutsDialog.java:503