public class GraphEditorInputMode extends MultiplexingInputMode
IInputMode
that can be used in a GraphControl
to edit an IGraph
instance.
This class delegates most of the work to minor IInputMode
implementations. However it contains a number of
properties that influence the general behavior:
SelectableItems
– Determines the types of items that can be selected at all.SelectablePredicate
– Allows to further constrain SelectableItems
with a predicate.MarqueeSelectableItems
– Determines the types of items that can be selected with marquee selection
.ClickSelectableItems
– Determines the types of items that can be selected by clicking them
.DetailSelectionRecognizer
– Determines when to use a detail click selection mode, which allows for selecting the item that is directly under the
mouse without taking into account the ClickHitTestOrder
.
ClickHitTestOrder
– Determines the priorities for hit tests during mouse clicks to determine which items should get
click events
.
DoubleClickHitTestOrder
– Determines the priorities for hit tests when
double-clicking items
.
MovableItems
– Determines the type of the items that can be moved
with the mouse.ShowHandleItems
– Determines the type of the items whose IHandle
s should be shown and movable by the
HandleInputMode
.
DeletableItems
– Determines the type of the items that can be deleted by deleteSelection()
.DeletablePredicate
– Allows to further constrain DeletableItems
with a predicate.LabelEditableItems
– Determines the type of the items that can have their labels edited.GroupingOperationsAllowed
– Determines whether this input mode should allow grouping operations at all.GroupSelectionAllowed
– Determines whether this input mode should allow grouping the current selection
.UngroupSelectionAllowed
– Determines whether this input mode should allow ungrouping the current selection
.ClearSelectionAllowed
– Determines whether this input mode should allow clearing the selection
. This has
implications both for the ICommand.DESELECT_ALL
and for click/marquee selection which usually clear the
selection unless the MultiSelectionRecognizer
is pressed.
ClipboardOperationsAllowed
– Determines whether this input mode should enable graph clipboard operations.
DuplicateAllowed
– Determines whether this input mode should enable graph clipboard's
GraphClipboard.duplicate(IInputModeContext, IGraph, Predicate, com.yworks.yfiles.graph.IElementCopiedCallback)
operation.
EditLabelAllowed
– Determines whether this input mode should allow editing labels.ReparentNodesAllowed
– Determines whether this input mode should allow reparenting nodes to other groups.
CreateNodeAllowed
– Determines whether this input mode should allow creating new nodes
via simple mouse clicks.CreateEdgeAllowed
– Determines whether CreateEdgeInputMode
should be Enabled
to allow for creating new edges.
EditLabelOnDoubleClickAllowed
– Determines whether labels should be editable on otherwise unhandled double clicks.ReverseEdgeAllowed
– Determines whether edges can be reversed.CreateBendAllowed
– Determines whether the CreateBendInputMode
should be Enabled
to allow for creating new bends.
EnterGroupAllowed
– Determines whether the mode allows for entering
group nodes in
IFoldingView
s.
ExitGroupAllowed
– Determines whether the mode allows for exiting
the current group node in
IFoldingView
s.
CollapseGroupAllowed
– Determines whether the mode allows for collapsing
group nodes in
IFoldingView
s.
ExpandGroupAllowed
– Determines whether the mode allows for expanding
group nodes in
IFoldingView
s.
HoverItems
– Determines which items should be reported as being hovered through the corresponding event
in this instance's ItemHoverInputMode
.
GraphInputMode.shouldInstallCommand(ICommand)
– Determines which of the built-in ICommand
s this input mode should provide and install.
By default, GraphEditorInputMode
supports the following commands. Most of them have default keybindings:
ICommand.UNDO
(Ctrl+Z on Windows and Linux and Command+Z on Mac OS) – Undoes the last operation. Can be disabled with UndoOperationsAllowed
.ICommand.REDO
(Ctrl+Y on Windows and Linux and Command+Y on Mac OS)) – Redoes the last operation that was undone. Can be disabled with
UndoOperationsAllowed
.
ICommand.SELECT_ALL
(Ctrl+A on Windows and Linux and Command+A on Mac OS)) – Selects all items. Can be configured with SelectableItems
and
SelectablePredicate
.
ICommand.DESELECT_ALL
(Ctrl+Shift+A on Windows and Linux and Command+Shift+A on Mac OS)) – Clears the current selection. Can be disabled with ClearSelectionAllowed
.ICommand.CUT
(Ctrl+X, Shift+Del on Windows and Linux and Command+Del on Mac OS)) – Cuts the current selection and places it in the clipboard. Can be disabled with
ClipboardOperationsAllowed
.
ICommand.COPY
(Ctrl+C, Ctrl+Ins on Windows and Linux and Command+C, Command+Ins on Mac OS)) – Copies the current selection to the clipboard. Can be disabled with
ClipboardOperationsAllowed
.
ICommand.PASTE
(Ctrl+V, Shift+Ins on Windows and Linux and Command+V, Shift+Ins on Mac OS)) – Pastes the current clipboard contents into the graph. Can be disabled with
ClipboardOperationsAllowed
.
ICommand.DUPLICATE
(Ctrl+D on Windows and Linux and Command+D on Mac OS)) – Duplicates the current selection. Can be disabled with DuplicateAllowed
.ICommand.DELETE
(Del) – Deletes the current selection. Can be configured with DeletablePredicate
and
DeletableItems
.
ICommand.ADD_LABEL
(Shift+F2) – Adds a new label to the selected item. Can be configured with LabelEditableItems
and
disabled with AddLabelAllowed
.
ICommand.EDIT_LABEL
(F2) – Edits an existing label or adds a new one to the selected item. Can be configured with LabelEditableItems
and disabled with EditLabelAllowed
.
ICommand.REVERSE_EDGE
(Ctrl+R on Windows and Linux and Command+R on Mac OS)) – Reverses the direction of the selected edges. Can be disabled with ReverseEdgeAllowed
.ICommand.GROUP_SELECTION
(Ctrl+G on Windows and Linux and Command+G on Mac OS)) – Creates a new group node and places the currently selected nodes into it. Can be disabled with GroupingOperationsAllowed
and GroupSelectionAllowed
.
ICommand.UNGROUP_SELECTION
(Ctrl+U on Windows and Linux and Command+U on Mac OS)) – Creates a new group node and places the currently selected nodes into it. Can be disabled with GroupingOperationsAllowed
and UngroupSelectionAllowed
.
ICommand.ADJUST_GROUP_NODE_SIZE
(Ctrl+Shift+G on Windows and Linux and Command+Shift+G on Mac OS)) – Adjusts the sizes of the selected group nodes to fit exactly around their contents. Can be disabled with GroupingOperationsAllowed
and AdjustGroupNodeSizeAllowed
.
All commands can also be selectively disabled by using the AvailableCommands
collection. Furthermore, there are a few commands provided by
NavigationInputMode
:
ICommand.COLLAPSE_GROUP
(Ctrl+Minus on Windows and Linux and Command+Minus on Mac OS)) – Collapses the currently selected group nodes. Can be disabled with CollapseGroupAllowed
of NavigationInputMode
.
ICommand.EXPAND_GROUP
(Ctrl+Plus on Windows and Linux and Command+Plus on Mac OS)) – Expands the currently selected group nodes. Can be disabled with ExpandGroupAllowed
of NavigationInputMode
.
ICommand.TOGGLE_EXPANSION_STATE
(Ctrl+Multiply on Windows and Linux and Command+Multiply on Mac OS)) – Collapses expanded group nodes and expands collapsed group nodes in the current selection. Can be disabled with CollapseGroupAllowed
and ExpandGroupAllowed
of
NavigationInputMode
.
ICommand.ENTER_GROUP
(Ctrl+Enter on Windows and Linux and Command+Enter on Mac OS)) – Replaces the currently displayed graph with the contents of the selected group node. Can be disabled with EnterGroupAllowed
of NavigationInputMode
.
ICommand.EXIT_GROUP
(Ctrl+Backspace on Windows and Linux and Command+Backspace on Mac OS)) – Replaces the currently displayed graph with the contents of the parent of the group node whose contents are currently
displayed. Can be disabled with ExitGroupAllowed
of
NavigationInputMode
.
GraphEditorInputMode
can be configured to automatically adjust the content rectangle
of the GraphControl
whenever the graph is changed using gestures.
This class contains a number of public methods that can be used to programmatically perform the corresponding actions,
too.
Setting the NodeCreator
to another instance or null
changes the way nodes are
created. Also the various minor IInputMode
instances can be disabled, to change the behavior, too.
This input mode manages a set of specialized input modes, each handling a specific part of the interaction with the
graph. The following list details those along with their default
priorities
. Lower priorities come earlier when handling events.
WaitInputMode
(−1) – Disables this input mode when layouts or animations run.HandleInputMode
(0) – Deals with displaying handles on or around items and interacting with them.KeyboardInputMode
(0) – Handles commands and arbitrary keyboard shortcuts.ClickInputMode
(10) – Handles mouse clicks and double-clicks.TapInputMode
(20) – Handles taps and double-tap.MoveViewportInputMode
(39) – Allows panning the viewport.MoveLabelInputMode
(39) – Allows moving labels to new positions.MoveInputMode
(40) – Allows moving items that are not labels.CreateBendInputMode
(42) – Allows creating bends on edges.CreateEdgeInputMode
(45) – Allows creating edgesMarqueeSelectionInputMode
(50) – Allows dragging a rectangle to select items within it.ItemHoverInputMode
(55) – Provides events to indicate that the mouse pointer hovers over an item.NavigationInputMode
(55) – Provides general navigation facilities, such as navigating from one item to another with the arrow keys, collapsing,
expanding, entering or exiting groups, as well as providing commands for those tasks.
AbstractContextMenuInputMode
(60) – Handles querying the context menu contents based on a location as well as preparing the menu for display.NodeDropInputMode
(70) – Allows dropping nodes on the GraphControl
, e.g. for dragging items from a palette.MouseHoverInputMode
(100) – Handles tool tips.TextEditorInputMode
(100) – Handles editing labels.
To enable single selection mode, disable MarqueeSelectionInputMode
and set MultiSelectionRecognizer
to IEventRecognizer.NEVER
. Remove ICommand.SELECT_ALL
and ICommand.TOGGLE_ITEM_SELECTION
from AvailableCommands
and from
NavigationInputMode
.AvailableCommands
.
An example can be found in Demo.yFiles.Graph.Input.SingleSelection
.
An overview of this input mode is given in the section Editing Graphs. Additionally, specific support for graph hierarchies is discussed in Supported User Interactions: Grouping.
Constructor and Description |
---|
GraphEditorInputMode()
Creates a new instance that is not bound to an existing graph or selection, initially.
|
Modifier and Type | Method and Description |
---|---|
void |
addCanvasClickedListener(IEventHandler<ClickEventArgs> canvasClickedEvent)
Adds the given listener for the
CanvasClicked event that occurs when the empty canvas area has been clicked. |
void |
addDeletedItemListener(IEventHandler<ItemEventArgs<IModelItem>> deletedItemEvent)
Adds the given listener for the
DeletedItem event that occurs when an item has been deleted interactively by
this mode. |
void |
addDeletedSelectionListener(IEventHandler<SelectionEventArgs<IModelItem>> deletedSelectionEvent)
Adds the given listener for the
DeletedSelection event that occurs just before the deleteSelection()
method has deleted the selection after all selected items have been removed. |
void |
addDeletingSelectionListener(IEventHandler<SelectionEventArgs<IModelItem>> deletingSelectionEvent)
Adds the given listener for the
DeletingSelection event that occurs just before the deleteSelection()
method starts its work and will be followed by any number of DeletedItem
events and finalized by a DeletedSelection event. |
void |
addEdgePortsChangedListener(IEventHandler<EdgeEventArgs> edgePortsChangedEvent)
Adds the given listener for the
EdgePortsChanged event that occurs after an edge's source and/or target ports
have been changed as the result of an input gesture. |
void |
addItemClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemClickedEvent)
Adds the given listener for the
ItemClicked event that occurs when an item has been clicked. |
void |
addItemDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemDoubleClickedEvent)
Adds the given listener for the
ItemDoubleClicked event that occurs when an item has been double clicked. |
void |
addItemLeftClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftClickedEvent)
Adds the given listener for the
ItemLeftClicked event that occurs when an item has been left clicked. |
void |
addItemLeftDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftDoubleClickedEvent)
Adds the given listener for the
ItemLeftDoubleClicked event that occurs when an item has been left double
clicked. |
void |
addItemRightClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightClickedEvent)
Adds the given listener for the
ItemRightClicked event that occurs when an item has been right clicked. |
void |
addItemRightDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightDoubleClickedEvent)
Adds the given listener for the
ItemRightDoubleClicked event that occurs when an item has been right double
clicked. |
Future<ILabel> |
addLabel(ILabelOwner owner)
Adds a new label to the given item interactively.
|
void |
addLabelAddedListener(IEventHandler<LabelEventArgs> labelAddedEvent)
Adds the given listener for the
LabelAdded event that occurs when this mode has triggered the addition of an
ILabel , for instance, in response to createLabel(ILabelOwner) . |
void |
addLabelAddingListener(IEventHandler<LabelEditingEventArgs> labelAddingEvent)
Adds the given listener for the
LabelAdding event that occurs when a label is about to be added. |
void |
addLabelEditingListener(IEventHandler<LabelEditingEventArgs> labelEditingEvent)
Adds the given listener for the
LabelEditing event that occurs when a label is about to be edited. |
void |
addLabelTextChangedListener(IEventHandler<LabelEventArgs> labelTextChangedEvent)
Adds the given listener for the
LabelTextChanged event that occurs when this mode has triggered the edit of an
ILabel , for instance, in response to editLabel(ILabel) . |
void |
addLabelTextEditingCanceledListener(IEventHandler<LabelEventArgs> labelTextEditingCanceledEvent)
Adds the given listener for the
LabelTextEditingCanceled event that occurs when the actual label editing process
is canceled. |
void |
addLabelTextEditingStartedListener(IEventHandler<LabelEventArgs> labelTextEditingStartedEvent)
Adds the given listener for the
LabelTextEditingStarted event that occurs when the actual label editing process
is about to start. |
void |
addMultiSelectionFinishedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionFinishedEvent)
Adds the given listener for the
MultiSelectionFinished event that occurs when a single or multi select operation
has been finished. |
void |
addMultiSelectionStartedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionStartedEvent)
Adds the given listener for the
MultiSelectionStarted event that occurs when a single or multi select operation
has been started. |
void |
addNodeCreatedListener(IEventHandler<ItemEventArgs<INode>> nodeCreatedEvent)
Adds the given listener for the
NodeCreated event that occurs when this mode has created a node in response to
user interaction. |
void |
addNodeReparentedListener(IEventHandler<NodeEventArgs> nodeReparentedEvent)
Adds the given listener for the
NodeReparented event that occurs when a node has been reparented interactively. |
void |
addPopulateItemContextMenuListener(IEventHandler<PopulateItemContextMenuEventArgs<IModelItem>> populateItemContextMenuEvent)
Adds the given listener for the
PopulateItemContextMenu event that occurs when the context menu
over an item is about to be opened to determine the contents of the
Menu . |
void |
addQueryItemToolTipListener(IEventHandler<QueryItemToolTipEventArgs<IModelItem>> queryItemToolTipEvent)
Adds the given listener for the
QueryItemToolTip event that occurs when the mouse is hovering
over an item to determine the tool tip to display. |
void |
addValidateLabelTextListener(IEventHandler<LabelTextValidatingEventArgs> validateLabelTextEvent)
|
void |
adjustContentRect()
Updates the
ContentRect using CanvasControl.updateContentRect(InsetsD, ICanvasObjectGroup)
and ContentRectMargins . |
protected void |
adjustGroupNodeSize(Iterable<INode> nodes)
Adjusts the size of the group nodes in the enumerable. |
void |
adjustGroupNodeSizes()
Adjusts the size of the selected group nodes. |
void |
adjustToSizeConstraints(INode node)
Adjusts the node's
Layout to adhere to possible
size constraints . |
protected Object |
childInputModeContextLookup(Class type)
Callback method that will be used by the
child context's ILookup.lookup(Class)
method. |
void |
clearSelection()
Clears the selection on the current
GraphSelection . |
protected void |
click(IModelItem item,
ClickEventArgs args)
Actually performs the click on the given item.
|
protected boolean |
clickClearSelection(IInputModeContext context)
Clears the selection on click if
the click is not
recognized by MultiSelectionRecognizer . |
protected boolean |
clickCreateNode(IInputModeContext context,
PointD location)
Creates a node on click.
|
void |
closeLabelEditor(boolean cancel)
Closes the label editor if it is currently open.
|
void |
copy()
Copies the currently selected elements to the clipboard.
|
protected ClickInputMode |
createClickInputMode()
Factory method for the ClickInputMode property.
|
protected AbstractContextMenuInputMode |
createContextMenuInputMode()
Factory method for the
ContextMenuInputMode property. |
protected CreateBendInputMode |
createCreateBendInputMode()
Factory method for the
CreateBendInputMode property. |
protected CreateEdgeInputMode |
createCreateEdgeInputMode()
Factory method for the
CreateEdgeInputMode property. |
protected HandleInputMode |
createHandleInputMode()
Factory method for the
HandleInputMode property. |
protected ItemHoverInputMode |
createItemHoverInputMode()
Factory method for the
ItemHoverInputMode property. |
protected KeyboardInputMode |
createKeyboardInputMode()
Factory method that creates the
KeyboardInputMode instance. |
Future<ILabel> |
createLabel(ILabelOwner owner)
Interactively creates a new label for the provided label owner.
|
protected MarqueeSelectionInputMode |
createMarqueeSelectionInputMode()
Factory method for the
MarqueeSelectionInputMode property. |
protected MouseHoverInputMode |
createMouseHoverInputMode()
Factory method for the
MouseHoverInputMode property. |
protected MoveInputMode |
createMoveInputMode()
Factory method for the
MoveInputMode property. |
protected MoveLabelInputMode |
createMoveLabelInputMode()
Factory method for the
MoveLabelInputMode property. |
MoveInputMode |
createMoveUnselectedInputMode(IEventRecognizer recognizer)
Helper method that can be used to create a
MoveInputMode instance that can be used to move unselected model
items. |
protected MoveViewportInputMode |
createMoveViewportInputMode()
Factory method for the
MoveViewportInputMode property. |
protected NavigationInputMode |
createNavigationInputMode()
Factory method for the
NavigationInputMode property. |
INode |
createNode(PointD location)
Creates a node given a certain click point.
|
protected NodeDropInputMode |
createNodeDropInputMode()
Factory method that creates the
NodeDropInputMode lazily the first time the property is
accessed. |
protected IReparentNodeHandler |
createReparentNodeHandler()
Factory method for the ReparentNodeHandler property.
|
protected SelectionEventArgs<IModelItem> |
createSelectionEventArgs(IInputModeContext context)
Helper method that yields a suitably configured
SelectionEventArgs using the GraphSelection
for this input mode. |
protected TapInputMode |
createTapInputMode()
Factory method for the
TapInputMode property. |
protected TextEditorInputMode |
createTextEditorInputMode()
Factory method for the
TextEditorInputMode property. |
protected WaitInputMode |
createWaitInputMode()
Factory method for the WaitInputMode property.
|
void |
cut()
Cuts and inserts the currently selected elements to the clipboard.
|
void |
deleteSelection()
This method deletes the currently selected elements.
|
protected void |
doubleClick(IModelItem item,
ClickEventArgs args)
Actually performs a double-click on the given item.
|
protected void |
doubleTap(IModelItem item,
TapEventArgs args)
Actually performs a double-tap on the given item.
|
void |
dragBend(IBend bend)
Initiates the
HandleInputMode to drag the given bend. |
void |
duplicateSelection()
Duplicates the selected elements.
|
void |
editLabel(ILabel label)
Starts editing the given label.
|
protected boolean |
editLabelOnDoubleClick(IModelItem item)
Starts label editing by executing
ICommand.EDIT_LABEL . |
IEnumerable<IModelItem> |
findItems(IInputModeContext context,
PointD location,
GraphItemTypes[] tests)
Used as a callback to find the items hit underneath a certain point.
|
IEnumerable<IModelItem> |
findItems(IInputModeContext context,
PointD location,
GraphItemTypes[] tests,
Predicate<IModelItem> filter)
Used as a callback to find the items hit underneath a certain point.
|
IEnumerable<IModelItem> |
findItems(PointD location,
GraphItemTypes[] tests)
Used as a callback to find the items hit underneath a certain point.
|
IEnumerable<IModelItem> |
findItems(PointD location,
GraphItemTypes[] tests,
Predicate<IModelItem> filter)
Used as a callback to find the items hit underneath a certain point.
|
AdjustContentRectPolicy |
getAdjustContentRectPolicy()
Gets a property that determines whether this instance should automatically adjust the
ContentRect
if the graph changes. |
Collection<ICommand> |
getAvailableCommands()
Gets a collection of commands that this input mode will handle.
|
GraphItemTypes |
getClickableItems()
Determines which types of items should be reported through the
item click events . |
GraphItemTypes[] |
getClickHitTestOrder()
Gets the order of the types of items that should be used to determine what item has been clicked or tapped.
|
ClickInputMode |
getClickInputMode()
Gets the
ClickInputMode that is used by this instance to determine clicks. |
GraphItemTypes |
getClickSelectableItems()
Determines which types of items should be selectable by mouse clicks.
|
InsetsD |
getContentRectMargins()
Gets the margins to use for
CanvasControl.updateContentRect(InsetsD, ICanvasObjectGroup) in adjustContentRect()
calls. |
AbstractContextMenuInputMode |
getContextMenuInputMode()
Gets the
ContextMenuInputMode property. |
GraphItemTypes |
getContextMenuItems()
Gets the types of items a context menu should be queried for.
|
CreateBendInputMode |
getCreateBendInputMode()
Gets the
CreateBendInputMode property. |
CreateEdgeInputMode |
getCreateEdgeInputMode()
Gets the
CreateEdgeInputMode property. |
IEventRecognizer |
getCyclicSelectionRecognizer()
Gets the
IEventRecognizer that will be queried to decide if a click should cycle through all the items that are
currently under the mouse cursor. |
GraphItemTypes |
getDeletableItems()
Determines which types of items may be deleted using the
deleteSelection() action. |
Predicate<IModelItem> |
getDeletablePredicate()
Gets a predicate that is queried to determine whether an
IModelItem can be deleted or not. |
IEventRecognizer |
getDetailSelectionRecognizer()
Gets the
IEventRecognizer that will be queried to decide if a click should select the item that is currently
visible under the mouse cursor, without giving more important items higher priority. |
GraphItemTypes[] |
getDoubleClickHitTestOrder()
Gets the order of the types of items that should be used to determine what item has been double-clicked or
double-tapped.
|
GraphItemTypes |
getFocusableItems()
Gets the items that can be given focus via the
setCurrentItem(IModelItem) method. |
IGraph |
getGraph()
Gets the graph instance from the
InputModeContext . |
GraphControl |
getGraphControl()
Gets the
GraphControl instance this mode is working on or null . |
IGraphSelection |
getGraphSelection()
Gets the graph selection from the
InputModeContext . |
HandleInputMode |
getHandleInputMode()
Gets the
HandleInputMode property. |
IHitTester<IModelItem> |
getHitTester()
Gets the hitTester property.
|
ItemHoverInputMode |
getItemHoverInputMode()
Gets the
ItemHoverInputMode that is provided by this instance for those who need to
make use of it. |
KeyboardInputMode |
getKeyboardInputMode()
Gets the
KeyboardInputMode . |
GraphItemTypes |
getLabelEditableItems()
Determines which types of items may have their
labels edited . |
SnapContext |
getLabelSnapContext()
The
LabelSnapContext instance that handles interactive snapping of
ILabel s to their owner during drag operations like movements. |
GraphItemTypes |
getMarqueeSelectableItems()
Determines which types of items should be selected during
marquee selections . |
MarqueeSelectionInputMode |
getMarqueeSelectionInputMode()
Gets the
MarqueeSelectionInputMode property. |
MouseHoverInputMode |
getMouseHoverInputMode()
Gets the
MouseHoverInputMode property. |
GraphItemTypes |
getMovableItems()
Determines which types of items should be movable using the
MoveInputMode or MoveLabelInputMode
respectively in case of labels. |
MoveInputMode |
getMoveInputMode()
Gets the
MoveInputMode property. |
MoveLabelInputMode |
getMoveLabelInputMode()
Gets the
MoveLabelInputMode property. |
MoveViewportInputMode |
getMoveViewportInputMode()
Gets the
MoveViewportInputMode associated with this instance. |
IEventRecognizer |
getMultiSelectionRecognizer()
Gets the
IEventRecognizer that will be queried to decide if a click is deemed a multi selection gesture. |
NavigationInputMode |
getNavigationInputMode()
Gets the
NavigationInputMode property. |
INodeCreationCallback |
getNodeCreator()
Gets the callback that is responsible for creating a new node, for instance, in response to a mouse click.
|
NodeDropInputMode |
getNodeDropInputMode()
Gets the
NodeDropInputMode property that is responsible for handling drag and drop
operations of nodes onto the Canvas. |
OrthogonalEdgeEditingPolicy |
getOrthogonalBendRemovalEnabled()
Gets the policy that controls whether removing bends from an orthogonal edge will keep the edge orthogonal.
|
OrthogonalEdgeEditingContext |
getOrthogonalEdgeEditingContext()
Gets the orthogonal edge editing context.
|
PointD |
getPasteDelta()
The offset for paste operation if clipboard operations are enabled.
|
GraphItemTypes |
getPasteSelectableItems()
Determines which types of items should be selected after
paste() or duplicateSelection() . |
IReparentNodeHandler |
getReparentNodeHandler()
Gets the
IReparentNodeHandler that is used for moving nodes out of group nodes or into other group nodes. |
GraphItemTypes |
getSelectableItems()
Determines which types of items should be selectable at all.
|
Predicate<IModelItem> |
getSelectablePredicate()
Gets a predicate that is queried to determine whether a given
IModelItem is selectable. |
GraphItemTypes |
getShowHandleItems()
Determines which types of items should have their
IHandle s shown. |
SnapContext |
getSnapContext()
The
SnapContext instance that handles interactive snapping of elements during drag operations like movements. |
TapInputMode |
getTapInputMode()
Gets the
TapInputMode property. |
TextEditorInputMode |
getTextEditorInputMode()
Gets the
TextEditorInputMode property. |
GraphItemTypes |
getToolTipItems()
Gets the types of the items that should be queried a tool tip for.
|
WaitInputMode |
getWaitInputMode()
Gets the
WaitInputMode that is provided by this instance for those who need to make use of it. |
INode |
groupSelection()
Creates a new group for all of the currently selected elements.
|
protected void |
initialize()
Initializes this mode by
adding
all of the minor modes that are used by this mode to this instance. |
void |
install(IInputModeContext context,
ConcurrencyController controller)
Installs this mode into the provided context.
|
boolean |
isAddLabelAllowed()
Gets a value determining whether the
ICommand.ADD_LABEL command should be handled. |
boolean |
isAdjustGroupNodeSizeAllowed()
Gets a value determining whether the
ICommand.ADJUST_GROUP_NODE_SIZE command should be handled. |
boolean |
isAutoRemovingEmptyLabelsEnabled()
Gets a value indicating whether this mode should automatically
remove labels from the
graph when a label text has been edited and the label text is empty. |
boolean |
isAutoSelectingSelfloopBendsEnabled()
Gets a property that determines whether clicking on a node should automatically select all bends of self loops adjacent
to that node.
|
boolean |
isClearSelectionAllowed()
Gets a value determining whether the
ICommand.DESELECT_ALL command should be handled. |
boolean |
isClipboardOperationsAllowed()
Gets a property that determines whether clipboard operations with the usual shortcuts are enabled on the canvas.
|
boolean |
isCreateBendAllowed()
Gets a value determining whether
bend creation should be
enabled . |
boolean |
isCreateEdgeAllowed()
Gets a value determining whether
edge creation should be
enabled . |
boolean |
isCreateNodeAllowed()
Gets a value determining whether
node creation by clicking on an empty canvas location is
enabled. |
boolean |
isDuplicateAllowed()
Gets a value determining whether the
ICommand.DUPLICATE command should be handled. |
boolean |
isEditLabelAllowed()
Gets a value determining whether the
ICommand.EDIT_LABEL command should be handled. |
boolean |
isEditLabelOnDoubleClickAllowed()
Gets a value determining whether double-clicking should start label editing.
|
boolean |
isGroupingOperationsAllowed()
Gets a value indicating whether grouping operations like
grouping selected nodes or moving nodes into group nodes
should be enabled. |
boolean |
isGroupSelectionAllowed()
Gets a value determining whether the
ICommand.GROUP_SELECTION command should be handled. |
boolean |
isHidingLabelDuringEditingEnabled()
Gets a property that determines whether the label should be hidden while it is edited.
|
boolean |
isIgnoringVoidStylesEnabled()
Gets a value indicating whether void styles (
VoidNodeStyle , VoidEdgeStyle , VoidLabelStyle , and
VoidPortStyle ) should be ignored when selecting or focusing items. |
boolean |
isPasteAllowed()
Gets a value determining whether the
ICommand.PASTE command should be handled. |
boolean |
isReparentNodesAllowed()
Gets a value indicating whether moving nodes out of group nodes or into other group nodes is allowed.
|
boolean |
isReparentToNonGroupNodesAllowed()
Gets a value indicating whether moving nodes into
non-group nodes is allowed to
convert them into group nodes. |
boolean |
isReverseEdgeAllowed()
Gets a value indicating whether the
ICommand.REVERSE_EDGE command should be handled. |
boolean |
isSmartPasteSelectionEnabled()
Determines whether nodes, edges, labels, and ports should only be selected after
paste() or duplicateSelection()
if they were selected when they were initially copied into the clipboard. |
boolean |
isUndoOperationsAllowed()
|
boolean |
isUngroupSelectionAllowed()
Gets a value determining whether the
ICommand.UNGROUP_SELECTION command should be handled. |
boolean |
isUsingCurrentItemForCommandsEnabled()
Gets a value indicating whether to use the
CurrentItem as a fallback for the
commands if no item is provided in the parameter and the current selection is empty. |
boolean |
isWaiting()
Uses the
WaitInputMode to delegate wait requests to. |
protected void |
marqueeSelect(IInputModeContext context,
RectD marqueeRectangle)
Performs marquee-selection with the given rectangle.
|
protected <T extends IModelItem> |
marqueeSelect(IInputModeContext context,
RectD marqueeRectangle,
Iterable<T> items,
Predicate<IModelItem> predicate)
Selects the given elements in the editor inside the provided marquee-selection rectangle.
|
void |
marqueeSelect(RectD marqueeRectangle)
Performs marquee-selection with the given rectangle.
|
protected boolean |
onAddLabel()
Callback that is invoked if the shift+F2 key is pressed and
AddLabelAllowed is set to
true . |
protected void |
onCanvasClicked(ClickEventArgs args)
Raises the
CanvasClicked event. |
protected void |
onClickInputModeChanged(ClickInputMode oldMode,
ClickInputMode newMode)
Called when the
ClickInputMode property value changes and after initialization of the
field. |
protected void |
onConcurrencyControllerActivated()
|
protected void |
onConcurrencyControllerDeactivated()
|
protected void |
onContextMenuInputModeChanged(AbstractContextMenuInputMode oldMode,
AbstractContextMenuInputMode newMode)
Called when the
AbstractContextMenuInputMode property value changes and after initialization of the field. |
protected void |
onCreateBendInputModeBendCreated(Object sender,
ItemEventArgs<IBend> e)
Callback that is called as soon as
CreateBendInputMode created a new bend. |
protected void |
onCreateBendInputModeChanged(CreateBendInputMode oldMode,
CreateBendInputMode newMode)
Called when the
CreateBendInputMode property value changes and after initialization of
the field. |
protected void |
onCreateEdgeInputModeChanged(CreateEdgeInputMode oldMode,
CreateEdgeInputMode newMode)
Called when the
CreateEdgeInputMode property value changes and after initialization of
the field. |
protected void |
onDeletedItem(ItemEventArgs<IModelItem> args)
Raises the
DeletedItem event. |
protected void |
onDeletedSelection(SelectionEventArgs<IModelItem> args)
Raises the
DeletedSelection event. |
protected void |
onDeletingSelection(SelectionEventArgs<IModelItem> args)
Raises the
DeletingSelection event. |
protected void |
onEdgePortsChanged(EdgeEventArgs args)
Callback to be invoked after an edge's source and/or target ports have been changed as the result of an input gesture.
|
protected boolean |
onEditLabel()
Callback that is invoked if the F2 key is pressed and
EditLabelAllowed is set to
true . |
protected void |
onGraphControlChanged(GraphControl oldGraphControl,
GraphControl newGraphControl)
Called when the
GraphControl property changes. |
protected void |
onGraphSelectionChanged(IGraphSelection oldSelection,
IGraphSelection newSelection)
Called when the
GraphSelection property changes. |
protected void |
onHandleInputModeChanged(HandleInputMode oldMode,
HandleInputMode newMode)
Called when the
HandleInputMode property value changes and after initialization of the
field. |
protected void |
onItemClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemClicked event. |
protected void |
onItemDoubleClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemDoubleClicked event. |
protected void |
onItemHoverInputModeChanged(ItemHoverInputMode oldMode,
ItemHoverInputMode newMode)
Called when the
ItemHoverInputMode property value changes and after initialization of
the field. |
protected void |
onItemLeftClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemLeftClicked event. |
protected void |
onItemLeftDoubleClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemLeftDoubleClicked event. |
protected void |
onItemRightClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemRightClicked event. |
protected void |
onItemRightDoubleClicked(ItemClickedEventArgs<IModelItem> args)
Raises the
ItemRightDoubleClicked event. |
protected void |
onKeyboardInputModeChanged(KeyboardInputMode oldMode,
KeyboardInputMode newMode)
Called when the
KeyboardInputMode changed. |
protected void |
onLabelAdded(LabelEventArgs args)
Raises the
LabelAdded event. |
protected void |
onLabelAdding(LabelEditingEventArgs args)
Raises the
LabelAdding event. |
protected void |
onLabelEditing(LabelEditingEventArgs args)
Raises the
LabelEditing event. |
protected void |
onLabelSnapContextChanged(SnapContext oldContext,
SnapContext newContext)
Called when the
LabelSnapContext property context changed. |
protected void |
onLabelTextChanged(LabelEventArgs args)
Raises the
LabelTextChanged event. |
protected void |
onLabelTextEdited(ILabel label,
String text)
Called when the text of a label has been
edited . |
protected void |
onLabelTextEditingCanceled(LabelEventArgs args)
Raises the
LabelTextEditingCanceled event. |
protected void |
onLabelTextEditingStarted(LabelEventArgs args)
Raises the
LabelTextEditingStarted event. |
protected void |
onMarqueeSelectionInputModeChanged(MarqueeSelectionInputMode oldMode,
MarqueeSelectionInputMode newMode)
Called when the
MarqueeSelectionInputMode property value changes and after
initialization of the field. |
protected void |
onMouseHoverInputModeChanged(MouseHoverInputMode oldMode,
MouseHoverInputMode newMode)
Called when the
MouseHoverInputMode property value changes and after initialization of the field. |
protected void |
onMoveInputModeChanged(MoveInputMode oldMode,
MoveInputMode newMode)
Called when the
MoveInputMode property value changes and after initialization of the field. |
protected void |
onMoveInputModeDragCanceled(Object sender,
IEventArgs e)
Called when
DragCanceled is triggered. |
protected void |
onMoveInputModeDragFinished(Object sender,
IEventArgs e)
Called when
DragFinished is triggered. |
protected void |
onMoveLabelInputModeChanged(MoveLabelInputMode oldMode,
MoveLabelInputMode newMode)
Called when the
MoveLabelInputMode property value changes and after initialization of
the field. |
protected void |
onMoveViewportInputModeChanged(MoveViewportInputMode oldMode,
MoveViewportInputMode newMode)
Called when the
MoveViewportInputMode property value changes and after
initialization of the field. |
protected void |
onMultiSelectionFinished(SelectionEventArgs<IModelItem> args)
Raises the
MultiSelectionFinished event. |
protected void |
onMultiSelectionStarted(SelectionEventArgs<IModelItem> args)
Raises the
MultiSelectionStarted event. |
protected void |
onNavigationInputModeChanged(NavigationInputMode oldMode,
NavigationInputMode newMode)
Called when the
NavigationInputMode property value changes and after initialization of
the field. |
protected void |
onNodeCreated(ItemEventArgs<INode> args)
Raises the
NodeCreated event. |
protected void |
onNodeDropInputModeChanged(NodeDropInputMode oldMode,
NodeDropInputMode newMode)
Called when the
NodeDropInputMode property value changes and after initialization of the
field. |
protected void |
onNodeDropInputModeNodeCreated(Object sender,
ItemEventArgs<INode> e)
Called when the
NodeDropInputMode 's ItemCreated
event is triggered. |
protected void |
onNodeReparented(NodeEventArgs args)
Raises the
NodeReparented event. |
protected void |
onPopulateItemContextMenu(PopulateItemContextMenuEventArgs<IModelItem> args)
Raises the
PopulateItemContextMenu event. |
protected void |
onQueryItemToolTip(QueryItemToolTipEventArgs<IModelItem> args)
Raises the
QueryItemToolTip event. |
protected void |
onReparentNodeHandlerChanged(IReparentNodeHandler oldMode,
IReparentNodeHandler newMode)
Called when the
ReparentNodeHandler property value changes and after initialization of
the field. |
protected void |
onSnapContextChanged(SnapContext oldContext,
SnapContext newContext)
Called when the
SnapContext property context changed. |
protected void |
onTapInputModeChanged(TapInputMode oldMode,
TapInputMode newMode)
Called when the
TapInputMode property value changes and after initialization of the field. |
protected void |
onTextEditorInputModeChanged(TextEditorInputMode oldMode,
TextEditorInputMode newMode)
Called when the
TextEditorInputMode property value changes and after initialization of
the field. |
protected void |
onValidateLabelText(LabelTextValidatingEventArgs args)
Raises the
ValidateLabelText event. |
protected void |
onWaitInputModeChanged(WaitInputMode oldMode,
WaitInputMode newMode)
Called when the
WaitInputMode property value changes and after initialization of the field. |
void |
paste()
Pastes the current clipboard contents.
|
void |
pasteAtLocation(PointD location)
Pastes the current clipboard contents at the given location.
|
void |
redo()
|
void |
removeCanvasClickedListener(IEventHandler<ClickEventArgs> canvasClickedEvent)
Removes the given listener for the
CanvasClicked event that occurs when the empty canvas area has been clicked. |
void |
removeDeletedItemListener(IEventHandler<ItemEventArgs<IModelItem>> deletedItemEvent)
Removes the given listener for the
DeletedItem event that occurs when an item has been deleted interactively by
this mode. |
void |
removeDeletedSelectionListener(IEventHandler<SelectionEventArgs<IModelItem>> deletedSelectionEvent)
Removes the given listener for the
DeletedSelection event that occurs just before the deleteSelection()
method has deleted the selection after all selected items have been removed. |
void |
removeDeletingSelectionListener(IEventHandler<SelectionEventArgs<IModelItem>> deletingSelectionEvent)
Removes the given listener for the
DeletingSelection event that occurs just before the deleteSelection()
method starts its work and will be followed by any number of DeletedItem
events and finalized by a DeletedSelection event. |
void |
removeEdgePortsChangedListener(IEventHandler<EdgeEventArgs> edgePortsChangedEvent)
Removes the given listener for the
EdgePortsChanged event that occurs after an edge's source and/or target ports
have been changed as the result of an input gesture. |
void |
removeItemClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemClickedEvent)
Removes the given listener for the
ItemClicked event that occurs when an item has been clicked. |
void |
removeItemDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemDoubleClickedEvent)
Removes the given listener for the
ItemDoubleClicked event that occurs when an item has been double clicked. |
void |
removeItemLeftClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftClickedEvent)
Removes the given listener for the
ItemLeftClicked event that occurs when an item has been left clicked. |
void |
removeItemLeftDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftDoubleClickedEvent)
Removes the given listener for the
ItemLeftDoubleClicked event that occurs when an item has been left double
clicked. |
void |
removeItemRightClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightClickedEvent)
Removes the given listener for the
ItemRightClicked event that occurs when an item has been right clicked. |
void |
removeItemRightDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightDoubleClickedEvent)
Removes the given listener for the
ItemRightDoubleClicked event that occurs when an item has been right double
clicked. |
void |
removeLabelAddedListener(IEventHandler<LabelEventArgs> labelAddedEvent)
Removes the given listener for the
LabelAdded event that occurs when this mode has triggered the addition of an
ILabel , for instance, in response to createLabel(ILabelOwner) . |
void |
removeLabelAddingListener(IEventHandler<LabelEditingEventArgs> labelAddingEvent)
Removes the given listener for the
LabelAdding event that occurs when a label is about to be added. |
void |
removeLabelEditingListener(IEventHandler<LabelEditingEventArgs> labelEditingEvent)
Removes the given listener for the
LabelEditing event that occurs when a label is about to be edited. |
void |
removeLabelTextChangedListener(IEventHandler<LabelEventArgs> labelTextChangedEvent)
Removes the given listener for the
LabelTextChanged event that occurs when this mode has triggered the edit of
an ILabel , for instance, in response to editLabel(ILabel) . |
void |
removeLabelTextEditingCanceledListener(IEventHandler<LabelEventArgs> labelTextEditingCanceledEvent)
Removes the given listener for the
LabelTextEditingCanceled event that occurs when the actual label editing
process is canceled. |
void |
removeLabelTextEditingStartedListener(IEventHandler<LabelEventArgs> labelTextEditingStartedEvent)
Removes the given listener for the
LabelTextEditingStarted event that occurs when the actual label editing
process is about to start. |
void |
removeMultiSelectionFinishedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionFinishedEvent)
Removes the given listener for the
MultiSelectionFinished event that occurs when a single or multi select
operation has been finished. |
void |
removeMultiSelectionStartedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionStartedEvent)
Removes the given listener for the
MultiSelectionStarted event that occurs when a single or multi select
operation has been started. |
void |
removeNodeCreatedListener(IEventHandler<ItemEventArgs<INode>> nodeCreatedEvent)
Removes the given listener for the
NodeCreated event that occurs when this mode has created a node in response
to user interaction. |
void |
removeNodeReparentedListener(IEventHandler<NodeEventArgs> nodeReparentedEvent)
Removes the given listener for the
NodeReparented event that occurs when a node has been reparented
interactively. |
void |
removePopulateItemContextMenuListener(IEventHandler<PopulateItemContextMenuEventArgs<IModelItem>> populateItemContextMenuEvent)
Removes the given listener for the
PopulateItemContextMenu event that occurs when the context menu
over an item is about to be opened to determine the contents of the
Menu . |
void |
removeQueryItemToolTipListener(IEventHandler<QueryItemToolTipEventArgs<IModelItem>> queryItemToolTipEvent)
Removes the given listener for the
QueryItemToolTip event that occurs when the mouse is hovering
over an item to determine the tool tip to display. |
void |
removeValidateLabelTextListener(IEventHandler<LabelTextValidatingEventArgs> validateLabelTextEvent)
|
protected void |
requeryHandles()
Trigger a reevaluation of all visible handles.
|
void |
reverseEdge(IEdge edge)
Reverses the given edges.
|
void |
reverseEdges(Iterable<IEdge> edges)
Reverses the given edges.
|
void |
reverseSelectedEdges()
Reverses the selected edges.
|
void |
selectAll()
Clears the current selection and selects all nodes and bends in this graph.
|
void |
selectNodeAndSelfloopBends(INode node)
Selects the node and possible bends of selfloop edges.
|
void |
setAddLabelAllowed(boolean value)
Sets a value determining whether the
ICommand.ADD_LABEL command should be handled. |
void |
setAdjustContentRectPolicy(AdjustContentRectPolicy value)
Sets a property that determines whether this instance should automatically adjust the
ContentRect
if the graph changes. |
void |
setAdjustGroupNodeSizeAllowed(boolean value)
Sets a value determining whether the
ICommand.ADJUST_GROUP_NODE_SIZE command should be handled. |
void |
setAutoRemovingEmptyLabelsEnabled(boolean value)
Sets a value indicating whether this mode should automatically
remove labels from the
graph when a label text has been edited and the label text is empty. |
void |
setAutoSelectingSelfloopBendsEnabled(boolean value)
Sets a property that determines whether clicking on a node should automatically select all bends of self loops adjacent
to that node.
|
void |
setClearSelectionAllowed(boolean value)
Sets a value determining whether the
ICommand.DESELECT_ALL command should be handled. |
void |
setClickableItems(GraphItemTypes value)
Determines which types of items should be reported through the
item click events . |
void |
setClickHitTestOrder(GraphItemTypes[] value)
Sets the order of the types of items that should be used to determine what item has been clicked or tapped.
|
void |
setClickInputMode(ClickInputMode value)
Sets the
ClickInputMode that is used by this instance to determine clicks. |
void |
setClickSelectableItems(GraphItemTypes value)
Determines which types of items should be selectable by mouse clicks.
|
void |
setClipboardOperationsAllowed(boolean value)
Sets a property that determines whether clipboard operations with the usual shortcuts are enabled on the canvas.
|
void |
setContentRectMargins(InsetsD value)
Sets the margins to use for
CanvasControl.updateContentRect(InsetsD, ICanvasObjectGroup) in adjustContentRect()
calls. |
void |
setContextMenuInputMode(AbstractContextMenuInputMode value)
Sets the
ContextMenuInputMode property. |
void |
setContextMenuItems(GraphItemTypes value)
Sets the types of items a context menu should be queried for.
|
void |
setCreateBendAllowed(boolean value)
Sets a value determining whether
bend creation should be
enabled . |
void |
setCreateBendInputMode(CreateBendInputMode value)
Sets the
CreateBendInputMode property. |
void |
setCreateEdgeAllowed(boolean value)
Sets a value determining whether
edge creation should be
enabled . |
void |
setCreateEdgeInputMode(CreateEdgeInputMode value)
Sets the
CreateEdgeInputMode property. |
void |
setCreateNodeAllowed(boolean value)
Sets a value determining whether
node creation by clicking on an empty canvas location is
enabled. |
void |
setCurrentItem(IModelItem item)
Callback that is used by this instance to set the current item on the
NavigationInputMode . |
void |
setCyclicSelectionRecognizer(IEventRecognizer value)
Sets the
IEventRecognizer that will be queried to decide if a click should cycle through all the items that are
currently under the mouse cursor. |
void |
setDeletableItems(GraphItemTypes value)
Determines which types of items may be deleted using the
deleteSelection() action. |
void |
setDeletablePredicate(Predicate<IModelItem> value)
Sets a predicate that is queried to determine whether an
IModelItem can be deleted or not. |
void |
setDetailSelectionRecognizer(IEventRecognizer value)
Sets the
IEventRecognizer that will be queried to decide if a click should select the item that is currently
visible under the mouse cursor, without giving more important items higher priority. |
void |
setDoubleClickHitTestOrder(GraphItemTypes[] value)
Sets the order of the types of items that should be used to determine what item has been double-clicked or
double-tapped.
|
void |
setDuplicateAllowed(boolean value)
Sets a value determining whether the
ICommand.DUPLICATE command should be handled. |
void |
setEditLabelAllowed(boolean value)
Sets a value determining whether the
ICommand.EDIT_LABEL command should be handled. |
void |
setEditLabelOnDoubleClickAllowed(boolean value)
Sets a value determining whether double-clicking should start label editing.
|
void |
setFocusableItems(GraphItemTypes value)
Sets the items that can be given focus via the
setCurrentItem(IModelItem) method. |
void |
setGroupingOperationsAllowed(boolean value)
Sets a value indicating whether grouping operations like
grouping selected nodes or moving nodes into group nodes
should be enabled. |
void |
setGroupSelectionAllowed(boolean value)
Sets a value determining whether the
ICommand.GROUP_SELECTION command should be handled. |
void |
setHandleInputMode(HandleInputMode value)
Sets the
HandleInputMode property. |
void |
setHidingLabelDuringEditingEnabled(boolean value)
Sets a property that determines whether the label should be hidden while it is edited.
|
void |
setHitTester(IHitTester<IModelItem> value)
Sets the hitTester property.
|
void |
setIgnoringVoidStylesEnabled(boolean value)
Sets a value indicating whether void styles (
VoidNodeStyle , VoidEdgeStyle , VoidLabelStyle , and
VoidPortStyle ) should be ignored when selecting or focusing items. |
void |
setItemHoverInputMode(ItemHoverInputMode value)
Sets the
ItemHoverInputMode that is provided by this instance for those who need to
make use of it. |
void |
setKeyboardInputMode(KeyboardInputMode value)
Sets the
KeyboardInputMode . |
void |
setLabelEditableItems(GraphItemTypes value)
Determines which types of items may have their
labels edited . |
void |
setLabelSnapContext(SnapContext value)
The
LabelSnapContext instance that handles interactive snapping of
ILabel s to their owner during drag operations like movements. |
void |
setLabelText(ILabel label,
String text)
Sets the label's text after it has been
edited . |
void |
setMarqueeSelectableItems(GraphItemTypes value)
Determines which types of items should be selected during
marquee selections . |
void |
setMarqueeSelectionInputMode(MarqueeSelectionInputMode value)
Sets the
MarqueeSelectionInputMode property. |
void |
setMouseHoverInputMode(MouseHoverInputMode value)
Sets the
MouseHoverInputMode property. |
void |
setMovableItems(GraphItemTypes value)
Determines which types of items should be movable using the
MoveInputMode or MoveLabelInputMode
respectively in case of labels. |
void |
setMoveInputMode(MoveInputMode value)
Sets the
MoveInputMode property. |
void |
setMoveLabelInputMode(MoveLabelInputMode value)
Sets the
MoveLabelInputMode property. |
void |
setMoveViewportInputMode(MoveViewportInputMode value)
Sets the
MoveViewportInputMode associated with this instance. |
void |
setMultiSelectionRecognizer(IEventRecognizer value)
Sets the
IEventRecognizer that will be queried to decide if a click is deemed a multi selection gesture. |
void |
setNavigationInputMode(NavigationInputMode value)
Sets the
NavigationInputMode property. |
void |
setNodeCreator(INodeCreationCallback value)
Sets the callback that is responsible for creating a new node, for instance, in response to a mouse click.
|
void |
setNodeDropInputMode(NodeDropInputMode value)
Sets the
NodeDropInputMode property that is responsible for handling drag and drop
operations of nodes onto the Canvas. |
void |
setNodeLayout(INode node,
RectD layout)
Updates the bounds of the node.
|
void |
setOrthogonalBendRemovalEnabled(OrthogonalEdgeEditingPolicy value)
Sets the policy that controls whether removing bends from an orthogonal edge will keep the edge orthogonal.
|
void |
setOrthogonalEdgeEditingContext(OrthogonalEdgeEditingContext value)
Sets the orthogonal edge editing context.
|
void |
setPasteAllowed(boolean value)
Sets a value determining whether the
ICommand.PASTE command should be handled. |
void |
setPasteDelta(PointD value)
The offset for paste operation if clipboard operations are enabled.
|
void |
setPasteSelectableItems(GraphItemTypes value)
Determines which types of items should be selected after
paste() or duplicateSelection() . |
void |
setReparentNodeHandler(IReparentNodeHandler value)
Sets the
IReparentNodeHandler that is used for moving nodes out of group nodes or into other group nodes. |
void |
setReparentNodesAllowed(boolean value)
Sets a value indicating whether moving nodes out of group nodes or into other group nodes is allowed.
|
void |
setReparentToNonGroupNodesAllowed(boolean value)
Sets a value indicating whether moving nodes into
non-group nodes is allowed to
convert them into group nodes. |
void |
setReverseEdgeAllowed(boolean value)
Sets a value indicating whether the
ICommand.REVERSE_EDGE command should be handled. |
void |
setSelectableItems(GraphItemTypes value)
Determines which types of items should be selectable at all.
|
void |
setSelectablePredicate(Predicate<IModelItem> value)
Sets a predicate that is queried to determine whether a given
IModelItem is selectable. |
void |
setSelected(IModelItem item,
boolean selected)
Uses the
GraphSelection to select the given item. |
void |
setShowHandleItems(GraphItemTypes value)
Determines which types of items should have their
IHandle s shown. |
void |
setSmartPasteSelectionEnabled(boolean value)
Determines whether nodes, edges, labels, and ports should only be selected after
paste() or duplicateSelection()
if they were selected when they were initially copied into the clipboard. |
void |
setSnapContext(SnapContext value)
The
SnapContext instance that handles interactive snapping of elements during drag operations like movements. |
void |
setTapInputMode(TapInputMode value)
Sets the
TapInputMode property. |
void |
setTextEditorInputMode(TextEditorInputMode value)
Sets the
TextEditorInputMode property. |
void |
setToolTipItems(GraphItemTypes value)
Sets the types of the items that should be queried a tool tip for.
|
void |
setUndoOperationsAllowed(boolean value)
|
void |
setUngroupSelectionAllowed(boolean value)
Sets a value determining whether the
ICommand.UNGROUP_SELECTION command should be handled. |
void |
setUsingCurrentItemForCommandsEnabled(boolean value)
Sets a value indicating whether to use the
CurrentItem as a fallback for the
commands if no item is provided in the parameter and the current selection is empty. |
void |
setWaiting(boolean value)
Uses the
WaitInputMode to delegate wait requests to. |
void |
setWaitInputMode(WaitInputMode value)
Sets the
WaitInputMode that is provided by this instance for those who need to make use of it. |
protected boolean |
shouldAddLabel(IModelItem item)
Predicate that determines whether a label may be added interactively to .
|
protected boolean |
shouldClick(IModelItem item)
Callback predicate method that is used to determine whether the given
item can be
clicked . |
protected boolean |
shouldClickSelect(IModelItem item)
Callback predicate method that is used to determine whether the given
item should be selected when
clicked with the primary mouse button . |
protected boolean |
shouldDelete(IModelItem item)
Callback method that determines whether the given item should be deleted during
deleteSelection() . |
protected boolean |
shouldDoubleClick(IModelItem item)
Callback predicate method that is used to determine whether the given
item can be
double clicked . |
protected boolean |
shouldEditLabel(IModelItem item)
Callback method that determines whether the label or the labels of the provided item should be edited in response to
onEditLabel()
or onAddLabel() . |
protected boolean |
shouldFocus(IModelItem item)
Callback that determines whether the provided
IModelItem should be
set to the current item . |
protected boolean |
shouldInstallCommand(ICommand command)
Callback method that is used to determine which of the built-in
ICommand s to install. |
protected boolean |
shouldMarqueeSelect(IModelItem item)
Callback method used by
marqueeSelect(RectD) that takes MarqueeSelectableItems
and shouldSelectItem(IModelItem) into account. |
protected boolean |
shouldMove(IModelItem item)
Determines whether or not moving the item is allowed.
|
protected boolean |
shouldPopulateContextMenu(IModelItem item)
Determines whether for the given item a context menu should be queried.
|
protected boolean |
shouldQueryToolTip(IModelItem item)
Determines whether for the given item a tool tip should be queried.
|
protected boolean |
shouldReverseEdge(IEdge edge)
Callback which determines whether the given edge should be reversed by
reverseEdge(IEdge) ,
reverseEdges(Iterable) , or reverseEdges(Iterable) . |
protected boolean |
shouldSelectAfterPaste(IModelItem item)
Can be overridden to determine which items should be selected after
paste() or duplicateSelection() . |
protected boolean |
shouldSelectItem(IModelItem item)
Callback predicate method that is used as a broad classification whether an item can generally be selected.
|
protected boolean |
shouldShowHandles(IModelItem item)
Determines whether to show the
handles for the given item. |
void |
snapToGrid(IInputModeContext context,
INode node)
Snaps the node to the grid using the
IGridConstraintProvider for INode s queried from the given context. |
protected void |
tap(IModelItem item,
TapEventArgs args)
Actually performs the tap on the given item.
|
void |
undo()
|
void |
ungroupSelection()
Makes each of the currently selected nodes a direct child of the root group.
|
void |
uninstall(IInputModeContext context)
Uninstalls this mode from the given context.
|
add, adjustCursor, cancel, createChildInputModeContext, createInputModeEventArgs, getController, getDefaultCursor, getInputModeContext, getMutexOwner, getPriority, getSortedModes, invalidate, isEnabled, isExclusive, remove, setDefaultCursor, setEnabled, setExclusive, setPriority, stop, subModePriorityChanged
public GraphEditorInputMode()
The IGraph
and IGraphSelection
instances are obtained later from the IInputModeContext
once this
mode gets installed
in a suitable canvas control.
public final void addDeletedItemListener(IEventHandler<ItemEventArgs<IModelItem>> deletedItemEvent)
DeletedItem
event that occurs when an item has been deleted interactively by
this mode.
Note that this event will not be triggered for items that are removed implicitly, e.g. if the event is triggered for a
node, its labels, ports, and adjacent edges will not necessarily be reported separately. In order to be notified of any
removal events, the IGraph
events should be used instead.
deletedItemEvent
- The listener to add.removeDeletedItemListener(IEventHandler)
public final void addDeletedSelectionListener(IEventHandler<SelectionEventArgs<IModelItem>> deletedSelectionEvent)
DeletedSelection
event that occurs just before the deleteSelection()
method has deleted the selection after all selected items have been removed.deletedSelectionEvent
- The listener to add.deleteSelection()
,
removeDeletedSelectionListener(IEventHandler)
public final void addDeletingSelectionListener(IEventHandler<SelectionEventArgs<IModelItem>> deletingSelectionEvent)
DeletingSelection
event that occurs just before the deleteSelection()
method starts its work and will be followed by any number of DeletedItem
events and finalized by a DeletedSelection
event.deletingSelectionEvent
- The listener to add.deleteSelection()
,
removeDeletingSelectionListener(IEventHandler)
public final void addEdgePortsChangedListener(IEventHandler<EdgeEventArgs> edgePortsChangedEvent)
EdgePortsChanged
event that occurs after an edge's source and/or target ports
have been changed as the result of an input gesture.edgePortsChangedEvent
- The listener to add.EdgeEventArgs
,
reverseSelectedEdges()
,
reverseEdges(Iterable)
,
reverseEdge(IEdge)
,
removeEdgePortsChangedListener(IEventHandler)
public Future<ILabel> addLabel(ILabelOwner owner)
This will activate the TextEditorInputMode
to let the user interactively enter the
label's text and unless the user cancels label creation the returned Future
will contain the label.
The text that the user enters may be validated
before the label is
actually added.
This method works nearly identical to createLabel(ILabelOwner)
. The only difference is when either the LabelAdding
event is handled, or owner
has an
IEditLabelHelper
, and via those instead of adding a label an existing one
should be edited. This method will edit that label instead of adding a new one.
owner
- The item to add a label to.null
if the creation was canceled.public final void addLabelAddedListener(IEventHandler<LabelEventArgs> labelAddedEvent)
LabelAdded
event that occurs when this mode has triggered the addition of an
ILabel
, for instance, in response to createLabel(ILabelOwner)
.labelAddedEvent
- The listener to add.removeLabelAddedListener(IEventHandler)
public final void addLabelAddingListener(IEventHandler<LabelEditingEventArgs> labelAddingEvent)
LabelAdding
event that occurs when a label is about to be added.
Event handlers for this event can customize the behavior for adding a new label extensively. Adding a label can be
forbidden entirely, or the properties of the added label can be changed, by setting the appropriate properties on the
LabelEditingEventArgs
. It is even possible to forbid adding a label, but edit an existing one instead.
labelAddingEvent
- The listener to add.removeLabelAddingListener(IEventHandler)
public final void addLabelEditingListener(IEventHandler<LabelEditingEventArgs> labelEditingEvent)
LabelEditing
event that occurs when a label is about to be edited.
Event handlers for this event can customize the behavior for editing an existing label. Editing can be forbidden entirely, or redirected to a different label, even on a different owner. In case editing existing labels is unwanted, event handlers can also specify that instead of editing a label, a new one should be added.
labelEditingEvent
- The listener to add.removeLabelEditingListener(IEventHandler)
public final void addLabelTextChangedListener(IEventHandler<LabelEventArgs> labelTextChangedEvent)
LabelTextChanged
event that occurs when this mode has triggered the edit of an
ILabel
, for instance, in response to editLabel(ILabel)
.labelTextChangedEvent
- The listener to add.removeLabelTextChangedListener(IEventHandler)
public final void addLabelTextEditingCanceledListener(IEventHandler<LabelEventArgs> labelTextEditingCanceledEvent)
LabelTextEditingCanceled
event that occurs when the actual label editing process
is canceled.
This allows to unconfigure temporary customizations for the actual label editing process.
labelTextEditingCanceledEvent
- The listener to add.addValidateLabelTextListener(IEventHandler)
,
removeLabelTextEditingCanceledListener(IEventHandler)
public final void addLabelTextEditingStartedListener(IEventHandler<LabelEventArgs> labelTextEditingStartedEvent)
LabelTextEditingStarted
event that occurs when the actual label editing process
is about to start.
This allows to customize the label editing process.
labelTextEditingStartedEvent
- The listener to add.addValidateLabelTextListener(IEventHandler)
,
removeLabelTextEditingStartedListener(IEventHandler)
public final void addNodeCreatedListener(IEventHandler<ItemEventArgs<INode>> nodeCreatedEvent)
NodeCreated
event that occurs when this mode has created a node in response to
user interaction.
This event is triggered if the node is created using a click gesture via createNode(PointD)
, or via a drag and
drop operation that was completed by NodeDropInputMode
. Note that if FolderNodeAsParentAllowed
is set to true
, the reported node can actually be part of the master graph
.
nodeCreatedEvent
- The listener to add.createNode(PointD)
,
removeNodeCreatedListener(IEventHandler)
public final void addNodeReparentedListener(IEventHandler<NodeEventArgs> nodeReparentedEvent)
NodeReparented
event that occurs when a node has been reparented interactively.
This is triggered whenever the ReparentNodeHandler
's IReparentNodeHandler.reparent(IInputModeContext, INode, INode)
method has been called to reparent a node interactively.
nodeReparentedEvent
- The listener to add.getReparentNodeHandler()
,
removeNodeReparentedListener(IEventHandler)
public final void addValidateLabelTextListener(IEventHandler<LabelTextValidatingEventArgs> validateLabelTextEvent)
ValidateLabelText
event that occurs when a label that is about to be added
or edited
.
This event that can be used to validate the label text before inserting/updating the actual label.
Note that in the case of addLabel(ILabelOwner)
the Label
is not
part of the current graph but only a dummy instance.
validateLabelTextEvent
- The listener to add.onValidateLabelText(LabelTextValidatingEventArgs)
,
removeValidateLabelTextListener(IEventHandler)
public void adjustContentRect()
ContentRect
using CanvasControl.updateContentRect(InsetsD, ICanvasObjectGroup)
and ContentRectMargins
.
This method is called whenever the content changes and takes the AdjustContentRectPolicy
into account.
protected void adjustGroupNodeSize(Iterable<INode> nodes)
Adjusts the size
of the group nodes in the enumerable.
This action is executed in response to the ICommand.ADJUST_GROUP_NODE_SIZE
if AdjustGroupNodeSizeAllowed
is set to true
.
nodes
- The nodes to adjust their sizes.public void adjustGroupNodeSizes()
Adjusts the size
of the selected group nodes.
This method delegates to adjustGroupNodeSize(Iterable)
with the
currently selected nodes
.
public void adjustToSizeConstraints(INode node)
Layout
to adhere to possible
size constraints
.
This method will use the INodeSizeConstraintProvider
for INode
that can be
found in their ILookup
to make sure they are still valid. The actual work of this method
will be delegated to setNodeLayout(INode, RectD)
.
node
- The node to possibly adjust the size of.protected Object childInputModeContextLookup(Class type)
MultiplexingInputMode
child context's
ILookup.lookup(Class)
method.type
- The type argument passed to ILookup.lookup(Class)
.null
.MultiplexingInputMode.createChildInputModeContext()
protected boolean clickCreateNode(IInputModeContext context, PointD location)
This method is only called if no item has been and GraphInputMode.clickClearSelection(IInputModeContext)
returned false
.
context
- The context where the click appearedlocation
- The point where the mouse had been clicked.true
if a node was successfully created, false
otherwise.public void closeLabelEditor(boolean cancel)
cancel
- Whether to cancel the editor and discard changes.protected CreateBendInputMode createCreateBendInputMode()
CreateBendInputMode
property.
This method will be called upon first access to the CreateBendInputMode
property.
CreateBendInputMode
protected CreateEdgeInputMode createCreateEdgeInputMode()
CreateEdgeInputMode
property.
This method will be called upon first access to the CreateEdgeInputMode
property.
protected HandleInputMode createHandleInputMode()
HandleInputMode
property.
This method will be called upon first access to the HandleInputMode
property.
public Future<ILabel> createLabel(ILabelOwner owner)
This method will invoke the text editor that will let the user edit the text of the label. If the user commits the label text the label will be added to the label owner.
The text that the user enters may be validated
before the label is
actually added.
This method works nearly identical to addLabel(ILabelOwner)
. The only difference is when either the LabelAdding
event is handled, or owner
has an
IEditLabelHelper
, and via those instead of adding a label an existing one
should be edited. This method will do nothing instead of editing an existing label or adding a new one in that case.
owner
- The item to create a new label for.null
if the creation was canceled.protected MoveInputMode createMoveInputMode()
MoveInputMode
property.
This method will be called upon first access to the MoveInputMode
property.
protected MoveLabelInputMode createMoveLabelInputMode()
MoveLabelInputMode
property.
This method will be called upon first access to the MoveLabelInputMode
property.
MoveLabelInputMode
public MoveInputMode createMoveUnselectedInputMode(IEventRecognizer recognizer)
MoveInputMode
instance that can be used to move unselected model
items.
In order to use this mode, the created instance should be installed in a GraphEditorInputMode
like this but
using a smaller priority
value than the priority
of the mode that is installed by default
.
recognizer
- Use this instance to make this mode work under certain conditions only. null
for default behavior, one of the KeyEventRecognizers
constants, e.g. for alternate behavior.MoveInputMode
instance that uses the IPositionHandler
instances of the items that
are hit at the position of the cursor, regardless of their selection state.protected MoveViewportInputMode createMoveViewportInputMode()
MoveViewportInputMode
property.
This method will be called upon first access to the MoveViewportInputMode
property.
MoveViewportInputMode
public INode createNode(PointD location)
This implementation delegates to the current INodeCreationCallback
or simply returns null
if there is no
such callback or CreateNodeAllowed
yields false
. Finally, it tries to
set the node as the current item
.
location
- The point where the mouse had been clicked.null
.onNodeCreated(ItemEventArgs)
,
GraphInputMode.setCurrentItem(IModelItem)
protected NodeDropInputMode createNodeDropInputMode()
NodeDropInputMode
lazily the first time the property is
accessed.NodeDropInputMode
type, which is initially
disabled
.protected IReparentNodeHandler createReparentNodeHandler()
This method will be called upon first access to the ReparentNodeHandler
property.
ReparentNodeHandler
protected TextEditorInputMode createTextEditorInputMode()
TextEditorInputMode
property.
This method will be called upon first access to the TextEditorInputMode
property.
public void cut()
public void deleteSelection()
If the GraphSelection
is non-empty this implementation triggers the DeletingSelection
event, possibly a number of DeletedItem
events, and a final deleteSelection()
event. Note that DeletedItem
will not be called for items that are
removed implicitly, e.g. if the event is triggered for a node, its labels, ports, and adjacent edges will not be
reported separately.
protected void doubleClick(IModelItem item, ClickEventArgs args)
This will raise the ItemLeftDoubleClicked
and ItemRightDoubleClicked
(depending on the button), and ItemDoubleClicked
events. If neither event was handled, label editing will be started, if EditLabelOnDoubleClickAllowed
is true
item
- The item that has been double-clicked.args
- The original event arguments for the click. Setting its Handled
property to true
will indicate that the double-click was handled and events on other items in the same location are no longer raised.protected void doubleTap(IModelItem item, TapEventArgs args)
This will raise the ItemDoubleClicked
event. If the
event was not handled, label editing will be started, if EditLabelOnDoubleClickAllowed
is true
item
- The item that has been double-tapped.args
- The original event arguments for the tap. Setting its Handled
property to true
will indicate that the double-tap was handled and events on other items in the same location are no longer raised.public void dragBend(IBend bend)
HandleInputMode
to drag the given bend.bend
- The bend to drag.onCreateBendInputModeBendCreated(Object, ItemEventArgs)
public void duplicateSelection()
public void editLabel(ILabel label)
This implementation uses the TextEditorInputMode
to display an editor to edit the label. The text that the user
enters may be validated
before the label is actually edited.
The label to edit can be a
SimpleLabel
, which will be edited as usual, except that the label text changes will be written directly back
into the instance.
This method will raise the LabelEditing
event and query the IEditLabelHelper
for the label and its owner, but will ignore the result except for the TextEditorInputModeConfigurator
property on the LabelEditingEventArgs
. Thus editing a label via this method cannot be prevented by event
handlers or IEditLabelHelper
s.
label
- The label to edit.onLabelTextEdited(ILabel, String)
protected boolean editLabelOnDoubleClick(IModelItem item)
ICommand.EDIT_LABEL
.
The method should return whether the request was satisfied.
item
- The item whose label or the label itself that should be edited upon the double click gesture.true
iff the request was handled.GraphInputMode.doubleClick(IModelItem, ClickEventArgs)
,
isEditLabelOnDoubleClickAllowed()
public final AdjustContentRectPolicy getAdjustContentRectPolicy()
ContentRect
if the graph changes.
The adjustContentRect()
method is called whenever the content changes. The default is
AdjustContentRectPolicy.UNION
.
setAdjustContentRectPolicy(AdjustContentRectPolicy)
public final InsetsD getContentRectMargins()
CanvasControl.updateContentRect(InsetsD, ICanvasObjectGroup)
in adjustContentRect()
calls.setContentRectMargins(InsetsD)
public final CreateBendInputMode getCreateBendInputMode()
CreateBendInputMode
property.
If the field has not yet been initialized upon first access, the factory method createCreateBendInputMode()
will be called. Upon change the onCreateBendInputModeChanged(CreateBendInputMode, CreateBendInputMode)
method
will be called.
By default this input mode has a priority of 42
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setCreateBendInputMode(CreateBendInputMode)
public final CreateEdgeInputMode getCreateEdgeInputMode()
CreateEdgeInputMode
property.
If the field has not yet been initialized upon first access, the factory method createCreateEdgeInputMode()
will be called. Upon change the onCreateEdgeInputModeChanged(CreateEdgeInputMode, CreateEdgeInputMode)
method
will be called.
By default this input mode has a priority of 45
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setCreateEdgeInputMode(CreateEdgeInputMode)
public final GraphItemTypes getDeletableItems()
deleteSelection()
action.
The default is GraphItemTypes.ALL
.
shouldDelete(IModelItem)
,
setDeletableItems(GraphItemTypes)
public final Predicate<IModelItem> getDeletablePredicate()
IModelItem
can be deleted or not.setDeletablePredicate(Predicate)
public final GraphControl getGraphControl()
GraphControl
instance this mode is working on or null
.
This property is set when this mode is install(IInputModeContext, ConcurrencyController)
ed in a
GraphControl
.
public final HandleInputMode getHandleInputMode()
HandleInputMode
property.
If the field has not yet been initialized upon first access, the factory method createHandleInputMode()
will be
called. Upon change the onHandleInputModeChanged(HandleInputMode, HandleInputMode)
method will be called.
By default this input mode has a priority of 0
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setHandleInputMode(HandleInputMode)
public final IHitTester<IModelItem> getHitTester()
The enumerator will be queried for hit tests if the user clicks on the canvas.
setHitTester(IHitTester)
public final GraphItemTypes getLabelEditableItems()
labels edited
.
The default is GraphItemTypes.LABEL_OWNER
|GraphItemTypes.LABEL
, which allows for editing the labels of
ILabelOwner
s, and existing ILabel
s.
shouldEditLabel(IModelItem)
,
setLabelEditableItems(GraphItemTypes)
public final SnapContext getLabelSnapContext()
LabelSnapContext
instance that handles interactive snapping of
ILabel
s to their owner during drag operations like movements.
Setting this property to null
will disable snapping, whereas setting it to null
will make the child
modes use the context from their IInputModeContext
s, if available. Upon change the onLabelSnapContextChanged(SnapContext, SnapContext)
method is called, which will as a side effect configure the snap context to display the SnapResult
s in the
CanvasControl
. Default is null
.
setLabelSnapContext(SnapContext)
public final GraphItemTypes getMovableItems()
MoveInputMode
or MoveLabelInputMode
respectively in case of labels.
The default is GraphItemTypes.ALL
.
shouldMove(IModelItem)
,
setMovableItems(GraphItemTypes)
public final MoveInputMode getMoveInputMode()
MoveInputMode
property.
If the field has not yet been initialized upon first access, the factory method createMoveInputMode()
will be
called. Upon change the onMoveInputModeChanged(MoveInputMode, MoveInputMode)
method will be called.
By default this input mode has a priority of 40
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.shouldMove(IModelItem)
,
setMoveInputMode(MoveInputMode)
public final MoveLabelInputMode getMoveLabelInputMode()
MoveLabelInputMode
property.
This mode is responsible for moving labels to another candidate position. If the field has not yet been initialized upon
first access, the factory method createMoveLabelInputMode()
will be called. Upon change the onMoveLabelInputModeChanged(MoveLabelInputMode, MoveLabelInputMode)
method will be called.
By default this input mode has a priority of 39
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.shouldMove(IModelItem)
,
setMoveLabelInputMode(MoveLabelInputMode)
public final INodeCreationCallback getNodeCreator()
A null
value will disable node creation using mouse clicks, just as setting CreateNodeAllowed
to false
.
createNode(PointD)
,
setNodeCreator(INodeCreationCallback)
public final NodeDropInputMode getNodeDropInputMode()
NodeDropInputMode
property that is responsible for handling drag and drop
operations of nodes onto the Canvas.
The mode by default is disabled
and needs to be enabled
to work, first. If the field has not yet been initialized upon first access, the factory method createNodeDropInputMode()
will be called. Upon change the onNodeDropInputModeChanged(NodeDropInputMode, NodeDropInputMode)
method will be
called.
By default this input mode has a priority of 70
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setNodeDropInputMode(NodeDropInputMode)
public final OrthogonalEdgeEditingPolicy getOrthogonalBendRemovalEnabled()
By default this feature is enabled automatically if an OrthogonalEdgeEditingContext
is set.
getOrthogonalEdgeEditingContext()
,
setOrthogonalBendRemovalEnabled(OrthogonalEdgeEditingPolicy)
public final OrthogonalEdgeEditingContext getOrthogonalEdgeEditingContext()
The default value is null
.
setOrthogonalEdgeEditingContext(OrthogonalEdgeEditingContext)
public final PointD getPasteDelta()
Default is (15, 15).
setPasteDelta(PointD)
public final GraphItemTypes getPasteSelectableItems()
paste()
or duplicateSelection()
.
The default is GraphItemTypes.ALL
.
shouldSelectAfterPaste(IModelItem)
,
isSmartPasteSelectionEnabled()
,
GraphInputMode.setSelected(IModelItem, boolean)
,
setPasteSelectableItems(GraphItemTypes)
public final IReparentNodeHandler getReparentNodeHandler()
IReparentNodeHandler
that is used for moving nodes out of group nodes or into other group nodes.
This setting has no effect if reparenting nodes is generally disallowed by setting ReparentNodesAllowed
to false
.
Child input modes will use this IReparentNodeHandler
as well, since it is added to
childInputModeContextLookup(Class)
.
If not already initialized, the factory method createReparentNodeHandler()
will be called on first access. Upon
changes, the onReparentNodeHandlerChanged(IReparentNodeHandler, IReparentNodeHandler)
method will be called.
isReparentNodesAllowed()
,
ReparentNodeHandler
,
setReparentNodeHandler(IReparentNodeHandler)
public final GraphItemTypes getShowHandleItems()
IHandle
s shown.
The default is GraphItemTypes.ALL
.
shouldShowHandles(IModelItem)
,
setShowHandleItems(GraphItemTypes)
public final SnapContext getSnapContext()
SnapContext
instance that handles interactive snapping of elements during drag operations like movements.
Setting this property to a SnapContext
which is disabled
will disable snapping,
whereas setting it to null
will make the child modes use the context from their IInputModeContext
s, if
available. Upon change the onSnapContextChanged(SnapContext, SnapContext)
method is called, which will as a
side effect configure the snap context to display the SnapResult
s in the CanvasControl
. Default is
null
.
setSnapContext(SnapContext)
public final TextEditorInputMode getTextEditorInputMode()
TextEditorInputMode
property.
If the field has not yet been initialized upon first access, the factory method createTextEditorInputMode()
will be called. Upon change the onTextEditorInputModeChanged(TextEditorInputMode, TextEditorInputMode)
method
will be called.
By default this input mode has a priority of 100
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setTextEditorInputMode(TextEditorInputMode)
public INode groupSelection()
This method will also clear the selection and select the newly created group node.
The default shortcut for this is Ctrl+G on Windows and Linux and Command+G on Mac OS.
null
.ICommand.GROUP_SELECTION
,
GraphInputMode.clearSelection()
,
GraphInputMode.setSelected(IModelItem, boolean)
protected void initialize()
adding
all of the minor modes that are used by this mode to this instance.GraphInputMode.getClickInputMode()
,
GraphInputMode.getTapInputMode()
,
GraphInputMode.getMarqueeSelectionInputMode()
,
GraphInputMode.getContextMenuInputMode()
,
GraphInputMode.getNavigationInputMode()
,
GraphInputMode.getMouseHoverInputMode()
,
GraphInputMode.getItemHoverInputMode()
,
GraphInputMode.getMoveViewportInputMode()
,
GraphInputMode.getWaitInputMode()
,
getHandleInputMode()
,
getMoveInputMode()
,
KeyboardInputMode
,
getCreateEdgeInputMode()
,
getCreateBendInputMode()
,
getMoveLabelInputMode()
,
getTextEditorInputMode()
,
getNodeDropInputMode()
public void install(IInputModeContext context, ConcurrencyController controller)
install
in interface IInputMode
context
- The context to install this mode in and retrieve the graph and selection instance from.controller
- The ConcurrencyController
for this mode.IInputMode.uninstall(IInputModeContext)
public final boolean isAddLabelAllowed()
ICommand.ADD_LABEL
command should be handled.
If this flag is set to true
pressing Shift+F2 will start the label editor. By default this feature is enabled.
createLabel(ILabelOwner)
,
setAddLabelAllowed(boolean)
public final boolean isAdjustGroupNodeSizeAllowed()
ICommand.ADJUST_GROUP_NODE_SIZE
command should be handled.
This setting has no effect if grouping operations are generally disallowed by setting GroupingOperationsAllowed
to false
.
The default value is true
.
isGroupingOperationsAllowed()
,
adjustGroupNodeSizes()
,
adjustGroupNodeSize(Iterable)
,
setAdjustGroupNodeSizeAllowed(boolean)
public final boolean isAutoRemovingEmptyLabelsEnabled()
remove labels
from the
graph when a label text has been edited and the label text is empty.
The default value is true
.
true
if empty labels should be removed after text editing; otherwise, false
.setAutoRemovingEmptyLabelsEnabled(boolean)
public final boolean isAutoSelectingSelfloopBendsEnabled()
The default value is true
.
setAutoSelectingSelfloopBendsEnabled(boolean)
public final boolean isClearSelectionAllowed()
ICommand.DESELECT_ALL
command should be handled.
The default value is true
.
setClearSelectionAllowed(boolean)
public final boolean isCreateBendAllowed()
bend creation
should be
enabled
.
This property delegates to CreateBendInputMode
's Enabled
property.
The default value is true
.
setCreateBendAllowed(boolean)
public final boolean isCreateEdgeAllowed()
edge creation
should be
enabled
.
This property delegates to CreateEdgeInputMode
's Enabled
property.
The default value is true
.
setCreateEdgeAllowed(boolean)
public final boolean isCreateNodeAllowed()
node creation
by clicking on an empty canvas location is
enabled.
To disable node creation via drag and drop gestures, the NodeDropInputMode
must be
disabled, too. However, it is disabled by default.
The default value is true
.
getNodeCreator()
,
createNode(PointD)
,
setCreateNodeAllowed(boolean)
public final boolean isDuplicateAllowed()
ICommand.DUPLICATE
command should be handled.
This setting has no effect if clipboard operations are generally disallowed by setting ClipboardOperationsAllowed
to false
.
The default value is true
.
setDuplicateAllowed(boolean)
public final boolean isEditLabelAllowed()
ICommand.EDIT_LABEL
command should be handled.
If this flag is set to true
pressing F2 will start the label editor. By default this feature is enabled.
editLabel(ILabel)
,
onEditLabel()
,
setEditLabelAllowed(boolean)
public final boolean isEditLabelOnDoubleClickAllowed()
If enabled, double-clicking an item will automatically execute the ICommand.EDIT_LABEL
command.
This setting has no effect if label editing is generally disallowed by setting EditLabelAllowed
to false
.
The default value is true
.
isEditLabelAllowed()
,
setEditLabelOnDoubleClickAllowed(boolean)
public final boolean isGroupingOperationsAllowed()
grouping selected nodes
or moving nodes into group nodes
should be enabled.
Setting this property to false
effectively disables handling of all grouping
commands
. If this property is set to true
the related properties
GroupSelectionAllowed
,
UngroupSelectionAllowed
, and ReparentNodesAllowed
allow for selectively enabling or disabling only certain grouping operations.
The default value is false
.
isGroupSelectionAllowed()
,
isUngroupSelectionAllowed()
,
isAdjustGroupNodeSizeAllowed()
,
isReparentNodesAllowed()
,
setGroupingOperationsAllowed(boolean)
public final boolean isGroupSelectionAllowed()
ICommand.GROUP_SELECTION
command should be handled.
This setting has no effect if grouping operations are generally disallowed by setting GroupingOperationsAllowed
to false
.
The default value is true
.
isGroupingOperationsAllowed()
,
groupSelection()
,
setGroupSelectionAllowed(boolean)
public final boolean isHidingLabelDuringEditingEnabled()
If enabled, any selection, focus, and highlight visualizations of the label are hidden along with the label visualization itself.
Even if enabled, the label text is still visible in the TextBox
.
The default value is true
.
setHidingLabelDuringEditingEnabled(boolean)
public final boolean isPasteAllowed()
ICommand.PASTE
command should be handled.
This setting has no effect if clipboard operations are generally disallowed by setting ClipboardOperationsAllowed
to false
.
The default value is true
.
setPasteAllowed(boolean)
public final boolean isReparentNodesAllowed()
If set to false
the ReparentNodeHandler
will effectively be disabled and not
called anymore for reparenting operations.
The default value is true
.
getReparentNodeHandler()
,
setReparentNodesAllowed(boolean)
public final boolean isReparentToNonGroupNodesAllowed()
non-group nodes
is allowed to
convert them into group nodes.
If reparenting nodes is allowed
in general and this property is enabled, users may
reparent nodes not only to groups and folders but also to non-group nodes. Still, the decision about the final
acceptance of the reparenting and the actual execution are delegated to the
ReparentNodeHandler
.
This setting has no effect if grouping operations are generally disallowed by setting GroupingOperationsAllowed
to false
.
The default value is false
.
isGroupingOperationsAllowed()
,
setReparentToNonGroupNodesAllowed(boolean)
public final boolean isReverseEdgeAllowed()
ICommand.REVERSE_EDGE
command should be handled.
If set to false
the methods reverseEdge(IEdge)
, reverseEdges(Iterable)
, and reverseSelectedEdges()
do nothing.
The default value is true
.
setReverseEdgeAllowed(boolean)
public final boolean isSmartPasteSelectionEnabled()
paste()
or duplicateSelection()
if they were selected when they were initially copied into the clipboard.
The default is true
. Disabling this feature will select all PasteSelectableItems
after a paste or duplicate operation.
shouldSelectAfterPaste(IModelItem)
,
getPasteSelectableItems()
,
GraphInputMode.setSelected(IModelItem, boolean)
,
setSmartPasteSelectionEnabled(boolean)
public final boolean isUndoOperationsAllowed()
undo()
and redo()
should be enabled.
Note that even if this feature is enabled, an undo engine
needs to be
available in the
InputModeContext
in order to work.
Setting this property to false
effectively disables handling of the commands ICommand.UNDO
and
ICommand.REDO
.
The default value is true
.
undo()
,
redo()
,
setUndoOperationsAllowed(boolean)
public final boolean isUngroupSelectionAllowed()
ICommand.UNGROUP_SELECTION
command should be handled.
This setting has no effect if grouping operations are generally disallowed by setting GroupingOperationsAllowed
to false
.
The default value is true
.
isGroupingOperationsAllowed()
,
ungroupSelection()
,
setUngroupSelectionAllowed(boolean)
public final boolean isUsingCurrentItemForCommandsEnabled()
CurrentItem
as a fallback for the
commands if no item is provided in the parameter and the current selection is empty.
This applies to the following commands:
true
if the current item should be used as a fallback; false
otherwise, which is the default.setUsingCurrentItemForCommandsEnabled(boolean)
public boolean isWaiting()
WaitInputMode
to delegate wait requests to.setWaiting(boolean)
protected boolean onAddLabel()
AddLabelAllowed
is set to
true
.
This method determines the label owner to add to and delegates to createLabel(ILabelOwner)
.
protected void onConcurrencyControllerActivated()
MultiplexingInputMode
Active
property of the installed ConcurrencyController
has been set to true
.
This implementation reenabled previously disabled concurrent child modes.
protected void onConcurrencyControllerDeactivated()
MultiplexingInputMode
Active
property of the installed ConcurrencyController
has been set to false
.
This implementation sets the PreferredCursor
property to null
and releases
the mutex if the mutex is currently owned by this instance.
Also, all concurrent child modes will be disabled.
protected void onCreateBendInputModeBendCreated(Object sender, ItemEventArgs<IBend> e)
CreateBendInputMode
created a new bend.
This method selects the bend and starts the HandleInputMode
using the handle for the newly
created bend. The bend is created using the hit edge's IBendCreator
implementation,
as obtained from the edge's ILookup.lookup(Class)
and calls
dragBend(IBend)
. If the subsequent drag is canceled by the user, this call will remove the bend again.
protected void onCreateBendInputModeChanged(CreateBendInputMode oldMode, CreateBendInputMode newMode)
CreateBendInputMode
property value changes and after initialization of
the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onCreateEdgeInputModeChanged(CreateEdgeInputMode oldMode, CreateEdgeInputMode newMode)
CreateEdgeInputMode
property value changes and after initialization of
the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected final void onDeletedItem(ItemEventArgs<IModelItem> args)
DeletedItem
event.args
- The instance containing the event data.protected void onDeletedSelection(SelectionEventArgs<IModelItem> args)
DeletedSelection
event.args
- The SelectionEventArgs
instance containing the event data.protected void onDeletingSelection(SelectionEventArgs<IModelItem> args)
DeletingSelection
event.args
- The SelectionEventArgs
instance containing the event data.protected void onEdgePortsChanged(EdgeEventArgs args)
Dispatches the EdgePortsChanged
event.
args
- The EdgeEventArgs
for the EdgePortsChanged
.protected boolean onEditLabel()
EditLabelAllowed
is set to
true
.
This method determines the label to edit and delegates to either editLabel(ILabel)
or createLabel(ILabelOwner)
if no label could be found.
protected void onGraphControlChanged(GraphControl oldGraphControl, GraphControl newGraphControl)
GraphControl
property changes.oldGraphControl
- The old control.newGraphControl
- The new control.protected void onGraphSelectionChanged(IGraphSelection oldSelection, IGraphSelection newSelection)
GraphSelection
property changes.
This will update the internal state of the modes.
oldSelection
- The old selection instance.newSelection
- The new selection instance.protected void onHandleInputModeChanged(HandleInputMode oldMode, HandleInputMode newMode)
HandleInputMode
property value changes and after initialization of the
field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onLabelAdded(LabelEventArgs args)
LabelAdded
event.args
- The ItemEventArgs
instance that contains the ILabel
that has been added.protected void onLabelAdding(LabelEditingEventArgs args)
LabelAdding
event.
Invoking the event handlers stops once one event marks the args
as handled.
args
- The event arguments.protected void onLabelEditing(LabelEditingEventArgs args)
LabelEditing
event.
Invoking the event handlers stops once one event marks the args
as handled.
args
- The event arguments.protected void onLabelSnapContextChanged(SnapContext oldContext, SnapContext newContext)
LabelSnapContext
property context changed.oldContext
- The old snap context.newContext
- The new snap context.protected void onLabelTextChanged(LabelEventArgs args)
LabelTextChanged
event.args
- The ItemEventArgs
instance that contains the ILabel
that has changed the text.protected void onLabelTextEdited(ILabel label, String text)
edited
.
This method validates the label text
and if successful calls
setLabelText(ILabel, String)
.
label
- The label that was edited.text
- The new text.protected void onLabelTextEditingCanceled(LabelEventArgs args)
LabelTextEditingCanceled
event.args
- The LabelEventArgs
instance containing the event data.protected void onLabelTextEditingStarted(LabelEventArgs args)
LabelTextEditingStarted
event.args
- The LabelEventArgs
instance containing the event data.protected void onMoveInputModeChanged(MoveInputMode oldMode, MoveInputMode newMode)
MoveInputMode
property value changes and after initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onMoveInputModeDragCanceled(Object sender, IEventArgs e)
DragCanceled
is triggered.protected void onMoveInputModeDragFinished(Object sender, IEventArgs e)
DragFinished
is triggered.protected void onMoveLabelInputModeChanged(MoveLabelInputMode oldMode, MoveLabelInputMode newMode)
MoveLabelInputMode
property value changes and after initialization of
the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onNodeCreated(ItemEventArgs<INode> args)
NodeCreated
event.
Note that if FolderNodeAsParentAllowed
is set to true
,
the reported node can actually be part of the master graph
.
args
- The ItemEventArgs
instance containing the created node.protected void onNodeDropInputModeChanged(NodeDropInputMode oldMode, NodeDropInputMode newMode)
NodeDropInputMode
property value changes and after initialization of the
field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onNodeDropInputModeNodeCreated(Object sender, ItemEventArgs<INode> e)
NodeDropInputMode
's ItemCreated
event is triggered.
This implementation adjusts the content rect
, triggers the NodeCreated
event and tries to set the newly created node as the current item
.
sender
- The sender.e
- The event argument instance containing the event data.protected void onNodeReparented(NodeEventArgs args)
NodeReparented
event.args
- The NodeEventArgs
instance containing the event data.getReparentNodeHandler()
protected void onReparentNodeHandlerChanged(IReparentNodeHandler oldMode, IReparentNodeHandler newMode)
ReparentNodeHandler
property value changes and after initialization of
the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onSnapContextChanged(SnapContext oldContext, SnapContext newContext)
SnapContext
property context changed.oldContext
- The old snap context.newContext
- The new snap context.protected void onTextEditorInputModeChanged(TextEditorInputMode oldMode, TextEditorInputMode newMode)
TextEditorInputMode
property value changes and after initialization of
the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onValidateLabelText(LabelTextValidatingEventArgs args)
ValidateLabelText
event.args
- The LabelTextValidatingEventArgs
instance containing the event data.public void paste()
pasteAtLocation(PointD)
public void pasteAtLocation(PointD location)
The location is at the center of the bounds of the items that are pasted. This method reconfigures PasteDelta
and calls paste()
.
location
- The location at which the center of the clipboard's contents should be positioned.public void redo()
public final void removeDeletedItemListener(IEventHandler<ItemEventArgs<IModelItem>> deletedItemEvent)
DeletedItem
event that occurs when an item has been deleted interactively by
this mode.
Note that this event will not be triggered for items that are removed implicitly, e.g. if the event is triggered for a
node, its labels, ports, and adjacent edges will not necessarily be reported separately. In order to be notified of any
removal events, the IGraph
events should be used instead.
deletedItemEvent
- The listener to remove.addDeletedItemListener(IEventHandler)
public final void removeDeletedSelectionListener(IEventHandler<SelectionEventArgs<IModelItem>> deletedSelectionEvent)
DeletedSelection
event that occurs just before the deleteSelection()
method has deleted the selection after all selected items have been removed.deletedSelectionEvent
- The listener to remove.deleteSelection()
,
addDeletedSelectionListener(IEventHandler)
public final void removeDeletingSelectionListener(IEventHandler<SelectionEventArgs<IModelItem>> deletingSelectionEvent)
DeletingSelection
event that occurs just before the deleteSelection()
method starts its work and will be followed by any number of DeletedItem
events and finalized by a DeletedSelection
event.deletingSelectionEvent
- The listener to remove.deleteSelection()
,
addDeletingSelectionListener(IEventHandler)
public final void removeEdgePortsChangedListener(IEventHandler<EdgeEventArgs> edgePortsChangedEvent)
EdgePortsChanged
event that occurs after an edge's source and/or target ports
have been changed as the result of an input gesture.edgePortsChangedEvent
- The listener to remove.EdgeEventArgs
,
reverseSelectedEdges()
,
reverseEdges(Iterable)
,
reverseEdge(IEdge)
,
addEdgePortsChangedListener(IEventHandler)
public final void removeLabelAddedListener(IEventHandler<LabelEventArgs> labelAddedEvent)
LabelAdded
event that occurs when this mode has triggered the addition of an
ILabel
, for instance, in response to createLabel(ILabelOwner)
.labelAddedEvent
- The listener to remove.addLabelAddedListener(IEventHandler)
public final void removeLabelAddingListener(IEventHandler<LabelEditingEventArgs> labelAddingEvent)
LabelAdding
event that occurs when a label is about to be added.
Event handlers for this event can customize the behavior for adding a new label extensively. Adding a label can be
forbidden entirely, or the properties of the added label can be changed, by setting the appropriate properties on the
LabelEditingEventArgs
. It is even possible to forbid adding a label, but edit an existing one instead.
labelAddingEvent
- The listener to remove.addLabelAddingListener(IEventHandler)
public final void removeLabelEditingListener(IEventHandler<LabelEditingEventArgs> labelEditingEvent)
LabelEditing
event that occurs when a label is about to be edited.
Event handlers for this event can customize the behavior for editing an existing label. Editing can be forbidden entirely, or redirected to a different label, even on a different owner. In case editing existing labels is unwanted, event handlers can also specify that instead of editing a label, a new one should be added.
labelEditingEvent
- The listener to remove.addLabelEditingListener(IEventHandler)
public final void removeLabelTextChangedListener(IEventHandler<LabelEventArgs> labelTextChangedEvent)
LabelTextChanged
event that occurs when this mode has triggered the edit of
an ILabel
, for instance, in response to editLabel(ILabel)
.labelTextChangedEvent
- The listener to remove.addLabelTextChangedListener(IEventHandler)
public final void removeLabelTextEditingCanceledListener(IEventHandler<LabelEventArgs> labelTextEditingCanceledEvent)
LabelTextEditingCanceled
event that occurs when the actual label editing
process is canceled.
This allows to unconfigure temporary customizations for the actual label editing process.
labelTextEditingCanceledEvent
- The listener to remove.addValidateLabelTextListener(IEventHandler)
,
addLabelTextEditingCanceledListener(IEventHandler)
public final void removeLabelTextEditingStartedListener(IEventHandler<LabelEventArgs> labelTextEditingStartedEvent)
LabelTextEditingStarted
event that occurs when the actual label editing
process is about to start.
This allows to customize the label editing process.
labelTextEditingStartedEvent
- The listener to remove.addValidateLabelTextListener(IEventHandler)
,
addLabelTextEditingStartedListener(IEventHandler)
public final void removeNodeCreatedListener(IEventHandler<ItemEventArgs<INode>> nodeCreatedEvent)
NodeCreated
event that occurs when this mode has created a node in response
to user interaction.
This event is triggered if the node is created using a click gesture via createNode(PointD)
, or via a drag and
drop operation that was completed by NodeDropInputMode
. Note that if FolderNodeAsParentAllowed
is set to true
, the reported node can actually be part of the master graph
.
nodeCreatedEvent
- The listener to remove.createNode(PointD)
,
addNodeCreatedListener(IEventHandler)
public final void removeNodeReparentedListener(IEventHandler<NodeEventArgs> nodeReparentedEvent)
NodeReparented
event that occurs when a node has been reparented
interactively.
This is triggered whenever the ReparentNodeHandler
's IReparentNodeHandler.reparent(IInputModeContext, INode, INode)
method has been called to reparent a node interactively.
nodeReparentedEvent
- The listener to remove.getReparentNodeHandler()
,
addNodeReparentedListener(IEventHandler)
public final void removeValidateLabelTextListener(IEventHandler<LabelTextValidatingEventArgs> validateLabelTextEvent)
ValidateLabelText
event that occurs when a label that is about to be added
or edited
.
This event that can be used to validate the label text before inserting/updating the actual label.
Note that in the case of addLabel(ILabelOwner)
the Label
is not
part of the current graph but only a dummy instance.
validateLabelTextEvent
- The listener to remove.onValidateLabelText(LabelTextValidatingEventArgs)
,
addValidateLabelTextListener(IEventHandler)
protected void requeryHandles()
This method is called when the ShowHandleItems
property is changed.
public void reverseEdge(IEdge edge)
The edge will only be reversed if ReverseEdgeAllowed
is set to true
and shouldReverseEdge(IEdge)
returns true
for the edge. A EdgePortsChanged
event will be
dispatched after the edge has been reversed.
public void reverseEdges(Iterable<IEdge> edges)
The edges will only be reversed if ReverseEdgeAllowed
is set to true
and shouldReverseEdge(IEdge)
returns true
for the edge.
For each edge a EdgePortsChanged
event will be dispatched.
ICommand.REVERSE_EDGE
public void reverseSelectedEdges()
This implementation invokes reverseEdges(Iterable)
providing the
selected edges
.
The edges will only be reversed if shouldReverseEdge(IEdge)
returns true
for each edge.
For each edge an EdgePortsChanged
event will be dispatched.
public void selectNodeAndSelfloopBends(INode node)
This method delegates to GraphInputMode.setSelected(IModelItem, boolean)
for the node and all adjacent self loop
bends.
node
- The node to select.public final void setAddLabelAllowed(boolean value)
ICommand.ADD_LABEL
command should be handled.
If this flag is set to true
pressing Shift+F2 will start the label editor. By default this feature is enabled.
value
- The AddLabelAllowed to set.createLabel(ILabelOwner)
,
isAddLabelAllowed()
public final void setAdjustContentRectPolicy(AdjustContentRectPolicy value)
ContentRect
if the graph changes.
The adjustContentRect()
method is called whenever the content changes. The default is
AdjustContentRectPolicy.UNION
.
value
- The AdjustContentRectPolicy to set.getAdjustContentRectPolicy()
public final void setAdjustGroupNodeSizeAllowed(boolean value)
ICommand.ADJUST_GROUP_NODE_SIZE
command should be handled.
This setting has no effect if grouping operations are generally disallowed by setting GroupingOperationsAllowed
to false
.
The default value is true
.
value
- The AdjustGroupNodeSizeAllowed to set.isGroupingOperationsAllowed()
,
adjustGroupNodeSizes()
,
adjustGroupNodeSize(Iterable)
,
isAdjustGroupNodeSizeAllowed()
public final void setAutoRemovingEmptyLabelsEnabled(boolean value)
remove labels
from the
graph when a label text has been edited and the label text is empty.
The default value is true
.
value
- true
if empty labels should be removed after text editing; otherwise, false
.isAutoRemovingEmptyLabelsEnabled()
public final void setAutoSelectingSelfloopBendsEnabled(boolean value)
The default value is true
.
value
- The AutoSelectingSelfloopBendsEnabled to set.isAutoSelectingSelfloopBendsEnabled()
public final void setClearSelectionAllowed(boolean value)
ICommand.DESELECT_ALL
command should be handled.
The default value is true
.
value
- The ClearSelectionAllowed to set.isClearSelectionAllowed()
public final void setContentRectMargins(InsetsD value)
CanvasControl.updateContentRect(InsetsD, ICanvasObjectGroup)
in adjustContentRect()
calls.value
- The ContentRectMargins to set.getContentRectMargins()
public final void setCreateBendAllowed(boolean value)
bend creation
should be
enabled
.
This property delegates to CreateBendInputMode
's Enabled
property.
The default value is true
.
value
- The CreateBendAllowed to set.isCreateBendAllowed()
public final void setCreateBendInputMode(CreateBendInputMode value)
CreateBendInputMode
property.
If the field has not yet been initialized upon first access, the factory method createCreateBendInputMode()
will be called. Upon change the onCreateBendInputModeChanged(CreateBendInputMode, CreateBendInputMode)
method
will be called.
By default this input mode has a priority of 42
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The CreateBendInputMode to set.getCreateBendInputMode()
public final void setCreateEdgeAllowed(boolean value)
edge creation
should be
enabled
.
This property delegates to CreateEdgeInputMode
's Enabled
property.
The default value is true
.
value
- The CreateEdgeAllowed to set.isCreateEdgeAllowed()
public final void setCreateEdgeInputMode(CreateEdgeInputMode value)
CreateEdgeInputMode
property.
If the field has not yet been initialized upon first access, the factory method createCreateEdgeInputMode()
will be called. Upon change the onCreateEdgeInputModeChanged(CreateEdgeInputMode, CreateEdgeInputMode)
method
will be called.
By default this input mode has a priority of 45
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The CreateEdgeInputMode to set.getCreateEdgeInputMode()
public final void setCreateNodeAllowed(boolean value)
node creation
by clicking on an empty canvas location is
enabled.
To disable node creation via drag and drop gestures, the NodeDropInputMode
must be
disabled, too. However, it is disabled by default.
The default value is true
.
value
- The CreateNodeAllowed to set.getNodeCreator()
,
createNode(PointD)
,
isCreateNodeAllowed()
public final void setDeletableItems(GraphItemTypes value)
deleteSelection()
action.
The default is GraphItemTypes.ALL
.
value
- The DeletableItems to set.shouldDelete(IModelItem)
,
getDeletableItems()
public final void setDeletablePredicate(Predicate<IModelItem> value)
IModelItem
can be deleted or not.value
- The DeletablePredicate to set.getDeletablePredicate()
public final void setDuplicateAllowed(boolean value)
ICommand.DUPLICATE
command should be handled.
This setting has no effect if clipboard operations are generally disallowed by setting ClipboardOperationsAllowed
to false
.
The default value is true
.
value
- The DuplicateAllowed to set.isDuplicateAllowed()
public final void setEditLabelAllowed(boolean value)
ICommand.EDIT_LABEL
command should be handled.
If this flag is set to true
pressing F2 will start the label editor. By default this feature is enabled.
value
- The EditLabelAllowed to set.editLabel(ILabel)
,
onEditLabel()
,
isEditLabelAllowed()
public final void setEditLabelOnDoubleClickAllowed(boolean value)
If enabled, double-clicking an item will automatically execute the ICommand.EDIT_LABEL
command.
This setting has no effect if label editing is generally disallowed by setting EditLabelAllowed
to false
.
The default value is true
.
value
- The EditLabelOnDoubleClickAllowed to set.isEditLabelAllowed()
,
isEditLabelOnDoubleClickAllowed()
public final void setGroupingOperationsAllowed(boolean value)
grouping selected nodes
or moving nodes into group nodes
should be enabled.
Setting this property to false
effectively disables handling of all grouping
commands
. If this property is set to true
the related properties
GroupSelectionAllowed
,
UngroupSelectionAllowed
, and ReparentNodesAllowed
allow for selectively enabling or disabling only certain grouping operations.
The default value is false
.
value
- Whether grouping operations are supported by this input mode.isGroupSelectionAllowed()
,
isUngroupSelectionAllowed()
,
isAdjustGroupNodeSizeAllowed()
,
isReparentNodesAllowed()
,
isGroupingOperationsAllowed()
public final void setGroupSelectionAllowed(boolean value)
ICommand.GROUP_SELECTION
command should be handled.
This setting has no effect if grouping operations are generally disallowed by setting GroupingOperationsAllowed
to false
.
The default value is true
.
value
- The GroupSelectionAllowed to set.isGroupingOperationsAllowed()
,
groupSelection()
,
isGroupSelectionAllowed()
public final void setHandleInputMode(HandleInputMode value)
HandleInputMode
property.
If the field has not yet been initialized upon first access, the factory method createHandleInputMode()
will be
called. Upon change the onHandleInputModeChanged(HandleInputMode, HandleInputMode)
method will be called.
By default this input mode has a priority of 0
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The HandleInputMode to set.getHandleInputMode()
public final void setHidingLabelDuringEditingEnabled(boolean value)
If enabled, any selection, focus, and highlight visualizations of the label are hidden along with the label visualization itself.
Even if enabled, the label text is still visible in the TextBox
.
The default value is true
.
value
- The HidingLabelDuringEditingEnabled to set.isHidingLabelDuringEditingEnabled()
public final void setHitTester(IHitTester<IModelItem> value)
The enumerator will be queried for hit tests if the user clicks on the canvas.
value
- The HitTester to set.getHitTester()
public final void setLabelEditableItems(GraphItemTypes value)
labels edited
.
The default is GraphItemTypes.LABEL_OWNER
|GraphItemTypes.LABEL
, which allows for editing the labels of
ILabelOwner
s, and existing ILabel
s.
value
- The LabelEditableItems to set.shouldEditLabel(IModelItem)
,
getLabelEditableItems()
public final void setLabelSnapContext(SnapContext value)
LabelSnapContext
instance that handles interactive snapping of
ILabel
s to their owner during drag operations like movements.
Setting this property to null
will disable snapping, whereas setting it to null
will make the child
modes use the context from their IInputModeContext
s, if available. Upon change the onLabelSnapContextChanged(SnapContext, SnapContext)
method is called, which will as a side effect configure the snap context to display the SnapResult
s in the
CanvasControl
. Default is null
.
value
- The LabelSnapContext to set.getLabelSnapContext()
public void setLabelText(ILabel label, String text)
edited
.
Depending on AutoRemovingEmptyLabelsEnabled
it will either set the label's
text or remove it from the graph. Also this method will query the label's Owner
for an INodeSizeConstraintProvider
if the owner is an INode
and will make sure that the size constraints are still kept if the PreferredSize
changes due to the edit by calling adjustToSizeConstraints(INode)
.
label
- The label to set the text or remove.text
- The new text.public final void setMovableItems(GraphItemTypes value)
MoveInputMode
or MoveLabelInputMode
respectively in case of labels.
The default is GraphItemTypes.ALL
.
value
- The MovableItems to set.shouldMove(IModelItem)
,
getMovableItems()
public final void setMoveInputMode(MoveInputMode value)
MoveInputMode
property.
If the field has not yet been initialized upon first access, the factory method createMoveInputMode()
will be
called. Upon change the onMoveInputModeChanged(MoveInputMode, MoveInputMode)
method will be called.
By default this input mode has a priority of 40
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The MoveInputMode to set.shouldMove(IModelItem)
,
getMoveInputMode()
public final void setMoveLabelInputMode(MoveLabelInputMode value)
MoveLabelInputMode
property.
This mode is responsible for moving labels to another candidate position. If the field has not yet been initialized upon
first access, the factory method createMoveLabelInputMode()
will be called. Upon change the onMoveLabelInputModeChanged(MoveLabelInputMode, MoveLabelInputMode)
method will be called.
By default this input mode has a priority of 39
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The MoveLabelInputMode to set.shouldMove(IModelItem)
,
getMoveLabelInputMode()
public final void setNodeCreator(INodeCreationCallback value)
A null
value will disable node creation using mouse clicks, just as setting CreateNodeAllowed
to false
.
value
- The NodeCreator to set.createNode(PointD)
,
getNodeCreator()
public final void setNodeDropInputMode(NodeDropInputMode value)
NodeDropInputMode
property that is responsible for handling drag and drop
operations of nodes onto the Canvas.
The mode by default is disabled
and needs to be enabled
to work, first. If the field has not yet been initialized upon first access, the factory method createNodeDropInputMode()
will be called. Upon change the onNodeDropInputModeChanged(NodeDropInputMode, NodeDropInputMode)
method will be
called.
By default this input mode has a priority of 70
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The NodeDropInputMode to set.getNodeDropInputMode()
public void setNodeLayout(INode node, RectD layout)
This method differs from a simple call to IGraph.setNodeLayout(INode, RectD)
in a number of ways:
IReshapeHandler
implementation found
in its lookup. This enables correctly adjusting e.g. affected orthogonal edges and parent group nodes.
adjustContentRect()
is called.node
- The node to reshape.layout
- The new node layout.public final void setOrthogonalBendRemovalEnabled(OrthogonalEdgeEditingPolicy value)
By default this feature is enabled automatically if an OrthogonalEdgeEditingContext
is set.
value
- The OrthogonalBendRemovalEnabled to set.getOrthogonalEdgeEditingContext()
,
getOrthogonalBendRemovalEnabled()
public final void setOrthogonalEdgeEditingContext(OrthogonalEdgeEditingContext value)
The default value is null
.
value
- The orthogonal edge editing context.getOrthogonalEdgeEditingContext()
public final void setPasteAllowed(boolean value)
ICommand.PASTE
command should be handled.
This setting has no effect if clipboard operations are generally disallowed by setting ClipboardOperationsAllowed
to false
.
The default value is true
.
value
- The PasteAllowed to set.isPasteAllowed()
public final void setPasteDelta(PointD value)
Default is (15, 15).
value
- The PasteDelta to set.getPasteDelta()
public final void setPasteSelectableItems(GraphItemTypes value)
paste()
or duplicateSelection()
.
The default is GraphItemTypes.ALL
.
value
- The PasteSelectableItems to set.shouldSelectAfterPaste(IModelItem)
,
isSmartPasteSelectionEnabled()
,
GraphInputMode.setSelected(IModelItem, boolean)
,
getPasteSelectableItems()
public final void setReparentNodeHandler(IReparentNodeHandler value)
IReparentNodeHandler
that is used for moving nodes out of group nodes or into other group nodes.
This setting has no effect if reparenting nodes is generally disallowed by setting ReparentNodesAllowed
to false
.
Child input modes will use this IReparentNodeHandler
as well, since it is added to
childInputModeContextLookup(Class)
.
If not already initialized, the factory method createReparentNodeHandler()
will be called on first access. Upon
changes, the onReparentNodeHandlerChanged(IReparentNodeHandler, IReparentNodeHandler)
method will be called.
value
- The ReparentNodeHandler to set.isReparentNodesAllowed()
,
ReparentNodeHandler
,
getReparentNodeHandler()
public final void setReparentNodesAllowed(boolean value)
If set to false
the ReparentNodeHandler
will effectively be disabled and not
called anymore for reparenting operations.
The default value is true
.
value
- The ReparentNodesAllowed to set.getReparentNodeHandler()
,
isReparentNodesAllowed()
public final void setReparentToNonGroupNodesAllowed(boolean value)
non-group nodes
is allowed to
convert them into group nodes.
If reparenting nodes is allowed
in general and this property is enabled, users may
reparent nodes not only to groups and folders but also to non-group nodes. Still, the decision about the final
acceptance of the reparenting and the actual execution are delegated to the
ReparentNodeHandler
.
This setting has no effect if grouping operations are generally disallowed by setting GroupingOperationsAllowed
to false
.
The default value is false
.
value
- The ReparentToNonGroupNodesAllowed to set.isGroupingOperationsAllowed()
,
isReparentToNonGroupNodesAllowed()
public final void setReverseEdgeAllowed(boolean value)
ICommand.REVERSE_EDGE
command should be handled.
If set to false
the methods reverseEdge(IEdge)
, reverseEdges(Iterable)
, and reverseSelectedEdges()
do nothing.
The default value is true
.
value
- The ReverseEdgeAllowed to set.isReverseEdgeAllowed()
public final void setShowHandleItems(GraphItemTypes value)
IHandle
s shown.
The default is GraphItemTypes.ALL
.
value
- The ShowHandleItems to set.shouldShowHandles(IModelItem)
,
getShowHandleItems()
public final void setSmartPasteSelectionEnabled(boolean value)
paste()
or duplicateSelection()
if they were selected when they were initially copied into the clipboard.
The default is true
. Disabling this feature will select all PasteSelectableItems
after a paste or duplicate operation.
value
- The SmartPasteSelectionEnabled to set.shouldSelectAfterPaste(IModelItem)
,
getPasteSelectableItems()
,
GraphInputMode.setSelected(IModelItem, boolean)
,
isSmartPasteSelectionEnabled()
public final void setSnapContext(SnapContext value)
SnapContext
instance that handles interactive snapping of elements during drag operations like movements.
Setting this property to a SnapContext
which is disabled
will disable snapping,
whereas setting it to null
will make the child modes use the context from their IInputModeContext
s, if
available. Upon change the onSnapContextChanged(SnapContext, SnapContext)
method is called, which will as a
side effect configure the snap context to display the SnapResult
s in the CanvasControl
. Default is
null
.
value
- The SnapContext to set.getSnapContext()
public final void setTextEditorInputMode(TextEditorInputMode value)
TextEditorInputMode
property.
If the field has not yet been initialized upon first access, the factory method createTextEditorInputMode()
will be called. Upon change the onTextEditorInputModeChanged(TextEditorInputMode, TextEditorInputMode)
method
will be called.
By default this input mode has a priority of 100
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The TextEditorInputMode to set.getTextEditorInputMode()
public final void setUndoOperationsAllowed(boolean value)
undo()
and redo()
should be enabled.
Note that even if this feature is enabled, an undo engine
needs to be
available in the
InputModeContext
in order to work.
Setting this property to false
effectively disables handling of the commands ICommand.UNDO
and
ICommand.REDO
.
The default value is true
.
value
- The UndoOperationsAllowed to set.undo()
,
redo()
,
isUndoOperationsAllowed()
public final void setUngroupSelectionAllowed(boolean value)
ICommand.UNGROUP_SELECTION
command should be handled.
This setting has no effect if grouping operations are generally disallowed by setting GroupingOperationsAllowed
to false
.
The default value is true
.
value
- The UngroupSelectionAllowed to set.isGroupingOperationsAllowed()
,
ungroupSelection()
,
isUngroupSelectionAllowed()
public final void setUsingCurrentItemForCommandsEnabled(boolean value)
CurrentItem
as a fallback for the
commands if no item is provided in the parameter and the current selection is empty.
This applies to the following commands:
value
- true
if the current item should be used as a fallback; false
otherwise, which is the default.isUsingCurrentItemForCommandsEnabled()
public void setWaiting(boolean value)
WaitInputMode
to delegate wait requests to.value
- The Waiting to set.isWaiting()
protected boolean shouldAddLabel(IModelItem item)
item
This is overridden if the item has a IEditLabelHelper
that returns false
for its IEditLabelHelper.onLabelAdding(LabelEditingEventArgs)
method.
item
- The item to querytrue
iff a label may be addedprotected boolean shouldDelete(IModelItem item)
deleteSelection()
.
This implementation uses and honors the DeletableItems
and DeletablePredicate
properties.
item
- The item.protected boolean shouldEditLabel(IModelItem item)
onEditLabel()
or onAddLabel()
.item
- The item.protected boolean shouldMove(IModelItem item)
This predicate determines whether an item can be moved by any appropriate input mode, e.g by default it also
evaluates to true
for ILabel
s which are moved by MoveLabelInputMode
instead of MoveInputMode
.
This implementation returns the result of the MovableItems
property for the given item.
item
- The item to check.getMovableItems()
,
getMoveInputMode()
,
getMoveLabelInputMode()
protected boolean shouldReverseEdge(IEdge edge)
reverseEdge(IEdge)
,
reverseEdges(Iterable)
, or reverseEdges(Iterable)
.
This implementation returns the value of ReverseEdgeAllowed
.
edge
- The edge which should be reversed.true
if the edge should be reversed.protected boolean shouldSelectAfterPaste(IModelItem item)
paste()
or duplicateSelection()
.
This implementation returns true
for the PasteSelectableItems
items.
item
- The item to check.paste()
or duplicateSelection()
.protected boolean shouldShowHandles(IModelItem item)
handles
for the given item.item
- The item to checkShowHandleItems
, property.public void snapToGrid(IInputModeContext context, INode node)
IGridConstraintProvider
for INode
s queried from the given context.
This method is called by this instance whenever new nodes are created using the UI.
public void undo()
public void ungroupSelection()
The default shortcut for this is Ctrl+U on Windows and Linux and Command+U on Mac OS.
ICommand.UNGROUP_SELECTION
public void uninstall(IInputModeContext context)
IInputMode
This code should clean up all changes made to the canvas in the IInputMode.install(IInputModeContext, ConcurrencyController)
method. After a mode has been uninstalled it can be installed again into the same or another canvas.
uninstall
in interface IInputMode
context
- The context to deregister from. This is the same instance that had been passed to IInputMode.install(IInputModeContext, ConcurrencyController)
during installation.public final void addCanvasClickedListener(IEventHandler<ClickEventArgs> canvasClickedEvent)
CanvasClicked
event that occurs when the empty canvas area has been clicked.
If one of the event handlers sets the Handled
property to true
the event will
not be propagated anymore.
canvasClickedEvent
- The listener to add.addItemClickedListener(IEventHandler)
,
removeCanvasClickedListener(IEventHandler)
public final void addItemClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemClickedEvent)
ItemClicked
event that occurs when an item has been clicked.
If one of the event handlers sets the Handled
property to true
the
event will not be propagated anymore.
This event will also be raised for taps
.
Button-specific events (ItemLeftClicked
and
ItemRightClicked
) will be raised before this event. If one of
those is marked Handled
this event will not be raised anymore.
itemClickedEvent
- The listener to add.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemLeftClickedListener(IEventHandler)
,
addItemRightClickedListener(IEventHandler)
,
removeItemClickedListener(IEventHandler)
public final void addItemDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemDoubleClickedEvent)
ItemDoubleClicked
event that occurs when an item has been double clicked.
If one of the event handlers sets the Handled
property to true
the
event will not be propagated anymore.
Depending on the value of the DoubleClickPolicy
property of ClickInputMode
this event may be preceded by no, one, or two ItemClicked
events (as well
as the corresponding button-specific event).
Button-specific events (ItemLeftDoubleClicked
and
ItemRightDoubleClicked
) will be raised before this event.
If one of those is marked Handled
this event will not be raised anymore.
itemDoubleClickedEvent
- The listener to add.addItemClickedListener(IEventHandler)
,
getClickableItems()
,
addItemLeftDoubleClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
removeItemDoubleClickedListener(IEventHandler)
public final void addItemLeftClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftClickedEvent)
ItemLeftClicked
event that occurs when an item has been left clicked.
This event will be raised before the ItemClicked
event. If one of the
event handlers sets the Handled
property to true
the event will not be
propagated anymore. This also means that the ItemClicked
event will not
be raised in that case.
itemLeftClickedEvent
- The listener to add.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemClickedListener(IEventHandler)
,
addItemRightClickedListener(IEventHandler)
,
addItemLeftDoubleClickedListener(IEventHandler)
,
removeItemLeftClickedListener(IEventHandler)
public final void addItemLeftDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftDoubleClickedEvent)
ItemLeftDoubleClicked
event that occurs when an item has been left double
clicked.
This event will be raised before the ItemDoubleClicked
event. If
one of the event handlers sets the Handled
property to true
the event
will not be propagated anymore. This also means that the ItemDoubleClicked
event will not be raised in that case.
itemLeftDoubleClickedEvent
- The listener to add.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
removeItemLeftDoubleClickedListener(IEventHandler)
public final void addItemRightClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightClickedEvent)
ItemRightClicked
event that occurs when an item has been right clicked.
This event will be raised before the ItemClicked
event. If one of the
event handlers sets the Handled
property to true
the event will not be
propagated anymore. This also means that the ItemClicked
event will not
be raised in that case.
itemRightClickedEvent
- The listener to add.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemClickedListener(IEventHandler)
,
addItemLeftClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
removeItemRightClickedListener(IEventHandler)
public final void addItemRightDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightDoubleClickedEvent)
ItemRightDoubleClicked
event that occurs when an item has been right double
clicked.
This event will be raised before the ItemDoubleClicked
event. If
one of the event handlers sets the Handled
property to true
the event
will not be propagated anymore. This also means that the ItemDoubleClicked
event will not be raised in that case.
itemRightDoubleClickedEvent
- The listener to add.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemLeftDoubleClickedListener(IEventHandler)
,
removeItemRightDoubleClickedListener(IEventHandler)
public final void addMultiSelectionFinishedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionFinishedEvent)
MultiSelectionFinished
event that occurs when a single or multi select operation
has been finished.
The event is not triggered for the individual selection operations that constitute a multi selection operation.
multiSelectionFinishedEvent
- The listener to add.removeMultiSelectionFinishedListener(IEventHandler)
public final void addMultiSelectionStartedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionStartedEvent)
MultiSelectionStarted
event that occurs when a single or multi select operation
has been started.
The event is not triggered for the individual selection operations that constitute a multi selection operation.
multiSelectionStartedEvent
- The listener to add.removeMultiSelectionStartedListener(IEventHandler)
public final void addPopulateItemContextMenuListener(IEventHandler<PopulateItemContextMenuEventArgs<IModelItem>> populateItemContextMenuEvent)
PopulateItemContextMenu
event that occurs when the context menu
over an item is about to be opened to determine the contents of the
Menu
.
This method will only be called for items that match the ContextMenuItems
type.
populateItemContextMenuEvent
- The listener to add.removePopulateItemContextMenuListener(IEventHandler)
public final void addQueryItemToolTipListener(IEventHandler<QueryItemToolTipEventArgs<IModelItem>> queryItemToolTipEvent)
QueryItemToolTip
event that occurs when the mouse is hovering
over an item to determine the tool tip to display.
This method will only be called for items that match the ToolTipItems
type.
queryItemToolTipEvent
- The listener to add.removeQueryItemToolTipListener(IEventHandler)
public void clearSelection()
GraphSelection
.
This implementation may be overridden for customizations. All it does is call
ISelectionModel.clear()
.
protected void click(IModelItem item, ClickEventArgs args)
This will raise the ItemLeftClicked
, ItemRightClicked
(depending on the button), and ItemClicked
events. If either event is
unhandled by all its event handlers the item will be selected
and
focused
. Before selection
the current selection will be cleared
, unless the MultiSelectionRecognizer
is triggered.
item
- The item that has been clicked.args
- The original event arguments for the click. Setting its Handled
property to true
will indicate that the click was handled. By default this happens when the clicked item is either selected or focused.protected boolean clickClearSelection(IInputModeContext context)
the click
is not
recognized by MultiSelectionRecognizer
.
This method is only called if no item has been hit and at least one item is currently selected.
This will use the clearSelection()
method to deselect all items.
context
- The context where the click appearedpublic void copy()
protected ClickInputMode createClickInputMode()
This method will be called upon first access to the ClickInputMode
property.
This implementation activates
both MouseButtons.LEFT
and
MouseButtons.RIGHT
protected AbstractContextMenuInputMode createContextMenuInputMode()
ContextMenuInputMode
property.
This method will be called upon first access to the AbstractContextMenuInputMode
property.
protected ItemHoverInputMode createItemHoverInputMode()
ItemHoverInputMode
property.
This method will be called upon first access to the ItemHoverInputMode
property.
ItemHoverInputMode
with the HoverItems
property set to GraphItemTypes.NONE
.protected KeyboardInputMode createKeyboardInputMode()
KeyboardInputMode
instance.protected MarqueeSelectionInputMode createMarqueeSelectionInputMode()
MarqueeSelectionInputMode
property.
This method will be called upon first access to the MarqueeSelectionInputMode
property.
protected MouseHoverInputMode createMouseHoverInputMode()
MouseHoverInputMode
property.
This method will be called upon first access to the MouseHoverInputMode
property.
MouseHoverInputMode
protected NavigationInputMode createNavigationInputMode()
NavigationInputMode
property.
This method will be called upon first access to the NavigationInputMode
property.
protected SelectionEventArgs<IModelItem> createSelectionEventArgs(IInputModeContext context)
SelectionEventArgs
using the GraphSelection
for this input mode.context
- An input mode context that is available in the SelectionEventArgs
.
Can be null
in which case a new context for this instance is created automatically.
protected TapInputMode createTapInputMode()
TapInputMode
property.
This method will be called upon first access to the TapInputMode
property.
protected WaitInputMode createWaitInputMode()
This method will be called upon first access to the WaitInputMode
property.
WaitInputMode
public final IEnumerable<IModelItem> findItems(IInputModeContext context, PointD location, GraphItemTypes[] tests)
This implementation uses the HitTester
to
determine the hit items.
context
- The context to use for to the IHitTestable.isHit(IInputModeContext, PointD)
callback.location
- The location to test.tests
- An array of GraphItemTypes
values that encode for which model items the hit test should be performed for
prioritizing.public IEnumerable<IModelItem> findItems(IInputModeContext context, PointD location, GraphItemTypes[] tests, Predicate<IModelItem> filter)
This implementation uses the HitTester
to
determine the hit items.
context
- The context to use for to the IHitTestable.isHit(IInputModeContext, PointD)
callback.location
- The location to test.tests
- An array of GraphItemTypes
values that encode for which model items the hit test should be performed for
prioritizing.filter
- The predicate that can be used to filter the results. May be null
.public final IEnumerable<IModelItem> findItems(PointD location, GraphItemTypes[] tests)
This implementation uses the HitTester
to
determine the hit items.
location
- The location to test.tests
- An array of GraphItemTypes
values that encode for which model items the hit test should be performed for
prioritizing.public IEnumerable<IModelItem> findItems(PointD location, GraphItemTypes[] tests, Predicate<IModelItem> filter)
This implementation uses the HitTester
to
determine the hit items.
location
- The location to test.tests
- An array of GraphItemTypes
values that encode for which model items the hit test should be performed for
prioritizing.filter
- The predicate that can be used to filter the results. May be null
.public final Collection<ICommand> getAvailableCommands()
This collection can be modified by removing commands to prevent the input mode from handling them. Previously removed commands can also be re-added again to enable them again. However, the input mode will never handle commands that weren't in the initial collection. Adding those will do nothing.
public final GraphItemTypes getClickableItems()
item click events
.
This also affects taps.
The default is GraphItemTypes.ALL
.
shouldClick(IModelItem)
,
setClickableItems(GraphItemTypes)
public final GraphItemTypes[] getClickHitTestOrder()
Change this field to adjust which items will be selected
if there are multiple
items at a given location. The default order is
getClickSelectableItems()
,
getSelectableItems()
,
findItems(PointD, GraphItemTypes[], Predicate)
,
setClickHitTestOrder(GraphItemTypes[])
public final ClickInputMode getClickInputMode()
ClickInputMode
that is used by this instance to determine clicks.
Whenever the mode detects a click
, this mode will use the IHitTester
from the InputModeContext
to determine the items being hit. If they
match the ClickableItems
type, the ItemClicked
event will be triggered. If they shouldFocus(IModelItem)
, the item will be
set as the current item
.
If the field has not yet been initialized upon first access, the factory method createClickInputMode()
will be
called. Upon change the onClickInputModeChanged(ClickInputMode, ClickInputMode)
method will be called.
By default this input mode has a priority of 10
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.onItemClicked(ItemClickedEventArgs)
,
setClickInputMode(ClickInputMode)
public final GraphItemTypes getClickSelectableItems()
The default is GraphItemTypes.ALL
.
shouldClickSelect(IModelItem)
,
setSelected(IModelItem, boolean)
,
setClickSelectableItems(GraphItemTypes)
public final AbstractContextMenuInputMode getContextMenuInputMode()
ContextMenuInputMode
property.
If the field has not yet been initialized upon first access, the factory method createContextMenuInputMode()
will be called. Upon change the onContextMenuInputModeChanged(AbstractContextMenuInputMode, AbstractContextMenuInputMode)
method will be called.
By default this input mode has a priority of 60
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setContextMenuInputMode(AbstractContextMenuInputMode)
public final GraphItemTypes getContextMenuItems()
The items for which a context menu should be queried
. The
default value is GraphItemTypes.NODE
|GraphItemTypes.EDGE
.
setContextMenuItems(GraphItemTypes)
public final IEventRecognizer getCyclicSelectionRecognizer()
IEventRecognizer
that will be queried to decide if a click should cycle through all the items that are
currently under the mouse cursor.
If the recognizer determines that the user wanted to use the cyclic click selection behavior, the HitTester
will be queried for the given item and previously reported items will be ignored. E.g. if multiple nodes are overlapping
each other, clicking on them will report the first item for the first click, the second one for the second click and so
on. If all elements have been reported previously, the first one is going to be reported again. If the order of the
elements at the clicked location changes, the cyclic selection is restarted anew.
The default is IEventRecognizer.ALT_PRESSED
.
setCyclicSelectionRecognizer(IEventRecognizer)
public final IEventRecognizer getDetailSelectionRecognizer()
IEventRecognizer
that will be queried to decide if a click should select the item that is currently
visible under the mouse cursor, without giving more important items higher priority.
If the recognizer determines that the user wanted to use the detail clicking behavior, the HitTester
will be queried for the given item and the first item that is returned will be considered a hit. Otherwise all hit items
are examined and are prioritized by item type. E.g. by default clicking on a node will select the node, even if there is
a node label which has been clicked at the same point. If detail selection is recognized, the label will be selected.
The default is IEventRecognizer.SHIFT_PRESSED
.
setDetailSelectionRecognizer(IEventRecognizer)
public final GraphItemTypes[] getDoubleClickHitTestOrder()
Change this field to adjust which items will be considered when double-clicked
if there are multiple items at a given location. The default order is
getClickSelectableItems()
,
getSelectableItems()
,
findItems(IInputModeContext, PointD, GraphItemTypes[], Predicate)
,
setDoubleClickHitTestOrder(GraphItemTypes[])
public final GraphItemTypes getFocusableItems()
setCurrentItem(IModelItem)
method.
The focusable items. The default is GraphItemTypes.NODE
setFocusableItems(GraphItemTypes)
public IGraph getGraph()
InputModeContext
.null
.public IGraphSelection getGraphSelection()
InputModeContext
.public final ItemHoverInputMode getItemHoverInputMode()
ItemHoverInputMode
that is provided by this instance for those who need to
make use of it.
Note that initially the HoverItems
property is set to
GraphItemTypes.NONE
, which effectively disables the functionality of the mode initially. In order to get the
mode to fire events, the property should be set to a corresponding value.
If the backing field has not yet been initialized upon first access, the factory method createItemHoverInputMode()
will be called. Upon change the onItemHoverInputModeChanged(ItemHoverInputMode, ItemHoverInputMode)
method will
be called.
By default this input mode has a priority of 55
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setItemHoverInputMode(ItemHoverInputMode)
public final KeyboardInputMode getKeyboardInputMode()
KeyboardInputMode
.
By default this input mode has a priority of 0
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.KeyboardInputMode
.setKeyboardInputMode(KeyboardInputMode)
public final GraphItemTypes getMarqueeSelectableItems()
marquee selections
.
The default is a combination of GraphItemTypes.NODE
, GraphItemTypes.EDGE
, and
GraphItemTypes.BEND
.
shouldMarqueeSelect(IModelItem)
,
setSelected(IModelItem, boolean)
,
setMarqueeSelectableItems(GraphItemTypes)
public final MarqueeSelectionInputMode getMarqueeSelectionInputMode()
MarqueeSelectionInputMode
property.
If the field has not yet been initialized upon first access, the factory method createMarqueeSelectionInputMode()
will be called. Upon change the onMarqueeSelectionInputModeChanged(MarqueeSelectionInputMode, MarqueeSelectionInputMode)
method will be called.
By default this input mode has a priority of 50
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setMarqueeSelectionInputMode(MarqueeSelectionInputMode)
public final MouseHoverInputMode getMouseHoverInputMode()
MouseHoverInputMode
property.
If the field has not yet been initialized upon first access, the factory method createMouseHoverInputMode()
will be called. Upon change the onMouseHoverInputModeChanged(MouseHoverInputMode, MouseHoverInputMode)
method
will be called.
By default this input mode has a priority of 100
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setMouseHoverInputMode(MouseHoverInputMode)
public final MoveViewportInputMode getMoveViewportInputMode()
MoveViewportInputMode
associated with this instance.
If the field has not yet been initialized upon first access, the factory method createMoveViewportInputMode()
will be called. Upon change the onMoveViewportInputModeChanged(MoveViewportInputMode, MoveViewportInputMode)
method will be called.
By default this input mode has a priority of 39
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setMoveViewportInputMode(MoveViewportInputMode)
public final IEventRecognizer getMultiSelectionRecognizer()
IEventRecognizer
that will be queried to decide if a click is deemed a multi selection gesture.
The default is IEventRecognizer.SHORTCUT_PRESSED
.
setMultiSelectionRecognizer(IEventRecognizer)
public final NavigationInputMode getNavigationInputMode()
NavigationInputMode
property.
This mode is responsible for navigating and traversing the elements in the IGraph
. If the field has not yet been
initialized upon first access, the factory method createNavigationInputMode()
will be called. Upon change the onNavigationInputModeChanged(NavigationInputMode, NavigationInputMode)
method will be called.
By default this input mode has a priority of 55
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setNavigationInputMode(NavigationInputMode)
public final GraphItemTypes getSelectableItems()
The default is GraphItemTypes.ALL
.
setSelected(IModelItem, boolean)
,
setSelectableItems(GraphItemTypes)
public final Predicate<IModelItem> getSelectablePredicate()
IModelItem
is selectable.
This allows to further restrict which items are selectable, compared to SelectableItems
.
If this property is set to null
the effect is the same as a predicate that always returns true
.
setSelectablePredicate(Predicate)
public final TapInputMode getTapInputMode()
TapInputMode
property.
If the field has not yet been initialized upon first access, the factory method createTapInputMode()
will be
called. Upon change the onTapInputModeChanged(TapInputMode, TapInputMode)
method will be called.
By default this input mode has a priority of 20
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.setTapInputMode(TapInputMode)
public final GraphItemTypes getToolTipItems()
The items for which a tool tip text should be queried
. The default
value is
GraphItemTypes.NODE
|GraphItemTypes.EDGE
|GraphItemTypes.LABEL
|GraphItemTypes.PORT
|.
setToolTipItems(GraphItemTypes)
public final WaitInputMode getWaitInputMode()
WaitInputMode
that is provided by this instance for those who need to make use of it.
If the field has not yet been initialized upon first access, the factory method createWaitInputMode()
will be
called. Upon change the onWaitInputModeChanged(WaitInputMode, WaitInputMode)
method will be called.
By default this input mode has a priority of -1
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.WaitInputMode.isWaiting()
,
setWaitInputMode(WaitInputMode)
public final boolean isClipboardOperationsAllowed()
Default value is true
setClipboardOperationsAllowed(boolean)
public final boolean isIgnoringVoidStylesEnabled()
VoidNodeStyle
, VoidEdgeStyle
, VoidLabelStyle
, and
VoidPortStyle
) should be ignored when selecting or focusing items.true
if void styles should be ignored for selection and focus; false
otherwise. Default is
true
.setIgnoringVoidStylesEnabled(boolean)
protected void marqueeSelect(IInputModeContext context, RectD marqueeRectangle)
This method is called internally when either the marqueeSelect(RectD)
method is called or the user performs a
marquee-selection gesture via MarqueeSelectionInputMode
.
context
- The input mode context.marqueeRectangle
- The selection rectangle.protected <T extends IModelItem> void marqueeSelect(IInputModeContext context, RectD marqueeRectangle, Iterable<T> items, Predicate<IModelItem> predicate)
This implementation iterates over the items and queries them for an implementation of IMarqueeTestable
using
their ILookup.lookup(Class)
. This instance will be used to determine whether the item should be selected.
This method is, in the default implementation, only called with individual item types in items
.
context
- The input mode context.marqueeRectangle
- The rectangle in world coordinates.items
- The items to iterate over.predicate
- The predicate that determines whether the provided item should be tested at all. May be null
.setSelected(IModelItem, boolean)
,
marqueeSelect(IInputModeContext, RectD)
public final void marqueeSelect(RectD marqueeRectangle)
It delegates directly to the marqueeSelect(IInputModeContext, RectD)
overload internally.
marqueeRectangle
- The selection rectangle.protected void onCanvasClicked(ClickEventArgs args)
CanvasClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ClickEventArgs
instance that contains the information about the click.protected void onClickInputModeChanged(ClickInputMode oldMode, ClickInputMode newMode)
ClickInputMode
property value changes and after initialization of the
field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onContextMenuInputModeChanged(AbstractContextMenuInputMode oldMode, AbstractContextMenuInputMode newMode)
AbstractContextMenuInputMode
property value changes and after initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onItemClicked(ItemClickedEventArgs<IModelItem> args)
ItemClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been clicked.protected void onItemDoubleClicked(ItemClickedEventArgs<IModelItem> args)
ItemDoubleClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been double clicked.protected void onItemHoverInputModeChanged(ItemHoverInputMode oldMode, ItemHoverInputMode newMode)
ItemHoverInputMode
property value changes and after initialization of
the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onItemLeftClicked(ItemClickedEventArgs<IModelItem> args)
ItemLeftClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been clicked.protected void onItemLeftDoubleClicked(ItemClickedEventArgs<IModelItem> args)
ItemLeftDoubleClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been double clicked.protected void onItemRightClicked(ItemClickedEventArgs<IModelItem> args)
ItemRightClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been clicked.protected void onItemRightDoubleClicked(ItemClickedEventArgs<IModelItem> args)
ItemRightDoubleClicked
event.
This implementation will stop the event propagation as soon as an event handler has set the Handled
property to true
.
args
- The ItemClickedEventArgs
instance that contains the item that has been double clicked.protected void onKeyboardInputModeChanged(KeyboardInputMode oldMode, KeyboardInputMode newMode)
KeyboardInputMode
changed.oldMode
- The old KeyboardInputMode
.newMode
- The new KeyboardInputMode
.protected void onMarqueeSelectionInputModeChanged(MarqueeSelectionInputMode oldMode, MarqueeSelectionInputMode newMode)
MarqueeSelectionInputMode
property value changes and after
initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onMouseHoverInputModeChanged(MouseHoverInputMode oldMode, MouseHoverInputMode newMode)
MouseHoverInputMode
property value changes and after initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onMoveViewportInputModeChanged(MoveViewportInputMode oldMode, MoveViewportInputMode newMode)
MoveViewportInputMode
property value changes and after
initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onMultiSelectionFinished(SelectionEventArgs<IModelItem> args)
MultiSelectionFinished
event.protected void onMultiSelectionStarted(SelectionEventArgs<IModelItem> args)
MultiSelectionStarted
event.protected void onNavigationInputModeChanged(NavigationInputMode oldMode, NavigationInputMode newMode)
NavigationInputMode
property value changes and after initialization of
the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onPopulateItemContextMenu(PopulateItemContextMenuEventArgs<IModelItem> args)
PopulateItemContextMenu
event.args
- The PopulateItemContextMenuEventArgs
instance containing the event data.protected void onQueryItemToolTip(QueryItemToolTipEventArgs<IModelItem> args)
QueryItemToolTip
event.args
- The QueryItemToolTipEventArgs
instance containing the event data.protected void onTapInputModeChanged(TapInputMode oldMode, TapInputMode newMode)
TapInputMode
property value changes and after initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valueprotected void onWaitInputModeChanged(WaitInputMode oldMode, WaitInputMode newMode)
WaitInputMode
property value changes and after initialization of the field.oldMode
- the old value, which may be null
the first timenewMode
- the new valuepublic final void removeCanvasClickedListener(IEventHandler<ClickEventArgs> canvasClickedEvent)
CanvasClicked
event that occurs when the empty canvas area has been clicked.
If one of the event handlers sets the Handled
property to true
the event will
not be propagated anymore.
canvasClickedEvent
- The listener to remove.addItemClickedListener(IEventHandler)
,
addCanvasClickedListener(IEventHandler)
public final void removeItemClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemClickedEvent)
ItemClicked
event that occurs when an item has been clicked.
If one of the event handlers sets the Handled
property to true
the
event will not be propagated anymore.
This event will also be raised for taps
.
Button-specific events (ItemLeftClicked
and
ItemRightClicked
) will be raised before this event. If one of
those is marked Handled
this event will not be raised anymore.
itemClickedEvent
- The listener to remove.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemLeftClickedListener(IEventHandler)
,
addItemRightClickedListener(IEventHandler)
,
addItemClickedListener(IEventHandler)
public final void removeItemDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemDoubleClickedEvent)
ItemDoubleClicked
event that occurs when an item has been double clicked.
If one of the event handlers sets the Handled
property to true
the
event will not be propagated anymore.
Depending on the value of the DoubleClickPolicy
property of ClickInputMode
this event may be preceded by no, one, or two ItemClicked
events (as well
as the corresponding button-specific event).
Button-specific events (ItemLeftDoubleClicked
and
ItemRightDoubleClicked
) will be raised before this event.
If one of those is marked Handled
this event will not be raised anymore.
itemDoubleClickedEvent
- The listener to remove.addItemClickedListener(IEventHandler)
,
getClickableItems()
,
addItemLeftDoubleClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
addItemDoubleClickedListener(IEventHandler)
public final void removeItemLeftClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftClickedEvent)
ItemLeftClicked
event that occurs when an item has been left clicked.
This event will be raised before the ItemClicked
event. If one of the
event handlers sets the Handled
property to true
the event will not be
propagated anymore. This also means that the ItemClicked
event will not
be raised in that case.
itemLeftClickedEvent
- The listener to remove.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemClickedListener(IEventHandler)
,
addItemRightClickedListener(IEventHandler)
,
addItemLeftDoubleClickedListener(IEventHandler)
,
addItemLeftClickedListener(IEventHandler)
public final void removeItemLeftDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemLeftDoubleClickedEvent)
ItemLeftDoubleClicked
event that occurs when an item has been left double
clicked.
This event will be raised before the ItemDoubleClicked
event. If
one of the event handlers sets the Handled
property to true
the event
will not be propagated anymore. This also means that the ItemDoubleClicked
event will not be raised in that case.
itemLeftDoubleClickedEvent
- The listener to remove.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
addItemLeftDoubleClickedListener(IEventHandler)
public final void removeItemRightClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightClickedEvent)
ItemRightClicked
event that occurs when an item has been right clicked.
This event will be raised before the ItemClicked
event. If one of the
event handlers sets the Handled
property to true
the event will not be
propagated anymore. This also means that the ItemClicked
event will not
be raised in that case.
itemRightClickedEvent
- The listener to remove.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemClickedListener(IEventHandler)
,
addItemLeftClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
,
addItemRightClickedListener(IEventHandler)
public final void removeItemRightDoubleClickedListener(IEventHandler<ItemClickedEventArgs<IModelItem>> itemRightDoubleClickedEvent)
ItemRightDoubleClicked
event that occurs when an item has been right double
clicked.
This event will be raised before the ItemDoubleClicked
event. If
one of the event handlers sets the Handled
property to true
the event
will not be propagated anymore. This also means that the ItemDoubleClicked
event will not be raised in that case.
itemRightDoubleClickedEvent
- The listener to remove.getClickableItems()
,
addItemDoubleClickedListener(IEventHandler)
,
addItemLeftDoubleClickedListener(IEventHandler)
,
addItemRightDoubleClickedListener(IEventHandler)
public final void removeMultiSelectionFinishedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionFinishedEvent)
MultiSelectionFinished
event that occurs when a single or multi select
operation has been finished.
The event is not triggered for the individual selection operations that constitute a multi selection operation.
multiSelectionFinishedEvent
- The listener to remove.addMultiSelectionFinishedListener(IEventHandler)
public final void removeMultiSelectionStartedListener(IEventHandler<SelectionEventArgs<IModelItem>> multiSelectionStartedEvent)
MultiSelectionStarted
event that occurs when a single or multi select
operation has been started.
The event is not triggered for the individual selection operations that constitute a multi selection operation.
multiSelectionStartedEvent
- The listener to remove.addMultiSelectionStartedListener(IEventHandler)
public final void removePopulateItemContextMenuListener(IEventHandler<PopulateItemContextMenuEventArgs<IModelItem>> populateItemContextMenuEvent)
PopulateItemContextMenu
event that occurs when the context menu
over an item is about to be opened to determine the contents of the
Menu
.
This method will only be called for items that match the ContextMenuItems
type.
populateItemContextMenuEvent
- The listener to remove.addPopulateItemContextMenuListener(IEventHandler)
public final void removeQueryItemToolTipListener(IEventHandler<QueryItemToolTipEventArgs<IModelItem>> queryItemToolTipEvent)
QueryItemToolTip
event that occurs when the mouse is hovering
over an item to determine the tool tip to display.
This method will only be called for items that match the ToolTipItems
type.
queryItemToolTipEvent
- The listener to remove.addQueryItemToolTipListener(IEventHandler)
public void selectAll()
By default, this method will be called in response to a Ctrl+A on Windows and Linux and Command+A on Mac OS key press recognized by
KeyboardInputMode
.
public final void setClickableItems(GraphItemTypes value)
item click events
.
This also affects taps.
The default is GraphItemTypes.ALL
.
value
- The ClickableItems to set.shouldClick(IModelItem)
,
getClickableItems()
public final void setClickHitTestOrder(GraphItemTypes[] value)
Change this field to adjust which items will be selected
if there are multiple
items at a given location. The default order is
value
- The ClickHitTestOrder to set.getClickSelectableItems()
,
getSelectableItems()
,
findItems(PointD, GraphItemTypes[], Predicate)
,
getClickHitTestOrder()
public final void setClickInputMode(ClickInputMode value)
ClickInputMode
that is used by this instance to determine clicks.
Whenever the mode detects a click
, this mode will use the IHitTester
from the InputModeContext
to determine the items being hit. If they
match the ClickableItems
type, the ItemClicked
event will be triggered. If they shouldFocus(IModelItem)
, the item will be
set as the current item
.
If the field has not yet been initialized upon first access, the factory method createClickInputMode()
will be
called. Upon change the onClickInputModeChanged(ClickInputMode, ClickInputMode)
method will be called.
By default this input mode has a priority of 10
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The ClickInputMode to set.onItemClicked(ItemClickedEventArgs)
,
getClickInputMode()
public final void setClickSelectableItems(GraphItemTypes value)
The default is GraphItemTypes.ALL
.
value
- The ClickSelectableItems to set.shouldClickSelect(IModelItem)
,
setSelected(IModelItem, boolean)
,
getClickSelectableItems()
public final void setClipboardOperationsAllowed(boolean value)
Default value is true
value
- The ClipboardOperationsAllowed to set.isClipboardOperationsAllowed()
public final void setContextMenuInputMode(AbstractContextMenuInputMode value)
ContextMenuInputMode
property.
If the field has not yet been initialized upon first access, the factory method createContextMenuInputMode()
will be called. Upon change the onContextMenuInputModeChanged(AbstractContextMenuInputMode, AbstractContextMenuInputMode)
method will be called.
By default this input mode has a priority of 60
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The ContextMenuInputMode to set.getContextMenuInputMode()
public final void setContextMenuItems(GraphItemTypes value)
The items for which a context menu should be queried
. The
default value is GraphItemTypes.NODE
|GraphItemTypes.EDGE
.
value
- The ContextMenuItems to set.getContextMenuItems()
public void setCurrentItem(IModelItem item)
NavigationInputMode
.item
- The item to set as the new "current" item.public final void setCyclicSelectionRecognizer(IEventRecognizer value)
IEventRecognizer
that will be queried to decide if a click should cycle through all the items that are
currently under the mouse cursor.
If the recognizer determines that the user wanted to use the cyclic click selection behavior, the HitTester
will be queried for the given item and previously reported items will be ignored. E.g. if multiple nodes are overlapping
each other, clicking on them will report the first item for the first click, the second one for the second click and so
on. If all elements have been reported previously, the first one is going to be reported again. If the order of the
elements at the clicked location changes, the cyclic selection is restarted anew.
The default is IEventRecognizer.ALT_PRESSED
.
value
- The CyclicSelectionRecognizer to set.getCyclicSelectionRecognizer()
public final void setDetailSelectionRecognizer(IEventRecognizer value)
IEventRecognizer
that will be queried to decide if a click should select the item that is currently
visible under the mouse cursor, without giving more important items higher priority.
If the recognizer determines that the user wanted to use the detail clicking behavior, the HitTester
will be queried for the given item and the first item that is returned will be considered a hit. Otherwise all hit items
are examined and are prioritized by item type. E.g. by default clicking on a node will select the node, even if there is
a node label which has been clicked at the same point. If detail selection is recognized, the label will be selected.
The default is IEventRecognizer.SHIFT_PRESSED
.
value
- The DetailSelectionRecognizer to set.getDetailSelectionRecognizer()
public final void setDoubleClickHitTestOrder(GraphItemTypes[] value)
Change this field to adjust which items will be considered when double-clicked
if there are multiple items at a given location. The default order is
value
- The DoubleClickHitTestOrder to set.getClickSelectableItems()
,
getSelectableItems()
,
findItems(IInputModeContext, PointD, GraphItemTypes[], Predicate)
,
getDoubleClickHitTestOrder()
public final void setFocusableItems(GraphItemTypes value)
setCurrentItem(IModelItem)
method.
The focusable items. The default is GraphItemTypes.NODE
value
- The FocusableItems to set.getFocusableItems()
public final void setIgnoringVoidStylesEnabled(boolean value)
VoidNodeStyle
, VoidEdgeStyle
, VoidLabelStyle
, and
VoidPortStyle
) should be ignored when selecting or focusing items.value
- true
if void styles should be ignored for selection and focus; false
otherwise. Default is
true
.isIgnoringVoidStylesEnabled()
public final void setItemHoverInputMode(ItemHoverInputMode value)
ItemHoverInputMode
that is provided by this instance for those who need to
make use of it.
Note that initially the HoverItems
property is set to
GraphItemTypes.NONE
, which effectively disables the functionality of the mode initially. In order to get the
mode to fire events, the property should be set to a corresponding value.
If the backing field has not yet been initialized upon first access, the factory method createItemHoverInputMode()
will be called. Upon change the onItemHoverInputModeChanged(ItemHoverInputMode, ItemHoverInputMode)
method will
be called.
By default this input mode has a priority of 55
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The ItemHoverInputMode to set.getItemHoverInputMode()
public final void setKeyboardInputMode(KeyboardInputMode value)
KeyboardInputMode
.
By default this input mode has a priority of 0
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The KeyboardInputMode
.getKeyboardInputMode()
public final void setMarqueeSelectableItems(GraphItemTypes value)
marquee selections
.
The default is a combination of GraphItemTypes.NODE
, GraphItemTypes.EDGE
, and
GraphItemTypes.BEND
.
value
- The MarqueeSelectableItems to set.shouldMarqueeSelect(IModelItem)
,
setSelected(IModelItem, boolean)
,
getMarqueeSelectableItems()
public final void setMarqueeSelectionInputMode(MarqueeSelectionInputMode value)
MarqueeSelectionInputMode
property.
If the field has not yet been initialized upon first access, the factory method createMarqueeSelectionInputMode()
will be called. Upon change the onMarqueeSelectionInputModeChanged(MarqueeSelectionInputMode, MarqueeSelectionInputMode)
method will be called.
By default this input mode has a priority of 50
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The MarqueeSelectionInputMode to set.getMarqueeSelectionInputMode()
public final void setMouseHoverInputMode(MouseHoverInputMode value)
MouseHoverInputMode
property.
If the field has not yet been initialized upon first access, the factory method createMouseHoverInputMode()
will be called. Upon change the onMouseHoverInputModeChanged(MouseHoverInputMode, MouseHoverInputMode)
method
will be called.
By default this input mode has a priority of 100
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The MouseHoverInputMode to set.getMouseHoverInputMode()
public final void setMoveViewportInputMode(MoveViewportInputMode value)
MoveViewportInputMode
associated with this instance.
If the field has not yet been initialized upon first access, the factory method createMoveViewportInputMode()
will be called. Upon change the onMoveViewportInputModeChanged(MoveViewportInputMode, MoveViewportInputMode)
method will be called.
By default this input mode has a priority of 39
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The MoveViewportInputMode to set.getMoveViewportInputMode()
public final void setMultiSelectionRecognizer(IEventRecognizer value)
IEventRecognizer
that will be queried to decide if a click is deemed a multi selection gesture.
The default is IEventRecognizer.SHORTCUT_PRESSED
.
value
- The MultiSelectionRecognizer to set.getMultiSelectionRecognizer()
public final void setNavigationInputMode(NavigationInputMode value)
NavigationInputMode
property.
This mode is responsible for navigating and traversing the elements in the IGraph
. If the field has not yet been
initialized upon first access, the factory method createNavigationInputMode()
will be called. Upon change the onNavigationInputModeChanged(NavigationInputMode, NavigationInputMode)
method will be called.
By default this input mode has a priority of 55
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The NavigationInputMode to set.getNavigationInputMode()
public final void setSelectableItems(GraphItemTypes value)
The default is GraphItemTypes.ALL
.
value
- The SelectableItems to set.setSelected(IModelItem, boolean)
,
getSelectableItems()
public final void setSelectablePredicate(Predicate<IModelItem> value)
IModelItem
is selectable.
This allows to further restrict which items are selectable, compared to SelectableItems
.
If this property is set to null
the effect is the same as a predicate that always returns true
.
value
- The SelectablePredicate to set.getSelectablePredicate()
public void setSelected(IModelItem item, boolean selected)
GraphSelection
to select the given item.item
- The item to set the selection state on.selected
- The new selection state.public final void setTapInputMode(TapInputMode value)
TapInputMode
property.
If the field has not yet been initialized upon first access, the factory method createTapInputMode()
will be
called. Upon change the onTapInputModeChanged(TapInputMode, TapInputMode)
method will be called.
By default this input mode has a priority of 20
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The TapInputMode to set.getTapInputMode()
public final void setToolTipItems(GraphItemTypes value)
The items for which a tool tip text should be queried
. The default
value is
GraphItemTypes.NODE
|GraphItemTypes.EDGE
|GraphItemTypes.LABEL
|GraphItemTypes.PORT
|.
value
- The ToolTipItems to set.getToolTipItems()
public final void setWaitInputMode(WaitInputMode value)
WaitInputMode
that is provided by this instance for those who need to make use of it.
If the field has not yet been initialized upon first access, the factory method createWaitInputMode()
will be
called. Upon change the onWaitInputModeChanged(WaitInputMode, WaitInputMode)
method will be called.
By default this input mode has a priority of -1
.
UnsupportedOperationException
- If an attempt is made to change the instance while this mode is
installed
. To
exchange a mode, first IInputMode.uninstall(IInputModeContext)
, then reinstall
to ensure that all data is initialized correctly.value
- The WaitInputMode to set.WaitInputMode.isWaiting()
,
getWaitInputMode()
protected boolean shouldClick(IModelItem item)
item
can be
clicked
.
This implementation uses the ClickableItems
value to determine whether the item should be
clicked. Note that this method will not be called for items that don't match ClickableItems
for performance reasons.
item
- The item to check.clicked
in response to a detected mouse click.protected boolean shouldClickSelect(IModelItem item)
item
should be selected when
clicked with the primary mouse button
.
This implementation uses the ClickSelectableItems
value to determine whether the item
should be selected. Note that this method will not be called for items that don't match ClickSelectableItems
and SelectableItems
for performance reasons.
item
- The item to check.protected boolean shouldDoubleClick(IModelItem item)
item
can be
double clicked
.
This implementation uses the shouldClick(IModelItem)
method to determine whether the item should be double
clicked. Note that this method will not be called for items that don't match ClickableItems
for performance reasons.
item
- The item to check.double clicked
in response to a detected
mouse click.protected boolean shouldFocus(IModelItem item)
IModelItem
should be
set to the current item
.
This implementation uses the FocusableItems
property to determine whether the item can be
set to the current item. It also honors the IgnoringVoidStylesEnabled
property.
item
- The item to check.protected boolean shouldInstallCommand(ICommand command)
ICommand
s to install.
This implementation unconditionally returns true
, subclasses may override this method to adjust the behavior.
command
- The command to install.protected boolean shouldMarqueeSelect(IModelItem item)
marqueeSelect(RectD)
that takes MarqueeSelectableItems
and shouldSelectItem(IModelItem)
into account.item
- The item to check.protected boolean shouldPopulateContextMenu(IModelItem item)
This implementation uses the ContextMenuItems
property to determine whether a context
menu should be queried for the given item.
item
- The item to check.PopulateItemContextMenu
event for the
given item.protected boolean shouldQueryToolTip(IModelItem item)
This implementation uses the ToolTipItems
property to determine whether tool tip should be
queried for the given item.
item
- The item to check.QueryItemToolTip
event for the given item.protected boolean shouldSelectItem(IModelItem item)
This implementation uses and honors the SelectableItems
, IgnoringVoidStylesEnabled
and SelectablePredicate
properties. This method is by default also called by shouldClickSelect(IModelItem)
and shouldMarqueeSelect(IModelItem)
, so turning selection off here also turns it off in other places.
item
- The item to check.true
if the item is selectable in general, false
if not.protected void tap(IModelItem item, TapEventArgs args)
This will raise the ItemClicked
event. If the event is unhandled by all
its event handlers the item will be selected
and
focused
. Before selection
the current selection will be cleared
.
item
- The item that has been tapped.args
- The original event arguments for the tap. Setting its Handled
property to true
will indicate that the tap was handled. By default this happens when the tapped item is either selected or focused.