Package | com.yworks.graph.model |
Class | public class PortRelocationHandle |
Inheritance | PortRelocationHandle EdgeEndMoveHandle Object |
IHandle
interface
the can be used to relocate a port.
This class heavily relies on the implementation of the IEdgePortCandidateProvider
that is
queried from the IEdge
this handle is acting on.
See also
Property | Defined By | ||
---|---|---|---|
addExistingPort : Boolean
Gets or sets a property that determines whether the existing port should be
available as a possible port candidate, too. | PortRelocationHandle | ||
cursor : Cursor [override]
Provides the cursor to display when the mouse hovers over or drags this
handle. | PortRelocationHandle | ||
location : IPoint [read-only]
Returns a view of the location of the item. | EdgeEndMoveHandle | ||
maximumSnapDistance : Number
Gets or sets the maximum distance the pointer may be away of a candidate in order to
be snapped to the candidate. | PortRelocationHandle | ||
portCandidateResolutionRecognizer : Function
The event recognizer that detects changes to the isPortCandidateResolutionEnabled property. | PortRelocationHandle | ||
resolvePortCandidates : Boolean
A value indicating whether PortCandidateValidity.DYNAMIC ports that are part of the port
candidates should be resolved for the current mouse location. | PortRelocationHandle | ||
showDummyEdge : Boolean
Gets or sets a property that determines whether to show a dummy edge
during the drag operation. | EdgeEndMoveHandle | ||
showHitNodeCandidatesOnly : Boolean
Gets or sets a value indicating whether to show the candidates of hit nodes only. | PortRelocationHandle | ||
type : uint [override]
Returns the type of the handle that can be used by the rendering engine
to render types differently. | PortRelocationHandle | ||
x : Number [read-only]
Gets the current x coordinate of this point. | EdgeEndMoveHandle | ||
y : Number [read-only]
Gets the current y coordinate of this point. | EdgeEndMoveHandle |
Method | Defined By | ||
---|---|---|---|
Creates a new instance. | PortRelocationHandle | ||
cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void [override]
Called by clients to indicate that the dragging has been canceled by the user. | PortRelocationHandle | ||
dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void [override]
Called by clients to indicate that the repositioning has just been finished. | PortRelocationHandle | ||
handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):Boolean [override]
Called by clients to indicate that the element has been dragged and its position
should be updated. | PortRelocationHandle | ||
initializeDrag(context:IInputModeContext):void [override]
Called by clients to indicate that the element is going to be dragged. | PortRelocationHandle |
Method | Defined By | ||
---|---|---|---|
[override]
Configures the dummy edge to look like the given edge. | PortRelocationHandle | ||
Factory method that creates the dummy edge that will be shown during the drag operation. | EdgeEndMoveHandle | ||
Factory method that creates a dummy display object creator for the dummy edge during the drag operation. | EdgeEndMoveHandle | ||
Factory method that creates the candidate for the existing port. | PortRelocationHandle | ||
Factory method that creates the ICanvasObjectDescriptor
that will be used to paint the IPortCandidates. | PortRelocationHandle | ||
getClosestCandidate(context:IInputModeContext, x:Number, y:Number, candidates:Iterable):IPortCandidate
Finds the closest candidate to the given coordinates from the given set of candidates. | PortRelocationHandle | ||
Gets the graph to use from the context. | EdgeEndMoveHandle | ||
Callback used during dragFinished()
This implementation returns the result of IPortCandidate.createInstance()
or calls IGraph.addPort() if the result was null. | PortRelocationHandle | ||
Gets the possible candidates for the given edge. | PortRelocationHandle | ||
Hides the original edge during the drag operation. | EdgeEndMoveHandle | ||
isPortCandidateResolutionEnabled(context:IInputModeContext):Boolean
Determines whether for the current gesture port candidate resolution is enabled in the specified context. | PortRelocationHandle | ||
resolveCandidate(context:IInputModeContext, candidate:IPortCandidate, location:IPoint):IPortCandidate
Tries to resolve a dynamic port candidate for the given location. | PortRelocationHandle | ||
setClosestCandidate(closest:IPortCandidate):void
Updates the closest candidate for visual feedback. | PortRelocationHandle | ||
setPort(context:IInputModeContext, edge:IEdge, setSourcePort:Boolean, portCandidate:IPortCandidate, suggestedLocation:IPoint):void
Callback that is triggered by dragFinished to actually change the port. | PortRelocationHandle | ||
Finally sets the ports for the edge to the new values. | PortRelocationHandle | ||
setPosition(x:Number, y:Number):void
Updates the position of the handle. | EdgeEndMoveHandle | ||
Updates the dummy edge's visual appearance to reflect the new port candidate. | PortRelocationHandle | ||
Unhides the original edge that was hidden during the drag operation. | EdgeEndMoveHandle |
addExistingPort | property |
addExistingPort:Boolean
Gets or sets a property that determines whether the existing port should be available as a possible port candidate, too.
If this property is set to false
,
getPortCandidates
will return only the ports provided by
the IPortCandidateProvider
in the node's lookup.
The default value is true
.
public function get addExistingPort():Boolean
public function set addExistingPort(value:Boolean):void
See also
cursor | property |
cursor:Cursor
[override] Provides the cursor to display when the mouse hovers over or drags this handle.
public function get cursor():Cursor
public function set cursor(value:Cursor):void
maximumSnapDistance | property |
maximumSnapDistance:Number
Gets or sets the maximum distance the pointer may be away of a candidate in order to be snapped to the candidate.
The distance is measured in view coordinates.
The default value is 50.0
.
public function get maximumSnapDistance():Number
public function set maximumSnapDistance(value:Number):void
portCandidateResolutionRecognizer | property |
portCandidateResolutionRecognizer:Function
The event recognizer that detects changes to the isPortCandidateResolutionEnabled
property.
By default this is set to the EventRecognizers.MODIFIER_SHIFT
. recognizer.
public function get portCandidateResolutionRecognizer():Function
public function set portCandidateResolutionRecognizer(value:Function):void
See also
resolvePortCandidates | property |
resolvePortCandidates:Boolean
A value indicating whether PortCandidateValidity.DYNAMIC
ports that are part of the 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.
The default value is true
.
public function get resolvePortCandidates():Boolean
public function set resolvePortCandidates(value:Boolean):void
See also
showHitNodeCandidatesOnly | property |
showHitNodeCandidatesOnly:Boolean
Gets or sets a value indicating whether to show the candidates of hit nodes only.
true
if only candidates of hit nodes are shown; otherwise, false
.
public function get showHitNodeCandidatesOnly():Boolean
public function set showHitNodeCandidatesOnly(value:Boolean):void
type | property |
type:uint
[override] Returns the type of the handle that can be used by the rendering engine to render types differently.
public function get type():uint
public function set type(value:uint):void
PortRelocationHandle | () | Constructor |
public function PortRelocationHandle(graph:IGraph, edge:IEdge, sourceEnd:Boolean)
Creates a new instance.
Parametersgraph:IGraph — The graph or null . If the graph instance is not specified,
the handle will try to receive the graph from the context that is passed in during initializeDrag .
| |
edge:IEdge — The edge.
| |
sourceEnd:Boolean — if set to true the source end will be subject to relocation,
otherwise it will be the target port.
|
cancelDrag | () | method |
override public function cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
Called by clients to indicate that the dragging has been canceled by the user.
This method may be called after the initial initializeDrag
and zero or
more invocations of handleMove
.
Implementations should reset the position of the items they modify to their initial state.
Alternatively to this method the dragFinished
method might be called.
Parameters
context:IInputModeContext — The context to retrieve information about the drag from.
| |
originalX:Number — The value of the x property at the time of initializeDrag .
| |
originalY:Number — The value of the y property at the time of initializeDrag .
|
configureDummy | () | method |
override protected function configureDummy(dummy:DefaultEdge, edge:IEdge):void
Configures the dummy edge to look like the given edge.
Parameters
dummy:DefaultEdge — The dummy edge that should mimic the given edge.
| |
edge:IEdge — The edge to mimic.
|
createExistingPortCandidate | () | method |
protected function createExistingPortCandidate(currentPort:IPort):IPortCandidate
Factory method that creates the candidate for the existing port.
Parameters
currentPort:IPort — The port to create a candidate for.
|
IPortCandidate — The candidate or null .
|
See also
createPortCandidateDescriptor | () | method |
protected function createPortCandidateDescriptor():ICanvasObjectDescriptor
Factory method that creates the ICanvasObjectDescriptor
that will be used to paint the IPortCandidate
s.
ICanvasObjectDescriptor — The descriptor to use for the rendering in the CanvasComponent .
|
dragFinished | () | method |
override public function dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
Called by clients to indicate that the repositioning has just been finished.
This method may be called after the initial initializeDrag
and zero or
more invocations of handleMove
.
Alternatively to this method the cancelDrag
method might be called.
Parameters
context:IInputModeContext — The context to retrieve information about the drag from.
| |
originalX:Number — The value of the x property at the time of initializeDrag .
| |
originalY:Number — The value of the y property at the time of initializeDrag .
| |
newX:Number — The value of the x coordinate in the world coordinate system that the client wants the handle to be at.
Depending on the implementation the x and y properties or may not be modified to reflect the new value.
This is the same value as delivered in the last invocation of handleMove .
| |
newY:Number — The value of the y coordinate in the world coordinate system that the client wants the handle to be at.
Depending on the implementation the x and y properties or may not be modified to reflect the new value.
This is the same value as delivered in the last invocation of handleMove .
|
getClosestCandidate | () | method |
protected function getClosestCandidate(context:IInputModeContext, x:Number, y:Number, candidates:Iterable):IPortCandidate
Finds the closest candidate to the given coordinates from the given set of candidates.
Parameters
context:IInputModeContext — The context in for which the closest handle candidate is sought.
| |
x:Number — The horizontal location for which to find a candidate.
| |
y:Number — The vertical location for which to find a candidate.
| |
candidates:Iterable — The current set of candidates
|
IPortCandidate — The closes candidate or null .
|
getPort | () | method |
protected function getPort(context:IInputModeContext, candidate:IPortCandidate, suggestedLocation:IPoint):IPort
Callback used during dragFinished()
This implementation returns the result of IPortCandidate.createInstance()
or calls IGraph.addPort()
if the result was null
.
Parameters
context:IInputModeContext — The context.
| |
candidate:IPortCandidate — The candidate to get a port instance from.
| |
suggestedLocation:IPoint — The suggested location for the port.
|
IPort — A non-null port instance.
|
See also
getPortCandidates | () | method |
protected function getPortCandidates(context:IInputModeContext, edge:IEdge, sourcePort:Boolean):Iterable
Gets the possible candidates for the given edge.
This implementation uses the IEdgePortCandidateProvider
from the edge's lookup
to retrieve the candidate sets.
If addExistingPort
is enabled, the existing port will be part of the
candidates.
Parameters
context:IInputModeContext — The context that is used to retrieve the candidates for.
| |
edge:IEdge — The edge.
| |
sourcePort:Boolean — Whether to look for source port candidates.
|
Iterable — A non-null iterable over the candidates.
|
See also
handleMove | () | method |
override public function handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):Boolean
Called by clients to indicate that the element has been dragged and its position should be updated.
This method may be called more than once after an initial initializeDrag
and will be followed by either dragFinished
or cancelDrag
.
Parameters
context:IInputModeContext — The value of the x property at the time of initializeDrag .
| |
originalX:Number — The value of the y property at the time of initializeDrag .
| |
originalY:Number — The value of the x coordinate in the world coordinate system that the client wants the handle to be at.
Depending on the implementation the x property may or may not be modified to reflect the new value.
| |
newX:Number — The value of the y coordinate in the world coordinate system that the client wants the handle to be at.
Depending on the implementation the y property may or may not be modified to reflect the new value.
| |
newY:Number |
Boolean — Whether the move had any visual effect. This is a hint to the engine to optimize invalidation.
|
initializeDrag | () | method |
override public function initializeDrag(context:IInputModeContext):void
Called by clients to indicate that the element is going to be dragged.
This call will be followed by one or more calls to handleMove
,
and a final dragFinished
or cancelDrag
.
Parameters
context:IInputModeContext — The context to retrieve information about the drag from.
|
isPortCandidateResolutionEnabled | () | method |
protected function isPortCandidateResolutionEnabled(context:IInputModeContext):Boolean
Determines whether for the current gesture port candidate resolution is enabled in the specified context.
This implementation checks whether the context is provided by a HandleInputMode
, if the
portCandidateResolutionRecognizer
recognizes its lastMouseEvent
and its
currentHandle
s location is equal to this location
.
Parameters
context:IInputModeContext — The context to inspect.
|
Boolean — true if port candidates may be resolved; otherwise false .
|
See also
resolveCandidate | () | method |
protected function resolveCandidate(context:IInputModeContext, candidate:IPortCandidate, location:IPoint):IPortCandidate
Tries to resolve a dynamic port candidate for the given location.
Parameters
context:IInputModeContext — The context in which the candidate is resolved.
| |
candidate:IPortCandidate — The candidate.
| |
location:IPoint — The current location.
|
IPortCandidate — A candidate.
|
See also
setClosestCandidate | () | method |
protected function setClosestCandidate(closest:IPortCandidate):void
Updates the closest candidate for visual feedback.
Parameters
closest:IPortCandidate |
setPort | () | method |
protected function setPort(context:IInputModeContext, edge:IEdge, setSourcePort:Boolean, portCandidate:IPortCandidate, suggestedLocation:IPoint):void
Callback that is triggered by dragFinished
to actually change the port.
Parameters
context:IInputModeContext — The context.
| |
edge:IEdge — The edge to change ports.
| |
setSourcePort:Boolean — Whether to set the source port. false for target ports.
| |
portCandidate:IPortCandidate — The candidate that has been chosen.
| |
suggestedLocation:IPoint — The suggested location for the port.
|
See also
setPorts | () | method |
protected function setPorts(context:IInputModeContext, edge:IEdge, sourcePort:IPort, targetPort:IPort):void
Finally sets the ports for the edge to the new values.
Parameters
context:IInputModeContext — The context in which the ports are set.
| |
edge:IEdge — The edge to set the ports for.
| |
sourcePort:IPort — The new source port.
| |
targetPort:IPort — The new target port.
|
setToPortCandidate | () | method |
protected function setToPortCandidate(dummy:DefaultEdge, source:Boolean, candidate:IPortCandidate):void
Updates the dummy edge's visual appearance to reflect the new port candidate.
Parameters
dummy:DefaultEdge — The dummy edge.
| |
source:Boolean — Whether to update the source or target port.
| |
candidate:IPortCandidate — The new candidate to indicate.
|