| Package | com.yworks.graph.model |
| Class | public class PortRelocationHandle |
| Implements | IHandle, IPoint |
IHandle interface
the can be used to relocate a port.
| 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
Provides the cursor to display when the mouse hovers over or drags this
handle.
| PortRelocationHandle | ||
| dummyEdge : DefaultEdge
[read-only]
| PortRelocationHandle | ||
| 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 | ||
| showDummyEdge : Boolean
Gets or sets a property that determines whether to show a dummy edge
during the drag operation.
| PortRelocationHandle | ||
| type : uint
Returns a view of the center of the handle.
| PortRelocationHandle | ||
| x : Number [read-only]
Gets the current x coordinate of this point.
| PortRelocationHandle | ||
| y : Number [read-only]
Gets the current y coordinate of this point.
| PortRelocationHandle | ||
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new instance.
| PortRelocationHandle | ||
|
cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
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
Called by clients to indicate that the repositioning has just been finished.
| PortRelocationHandle | ||
|
handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number, dx:Number, dy:Number):Boolean
Called by clients to indicate that the element has been dragged and its position
should be updated.
| PortRelocationHandle | ||
|
initializeDrag(context:IInputModeContext):void
Called by clients to indicate that the element is going to be dragged.
| PortRelocationHandle | ||
|
setPosition(x:Number, y:Number):void
Updates the position of the handle.
| PortRelocationHandle | ||
| Method | Defined by | ||
|---|---|---|---|
|
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.
| PortRelocationHandle | ||
|
Factory method that creates a dummy paintable for the
dummy edge during the drag operation.
| PortRelocationHandle | ||
|
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 | ||
|
Finds the closest candidate to the given coordinates from the given set of candidates.
| PortRelocationHandle | ||
|
Callback used during
dragFinished()
This implementation returns the result of | PortRelocationHandle | ||
|
Gets the possible candidates for the given edge.
| PortRelocationHandle | ||
|
Hides the original edge that during the drag operation.
| PortRelocationHandle | ||
|
setClosestCandidate(closest:IPortCandidate):void
Updates the closes candidate for visual feedback.
| PortRelocationHandle | ||
|
Finally sets the ports for the edge to the new values.
| PortRelocationHandle | ||
|
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.
| PortRelocationHandle | ||
| addExistingPort | property |
addExistingPort:Boolean [read-write]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 [read-write]Provides the cursor to display when the mouse hovers over or drags this handle.
Implementation public function get cursor():Cursor
public function set cursor(value:Cursor):void
| dummyEdge | property |
| maximumSnapDistance | property |
maximumSnapDistance:Number [read-write]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
| showDummyEdge | property |
showDummyEdge:Boolean [read-write]Gets or sets a property that determines whether to show a dummy edge during the drag operation.
The default value is true.
public function get showDummyEdge():Boolean
public function set showDummyEdge(value:Boolean):void
| type | property |
type:uint [read-write]Returns a view of the center of the handle.
The point describes the current world coordinate of the element that can be modified by this handle.
Implementation public function get type():uint
public function set type(value:uint):void
| x | property |
x:Number [read-only]Gets the current x coordinate of this point.
Depending on context the values returned may change over time.
Implementation public function get x():Number
| y | property |
y:Number [read-only]Gets the current y coordinate of this point.
Depending on context the values returned may change over time.
Implementation public function get y():Number
| PortRelocationHandle | () | constructor |
public function PortRelocationHandle(graph:IGraph, edge:IEdge, sourcePort:Boolean)Creates a new instance.
Parametersgraph:IGraph — The graph or null. If the graph is null,
the handle will try to receive the graph from the canvas that is passed to initializeDrag.
|
|
edge:IEdge — The edge.
|
|
sourcePort:Boolean — if set to true the source port will be subject to relocation,
otherwise it will be the target port.
|
| cancelDrag | () | method |
public function cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):voidCalled 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.
context:IInputModeContext — The canvas in which the element is being repositioned.
|
|
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 |
protected function configureDummy(dummy:DefaultEdge, edge:IEdge):voidConfigures the dummy edge to look like the given edge.
Parametersdummy:DefaultEdge — The dummy edge that should mimic the given edge.
|
|
edge:IEdge — The edge to mimic.
|
See also
| createDummyEdge | () | method |
protected function createDummyEdge():DefaultEdgeFactory method that creates the dummy edge that will be shown during the drag operation.
ReturnsDefaultEdge —
The dummy edge instance to use.
|
See also
| createDummyEdgePaintable | () | method |
protected function createDummyEdgePaintable(dummy:DefaultEdge):IPaintableFactory method that creates a dummy paintable for the dummy edge during the drag operation.
Parametersdummy:DefaultEdge — The dummy edge to create a paintable for.
|
IPaintable —
A paintable that shows the dummy edge.
|
See also
| createExistingPortCandidate | () | method |
protected function createExistingPortCandidate(currentPort:IPort):IPortCandidateFactory method that creates the candidate for the existing port.
ParameterscurrentPort: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 IPortCandidates.
ICanvasObjectDescriptor —
The descriptor to use for the rendering in the CanvasComponent.
|
| dragFinished | () | method |
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.
context:IInputModeContext — The canvas in which the element is being repositioned.
|
|
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(x:Number, y:Number, candidates:Iterable):IPortCandidateFinds the closest candidate to the given coordinates from the given set of candidates.
Parametersx:Number — The current set of candidates
|
|
y:Number |
|
candidates:Iterable |
IPortCandidate |
| getPort | () | method |
protected function getPort(candidate:IPortCandidate):IPort
Callback used during dragFinished()
This implementation returns the result of IPortCandidate.createInstance()
or calls IGraph.addPort() if the result was null.
candidate:IPortCandidate — The candidate to get a port instance from.
|
IPort —
A non-null port instance.
|
See also
| getPortCandidates | () | method |
protected function getPortCandidates(context:IInputModeContext, edge:IEdge, sourcePort:Boolean):IterableGets 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.
context:IInputModeContext — The canvas.
|
|
edge:IEdge — The edge.
|
|
sourcePort:Boolean — Whether to look for source port candidates.
|
Iterable —
A non-null iterable over the candidates.
|
| handleMove | () | method |
public function handleMove(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number, dx:Number, dy:Number):BooleanCalled 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.
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 — The delta of the x coordinates since the last call to this method.
|
|
dx:Number — The delta of the y coordinates since the last call to this method.
|
|
dy:Number |
Boolean — Whether the move had any visual effect. This is a hint to the engine to optimize invalidation.
|
| hideOriginalEdge | () | method |
protected function hideOriginalEdge(canvas:CanvasComponent, edge:IEdge):voidHides the original edge that during the drag operation.
Parameterscanvas:CanvasComponent — The edge to hide.
|
|
edge:IEdge — The canvas to hide the edge from.
|
See also
| initializeDrag | () | method |
public function initializeDrag(context:IInputModeContext):voidCalled 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.
context:IInputModeContext — The canvas in which the element is going to be repositioned.
|
| setClosestCandidate | () | method |
protected function setClosestCandidate(closest:IPortCandidate):voidUpdates the closes candidate for visual feedback.
Parametersclosest:IPortCandidate |
| setPorts | () | method |
protected function setPorts(edge:IEdge, sourcePort:IPort, targetPort:IPort):voidFinally sets the ports for the edge to the new values.
Parametersedge:IEdge — The edge to set the ports for.
|
|
sourcePort:IPort — The new source port.
|
|
targetPort:IPort — The new target port.
|
| setPosition | () | method |
public function setPosition(x:Number, y:Number):voidUpdates the position of the handle.
Parametersx:Number |
|
y:Number |
| setToPortCandidate | () | method |
protected function setToPortCandidate(dummy:DefaultEdge, source:Boolean, candidate:IPortCandidate):voidUpdates the dummy edge's visual appearance to reflect the new port candidate.
Parametersdummy:DefaultEdge — The dummy edge.
|
|
source:Boolean — Whether to update the source or target port.
|
|
candidate:IPortCandidate — The new candidate to indicate.
|
| unhideOriginalEdge | () | method |
protected function unhideOriginalEdge(edge:IEdge, canvas:CanvasComponent):voidUnhides the original edge that was hidden during the drag operation.
Parametersedge:IEdge — The edge to unhide.
|
|
canvas:CanvasComponent — The canvas the edge was hidden from.
|
See also