CommandHandler$Typings extension
Properties
-
archetypeGroupData
↔ Object
-
Gets or sets a data object that is copied by #groupSelection
when creating a new Group.
getter/setter pair
-
copiesConnectedLinks
↔ bool
-
Gets or sets whether #copySelection should also copy Links that connect with selected Nodes.
The default value is true.
Setting this property does not raise any events.
getter/setter pair
-
copiesGroupKey
↔ bool
-
Gets or sets whether #copySelection and #copyToClipboard copy the node data property
whose value is the containing group data's key.
getter/setter pair
-
copiesParentKey
↔ bool
-
Gets or sets whether #copySelection and #copyToClipboard copy the node data property
whose value is the tree-parent node data's key.
getter/setter pair
-
copiesTree
↔ bool
-
Gets or sets whether #copySelection should also copy subtrees.
The default value is false.
Setting this property does not raise any events.
getter/setter pair
-
defaultScale
↔ num
-
(undocumented)
Deprecated in favor of Diagram#defaultScale.
getter/setter pair
-
deletesConnectedLinks
↔ bool
-
Gets or sets whether #deleteSelection should also delete links that are connected to nodes that are deleted.
The default value is true.
Setting this property does not raise any events.
getter/setter pair
-
deletesTree
↔ bool
-
Gets or sets whether #deleteSelection should also delete subtrees.
The default value is false.
Setting this property does not raise any events.
getter/setter pair
-
diagram
↔ Diagram
-
This read-only property returns the Diagram that is using this CommandHandler,
after Diagram#commandHandler has been set to this object.
getter/setter pair
-
isZoomToFitRestoreEnabled
↔ bool
-
Gets or sets whether the #zoomToFit command ever restores the previous
Diagram scale and position.
When this property is false, this command always calls Diagram#zoomToFit.
getter/setter pair
-
memberValidation
↔ bool Function(Group, Part)?
-
Gets or sets the predicate that determines whether or not a node may become a member of a group.
This predicate is called in addition to any existing group's Group#memberValidation predicate.
The default predicate is null, which is equivalent to simply returning true.
The predicate may be called passing null as the first argument (the Group) --
this asks whether it is OK to make the second argument (the Part, but not a Link) a top-level Part of the diagram.
getter/setter pair
-
zoomFactor
↔ num
-
Gets or sets the amount by which #decreaseZoom and #increaseZoom change
the Diagram#scale.
getter/setter pair
Methods
-
addTopLevelParts(Iterable<Part> coll, [bool? check])
→ bool
-
Make sure all of the unnested Parts in the given collection
are removed from any containing Groups.
-
canCollapseSubGraph([Group? group])
→ bool
-
This predicate controls whether the user can collapse expanded Groups.
-
canCollapseTree([Node? node])
→ bool
-
This predicate controls whether the user can collapse expanded subtrees of Nodes.
-
canCopySelection()
→ bool
-
This predicate controls whether or not the user can invoke the #copySelection command.
-
canCutSelection()
→ bool
-
This predicate controls whether or not the user can invoke the #cutSelection command.
-
canDecreaseZoom([num? factor])
→ bool
-
This predicate controls whether or not the user can invoke the #decreaseZoom command.
-
canDeleteSelection()
→ bool
-
This predicate controls whether or not the user can invoke the #deleteSelection command.
-
canEditTextBlock([TextBlock? textblock])
→ bool
-
This predicate controls whether or not the user can invoke the #editTextBlock command.
-
canExpandSubGraph([Group? group])
→ bool
-
This predicate controls whether the user can expand collapsed Groups.
-
canExpandTree([Node? node])
→ bool
-
This predicate controls whether the user can expand collapsed subtrees of Nodes.
-
canGroupSelection()
→ bool
-
This predicate controls whether or not the user can invoke the #groupSelection command.
-
canIncreaseZoom([num? factor])
→ bool
-
This predicate controls whether or not the user can invoke the #increaseZoom command.
-
canPasteSelection([Point? pos])
→ bool
-
This predicate controls whether or not the user can invoke the #pasteSelection command.
-
canRedo()
→ bool
-
This predicate controls whether or not the user can invoke the #redo command.
-
canResetZoom([num? newscale])
→ bool
-
This predicate controls whether or not the user can invoke the #resetZoom command.
-
canScrollToPart([Part? part])
→ bool
-
This predicate controls whether or not the user can invoke the #scrollToPart command.
This returns false if there is no argument Part and there are no selected Parts.
-
canSelectAll()
→ bool
-
This predicate controls whether or not the user can invoke the #selectAll command.
-
This predicate controls whether or not the user can invoke the #showContextMenu command.
-
canStopCommand()
→ bool
-
This predicate controls whether the user may stop the current tool.
This just returns true.
-
canUndo()
→ bool
-
This predicate controls whether or not the user can invoke the #undo command.
-
canUngroupSelection([Group? group])
→ bool
-
This predicate controls whether or not the user can invoke the #ungroupSelection command.
-
canZoomToFit()
→ bool
-
This predicate controls whether or not the user can invoke the #zoomToFit command.
-
collapseSubGraph([Group? group])
→ void
-
This command collapses all expanded selected Groups.
This operation is performed within a "Collapse SubGraph" transaction.
Just before the end of the transaction this raises the "SubGraphCollapsed" DiagramEvent,
with a collection of collapsed Groups as the subject.
This currently has no default keyboard shortcut.
-
collapseTree([Node? node])
→ void
-
This command collapses all expanded selected Nodes.
This operation is performed within a "Collapse Tree" transaction.
Just before the end of the transaction this raises the "TreeCollapsed" DiagramEvent,
with a collection of collapsed Nodes as the subject.
This currently has no default keyboard shortcut.
-
computeEffectiveCollection(Iterable<Part> parts, [DraggingOptions? options])
→ Map<Part, DraggingInfo>
-
Find the actual collection of nodes and links to be moved or copied,
given an initial collection.
This includes links that connected at both ends to nodes being moved or copied,
members of Groups, and if DraggingTool#dragsTree is true,
this includes nodes and links that are "tree" descendants from selected nodes.
-
copySelection()
→ void
-
This command copies the currently selected parts, Diagram#selection, from the Diagram into the clipboard.
This is normally invoked by the
Ctrl-C
keyboard shortcut.
-
copyToClipboard([Iterable<Part>? coll])
→ void
-
Make a copy of the given collection of Parts
and stores it in a static variable acting as the clipboard.
-
cutSelection()
→ void
-
This command executes a #copySelection followed by a #deleteSelection.
This is normally invoked by the
Ctrl-X
keyboard shortcut.
-
decreaseZoom([num? factor])
→ void
-
This command decreases the Diagram#scale by a given factor.
This is normally invoked by the
Ctrl--
and Keypad--
keyboard shortcuts.
-
deleteSelection()
→ void
-
This command deletes the currently selected parts from the diagram.
This is normally invoked by the
Del
keyboard shortcut.
-
doKeyDown()
→ void
-
This is called by tools to handle keyboard commands.
For most commands, this calls the "can..." predicate; if that returns true it calls the command method.
If GoJS handles a key-down event as a keyboard command, the underlying event will not bubble.
-
doKeyUp()
→ void
-
This is called by tools to handle keyboard commands.
-
editTextBlock([TextBlock? textblock])
→ void
-
This command starts in-place editing of a TextBlock in the selected Part.
This is normally invoked by the
F2
keyboard shortcut.
-
expandSubGraph([Group? group])
→ void
-
This command expands all collapsed selected Groups.
This operation is performed within an "Expand SubGraph" transaction.
Just before the end of the transaction this raises the "SubGraphExpanded" DiagramEvent,
with a collection of expanded Groups as the subject.
This currently has no default keyboard shortcut.
-
expandTree([Node? node])
→ void
-
This command expands all collapsed selected Nodes.
This operation is performed within an "Expand Tree" transaction.
Just before the end of the transaction this raises the "TreeExpanded" DiagramEvent,
with a collection of expanded Nodes as the subject.
This currently has no default keyboard shortcut.
-
groupSelection()
→ void
-
This command adds a copy of #archetypeGroupData to the diagram's model
to create a new Group and then adds the selected Parts to that new group.
This is normally invoked by the
Ctrl-G
keyboard shortcut.
-
increaseZoom([num? factor])
→ void
-
This command increases the Diagram#scale by a given factor.
This is normally invoked by the
Ctrl-+
and Keypad-+
keyboard shortcuts.
-
isValidMember(Group group, Part part)
→ bool
-
This predicate is called to determine whether a Node may be added as a member of a Group.
This always checks to make sure no group might become a member of itself, either directly or indirectly.
If the Group has a Group#memberValidation predicate and if it returns false, this method returns false.
If this CommandHandler has a #memberValidation predicate and if it returns false, this method returns false.
Otherwise this will return true.
-
pasteFromClipboard()
→ Set<Part>
-
If the clipboard holds a collection of Parts,
and if the Model#dataFormat matches that stored in the clipboard,
this makes a copy of the clipboard's parts and adds the copies to this Diagram.
-
pasteSelection([Point? pos])
→ void
-
This command copies the contents of the clipboard into this diagram and makes those new parts the new selection.
This is normally invoked by the
Ctrl-V
keyboard shortcut.
-
redo()
→ void
-
This command calls UndoManager#redo.
This is normally invoked by the
Ctrl-Y
keyboard shortcut.
-
resetZoom([num? newscale])
→ void
-
This command sets the Diagram#scale to a new scale value, by default 1.
This is normally invoked by the
Ctrl-0
keyboard shortcut.
-
scrollToPart([Part? part])
→ void
-
This command scrolls the diagram to make a highlighted or selected Part visible in the viewport.
Call this command repeatedly to cycle through the Diagram#highlighteds collection,
if there are any Parts in that collection, or else in the Diagram#selection collection,
scrolling to each one in turn by calling Diagram#centerRect.
-
selectAll()
→ void
-
This command selects all of the selectable Parts in the diagram by setting Part#isSelected to true on each one.
This is normally invoked by the
Ctrl-A
keyboard shortcut.
-
This command opens the context menu for a selected Part or given GraphObject, or else for the whole Diagram.
This is normally invoked by the
Menu
keyboard shortcut.
-
stopCommand()
→ void
-
This command cancels the operation of the current tool.
This is typically called when the user presses ESCAPE.
-
undo()
→ void
-
This command calls UndoManager#undo.
This is normally invoked by the
Ctrl-Z
keyboard shortcut.
-
ungroupSelection([Group? group])
→ void
-
This command removes selected groups from the diagram without removing their members from the diagram.
This is normally invoked by the
Ctrl-Shift-G
keyboard shortcut.
-
zoomToFit()
→ void
-
This command changes the Diagram#scale so that the Diagram#documentBounds fits within the viewport.
If this command had been called before without any other zooming since then,
the original Diagram scale and position are restored.
This is normally invoked by the
Shift-Z
keyboard shortcut.
If you do not want the behavior where this command might restore the original diagram scale and position on a subsequent call,
set #isZoomToFitRestoreEnabled to false.