Package sc.fiji.snt.gui
Enum Class NodeEditCommand
- All Implemented Interfaces:
Serializable,Comparable<NodeEditCommand>,java.lang.constant.Constable
Node-editing commands of 'Edit Mode': single source of truth for their labels, default shortcuts and
enabled-state logic, so that every front-end (classic canvas, Bdv, Bvv) exposes the same menu and key bindings.
The operations themselves live in
PathNodeEditor; hosts only map a command to a call and
supply the cursor position (see BigViewerEditor).- Author:
- Tiago Ferreira
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe editor state that determines which commands are enabledNested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionactionId()static ActionMapactionMap(Consumer<NodeEditCommand> handler) static voidaddMenuItems(JPopupMenu menu, NodeEditCommand.MenuState state, Consumer<NodeEditCommand> handler) Appends the node-editing commands to a menu, grouped by separators.createMenuItem(ActionListener listener) Creates a menu item for this command (label, shortcut and tooltip).static StringeditToggleLabel(String pathName) static NodeEditCommandfromActionId(String id) static InputMapinputMap()intkeyCode()label()label(boolean nodeLocked) static Stringtooltip()static NodeEditCommandReturns the enum constant of this class with the specified name.static NodeEditCommand[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DELETE
-
INSERT
-
MOVE
-
LOCK
-
RADIUS
-
TAG
-
SET_ROOT
-
SPLIT
-
UNDO
-
-
Field Details
-
UNDO_LABEL
Label ofUNDOas a compile-time constant (e.g., forswitchdispatch)- See Also:
-
MENU_INDENT
Prefix used to visually nest edit commands under the Edit Mode entry of a menu- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
label
- Parameters:
nodeLocked- whether the active node is locked- Returns:
- the menu label, which for
LOCKdepends on the state of the active node
-
tooltip
- Returns:
- the tooltip, or null
-
fromActionId
- Parameters:
id- an id as returned byactionId()- Returns:
- the matching command, or null
-
createMenuItem
Creates a menu item for this command (label, shortcut and tooltip). Its action command isactionId()- Parameters:
listener- the listener to be notified when the item is chosen- Returns:
- the menu item
-
label
- Returns:
- the menu label
-
keyCode
public int keyCode()- Returns:
- the default (unmodified) key code, or 0 if the command has no shortcut
-
actionId
-
editToggleLabel
- Parameters:
pathName- the (abbreviated) name of the path to be edited, or null- Returns:
- the label of the Edit Mode toggle in context menus
-
shortName
- Parameters:
p- the path- Returns:
- the (abbreviated) name of the path, for use in menu labels
-
addMenuItems
public static void addMenuItems(JPopupMenu menu, NodeEditCommand.MenuState state, Consumer<NodeEditCommand> handler) Appends the node-editing commands to a menu, grouped by separators. Commands that are not applicable in the given state are disabled, not omitted- Parameters:
menu- the menu to be populatedstate- the editor statehandler- the callback executed when an item is chosen
-
inputMap
- Returns:
- a new map with the default shortcut of every command that has one
-
actionMap
- Parameters:
handler- the callback executed when a command is triggered- Returns:
- a new map associating every command id of
inputMap()with an action callinghandler
-