Packagecom.yworks.graph.input
Classpublic class PortLocationModelParameterHandle
InheritancePortLocationModelParameterHandle Inheritance Object
Implements IHandle
Subclasses CroppedPortLocationModelParameterHandle

An implementation of the IHandle that can be used to move an IPort interactively by assigning new IPortLocationModelParameters to the IPort.locationModelParameter property. This class also provides snapping facilities and can be used in conjunction with both OrthogonalEdgeEditingContext as well as GraphSnapContext.

See also

OrthogonalEdgeEditingContext
GraphSnapContext


Public Properties
 PropertyDefined By
  cursor : Cursor
[read-only] Provides the cursor to display when the mouse hovers over or drags this handle.
PortLocationModelParameterHandle
  type : uint
[read-only] Returns the type of the handle that can be used by the rendering engine to render types differently.
PortLocationModelParameterHandle
  x : Number
[read-only] Returns the x coordinate of the current position of the element.
PortLocationModelParameterHandle
  y : Number
[read-only] Returns the y coordinate of the current position of the element.
PortLocationModelParameterHandle
Protected Properties
 PropertyDefined By
  _cursor : Cursor
PortLocationModelParameterHandle
  _dummyLocation : IPoint
PortLocationModelParameterHandle
  _graph : IGraph
PortLocationModelParameterHandle
  _lastParameter : IPortLocationModelParameter
PortLocationModelParameterHandle
  _model : IPortLocationModel
PortLocationModelParameterHandle
  _oldParameter : IPortLocationModelParameter
PortLocationModelParameterHandle
  _port : IPort
PortLocationModelParameterHandle
  port : IPort
[read-only] The port this handle does move.
PortLocationModelParameterHandle
  _type : uint = 0x001
PortLocationModelParameterHandle
Public Methods
 MethodDefined By
  
Initializes a new instance to change the IPortLocationModelParameter of the given IPort
PortLocationModelParameterHandle
  
cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
Called by clients to indicate that the dragging has been canceled by the user.
PortLocationModelParameterHandle
  
dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
Called by clients to indicate that the repositioning has just been finished.
PortLocationModelParameterHandle
  
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.
PortLocationModelParameterHandle
  
Called by clients to indicate that the element is going to be dragged.
PortLocationModelParameterHandle
  
setPosition(x:Number, y:Number):void
PortLocationModelParameterHandle
Protected Methods
 MethodDefined By
  
Called during the drag to collect snap results.
PortLocationModelParameterHandle
  
Gets the graph to use for setting the parameter via IGraph.setPortLocationModelParameter from the context.
PortLocationModelParameterHandle
  
getMoveType(port:IPort):uint
Determines the type of the movement for the given port.
PortLocationModelParameterHandle
  
Callback method that obtains the new parameter for the given location and port.
PortLocationModelParameterHandle
  
setParameter(graph:IGraph, port:IPort, newParameter:IPortLocationModelParameter):void
Callback method that applies the parameter
PortLocationModelParameterHandle
Property Detail
_cursorproperty
protected var _cursor:Cursor

_dummyLocationproperty 
protected var _dummyLocation:IPoint

_graphproperty 
protected var _graph:IGraph

_lastParameterproperty 
protected var _lastParameter:IPortLocationModelParameter

_modelproperty 
protected var _model:IPortLocationModel

_oldParameterproperty 
protected var _oldParameter:IPortLocationModelParameter

_portproperty 
protected var _port:IPort

_typeproperty 
protected var _type:uint = 0x001

cursorproperty 
cursor:Cursor  [read-only]

Provides the cursor to display when the mouse hovers over or drags this handle.


Implementation
    public function get cursor():Cursor
portproperty 
port:IPort  [read-only]

The port this handle does move.


Implementation
    protected function get port():IPort
typeproperty 
type:uint  [read-only]

Returns the type of the handle that can be used by the rendering engine to render types differently.


Implementation
    public function get type():uint
xproperty 
x:Number  [read-only]

Returns the x coordinate of the current position of the element.

The point describes the current world coordinate position of the element. It is up to the implementation how this position is interpreted. The values returned by this method will be used for the "originalX" parameter in the handleMove, cancelDrag and dragFinished methods.


Implementation
    public function get x():Number
yproperty 
y:Number  [read-only]

Returns the y coordinate of the current position of the element.

The point describes the current world coordinate position of the element. It is up to the implementation how this position is interpreted. The values returned by this method will be used for the "originalY" parameter in the handleMove, cancelDrag and dragFinished methods.


Implementation
    public function get y():Number
Constructor Detail
PortLocationModelParameterHandle()Constructor
public function PortLocationModelParameterHandle(port:IPort)

Initializes a new instance to change the IPortLocationModelParameter of the given IPort

Parameters
port:IPort — The port to adjust the location parameter of.
Method Detail
cancelDrag()method
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.

collectSnapResults()method 
protected function collectSnapResults(evt:CollectSnapResultEvent):void

Called during the drag to collect snap results. This implementation will delegate to the IPortSnapResultProvider that has been received from the port this instance is bound to.

Parameters

evt:CollectSnapResultEvent — The event argument to obtain the necessary information from and add results to.

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.

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.

getGraph()method 
protected function getGraph(context:IInputModeContext):IGraph

Gets the graph to use for setting the parameter via IGraph.setPortLocationModelParameter from the context.

Parameters

context:IInputModeContext — The input mode context to use.

Returns
IGraph — The graph or null if the graph could not be obtained.
getMoveType()method 
protected function getMoveType(port:IPort):uint

Determines the type of the movement for the given port. This is used for the PortMovementInfo that is passed to the OrthogonalEdgeEditingContext.addMovedPort method.

Parameters

port:IPort — The port to determine the move type for.

Returns
uint — This implementation returns MoveTypes.LINEAR_MOVE for models of type NodeScaledPortLocationModel and MoveTypes.NON_LINEAR_MOVE for all others.

See also

PortMovementInfo
com.yworks.graph.input.snapLines.OrthogonalEdgeEditingContext.addMovedPort
MoveTypes
NodeScaledPortLocationModel
getNewParameter()method 
protected function getNewParameter(port:IPort, model:IPortLocationModel, newLocation:IPoint):IPortLocationModelParameter

Callback method that obtains the new parameter for the given location and port.

Parameters

port:IPort — The port to obtain a parameter for.
 
model:IPortLocationModel — The model to use.
 
newLocation:IPoint — The new location.

Returns
IPortLocationModelParameter — The new parameter to use.
handleMove()method 
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

Returns
Boolean — Whether the move had any visual effect. This is a hint to the engine to optimize invalidation.
initializeDrag()method 
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.

setParameter()method 
protected function setParameter(graph:IGraph, port:IPort, newParameter:IPortLocationModelParameter):void

Callback method that applies the parameter

Parameters

graph:IGraph — The graph to use for applying.
 
port:IPort — The port to apply the parameter to.
 
newParameter:IPortLocationModelParameter — The new parameter to apply.

setPosition()method 
public function setPosition(x:Number, y:Number):void

Parameters

x:Number
 
y:Number