public class CreateEdgeInputMode extends Object implements IInputMode
IInputMode
for interacticely creating edges between nodes and edges in an IGraph
displayed in a CanvasControl
or GraphControl
.
This class provides a factory callback
that the final edge creation will be delegated to. The
styling of the newly created edge can be customized via the EdgeDefaults
. Defaults can be
automatically adjusted in response to the various events that will be triggered by this instance during the edge
creation. Use the DummyEdgeGraph
property to modify the appearance of the dummy edge. This
class uses IPortCandidateProvider
instances found in the ILookup
of the nodes
in the graph
to display port candidates and to finally create the edges.
This mode is Exclusive
by default.
Constructor and Description |
---|
CreateEdgeInputMode()
Creates a new instance that will use the
IGraph from the InputModeContext to
create edges in. |
Modifier and Type | Method and Description |
---|---|
void |
addEdgeCreatedListener(IEventHandler<EdgeEventArgs> edgeCreatedEvent)
Adds the given listener for the
EdgeCreated event that occurs after an edge has been created by this mode. |
void |
addEdgeCreationStartedListener(IEventHandler<EdgeEventArgs> edgeCreationStartedEvent)
Adds the given listener for the
EdgeCreationStarted event that occurs when the edge creation has started. |
void |
addGestureCanceledListener(IEventHandler<InputModeEventArgs> gestureCanceledEvent)
Adds the given listener for the
GestureCanceled event that occurs when the gesture has been canceled. |
void |
addGestureCancelingListener(IEventHandler<InputModeEventArgs> gestureCancelingEvent)
Adds the given listener for the
GestureCanceling event that occurs before the gesture will be canceled. |
void |
addGestureFinishedListener(IEventHandler<InputModeEventArgs> gestureFinishedEvent)
Adds the given listener for the
GestureFinished event that occurs once the gesture has been finished. |
void |
addGestureFinishingListener(IEventHandler<InputModeEventArgs> gestureFinishingEvent)
Adds the given listener for the
GestureFinishing event that occurs before the gesture will be finished. |
void |
addGestureStartedListener(IEventHandler<InputModeEventArgs> gestureStartedEvent)
Adds the given listener for the
GestureStarted event that occurs once the gesture is initialized and has
started. |
void |
addGestureStartingListener(IEventHandler<InputModeEventArgs> gestureStartingEvent)
Adds the given listener for the
GestureStarting event that occurs once the gesture is starting. |
void |
addMovedListener(IEventHandler<InputModeEventArgs> movedEvent)
Adds the given listener for the
Moved event that occurs at the end of every drag or move. |
void |
addMovingListener(IEventHandler<InputModeEventArgs> movingEvent)
Adds the given listener for the
Moving event that occurs at the start of every drag or move. |
void |
addPortAddedListener(IEventHandler<ItemEventArgs<IPort>> portAddedEvent)
Adds the given listener for the
PortAdded event that occurs when this instance adds a port
to the source or target node during completion of the edge creation gesture. |
void |
addSourcePortCandidateChangedListener(IEventHandler<ItemEventArgs<IPortCandidate>> sourcePortCandidateChangedEvent)
Adds the given listener for the
SourcePortCandidateChanged event that occurs when the value of the SourcePortCandidate
property changes. |
void |
addTargetPortCandidateChangedListener(IEventHandler<ItemEventArgs<IPortCandidate>> targetPortCandidateChangedEvent)
Adds the given listener for the
TargetPortCandidateChanged event that occurs when the value of the TargetPortCandidate
property changes. |
void |
cancel()
Cancels the editing of this mode.
|
protected IEdge |
createDummyEdge()
Creates the dummy edge that will be displayed by the input mode during the creation.
|
protected IGraph |
createDummyEdgeGraph()
Factory method that will create the dummy graph to hold the preview of the
DummyEdge . |
protected IEdge |
createEdge()
Callback at the end of the edge creation process.
|
protected IEdge |
createEdge(IGraph graph,
IPortCandidate sourcePortCandidate,
IPortCandidate targetPortCandidate)
|
protected IInputModeContext |
createEdgeCreationInputModeContext()
Creates an
IInputModeContext for use with the port candidates queries for the upcoming edge creation operation
and the actual edge creation. |
void |
doStartEdgeCreation(IPortCandidate sourcePortCandidate)
Synthetically starts the interactive edge creation process using the provided
IPortCandidate as the source
port. |
IHitTestable |
getBeginHitTestable()
Gets a
IHitTestable that determines, whether it is valid to start an edge creation gesture here. |
IEventRecognizer |
getCancelRecognizer()
Gets the property that determines cancel events.
|
IEventRecognizer |
getCancelRecognizerTouch()
Gets the property that determines cancel events via touch.
|
ICanvasObjectDescriptor |
getCandidateDescriptor()
Gets the
ICanvasObjectDescriptor that is used for visualizing the
IPortCandidate s in the canvas during the edit. |
protected IPortCandidate |
getClosestCandidate(Iterable<IPortCandidate> candidates,
PointD location)
Finds the closest
PortCandidateValidity.VALID candidate given a number of
IPortCandidate s and a location in world coordinates. |
ICanvasObjectDescriptor |
getClosestCandidateDescriptor()
Gets the
ICanvasObjectDescriptor that is used for visualizing the closest IPortCandidate in the canvas
during the edit. |
protected IPortCandidate |
getClosestSourceCandidate(Iterable<IPortCandidate> candidates,
PointD location)
Finds the closest candidate given a number of
IPortCandidate s and a location in world coordinates. |
protected IPortCandidate |
getClosestTargetCandidate(Iterable<IPortCandidate> candidates,
PointD location)
Finds the closest target candidate given a number of
IPortCandidate s and a location in world coordinates. |
protected ConcurrencyController |
getController()
Returns the installed
Controller . |
IEventRecognizer |
getCreateBendRecognizer()
The event recognizer that recognizes the creation of a bend.
|
IEventRecognizer |
getCreateBendRecognizerTouch()
The event recognizer that recognizes the creation of a bend via touch.
|
IEventRecognizer |
getDisableSnappingRecognizer()
Gets
IEventRecognizer that temporarily disables snapping. |
IEventRecognizer |
getDraggedRecognizer()
The event recognizer that recognizes the initial dragging gesture that is used to initiate the creation after the
preparation.
|
IEventRecognizer |
getDraggedRecognizerTouch()
The event recognizer that recognizes the initial dragging gesture that is used to initiate the creation after the
preparation via touch.
|
IPoint |
getDragPoint()
Gets the dynamically updated dragging point for the edge creation.
|
IEdge |
getDummyEdge()
Gets the dummy edge instance that will be used to render a preview of the edge to be created.
|
IGraph |
getDummyEdgeGraph()
Gets the dummy graph instance that will hold the items that will render a preview of the newly created edge.
|
protected IEnumerable<OrthogonalSnapLine> |
getDummyEdgeSnapLines(GraphSnapContext context,
ISnapLineProvider provider)
Gets the snap lines lines that are induced by the current dummy edge.
|
IEdgeCreationCallback |
getEdgeCreator()
Gets the ports based edge creation callback.
|
IEdgeDefaults |
getEdgeDefaults()
Convenience property for customizing the appearance of newly created edges.
|
IEventRecognizer |
getEnableSnappingRecognizer()
Gets
IEventRecognizer that reenables temporarily disabled snapping. |
IHitTestable |
getEndHitTestable()
Gets a
IHitTestable that determines, whether it is valid to finish an edge creation gesture here. |
IEventRecognizer |
getEndPointMovedRecognizer()
The event recognizer that recognizes the movement of the end point of the edge.
|
IEventRecognizer |
getEnforceBendCreationRecognizer()
Gets the
IEventRecognizer that will be queried to decide if bend creation is enforced. |
IEventRecognizer |
getFinishRecognizer()
The event recognizer that recognizes the finishing gesture that is used to end the edge creation on the target node.
|
IEventRecognizer |
getFinishRecognizerTouch()
The event recognizer that recognizes the finishing gesture that is used to end the edge creation on the target node by a
touch gesture.
|
protected EdgeSegmentDirection |
getFirstSegmentDirection()
Calculates direction of first edge segment of the DummyNode.
|
IGraph |
getGraph()
Gets the Graph this mode is acting upon.
|
IInputModeContext |
getInputModeContext()
Returns the context instance this mode is currently installed in or
null if this instance is not installed. |
double |
getNodeBorderWidthRatio()
Defines the width of a node's border which is taken into account when deciding which way to route the first segment of
an orthogonal edge.
|
OrthogonalEdgeEditingPolicy |
getOrthogonalEdgeCreationEnabled()
Gets the the policy that controls whether edges will be create orthogonally.
|
double |
getOrthogonalSnapDistance()
Gets the distance in the view coordinate system that determines how far the mouse should be snapped to a horizontal or
vertical line.
|
IEventRecognizer |
getPortCandidateResolutionRecognizer()
Gets the event recognizer that determines whether dynamic port candidates should be resolved.
|
protected IPortOwner |
getPortOwner(PointD location)
Retrieves the port owner at a given position in world coordinates.
|
protected Iterable<IPortOwner> |
getPortOwners()
Retrieves the port owners from the graph in the order of their importance.
|
double |
getPreferredMinimalEdgeDistance()
Defines the preferred minimal distance of orthogonal edges.
|
IEventRecognizer |
getPrepareRecognizer()
The event recognizer that recognizes the starting gesture that is used to prepare the edge creation on the source node.
|
IEventRecognizer |
getPrepareRecognizerTouch()
The event recognizer that recognizes the starting gesture that is used to prepare the edge creation on the source node
via touch.
|
int |
getPriority()
The priority of this input mode.
|
IEventRecognizer |
getRemoveBendRecognizer()
Gets the property that determines bend removal events.
|
IEventRecognizer |
getRemoveBendRecognizerTouch()
Gets the property that determines bend removal events via touch.
|
SnapContext |
getSnapContext()
The
SnapContext which manages snapping model items to certain coordinates (for instance, other
items). |
double |
getSnapDistance()
Gets the distance in the view coordinate system that determines how far the mouse should be snapped to a port candidate
if
SnappingToTargetCandidateEnabled is enabled. |
protected IPortOwner |
getSource(PointD sourceLocation)
Finds the source
port owner at the specified location. |
IPortCandidate |
getSourcePortCandidate()
Gets the candidate for the
SourcePort of the edge to be created. |
protected IPortCandidate |
getSourcePortCandidate(IPortCandidateProvider provider,
PointD location,
boolean resolveCandidates)
Finds the best matching source port
IPortCandidate given a provider and the current location. |
protected IPortCandidate |
getSourcePortCandidate(PointD location)
Finds the best matching source
port candidate based on the given location. |
protected IPortCandidateProvider |
getSourcePortCandidateProvider(IPortOwner sourceOwner)
Retrieves the port candidate provider instance given a source port owner.
|
PointD |
getStartPoint()
Gets a copy of the starting point at which the edge creation gesture started.
|
protected IPortOwner |
getTarget(PointD targetLocation)
Finds the target
port owner at the specified location. |
IPortCandidate |
getTargetPortCandidate()
Gets the current candidate for the
TargetPort of the edge to be created. |
protected IPortCandidateProvider |
getTargetPortCandidateProvider(IPortCandidate sourcePortCandidate,
IPortOwner targetOwner,
PointD location)
Retrieves the port candidate provider instance given a source port candidate and a possible target item.
|
protected IPortCandidateProvider |
getTargetPortCandidateProvider(IPortCandidate sourcePortCandidate,
PointD location)
Retrieves the
IPortCandidateProvider instance that provides the possible candidates for the target of the edge
given the current source candidate. |
protected Iterable<IPortCandidate> |
getTargetPortCandidates(PointD location,
boolean resolveCandidates)
Retrieves the target port candidates for a given location in world coordinates.
|
IEventRecognizer |
getToggleSegmentOrientationRecognizer()
Gets the
IEventRecognizer that toggles the orientation of the first orthogonally created segment. |
Cursor |
getValidBeginCursor()
Gets the cursor that indicates a valid place to begin an edge creation.
|
Cursor |
getValidBendCursor()
Gets the cursor that indicates a valid place to create a bend.
|
IHitTestable |
getValidBendHitTestable()
Gets a
IHitTestable that determines, whether it is valid to create a bend here. |
Cursor |
getValidEndCursor()
Gets the cursor that indicates a valid place to finish creation.
|
void |
install(IInputModeContext context,
ConcurrencyController controller)
Installs this mode into the given context that is provided by the canvas.
|
boolean |
isCancelGestureOnInvalidTarget()
Determines whether an edge creation gesture will be canceled when the gesture is ended on an invalid target and no bend
may be created there.
|
boolean |
isCancelingEditImplicitlyEnabled()
Gets whether after calls to
createEdge(IGraph, IPortCandidate, IPortCandidate) the current undo edit should be
canceled if the method returns null . |
boolean |
isCreateBendAllowed()
Determines whether or not to allow the creation of bends.
|
boolean |
isCreationInProgress()
Determines whether currently an edge creation is in progress.
|
boolean |
isEdgeToEdgeConnectionsAllowed()
Determines whether or not edges are allowed to connect to other edges.
|
boolean |
isEnabled()
Gets the enabled state of this input mode.
|
boolean |
isExclusive()
Gets a value indicating whether this mode will be the only one running when it has the mutex.
|
boolean |
isForcingSnapToCandidateEnabled()
Gets a property that determines whether the mouse should be forced to snap to the nearest valid port candidate if the
mouse hovers over a target node.
|
boolean |
isPortCandidateShowingEnabled()
Determines whether or not to display possible port candidates during the creation of the edge.
|
boolean |
isResolvingSourcePortCandidatesEnabled()
Gets a value indicating whether
PortCandidateValidity.DYNAMIC ports that are part of the source port candidates
should be resolved for the current mouse location. |
boolean |
isResolvingTargetPortCandidatesEnabled()
Gets a value indicating whether
PortCandidateValidity.DYNAMIC ports that are part of the target port candidates
should be resolved for the current mouse location. |
boolean |
isSelfloopsAllowed()
Determines whether or not to allow the creation of self loops.
|
boolean |
isSnappingToTargetCandidateEnabled()
Determines whether or not the edge's end point should snap to the current target port candidate during the creation of
the edge.
|
boolean |
isUsingHitItemsCandidatesOnlyEnabled()
Gets a property that determines whether this mode should use only the
target port candidates
of the node the mouse currently hovers over. |
protected void |
onCanceled()
Called after
cancel() has been called. |
protected void |
onConcurrencyControllerActivated()
Called after the
ConcurrencyController property of the installed ConcurrencyController has been set to
true . |
protected void |
onConcurrencyControllerDeactivated()
|
protected void |
onEdgeCreated(EdgeEventArgs args)
Called by
createEdge() after the edge has been finalized. |
protected void |
onEdgeCreationStarted(EdgeEventArgs args)
Raises the
EdgeCreationStarted event when the gesture for
creating an edge has been initialized. |
protected void |
onGestureCanceled(InputModeEventArgs inputModeEventArgs)
Triggers the
GestureCanceled event. |
protected void |
onGestureCanceling(InputModeEventArgs inputModeEventArgs)
Triggers the
GestureCanceling event. |
protected void |
onGestureFinished(InputModeEventArgs inputModeEventArgs)
Callback triggered once the drag has been finalized.
|
protected void |
onGestureFinishing(InputModeEventArgs inputModeEventArgs)
Callback triggered before the drag will be finalized.
|
protected void |
onGestureStarted(InputModeEventArgs inputModeEventArgs)
Triggers the
GestureStarted event. |
protected void |
onGestureStarting(InputModeEventArgs inputModeEventArgs)
Triggers the
GestureStarting event. |
protected void |
onMoved(InputModeEventArgs inputModeEventArgs)
Callback triggered at the end of each drag.
|
protected void |
onMoving(InputModeEventArgs inputModeEventArgs)
Callback triggered at the start of each drag.
|
protected void |
onPortAdded(ItemEventArgs<IPort> args)
Raises the
PortAdded event if the mode has added a port
for the source or target node to complete the edge creation. |
protected void |
onSourcePortCandidateChanged(ItemEventArgs<IPortCandidate> args)
Triggers the
SourcePortCandidateChanged event. |
protected void |
onStopped()
Called after
stop() has been called. |
protected void |
onTargetPortCandidateChanged(ItemEventArgs<IPortCandidate> args)
Triggers the
TargetPortCandidateChanged event. |
void |
removeEdgeCreatedListener(IEventHandler<EdgeEventArgs> edgeCreatedEvent)
Removes the given listener for the
EdgeCreated event that occurs after an edge has been created by this mode. |
void |
removeEdgeCreationStartedListener(IEventHandler<EdgeEventArgs> edgeCreationStartedEvent)
Removes the given listener for the
EdgeCreationStarted event that occurs when the edge creation has started. |
void |
removeGestureCanceledListener(IEventHandler<InputModeEventArgs> gestureCanceledEvent)
Removes the given listener for the
GestureCanceled event that occurs when the gesture has been canceled. |
void |
removeGestureCancelingListener(IEventHandler<InputModeEventArgs> gestureCancelingEvent)
Removes the given listener for the
GestureCanceling event that occurs before the gesture will be canceled. |
void |
removeGestureFinishedListener(IEventHandler<InputModeEventArgs> gestureFinishedEvent)
Removes the given listener for the
GestureFinished event that occurs once the gesture has been finished. |
void |
removeGestureFinishingListener(IEventHandler<InputModeEventArgs> gestureFinishingEvent)
Removes the given listener for the
GestureFinishing event that occurs before the gesture will be finished. |
void |
removeGestureStartedListener(IEventHandler<InputModeEventArgs> gestureStartedEvent)
Removes the given listener for the
GestureStarted event that occurs once the gesture is initialized and has
started. |
void |
removeGestureStartingListener(IEventHandler<InputModeEventArgs> gestureStartingEvent)
Removes the given listener for the
GestureStarting event that occurs once the gesture is starting. |
void |
removeMovedListener(IEventHandler<InputModeEventArgs> movedEvent)
Removes the given listener for the
Moved event that occurs at the end of every drag or move. |
void |
removeMovingListener(IEventHandler<InputModeEventArgs> movingEvent)
Removes the given listener for the
Moving event that occurs at the start of every drag or move. |
void |
removePortAddedListener(IEventHandler<ItemEventArgs<IPort>> portAddedEvent)
Removes the given listener for the
PortAdded event that occurs when this instance adds a port
to the source or target node during completion of the edge creation gesture. |
void |
removeSourcePortCandidateChangedListener(IEventHandler<ItemEventArgs<IPortCandidate>> sourcePortCandidateChangedEvent)
Removes the given listener for the
SourcePortCandidateChanged event that occurs when the value of the SourcePortCandidate
property changes. |
void |
removeTargetPortCandidateChangedListener(IEventHandler<ItemEventArgs<IPortCandidate>> targetPortCandidateChangedEvent)
Removes the given listener for the
TargetPortCandidateChanged event that occurs when the value of the TargetPortCandidate
property changes. |
protected Iterable<IPortCandidate> |
resolveCandidates(Iterable<IPortCandidate> candidates,
PointD location)
Returns an enumerable over the given candidates where no instance has
PortCandidateValidity.DYNAMIC
Validity . |
void |
setBeginHitTestable(IHitTestable value)
Sets a
IHitTestable that determines, whether it is valid to start an edge creation gesture here. |
void |
setCancelGestureOnInvalidTarget(boolean value)
Determines whether an edge creation gesture will be canceled when the gesture is ended on an invalid target and no bend
may be created there.
|
void |
setCancelingEditImplicitlyEnabled(boolean value)
Sets whether after calls to
createEdge(IGraph, IPortCandidate, IPortCandidate) the current undo edit should be
canceled if the method returns null . |
void |
setCancelRecognizer(IEventRecognizer value)
Sets the property that determines cancel events.
|
void |
setCancelRecognizerTouch(IEventRecognizer value)
Sets the property that determines cancel events via touch.
|
void |
setCandidateDescriptor(ICanvasObjectDescriptor value)
Sets the
ICanvasObjectDescriptor that is used for visualizing the
IPortCandidate s in the canvas during the edit. |
void |
setClosestCandidateDescriptor(ICanvasObjectDescriptor value)
Sets the
ICanvasObjectDescriptor that is used for visualizing the closest IPortCandidate in the canvas
during the edit. |
void |
setCreateBendAllowed(boolean value)
Determines whether or not to allow the creation of bends.
|
void |
setCreateBendRecognizer(IEventRecognizer value)
The event recognizer that recognizes the creation of a bend.
|
void |
setCreateBendRecognizerTouch(IEventRecognizer value)
The event recognizer that recognizes the creation of a bend via touch.
|
void |
setDisableSnappingRecognizer(IEventRecognizer value)
Sets
IEventRecognizer that temporarily disables snapping. |
void |
setDraggedRecognizer(IEventRecognizer value)
The event recognizer that recognizes the initial dragging gesture that is used to initiate the creation after the
preparation.
|
void |
setDraggedRecognizerTouch(IEventRecognizer value)
The event recognizer that recognizes the initial dragging gesture that is used to initiate the creation after the
preparation via touch.
|
void |
setEdgeCreator(IEdgeCreationCallback value)
Sets the ports based edge creation callback.
|
void |
setEdgeDefaults(IEdgeDefaults value)
Convenience property for customizing the appearance of newly created edges.
|
void |
setEdgeToEdgeConnectionsAllowed(boolean value)
Determines whether or not edges are allowed to connect to other edges.
|
void |
setEnabled(boolean value)
Sets the enabled state of this input mode.
|
void |
setEnableSnappingRecognizer(IEventRecognizer value)
Sets
IEventRecognizer that reenables temporarily disabled snapping. |
void |
setEndHitTestable(IHitTestable value)
Sets a
IHitTestable that determines, whether it is valid to finish an edge creation gesture here. |
void |
setEndPointMovedRecognizer(IEventRecognizer value)
The event recognizer that recognizes the movement of the end point of the edge.
|
void |
setEnforceBendCreationRecognizer(IEventRecognizer value)
Sets the
IEventRecognizer that will be queried to decide if bend creation is enforced. |
void |
setExclusive(boolean value)
Sets a value indicating whether this mode will be the only one running when it has the mutex.
|
void |
setFinishRecognizer(IEventRecognizer value)
The event recognizer that recognizes the finishing gesture that is used to end the edge creation on the target node.
|
void |
setFinishRecognizerTouch(IEventRecognizer value)
The event recognizer that recognizes the finishing gesture that is used to end the edge creation on the target node by a
touch gesture.
|
void |
setForcingSnapToCandidateEnabled(boolean value)
Sets a property that determines whether the mouse should be forced to snap to the nearest valid port candidate if the
mouse hovers over a target node.
|
void |
setNodeBorderWidthRatio(double value)
Defines the width of a node's border which is taken into account when deciding which way to route the first segment of
an orthogonal edge.
|
void |
setOrthogonalEdgeCreationEnabled(OrthogonalEdgeEditingPolicy value)
Sets the the policy that controls whether edges will be create orthogonally.
|
void |
setOrthogonalSnapDistance(double value)
Sets the distance in the view coordinate system that determines how far the mouse should be snapped to a horizontal or
vertical line.
|
void |
setPortCandidateResolutionRecognizer(IEventRecognizer value)
Sets the event recognizer that determines whether dynamic port candidates should be resolved.
|
void |
setPortCandidateShowingEnabled(boolean value)
Determines whether or not to display possible port candidates during the creation of the edge.
|
void |
setPreferredMinimalEdgeDistance(double value)
Defines the preferred minimal distance of orthogonal edges.
|
void |
setPrepareRecognizer(IEventRecognizer value)
The event recognizer that recognizes the starting gesture that is used to prepare the edge creation on the source node.
|
void |
setPrepareRecognizerTouch(IEventRecognizer value)
The event recognizer that recognizes the starting gesture that is used to prepare the edge creation on the source node
via touch.
|
void |
setPriority(int value)
The priority of this input mode.
|
void |
setRemoveBendRecognizer(IEventRecognizer value)
Sets the property that determines bend removal events.
|
void |
setRemoveBendRecognizerTouch(IEventRecognizer value)
Sets the property that determines bend removal events via touch.
|
void |
setResolvingSourcePortCandidatesEnabled(boolean value)
Sets a value indicating whether
PortCandidateValidity.DYNAMIC ports that are part of the source port candidates
should be resolved for the current mouse location. |
void |
setResolvingTargetPortCandidatesEnabled(boolean value)
Sets a value indicating whether
PortCandidateValidity.DYNAMIC ports that are part of the target port candidates
should be resolved for the current mouse location. |
void |
setSelfloopsAllowed(boolean value)
Determines whether or not to allow the creation of self loops.
|
void |
setSnapContext(SnapContext value)
The
SnapContext which manages snapping model items to certain coordinates (for instance, other
items). |
void |
setSnapDistance(double value)
Sets the distance in the view coordinate system that determines how far the mouse should be snapped to a port candidate
if
SnappingToTargetCandidateEnabled is enabled. |
void |
setSnappingToTargetCandidateEnabled(boolean value)
Determines whether or not the edge's end point should snap to the current target port candidate during the creation of
the edge.
|
void |
setSourcePortCandidate(IPortCandidate value)
Sets the candidate for the
SourcePort of the edge to be created. |
void |
setTargetPortCandidate(IPortCandidate value)
Sets the current candidate for the
TargetPort of the edge to be created. |
void |
setToggleSegmentOrientationRecognizer(IEventRecognizer value)
Sets the
IEventRecognizer that toggles the orientation of the first orthogonally created segment. |
void |
setUsingHitItemsCandidatesOnlyEnabled(boolean value)
Sets a property that determines whether this mode should use only the
target port candidates
of the node the mouse currently hovers over. |
void |
setValidBeginCursor(Cursor value)
Sets the cursor that indicates a valid place to begin an edge creation.
|
void |
setValidBendCursor(Cursor value)
Sets the cursor that indicates a valid place to create a bend.
|
void |
setValidBendHitTestable(IHitTestable value)
Sets a
IHitTestable that determines, whether it is valid to create a bend here. |
void |
setValidEndCursor(Cursor value)
Sets the cursor that indicates a valid place to finish creation.
|
boolean |
stop()
Called by the client in order to stop a current editing progress.
|
void |
uninstall(IInputModeContext context)
Uninstalls this mode from the given context.
|
protected void |
updateDummyEdgeSourcePort(IPortCandidate sourcePortCandidate)
Updates the
DummyEdge to reflect the current source port candidate. |
protected void |
updateDummyEdgeTargetPort(IPortCandidate targetPortCandidate)
Updates the
DummyEdge to reflect the current target port candidate. |
protected void |
updateTargetLocation(PointD location)
Updates the drag point.
|
public CreateEdgeInputMode()
IGraph
from the InputModeContext
to
create edges in.
Setting the Graph
property can be used to optionally set a different graph to work on.
getGraph()
public final void addEdgeCreatedListener(IEventHandler<EdgeEventArgs> edgeCreatedEvent)
EdgeCreated
event that occurs after an edge has been created by this mode.edgeCreatedEvent
- The listener to add.onEdgeCreated(EdgeEventArgs)
,
removeEdgeCreatedListener(IEventHandler)
public final void addEdgeCreationStartedListener(IEventHandler<EdgeEventArgs> edgeCreationStartedEvent)
EdgeCreationStarted
event that occurs when the edge creation has started.
The edge that is stored in the Item
property is the DummyEdge
that is used during creation.
edgeCreationStartedEvent
- The listener to add.removeEdgeCreationStartedListener(IEventHandler)
public final void addGestureCanceledListener(IEventHandler<InputModeEventArgs> gestureCanceledEvent)
GestureCanceled
event that occurs when the gesture has been canceled.gestureCanceledEvent
- The listener to add.removeGestureCanceledListener(IEventHandler)
public final void addGestureCancelingListener(IEventHandler<InputModeEventArgs> gestureCancelingEvent)
GestureCanceling
event that occurs before the gesture will be canceled.gestureCancelingEvent
- The listener to add.removeGestureCancelingListener(IEventHandler)
public final void addGestureFinishedListener(IEventHandler<InputModeEventArgs> gestureFinishedEvent)
GestureFinished
event that occurs once the gesture has been finished.gestureFinishedEvent
- The listener to add.removeGestureFinishedListener(IEventHandler)
public final void addGestureFinishingListener(IEventHandler<InputModeEventArgs> gestureFinishingEvent)
GestureFinishing
event that occurs before the gesture will be finished.gestureFinishingEvent
- The listener to add.removeGestureFinishingListener(IEventHandler)
public final void addGestureStartedListener(IEventHandler<InputModeEventArgs> gestureStartedEvent)
GestureStarted
event that occurs once the gesture is initialized and has
started.gestureStartedEvent
- The listener to add.removeGestureStartedListener(IEventHandler)
public final void addGestureStartingListener(IEventHandler<InputModeEventArgs> gestureStartingEvent)
GestureStarting
event that occurs once the gesture is starting.gestureStartingEvent
- The listener to add.removeGestureStartingListener(IEventHandler)
public final void addMovedListener(IEventHandler<InputModeEventArgs> movedEvent)
Moved
event that occurs at the end of every drag or move.movedEvent
- The listener to add.removeMovedListener(IEventHandler)
public final void addMovingListener(IEventHandler<InputModeEventArgs> movingEvent)
Moving
event that occurs at the start of every drag or move.movingEvent
- The listener to add.removeMovingListener(IEventHandler)
public final void addPortAddedListener(IEventHandler<ItemEventArgs<IPort>> portAddedEvent)
PortAdded
event that occurs when this instance adds a port
to the source or target node during completion of the edge creation gesture.portAddedEvent
- The listener to add.removePortAddedListener(IEventHandler)
public final void addSourcePortCandidateChangedListener(IEventHandler<ItemEventArgs<IPortCandidate>> sourcePortCandidateChangedEvent)
SourcePortCandidateChanged
event that occurs when the value of the SourcePortCandidate
property changes.sourcePortCandidateChangedEvent
- The listener to add.removeSourcePortCandidateChangedListener(IEventHandler)
public final void addTargetPortCandidateChangedListener(IEventHandler<ItemEventArgs<IPortCandidate>> targetPortCandidateChangedEvent)
TargetPortCandidateChanged
event that occurs when the value of the TargetPortCandidate
property changes.targetPortCandidateChangedEvent
- The listener to add.removeTargetPortCandidateChangedListener(IEventHandler)
public void cancel()
This implementation releases
the mutex if it is currently owned by this
instance and calls onCanceled()
.
cancel
in interface IInputMode
onCanceled()
protected IEdge createDummyEdge()
IEdge
implementation that can be used as a dummy.protected IGraph createDummyEdgeGraph()
DummyEdge
.
Note that the instance returned by this instance must accept any port as valid source and target ports for it's IGraph.setEdgePorts(IEdge, IPort, IPort)
method. This will allow the preview edge to be connected to the actual Graph
.
protected IEdge createEdge()
This method will actually create the edge using the createEdge(IGraph, IPortCandidate, IPortCandidate)
method.
This method will ultimately call onEdgeCreated(EdgeEventArgs)
.
null
.protected IEdge createEdge(IGraph graph, IPortCandidate sourcePortCandidate, IPortCandidate targetPortCandidate)
createEdge()
if both SourcePortCandidate
and TargetPortCandidate
have been set.
This method will first create the new ports
if necessary and then
create the edge via the EdgeCreator
callback to the ports. After the ports are created the
corresponding PortAdded
events are triggered. If the edge creation is
canceled by the creator callback, newly created ports will be removed again.
graph
- The graph to create the edge for.sourcePortCandidate
- The candidate to use for the source.targetPortCandidate
- The candidate to use for the target.null
.protected IInputModeContext createEdgeCreationInputModeContext()
IInputModeContext
for use with the port candidates queries for the upcoming edge creation operation
and the actual edge creation.IInputModeContext
that is configured for this mode.public void doStartEdgeCreation(IPortCandidate sourcePortCandidate)
IPortCandidate
as the source
port.
This instance needs to be installed
and Enabled
and it needs to be able to request the input mutex
in order to proceed.
If any of these conditions are not satisfied, this method will throw an IllegalStateException
.
sourcePortCandidate
- The source port candidate to use for the edge creation.public final IHitTestable getBeginHitTestable()
IHitTestable
that determines, whether it is valid to start an edge creation gesture here.
The default implementation returns true
if getSource(PointD)
yields a non-null
value.
setBeginHitTestable(IHitTestable)
public final IEventRecognizer getCancelRecognizer()
setCancelRecognizer(IEventRecognizer)
public final IEventRecognizer getCancelRecognizerTouch()
The default is IEventRecognizer.TOUCH_MULTI_TAPPED_SECONDARY
.
setCancelRecognizerTouch(IEventRecognizer)
public final ICanvasObjectDescriptor getCandidateDescriptor()
ICanvasObjectDescriptor
that is used for visualizing the
IPortCandidate
s in the canvas during the edit.
This descriptor is queried for the IVisualCreator
to obtain the visualizations for the
candidates that are not currently closest. By default an instance of DefaultPortCandidateDescriptor
is used.
getClosestCandidateDescriptor()
,
setCandidateDescriptor(ICanvasObjectDescriptor)
protected IPortCandidate getClosestCandidate(Iterable<IPortCandidate> candidates, PointD location)
PortCandidateValidity.VALID
candidate given a number of
IPortCandidate
s and a location in world coordinates.candidates
- The candidates to find the closest from.location
- The location of the mouse in world coordinates.null
if no candidate satisfies the needspublic final ICanvasObjectDescriptor getClosestCandidateDescriptor()
ICanvasObjectDescriptor
that is used for visualizing the closest IPortCandidate
in the canvas
during the edit.
This descriptor is queried for the IVisualCreator
to obtain the visualization for the
currently closest candidate. By default an instance of DefaultPortCandidateDescriptor
is used.
getCandidateDescriptor()
,
setClosestCandidateDescriptor(ICanvasObjectDescriptor)
protected IPortCandidate getClosestSourceCandidate(Iterable<IPortCandidate> candidates, PointD location)
IPortCandidate
s and a location in world coordinates.candidates
- The candidates to find the closest from.location
- The location of the pointer in world coordinates.null
if no candidate satisfies the needsprotected IPortCandidate getClosestTargetCandidate(Iterable<IPortCandidate> candidates, PointD location)
IPortCandidate
s and a location in world coordinates.candidates
- The candidates to find the closest from.location
- The location of the mouse in world coordinates.null
if no candidate satisfies the needs or EnforceBendCreationRecognizer
yields true
.protected final ConcurrencyController getController()
Controller
.public final IEventRecognizer getCreateBendRecognizer()
The default is IEventRecognizer.MOUSE_LEFT_RELEASED
.
setCreateBendRecognizer(IEventRecognizer)
public final IEventRecognizer getCreateBendRecognizerTouch()
The default is IEventRecognizer.TOUCH_UP_PRIMARY
.
setCreateBendRecognizerTouch(IEventRecognizer)
public final IEventRecognizer getDisableSnappingRecognizer()
IEventRecognizer
that temporarily disables snapping.IEventRecognizer.SHORTCUT_DOWN
setDisableSnappingRecognizer(IEventRecognizer)
public final IEventRecognizer getDraggedRecognizer()
The default is IEventRecognizer.MOUSE_DRAGGED
.
setDraggedRecognizer(IEventRecognizer)
public final IEventRecognizer getDraggedRecognizerTouch()
The default is IEventRecognizer.TOUCH_MOVED_PRIMARY
.
setDraggedRecognizerTouch(IEventRecognizer)
public final IPoint getDragPoint()
public final IEdge getDummyEdge()
This instance will be used for rendering the edge during the gesture. If this property is unset initially, factory
method createDummyEdge()
will be called.
public final IGraph getDummyEdgeGraph()
The dummy edge graph can be used to change the appearance and other properties of the dummy edge, either when starting a gesture or during it in response to certain events. Possible actions are:
All changes made to the dummy edge during the gesture will be persisted to the created edge in the original graph. This
behavior can be changed by setting a custom EdgeCreator
.
The dummy edge graph only allows operations on the dummy edge.
If the property is not set initially, method createDummyEdgeGraph()
will be used as the factory method.
getDummyEdge()
protected IEnumerable<OrthogonalSnapLine> getDummyEdgeSnapLines(GraphSnapContext context, ISnapLineProvider provider)
context
- The graph snap context.provider
- The dummy edge segment snap line provider.public final IEdgeCreationCallback getEdgeCreator()
The default creator will delegate to IGraph.createEdge(INode, INode, IEdgeStyle, Object)
and obtain the tag from
the DummyEdge
. It will then copy over all bends, labels, and ports from the
DummyEdge
.
NullPointerException
- If the argument is null
createEdge(IGraph, IPortCandidate, IPortCandidate)
.setEdgeCreator(IEdgeCreationCallback)
public final IEdgeDefaults getEdgeDefaults()
This property directly delegates to the EdgeDefaults
of the
DummyEdgeGraph
.
setEdgeDefaults(IEdgeDefaults)
public final IEventRecognizer getEnableSnappingRecognizer()
IEventRecognizer
that reenables temporarily disabled snapping.IEventRecognizer.SHORTCUT_UP
getDisableSnappingRecognizer()
,
setEnableSnappingRecognizer(IEventRecognizer)
public final IHitTestable getEndHitTestable()
IHitTestable
that determines, whether it is valid to finish an edge creation gesture here.
The default implementation returns true
if there is a node at the given location.
setEndHitTestable(IHitTestable)
public final IEventRecognizer getEndPointMovedRecognizer()
The default is IEventRecognizer.MOUSE_MOVED_OR_DRAGGED
.
setEndPointMovedRecognizer(IEventRecognizer)
public final IEventRecognizer getEnforceBendCreationRecognizer()
IEventRecognizer
that will be queried to decide if bend creation is enforced.
The default is IEventRecognizer.SHORTCUT_PRESSED
.
setEnforceBendCreationRecognizer(IEventRecognizer)
public final IEventRecognizer getFinishRecognizer()
The default is a combination of IEventRecognizer.MOUSE_LEFT_PRESSED
and
IEventRecognizer.MOUSE_LEFT_RELEASED
.
setFinishRecognizer(IEventRecognizer)
public final IEventRecognizer getFinishRecognizerTouch()
The default is IEventRecognizer.TOUCH_UP_PRIMARY
.
setFinishRecognizerTouch(IEventRecognizer)
protected EdgeSegmentDirection getFirstSegmentDirection()
An edge starting in an border will always be orthogonal to the border's outer line. An edge starting in a corner will
point the way the user dragged the mouse. An edge starting in the inner of the node will be directed the way dragged
unless another edge that is close to the new edge
(PreferredMinimalEdgeDistance
) already went that way.
EdgeSegmentDirection
defining the direction of the first edge segment.public final IGraph getGraph()
public final IInputModeContext getInputModeContext()
IInputMode
null
if this instance is not installed.
Note that this instance should not be passed down to subordinate modes or instances. Instead a corresponding context
that has this instance set as the ParentInputMode
should be used.
getInputModeContext
in interface IInputMode
public final double getNodeBorderWidthRatio()
An edge starting inside a given margin is always pointing away from it.
setNodeBorderWidthRatio(double)
public final OrthogonalEdgeEditingPolicy getOrthogonalEdgeCreationEnabled()
By default orthogonal edge creation is enabled if orthogonal edge editing is enabled on the
parent input mode
.
GraphEditorInputMode.getOrthogonalEdgeEditingContext()
,
OrthogonalEdgeEditingContext.isEnabled()
,
setOrthogonalEdgeCreationEnabled(OrthogonalEdgeEditingPolicy)
public final double getOrthogonalSnapDistance()
The default value is 5
.
setOrthogonalSnapDistance(double)
public final IEventRecognizer getPortCandidateResolutionRecognizer()
By default this is IEventRecognizer.SHIFT_PRESSED
.
setPortCandidateResolutionRecognizer(IEventRecognizer)
protected IPortOwner getPortOwner(PointD location)
If there is a IHitTester
for type INode
in the lookup of this mode's InputModeContext
then this instance will be used for the query.
Otherwise this implementation calls the INodeStyleRenderer.getHitTestable(INode, INodeStyle)
method of the nodes to find hit nodes and uses the Comparator
to determine the first hit node.
location
- The position in world coordinates.null
if no suitable node was found.protected Iterable<IPortOwner> getPortOwners()
This implementation only considers nodes in the graph unless EdgeToEdgeConnectionsAllowed
is set to true
, in which case edges are also added to the enumerable.
IPortOwner
s in this graphpublic final double getPreferredMinimalEdgeDistance()
This information is needed when deciding which way to route the first segment of an orthogonal edge.
setPreferredMinimalEdgeDistance(double)
public final IEventRecognizer getPrepareRecognizer()
The default is IEventRecognizer.MOUSE_LEFT_PRESSED
.
setPrepareRecognizer(IEventRecognizer)
public final IEventRecognizer getPrepareRecognizerTouch()
The default is IEventRecognizer.TOUCH_LONG_PRESSED_PRIMARY
.
setPrepareRecognizerTouch(IEventRecognizer)
public final int getPriority()
IInputMode
The priority will influence the order in which the modes will be installed
into the canvas control. The lower the priority value, the earlier it will be installed. If two modes are installed
using the same priority value, the first one will be installed earlier.
getPriority
in interface IInputMode
public final IEventRecognizer getRemoveBendRecognizer()
setRemoveBendRecognizer(IEventRecognizer)
public final IEventRecognizer getRemoveBendRecognizerTouch()
The default is IEventRecognizer.TOUCH_LONG_PRESSED_SECONDARY
.
setRemoveBendRecognizerTouch(IEventRecognizer)
public final SnapContext getSnapContext()
SnapContext
which manages snapping model items to certain coordinates (for instance, other
items).
If set to null
(the default) this input mode tries to obtain the SnapContext
from the
IInputModeContext
. To explicitly disable snapping, a SnapContext
implementation
that does nothing has to be set to this instance.
setSnapContext(SnapContext)
public final double getSnapDistance()
SnappingToTargetCandidateEnabled
is enabled.
The default value is 20
.
setSnapDistance(double)
protected IPortOwner getSource(PointD sourceLocation)
port owner
at the specified location.
This always is the source node
if EdgeToEdgeConnectionsAllowed
is set to false
.
This default implementation simply delegates to getPortOwner(PointD)
.
sourceLocation
- The location of the mouse at the beginning of the gesture.null
.public final IPortCandidate getSourcePortCandidate()
SourcePort
of the edge to be created.
This property will be populated automatically when edge creation has started.
setSourcePortCandidate(IPortCandidate)
protected IPortCandidate getSourcePortCandidate(IPortCandidateProvider provider, PointD location, boolean resolveCandidates)
IPortCandidate
given a provider and the current location.
The resolveCandidates
parameter determines whether dynamic port candidates should be resolved
with respect to location
or simply be discarded.
provider
- The provider for the candidates.location
- The location where the gesture was initiated.resolveCandidates
- Determines whether PortCandidateValidity.DYNAMIC
ports should be resolved with respect to the location
or not.null
.isResolvingSourcePortCandidatesEnabled()
,
getPortCandidateResolutionRecognizer()
protected IPortCandidate getSourcePortCandidate(PointD location)
port candidate
based on the given location.
This implementation will use the port owner
to look up the port candidate provider
and finally delegate to getSourcePortCandidate(IPortCandidateProvider, PointD, boolean)
.
location
- The location where the gesture was initiated.getSource(PointD)
,
getSourcePortCandidateProvider(IPortOwner)
,
getSourcePortCandidate(IPortCandidateProvider, PointD, boolean)
protected IPortCandidateProvider getSourcePortCandidateProvider(IPortOwner sourceOwner)
This implementations uses the sourceOwner
's ILookup.lookup(Class)
to retrieve an IPortCandidateProvider
implementation.
sourceOwner
- The IPortOwner
to find the candidates for.null
.public final PointD getStartPoint()
protected IPortOwner getTarget(PointD targetLocation)
port owner
at the specified location.
This always is a target node
if EdgeToEdgeConnectionsAllowed
is
set to false
.
This default implementation simply delegates to getPortOwner(PointD)
.
targetLocation
- The location of the pointer at the beginning of the gesture.null
.public final IPortCandidate getTargetPortCandidate()
TargetPort
of the edge to be created.setTargetPortCandidate(IPortCandidate)
protected IPortCandidateProvider getTargetPortCandidateProvider(IPortCandidate sourcePortCandidate, IPortOwner targetOwner, PointD location)
This implementations uses the targetOwner
's ILookup.lookup(Class)
to retrieve an IPortCandidateProvider
implementation.
sourcePortCandidate
- The current source port candidate.targetOwner
- The IPortOwner
to find the candidates for.location
- The location of the mouse.null
.protected IPortCandidateProvider getTargetPortCandidateProvider(IPortCandidate sourcePortCandidate, PointD location)
IPortCandidateProvider
instance that provides the possible candidates for the target of the edge
given the current source candidate.
This implementation queries all nodes in the graph for their provider
and returns a composite unless UsingHitItemsCandidatesOnlyEnabled
is set
to true
in which case the getTargetPortCandidateProvider(IPortCandidate, IPortOwner, PointD)
is queried
using the current target
.
sourcePortCandidate
- The source candidate that has been chosen for the edge creation.location
- The location of the mouse.protected Iterable<IPortCandidate> getTargetPortCandidates(PointD location, boolean resolveCandidates)
The resolveCandidates
parameter determines whether dynamic port candidates should be resolved
with respect to location
or simply be discarded. This implementation delegates to getTargetPortCandidateProvider(IPortCandidate, PointD)
or returns an empty enumerable if no provider has been found.
location
- The location of the mouse in world coordinates.resolveCandidates
- Determines whether PortCandidateValidity.DYNAMIC
ports should be resolved with respect to the location
or not.getSourcePortCandidate()
,
isResolvingTargetPortCandidatesEnabled()
,
getPortCandidateResolutionRecognizer()
public final IEventRecognizer getToggleSegmentOrientationRecognizer()
IEventRecognizer
that toggles the orientation of the first orthogonally created segment.getOrthogonalEdgeCreationEnabled()
,
setToggleSegmentOrientationRecognizer(IEventRecognizer)
public final Cursor getValidBeginCursor()
setValidBeginCursor(Cursor)
public final Cursor getValidBendCursor()
setValidBendCursor(Cursor)
public final IHitTestable getValidBendHitTestable()
IHitTestable
that determines, whether it is valid to create a bend here.
The default implementation returns always true
.
setValidBendHitTestable(IHitTestable)
public final Cursor getValidEndCursor()
setValidEndCursor(Cursor)
public void install(IInputModeContext context, ConcurrencyController controller)
In general a mode can only be installed into a single canvas at all times.
This method is called to initialize this instance. Subclasses should override this method to register the corresponding event handler delegates for the various input events they need to register with.
Overriding implementations should call the base implementation, first.
install
in interface IInputMode
context
- The context that this instance shall be installed into. The same instance will be passed to this instance during
IInputMode.uninstall(IInputModeContext)
. A reference to the context may be kept and queried during the time
the mode is installed.controller
- The Controller
for this mode.IInputMode.uninstall(IInputModeContext)
public final boolean isCancelGestureOnInvalidTarget()
If bend creation is allowed at the target location (i.e. ValidBendHitTestable
returns
true), the gesture will always continue by creating a bend. Otherwise, if this property is
true
, the gesture will be canceled automatically.
The default is false
, meaning that the gesture must always be canceled explicitely.
isCreateBendAllowed()
,
getValidBendHitTestable()
,
setCancelGestureOnInvalidTarget(boolean)
public final boolean isCancelingEditImplicitlyEnabled()
createEdge(IGraph, IPortCandidate, IPortCandidate)
the current undo edit should be
canceled if the method returns null
.
This should be set to false
if you want to perform some undoable actions in these methods and/or in the EdgeCreator
callback, but need to return null
from any of these methods. Default value is true
, meaning that
returning null
results in canceling the composite undo entry.
setCancelingEditImplicitlyEnabled(boolean)
public final boolean isCreateBendAllowed()
The default is true
.
setCreateBendAllowed(boolean)
public boolean isCreationInProgress()
This property yields true
after the edge creation has been started and before it has been cancelled
or finalized.
public final boolean isEdgeToEdgeConnectionsAllowed()
The default is false
.
setEdgeToEdgeConnectionsAllowed(boolean)
public boolean isEnabled()
Clients can use this property to disable or reenable this instance. This will set the Enabled
property of the installed Controller
so a disabled instance should never try to acquire the
input mutex.
setEnabled(boolean)
public final boolean isExclusive()
The value of this property will be delegated to the Exclusive
property of
the Controller
.
If this mode is marked as exclusive and has the mutex, all other modes added
to the same MultiplexingInputMode
will be deactivated. Otherwise it will always run
concurrently with all other modes.
setExclusive(boolean)
public final boolean isForcingSnapToCandidateEnabled()
If the nearest port candidate is farther away than SnapDistance
and the mouse hovers over a
valid target
, this property will cause the mouse to snap to the nearest valid candidate. The
default is true
.
setForcingSnapToCandidateEnabled(boolean)
public final boolean isPortCandidateShowingEnabled()
The default is true
.
setPortCandidateShowingEnabled(boolean)
public final boolean isResolvingSourcePortCandidatesEnabled()
PortCandidateValidity.DYNAMIC
ports that are part of the source port candidates
should be resolved for the current mouse location.
By default this feature is enabled and the PortCandidateResolutionRecognizer
is configured so that the resolution mechanism is used if the user holds the shift modifier during the gesture.
getPortCandidateResolutionRecognizer()
,
resolveCandidates(Iterable, PointD)
,
setResolvingSourcePortCandidatesEnabled(boolean)
public final boolean isResolvingTargetPortCandidatesEnabled()
PortCandidateValidity.DYNAMIC
ports that are part of the target port candidates
should be resolved for the current mouse location.
By default this feature is enabled and the PortCandidateResolutionRecognizer
is configured so that the resolution mechanism is used if the user holds the shift modifier during the gesture.
getPortCandidateResolutionRecognizer()
,
resolveCandidates(Iterable, PointD)
,
setResolvingTargetPortCandidatesEnabled(boolean)
public final boolean isSelfloopsAllowed()
The default is true
, which enables that an edge is connected to a SourcePort
and TargetPort
that have the same Owner
.
setSelfloopsAllowed(boolean)
public final boolean isSnappingToTargetCandidateEnabled()
This will make the edge's end point point to the position of the target port candidate. This will result in the preview edge looking exactly like the edge after creation.
setSnappingToTargetCandidateEnabled(boolean)
public final boolean isUsingHitItemsCandidatesOnlyEnabled()
target port candidates
of the node the mouse currently hovers over.
The default is true
.
isPortCandidateShowingEnabled()
,
getTarget(PointD)
,
getTargetPortCandidates(PointD, boolean)
,
setUsingHitItemsCandidatesOnlyEnabled(boolean)
protected void onCanceled()
cancel()
has been called.
Can be overridden in subclasses to perform additional actions after the mode has been canceled.
This implementation does nothing.
protected void onConcurrencyControllerActivated()
ConcurrencyController
property of the installed ConcurrencyController
has been set to
true
.
Can be overridden in subclasses to perform additional actions after the mode has been activated.
Overriding implementations should call the base implementation.
protected void onConcurrencyControllerDeactivated()
Active
property of the installed ConcurrencyController
has been set to false
.
Can be overridden in subclasses to perform additional actions after the mode has been deactivated.
Overriding implementations should call the base implementation.
protected void onEdgeCreated(EdgeEventArgs args)
createEdge()
after the edge has been finalized.
This method will trigger the EdgeCreated
event.
args
- The event argument holding the edge.protected void onEdgeCreationStarted(EdgeEventArgs args)
EdgeCreationStarted
event when the gesture for
creating an edge has been initialized.args
- The ItemEventArgs
instance containing the dummy edge that will be used during edge creation.protected void onGestureCanceled(InputModeEventArgs inputModeEventArgs)
GestureCanceled
event.inputModeEventArgs
- The event argument that contains context information.protected void onGestureCanceling(InputModeEventArgs inputModeEventArgs)
GestureCanceling
event.inputModeEventArgs
- The event argument that contains context information.protected void onGestureFinished(InputModeEventArgs inputModeEventArgs)
This method triggers the GestureFinished
event.
inputModeEventArgs
- The event argument that contains context information.protected void onGestureFinishing(InputModeEventArgs inputModeEventArgs)
This method triggers the GestureFinishing
event.
inputModeEventArgs
- The event argument that contains context information.protected void onGestureStarted(InputModeEventArgs inputModeEventArgs)
GestureStarted
event.inputModeEventArgs
- The event argument that contains context information.protected void onGestureStarting(InputModeEventArgs inputModeEventArgs)
GestureStarting
event.inputModeEventArgs
- The event argument that contains context information.protected void onMoved(InputModeEventArgs inputModeEventArgs)
This method triggers the Moved
event.
inputModeEventArgs
- The event argument that contains context information.protected void onMoving(InputModeEventArgs inputModeEventArgs)
This method triggers the Moving
event.
inputModeEventArgs
- The event argument that contains context information.protected void onPortAdded(ItemEventArgs<IPort> args)
PortAdded
event if the mode has added a port
for the source or target node to complete the edge creation.args
- The ItemEventArgs
instance containing the port that has been added.addPortAddedListener(IEventHandler)
protected void onSourcePortCandidateChanged(ItemEventArgs<IPortCandidate> args)
SourcePortCandidateChanged
event.args
- The event argument that contains context information.protected void onStopped()
stop()
has been called.
Can be overridden in subclasses to perform additional actions after the mode has been stopped.
This implementation does nothing.
protected void onTargetPortCandidateChanged(ItemEventArgs<IPortCandidate> args)
TargetPortCandidateChanged
event.args
- The event argument that contains context information.public final void removeEdgeCreatedListener(IEventHandler<EdgeEventArgs> edgeCreatedEvent)
EdgeCreated
event that occurs after an edge has been created by this mode.edgeCreatedEvent
- The listener to remove.onEdgeCreated(EdgeEventArgs)
,
addEdgeCreatedListener(IEventHandler)
public final void removeEdgeCreationStartedListener(IEventHandler<EdgeEventArgs> edgeCreationStartedEvent)
EdgeCreationStarted
event that occurs when the edge creation has started.
The edge that is stored in the Item
property is the DummyEdge
that is used during creation.
edgeCreationStartedEvent
- The listener to remove.addEdgeCreationStartedListener(IEventHandler)
public final void removeGestureCanceledListener(IEventHandler<InputModeEventArgs> gestureCanceledEvent)
GestureCanceled
event that occurs when the gesture has been canceled.gestureCanceledEvent
- The listener to remove.addGestureCanceledListener(IEventHandler)
public final void removeGestureCancelingListener(IEventHandler<InputModeEventArgs> gestureCancelingEvent)
GestureCanceling
event that occurs before the gesture will be canceled.gestureCancelingEvent
- The listener to remove.addGestureCancelingListener(IEventHandler)
public final void removeGestureFinishedListener(IEventHandler<InputModeEventArgs> gestureFinishedEvent)
GestureFinished
event that occurs once the gesture has been finished.gestureFinishedEvent
- The listener to remove.addGestureFinishedListener(IEventHandler)
public final void removeGestureFinishingListener(IEventHandler<InputModeEventArgs> gestureFinishingEvent)
GestureFinishing
event that occurs before the gesture will be finished.gestureFinishingEvent
- The listener to remove.addGestureFinishingListener(IEventHandler)
public final void removeGestureStartedListener(IEventHandler<InputModeEventArgs> gestureStartedEvent)
GestureStarted
event that occurs once the gesture is initialized and has
started.gestureStartedEvent
- The listener to remove.addGestureStartedListener(IEventHandler)
public final void removeGestureStartingListener(IEventHandler<InputModeEventArgs> gestureStartingEvent)
GestureStarting
event that occurs once the gesture is starting.gestureStartingEvent
- The listener to remove.addGestureStartingListener(IEventHandler)
public final void removeMovedListener(IEventHandler<InputModeEventArgs> movedEvent)
Moved
event that occurs at the end of every drag or move.movedEvent
- The listener to remove.addMovedListener(IEventHandler)
public final void removeMovingListener(IEventHandler<InputModeEventArgs> movingEvent)
Moving
event that occurs at the start of every drag or move.movingEvent
- The listener to remove.addMovingListener(IEventHandler)
public final void removePortAddedListener(IEventHandler<ItemEventArgs<IPort>> portAddedEvent)
PortAdded
event that occurs when this instance adds a port
to the source or target node during completion of the edge creation gesture.portAddedEvent
- The listener to remove.addPortAddedListener(IEventHandler)
public final void removeSourcePortCandidateChangedListener(IEventHandler<ItemEventArgs<IPortCandidate>> sourcePortCandidateChangedEvent)
SourcePortCandidateChanged
event that occurs when the value of the SourcePortCandidate
property changes.sourcePortCandidateChangedEvent
- The listener to remove.addSourcePortCandidateChangedListener(IEventHandler)
public final void removeTargetPortCandidateChangedListener(IEventHandler<ItemEventArgs<IPortCandidate>> targetPortCandidateChangedEvent)
TargetPortCandidateChanged
event that occurs when the value of the TargetPortCandidate
property changes.targetPortCandidateChangedEvent
- The listener to remove.addTargetPortCandidateChangedListener(IEventHandler)
protected Iterable<IPortCandidate> resolveCandidates(Iterable<IPortCandidate> candidates, PointD location)
PortCandidateValidity.DYNAMIC
Validity
.
If the location has a value, method IPortCandidate.getPortCandidateAt(IInputModeContext, PointD)
is used to
resolve the dynamic candidate to a real candidate, otherwise that candidate is discarded.
candidates
- The candidates to possibly resolve.location
- The location to resolve dynamic candidates against or null
if they should be discarded instead.PortCandidateValidity.DYNAMIC
port candidates.public final void setBeginHitTestable(IHitTestable value)
IHitTestable
that determines, whether it is valid to start an edge creation gesture here.
The default implementation returns true
if getSource(PointD)
yields a non-null
value.
value
- The BeginHitTestable to set.getBeginHitTestable()
public final void setCancelGestureOnInvalidTarget(boolean value)
If bend creation is allowed at the target location (i.e. ValidBendHitTestable
returns
true), the gesture will always continue by creating a bend. Otherwise, if this property is
true
, the gesture will be canceled automatically.
The default is false
, meaning that the gesture must always be canceled explicitely.
value
- The CancelGestureOnInvalidTarget to set.isCreateBendAllowed()
,
getValidBendHitTestable()
,
isCancelGestureOnInvalidTarget()
public final void setCancelingEditImplicitlyEnabled(boolean value)
createEdge(IGraph, IPortCandidate, IPortCandidate)
the current undo edit should be
canceled if the method returns null
.
This should be set to false
if you want to perform some undoable actions in these methods and/or in the EdgeCreator
callback, but need to return null
from any of these methods. Default value is true
, meaning that
returning null
results in canceling the composite undo entry.
value
- The CancelingEditImplicitlyEnabled to set.isCancelingEditImplicitlyEnabled()
public final void setCancelRecognizer(IEventRecognizer value)
value
- The CancelRecognizer to set.getCancelRecognizer()
public final void setCancelRecognizerTouch(IEventRecognizer value)
The default is IEventRecognizer.TOUCH_MULTI_TAPPED_SECONDARY
.
value
- The CancelRecognizerTouch to set.getCancelRecognizerTouch()
public final void setCandidateDescriptor(ICanvasObjectDescriptor value)
ICanvasObjectDescriptor
that is used for visualizing the
IPortCandidate
s in the canvas during the edit.
This descriptor is queried for the IVisualCreator
to obtain the visualizations for the
candidates that are not currently closest. By default an instance of DefaultPortCandidateDescriptor
is used.
value
- The CandidateDescriptor to set.getClosestCandidateDescriptor()
,
getCandidateDescriptor()
public final void setClosestCandidateDescriptor(ICanvasObjectDescriptor value)
ICanvasObjectDescriptor
that is used for visualizing the closest IPortCandidate
in the canvas
during the edit.
This descriptor is queried for the IVisualCreator
to obtain the visualization for the
currently closest candidate. By default an instance of DefaultPortCandidateDescriptor
is used.
value
- The ClosestCandidateDescriptor to set.getCandidateDescriptor()
,
getClosestCandidateDescriptor()
public final void setCreateBendAllowed(boolean value)
The default is true
.
value
- The CreateBendAllowed to set.isCreateBendAllowed()
public final void setCreateBendRecognizer(IEventRecognizer value)
The default is IEventRecognizer.MOUSE_LEFT_RELEASED
.
value
- The CreateBendRecognizer to set.getCreateBendRecognizer()
public final void setCreateBendRecognizerTouch(IEventRecognizer value)
The default is IEventRecognizer.TOUCH_UP_PRIMARY
.
value
- The CreateBendRecognizerTouch to set.getCreateBendRecognizerTouch()
public final void setDisableSnappingRecognizer(IEventRecognizer value)
IEventRecognizer
that temporarily disables snapping.value
- The disable snapping recognizer. The default is IEventRecognizer.SHORTCUT_DOWN
getDisableSnappingRecognizer()
public final void setDraggedRecognizer(IEventRecognizer value)
The default is IEventRecognizer.MOUSE_DRAGGED
.
value
- The DraggedRecognizer to set.getDraggedRecognizer()
public final void setDraggedRecognizerTouch(IEventRecognizer value)
The default is IEventRecognizer.TOUCH_MOVED_PRIMARY
.
value
- The DraggedRecognizerTouch to set.getDraggedRecognizerTouch()
public final void setEdgeCreator(IEdgeCreationCallback value)
The default creator will delegate to IGraph.createEdge(INode, INode, IEdgeStyle, Object)
and obtain the tag from
the DummyEdge
. It will then copy over all bends, labels, and ports from the
DummyEdge
.
NullPointerException
- If the argument is null
value
- The ports based edge creation callback that will be used during
createEdge(IGraph, IPortCandidate, IPortCandidate)
.getEdgeCreator()
public final void setEdgeDefaults(IEdgeDefaults value)
This property directly delegates to the EdgeDefaults
of the
DummyEdgeGraph
.
value
- The EdgeDefaults to set.getEdgeDefaults()
public final void setEdgeToEdgeConnectionsAllowed(boolean value)
The default is false
.
value
- The EdgeToEdgeConnectionsAllowed to set.isEdgeToEdgeConnectionsAllowed()
public void setEnabled(boolean value)
Clients can use this property to disable or reenable this instance. This will set the Enabled
property of the installed Controller
so a disabled instance should never try to acquire the
input mutex.
value
- The Enabled to set.isEnabled()
public final void setEnableSnappingRecognizer(IEventRecognizer value)
IEventRecognizer
that reenables temporarily disabled snapping.value
- The disable snapping recognizer. The default is IEventRecognizer.SHORTCUT_UP
getDisableSnappingRecognizer()
,
getEnableSnappingRecognizer()
public final void setEndHitTestable(IHitTestable value)
IHitTestable
that determines, whether it is valid to finish an edge creation gesture here.
The default implementation returns true
if there is a node at the given location.
value
- The EndHitTestable to set.getEndHitTestable()
public final void setEndPointMovedRecognizer(IEventRecognizer value)
The default is IEventRecognizer.MOUSE_MOVED_OR_DRAGGED
.
value
- The EndPointMovedRecognizer to set.getEndPointMovedRecognizer()
public final void setEnforceBendCreationRecognizer(IEventRecognizer value)
IEventRecognizer
that will be queried to decide if bend creation is enforced.
The default is IEventRecognizer.SHORTCUT_PRESSED
.
value
- The EnforceBendCreationRecognizer to set.getEnforceBendCreationRecognizer()
public final void setExclusive(boolean value)
The value of this property will be delegated to the Exclusive
property of
the Controller
.
If this mode is marked as exclusive and has the mutex, all other modes added
to the same MultiplexingInputMode
will be deactivated. Otherwise it will always run
concurrently with all other modes.
value
- The Exclusive to set.isExclusive()
public final void setFinishRecognizer(IEventRecognizer value)
The default is a combination of IEventRecognizer.MOUSE_LEFT_PRESSED
and
IEventRecognizer.MOUSE_LEFT_RELEASED
.
value
- The FinishRecognizer to set.getFinishRecognizer()
public final void setFinishRecognizerTouch(IEventRecognizer value)
The default is IEventRecognizer.TOUCH_UP_PRIMARY
.
value
- The FinishRecognizerTouch to set.getFinishRecognizerTouch()
public final void setForcingSnapToCandidateEnabled(boolean value)
If the nearest port candidate is farther away than SnapDistance
and the mouse hovers over a
valid target
, this property will cause the mouse to snap to the nearest valid candidate. The
default is true
.
value
- The ForcingSnapToCandidateEnabled to set.isForcingSnapToCandidateEnabled()
public final void setNodeBorderWidthRatio(double value)
An edge starting inside a given margin is always pointing away from it.
value
- The NodeBorderWidthRatio to set.getNodeBorderWidthRatio()
public final void setOrthogonalEdgeCreationEnabled(OrthogonalEdgeEditingPolicy value)
By default orthogonal edge creation is enabled if orthogonal edge editing is enabled on the
parent input mode
.
value
- The OrthogonalEdgeCreationEnabled to set.GraphEditorInputMode.getOrthogonalEdgeEditingContext()
,
OrthogonalEdgeEditingContext.isEnabled()
,
getOrthogonalEdgeCreationEnabled()
public final void setOrthogonalSnapDistance(double value)
The default value is 5
.
value
- The OrthogonalSnapDistance to set.getOrthogonalSnapDistance()
public final void setPortCandidateResolutionRecognizer(IEventRecognizer value)
By default this is IEventRecognizer.SHIFT_PRESSED
.
value
- The PortCandidateResolutionRecognizer to set.getPortCandidateResolutionRecognizer()
public final void setPortCandidateShowingEnabled(boolean value)
The default is true
.
value
- The PortCandidateShowingEnabled to set.isPortCandidateShowingEnabled()
public final void setPreferredMinimalEdgeDistance(double value)
This information is needed when deciding which way to route the first segment of an orthogonal edge.
value
- The PreferredMinimalEdgeDistance to set.getPreferredMinimalEdgeDistance()
public final void setPrepareRecognizer(IEventRecognizer value)
The default is IEventRecognizer.MOUSE_LEFT_PRESSED
.
value
- The PrepareRecognizer to set.getPrepareRecognizer()
public final void setPrepareRecognizerTouch(IEventRecognizer value)
The default is IEventRecognizer.TOUCH_LONG_PRESSED_PRIMARY
.
value
- The PrepareRecognizerTouch to set.getPrepareRecognizerTouch()
public final void setPriority(int value)
The priority will influence the order in which the modes will be installed
into the canvas control. The lower the priority value, the earlier it will be installed. If two modes are installed
using the same priority value, the first one will be installed earlier.
value
- The Priority to set.getPriority()
public final void setRemoveBendRecognizer(IEventRecognizer value)
value
- The RemoveBendRecognizer to set.getRemoveBendRecognizer()
public final void setRemoveBendRecognizerTouch(IEventRecognizer value)
The default is IEventRecognizer.TOUCH_LONG_PRESSED_SECONDARY
.
value
- The RemoveBendRecognizerTouch to set.getRemoveBendRecognizerTouch()
public final void setResolvingSourcePortCandidatesEnabled(boolean value)
PortCandidateValidity.DYNAMIC
ports that are part of the source port candidates
should be resolved for the current mouse location.
By default this feature is enabled and the PortCandidateResolutionRecognizer
is configured so that the resolution mechanism is used if the user holds the shift modifier during the gesture.
value
- The ResolvingSourcePortCandidatesEnabled to set.getPortCandidateResolutionRecognizer()
,
resolveCandidates(Iterable, PointD)
,
isResolvingSourcePortCandidatesEnabled()
public final void setResolvingTargetPortCandidatesEnabled(boolean value)
PortCandidateValidity.DYNAMIC
ports that are part of the target port candidates
should be resolved for the current mouse location.
By default this feature is enabled and the PortCandidateResolutionRecognizer
is configured so that the resolution mechanism is used if the user holds the shift modifier during the gesture.
value
- The ResolvingTargetPortCandidatesEnabled to set.getPortCandidateResolutionRecognizer()
,
resolveCandidates(Iterable, PointD)
,
isResolvingTargetPortCandidatesEnabled()
public final void setSelfloopsAllowed(boolean value)
The default is true
, which enables that an edge is connected to a SourcePort
and TargetPort
that have the same Owner
.
value
- The SelfloopsAllowed to set.isSelfloopsAllowed()
public final void setSnapContext(SnapContext value)
SnapContext
which manages snapping model items to certain coordinates (for instance, other
items).
If set to null
(the default) this input mode tries to obtain the SnapContext
from the
IInputModeContext
. To explicitly disable snapping, a SnapContext
implementation
that does nothing has to be set to this instance.
value
- The SnapContext to set.getSnapContext()
public final void setSnapDistance(double value)
SnappingToTargetCandidateEnabled
is enabled.
The default value is 20
.
value
- The SnapDistance to set.getSnapDistance()
public final void setSnappingToTargetCandidateEnabled(boolean value)
This will make the edge's end point point to the position of the target port candidate. This will result in the preview edge looking exactly like the edge after creation.
value
- The SnappingToTargetCandidateEnabled to set.isSnappingToTargetCandidateEnabled()
public final void setSourcePortCandidate(IPortCandidate value)
SourcePort
of the edge to be created.
This property will be populated automatically when edge creation has started.
value
- The SourcePortCandidate to set.getSourcePortCandidate()
public final void setTargetPortCandidate(IPortCandidate value)
TargetPort
of the edge to be created.value
- The TargetPortCandidate to set.getTargetPortCandidate()
public final void setToggleSegmentOrientationRecognizer(IEventRecognizer value)
IEventRecognizer
that toggles the orientation of the first orthogonally created segment.value
- The recognizer instances that identifies the event that toggles the orientation of the first segment. The default
instance recognizes if the user presses the space key.getOrthogonalEdgeCreationEnabled()
,
getToggleSegmentOrientationRecognizer()
public final void setUsingHitItemsCandidatesOnlyEnabled(boolean value)
target port candidates
of the node the mouse currently hovers over.
The default is true
.
value
- The UsingHitItemsCandidatesOnlyEnabled to set.isPortCandidateShowingEnabled()
,
getTarget(PointD)
,
getTargetPortCandidates(PointD, boolean)
,
isUsingHitItemsCandidatesOnlyEnabled()
public final void setValidBeginCursor(Cursor value)
value
- The ValidBeginCursor to set.getValidBeginCursor()
public final void setValidBendCursor(Cursor value)
value
- The ValidBendCursor to set.getValidBendCursor()
public final void setValidBendHitTestable(IHitTestable value)
IHitTestable
that determines, whether it is valid to create a bend here.
The default implementation returns always true
.
value
- The ValidBendHitTestable to set.getValidBendHitTestable()
public final void setValidEndCursor(Cursor value)
value
- The ValidEndCursor to set.getValidEndCursor()
public boolean stop()
IInputMode
This should stop the current edit, if one is in progress and possibly commit all of the changes. If stopping is not
possible, this method can return false
stop
in interface IInputMode
true
if and only if the editing has been stopped or there was no edit in progressIInputMode.cancel()
public void uninstall(IInputModeContext context)
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.
Overriding implementations should call the base implementation after their own code.
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.protected void updateDummyEdgeSourcePort(IPortCandidate sourcePortCandidate)
DummyEdge
to reflect the current source port candidate.
This implementation creates a self loop of the dummy edge if the sourcePortCandidate
is the same as the owner of
the TargetPortCandidate
.
sourcePortCandidate
- The new owner target port candidate.protected void updateDummyEdgeTargetPort(IPortCandidate targetPortCandidate)
DummyEdge
to reflect the current target port candidate.
This implementation creates a self loop of the dummy edge if the targetPortCandidate
is the same as the owner of
the SourcePortCandidate
.
targetPortCandidate
- The new owner target port candidate.protected void updateTargetLocation(PointD location)
This method is called when the current target location for the creation gesture is changed.
location
- The new coordinates.