Package | com.yworks.graph.input.snapLines |
Class | public class OrthogonalEdgeEditingContext |
Inheritance | OrthogonalEdgeEditingContext flash.events.EventDispatcher |
This class will be queried from the IInputModeContext
of implementations of
IPositionHandler
, IHandle
, and IReshapeHandler
that support
orthogonal editing of edges.
In a first step, the edit (which is a movement of one or more IPort
s, IBend
s,
edge ends or IPortOwner
s) is being initialized before anything has been changed.
Then, client code that seeks to modify the graph, uses the methods addExplicitlyMovedBend
,
addMovedEdgeEnd
, addMovedPort
and addTransformedPortOwner
.
In the next step, the drag is being initialized and all affected edges will be prepared so that the editing will not destroy the orthogonality. Interested editors now get the chance to register and negotiate implicitly moved bends. Then the actual editing is performed and the edit is either canceled, in which case the added bends are removed or the edit is finished and the affected edges are being cleaned up.
See also
Property | Defined By | ||
---|---|---|---|
addedBends : Iterable [read-only]
Gets the previously registered added bends. | OrthogonalEdgeEditingContext | ||
isInitialized : Boolean [read-only]
Whether the context is initialized. | OrthogonalEdgeEditingContext | ||
isInitializing : Boolean [read-only]
Gets a value indicating whether this instance is currently initializing. | OrthogonalEdgeEditingContext | ||
movePorts : Boolean
Gets or sets a value indicating ports are allowed to be moved at all. | OrthogonalEdgeEditingContext | ||
orthogonalEdgeEditing : Boolean
Gets or sets a value indicating whether orthogonal edge editing is enabled at all. | OrthogonalEdgeEditingContext |
Property | Defined By | ||
---|---|---|---|
currentInputModeContext : IInputModeContext [read-only]
Gets the current input mode context that is in effect for the current edit. | OrthogonalEdgeEditingContext | ||
transformedPortOwners : Iterable [read-only]
Provides access to the Iterable of IPortOwner instances that are being transformed
during the edit. | OrthogonalEdgeEditingContext |
Method | Defined By | ||
---|---|---|---|
Initializes a new instance of the OrthogonalEdgeEditingContext class where
orthogonalEdgeEditing is turned on. | OrthogonalEdgeEditingContext | ||
addExplicitlyMovedBend(movementInfo:BendMovementInfo):void
Registers the provided bend with this instance so that it will be considered explicitly moved for this edit. | OrthogonalEdgeEditingContext | ||
Registers the provided bend as being moved implicitly for this edit. | OrthogonalEdgeEditingContext | ||
addMovedEdgeEnd(movementInfo:EdgeEndMovementInfo):void
Registers the provided end of the edge with this instance so that it will be considered explicitly
moved for this edit. | OrthogonalEdgeEditingContext | ||
addMovedPort(movementInfo:PortMovementInfo):void
Registers the provided port with this instance so that it will be considered explicitly moved for this edit. | OrthogonalEdgeEditingContext | ||
addTransformedPortOwner(portOwner:IPortOwner):void
Adds an IPortOwner that is being transformed somehow during the edit so that the attached
ports will be moved in an irregular, non-linear way. | OrthogonalEdgeEditingContext | ||
canBeMoved(edge:IEdge, sourceSide:Boolean):Boolean
Callback that can be used by IDragHandlers and the like to determines whether
the specified end of the provided edge should be moved implicitly. | OrthogonalEdgeEditingContext | ||
cancelDrag():void
Called by client edit code when a drag has been canceled. | OrthogonalEdgeEditingContext | ||
createImplicitlyMovedBendInfo(implicitlyMovedBend:IBend, horizontalAdjacentInfo:MovementInfo, verticalAdjacentInfo:MovementInfo):BendMovementInfo
Creates or obtains a previously created BendMovementInfo for the provided implicitly moved bend. | OrthogonalEdgeEditingContext | ||
dragFinished():void
Called when a drag has been successfully finished. | OrthogonalEdgeEditingContext | ||
dragInitialized():void
Needs to be called by client editing code after initializeDrag has been called
and all IDragHandlers have been initialized. | OrthogonalEdgeEditingContext | ||
getSegmentOrientation(edge:IEdge, segmentIndex:int):uint
Gets the declared segment orientation for the provided segment at the given edge. | OrthogonalEdgeEditingContext | ||
initializeDrag(context:IInputModeContext):void
Called by client code when a drag is started about to be started. | OrthogonalEdgeEditingContext | ||
Callback that can be used by IDragHandlers and the like to determines whether
the given edge is orthogonally edited edge in the specified input mode context. | OrthogonalEdgeEditingContext | ||
lockPortMovement(edge:IEdge):void
Locks the movement of the ports of the edges so that canBeMoved will yield false
for the provided edge during the current edit. | OrthogonalEdgeEditingContext |
Method | Defined By | ||
---|---|---|---|
cleanUp():void
Performs clean up procedures. | OrthogonalEdgeEditingContext | ||
Cleans up the edge's path after a successfully finished drag. | OrthogonalEdgeEditingContext | ||
cleanupEdgePaths(graph:IGraph):void
Called after a successfully finished drag to clean up artifacts of modified edges. | OrthogonalEdgeEditingContext | ||
getMovementInfos(edge:IEdge):Array
Gets the MovementInfos that describe the orthogonal path of the edge. | OrthogonalEdgeEditingContext | ||
Callback method that gets the IOrthogonalEdgeHelper instance associated with the given edge. | OrthogonalEdgeEditingContext | ||
onCleanedUp():void
Raises the CleanedUp event. | OrthogonalEdgeEditingContext | ||
onInitialized():void
Raises the OrthogonalEdgeEditingEvent.INITIALIZED event. | OrthogonalEdgeEditingContext | ||
onInitializing():void
Raises the OrthogonalEdgeEditingEvent.INITIALIZING event. | OrthogonalEdgeEditingContext | ||
prepareEdgePaths(graph:IGraph):void
Called during dragInitialized to prepare the edge paths for orthogonal editing. | OrthogonalEdgeEditingContext | ||
Helper method that inspects and prepares an orthogonal edge for the upcoming edit process. | OrthogonalEdgeEditingContext | ||
registerAddedBend(bend:IBend):void
Can be used by subclasses during prepareOrthogonalEdge to register added bends that
can later be removed in case the operation is canceled. | OrthogonalEdgeEditingContext | ||
Removes previously registered added bends. | OrthogonalEdgeEditingContext |
Event | Summary | Defined By | ||
---|---|---|---|---|
Occurs when the recent edit operation of an OrthogonalEdgeEditingContext has been cleaned up. | OrthogonalEdgeEditingContext | |||
Occurs when the edit has been initialized. | OrthogonalEdgeEditingContext | |||
Occurs when the edit is about to be initialized. | OrthogonalEdgeEditingContext |
Constant | Defined By | ||
---|---|---|---|
segmentEpsilon : Number = 0.01 [static] | OrthogonalEdgeEditingContext |
addedBends | property |
addedBends:Iterable
[read-only]
Gets the previously registered added bends.
An iterable over the bends that have been added previously using registerAddedBend
.
public function get addedBends():Iterable
See also
currentInputModeContext | property |
currentInputModeContext:IInputModeContext
[read-only]
Gets the current input mode context that is in effect for the current edit.
The current input mode context, which is only available if this instance
is initializing
or initialized
.
protected function get currentInputModeContext():IInputModeContext
See also
isInitialized | property |
isInitialized:Boolean
[read-only]
Whether the context is initialized.
The context is initialized between the calls to initializeDrag
and dragFinished
or cancelDrag
.
public function get isInitialized():Boolean
See also
isInitializing | property |
isInitializing:Boolean
[read-only]
Gets a value indicating whether this instance is currently initializing.
true
if this instance is initializing
but not yet initialized
;
otherwise false
.
public function get isInitializing():Boolean
lockedPortEdges | property |
lockedPortEdges:Iterable
[read-only]
Provides access to the iterable of IEdge
instances whose ports have been locked at
source and target end.
For elements in the enumerable the end points should not be moved and thus canBeMoved
returns
false
for these edges.
Note that this collection is reset for each edit.
yworks_internal function get lockedPortEdges():Iterable
See also
movePorts | property |
movePorts:Boolean
Gets or sets a value indicating ports are allowed to be moved at all.
true
if bends adjacent to ports should try to move the port
to stay perpendicular to the bend, false
otherwise.
The default value is
.true
public function get movePorts():Boolean
public function set movePorts(value:Boolean):void
See also
orthogonalEdgeEditing | property |
orthogonalEdgeEditing:Boolean
Gets or sets a value indicating whether orthogonal edge editing is enabled at all.
true
if orthogonal edge editing is enabled at all; otherwise false
.
The default value is
.true
public function get orthogonalEdgeEditing():Boolean
public function set orthogonalEdgeEditing(value:Boolean):void
See also
transformedPortOwners | property |
transformedPortOwners:Iterable
[read-only]
Provides access to the Iterable
of IPortOwner
instances that are being transformed
during the edit.
For elements in the iterable the attached ports are considered to be moved in an irregular way during the edit.
protected function get transformedPortOwners():Iterable
See also
OrthogonalEdgeEditingContext | () | Constructor |
public function OrthogonalEdgeEditingContext()
Initializes a new instance of the OrthogonalEdgeEditingContext
class where
orthogonalEdgeEditing
is turned on.
See also
addExplicitlyMovedBend | () | method |
public function addExplicitlyMovedBend(movementInfo:BendMovementInfo):void
Registers the provided bend with this instance so that it will be considered explicitly moved for this edit.
IDragHandler
implementations that are being used to explicitly move a bend during the edit
should use this method to register their edit while they are being initialized.
Parameters
movementInfo:BendMovementInfo — The movement info that describes the movement of the bend.
|
See also
addImplicitlyMovedBend | () | method |
public function addImplicitlyMovedBend(movementInfo:BendMovementInfo):BendMovementInfo
Registers the provided bend as being moved implicitly for this edit.
The instance will be returned by createImplicitlyMovedBendInfo
and the
MovementInfo.moveType
will be combined with the requested move type.
Parameters
movementInfo:BendMovementInfo — The movement info for the bend.
|
BendMovementInfo — The info that has been registered with this instance.
|
See also
addMovedEdgeEnd | () | method |
public function addMovedEdgeEnd(movementInfo:EdgeEndMovementInfo):void
Registers the provided end of the edge with this instance so that it will be considered explicitly
moved for this edit.
IDragHandler
implementations that are being used to explicitly move the end of an edge
during the edit should use this method to register their edit while they are being initialized.
Parameters
movementInfo:EdgeEndMovementInfo — The movement info that describes the movement of the end of the edge.
|
See also
addMovedPort | () | method |
public function addMovedPort(movementInfo:PortMovementInfo):void
Registers the provided port with this instance so that it will be considered explicitly moved for this edit.
IDragHandler
implementations that are being used to explicitly move a bend during the edit
should use this method to register their edit while they are being initialized.
Parameters
movementInfo:PortMovementInfo — The movement info that describes the movement of the port.
|
See also
addTransformedPortOwner | () | method |
public function addTransformedPortOwner(portOwner:IPortOwner):void
Adds an IPortOwner
that is being transformed somehow during the edit so that the attached
ports will be moved in an irregular, non-linear way.
Normally this will be nodes that are being resized or moved in a non-linear way, or edges whose bends or
ports are being changed.
Parameters
portOwner:IPortOwner — The item that will be transformed.
|
See also
canBeMoved | () | method |
public function canBeMoved(edge:IEdge, sourceSide:Boolean):Boolean
Callback that can be used by IDragHandler
s and the like to determines whether
the specified end of the provided edge should be moved implicitly.
If an item is next to the end of an edge and the last segment should be kept orthogonal, this may only
be possible if the end of the edge is moved, too. This can be achieved by moving the edge to another
IPort
or by moving the port instance itself. This depends on the implementation of the
IEdgePortHandleProvider
for the given edge.
This implementation will delegate to getOrthogonalEdgeHelper().canBeMoved
unless the side
of the edge is connected to an IPortOwner
instance that is marked as transformed during the edit.
Parameters
edge:IEdge — The edge for which it should be determined whether the edge end can be moved.
| |
sourceSide:Boolean — If set to true the source side of the end is queried, else the target side.
|
Boolean — true if the specified side of the edge can be moved; otherwise false in which
case the segment should be split to maintain orthogonality.
|
See also
cancelDrag | () | method |
public function cancelDrag():void
Called by client edit code when a drag has been canceled.
Resets all internal state lists and sets isInitialized
back to false
.
Also temporarily added bends are removed and cleanedUp
will be triggered.
CLEANED_UP
— |
See also
cleanUp | () | method |
protected function cleanUp():void
Performs clean up procedures.
This is called in response to cancelDrag
and dragFinished
as well as initially
during initializeDrag
.
See also
cleanUpEdgePath | () | method |
protected function cleanUpEdgePath(graph:IGraph, modifiedEdge:IEdge):void
Cleans up the edge's path after a successfully finished drag.
This implementations delegates to the IOrthogonalEdgeHelper
's
IOrthogonalEdgeHelper.cleanUpEdge
method.
Parameters
graph:IGraph | |
modifiedEdge:IEdge |
See also
cleanupEdgePaths | () | method |
protected function cleanupEdgePaths(graph:IGraph):void
Called after a successfully finished drag to clean up artifacts of modified edges.
Parameters
graph:IGraph — The graph.
|
See also
createImplicitlyMovedBendInfo | () | method |
public function createImplicitlyMovedBendInfo(implicitlyMovedBend:IBend, horizontalAdjacentInfo:MovementInfo, verticalAdjacentInfo:MovementInfo):BendMovementInfo
Creates or obtains a previously created BendMovementInfo
for the provided implicitly moved bend.
This method is queried by client IDragHandler
implementations that have been initialized for
the current edit that need to move adjacent bends implicitly.
Implementations should pass as the parameters the movement information that controls the vertical or horizontal
movement of the bend implicitly.
Parameters
implicitlyMovedBend:IBend — The implicitly moved bend.
| |
horizontalAdjacentInfo:MovementInfo — The movement info that implicitly constrains the horizontal movement of the
bend or null .
| |
verticalAdjacentInfo:MovementInfo — The movement info that implicitly constrains the vertical movement of the
bend or null .
|
BendMovementInfo — The info to be used by clients that requested it.
|
See also
dragFinished | () | method |
public function dragFinished():void
Called when a drag has been successfully finished. This method will perform the necessary clean up also for edge paths.
#CLEANED_UP
— |
See also
dragInitialized | () | method |
public function dragInitialized():void
Needs to be called by client editing code after initializeDrag
has been called
and all IDragHandler
s have been initialized.
This method will update the isInitializing
and isInitialized
states
accordingly and will then prepare the edge paths.
Finally the INITIALIZED
event is triggered so that registered handlers can perform their
post-initialization process.
#INITIALIZED
—
|
See also
getMovementInfos | () | method |
protected function getMovementInfos(edge:IEdge):Array
Gets the MovementInfo
s that describe the orthogonal path of the edge.
Parameters
edge:IEdge — The edge to obtain the infos for.
|
Array — An array that contains for the first entry the source end of the edge, then all bends and then
as the final entry the target end of the edge. For the bends, this can be be null values if nothing
is known about the bend, yet.
|
getOrthogonalEdgeHelper | () | method |
protected function getOrthogonalEdgeHelper(edge:IEdge):IOrthogonalEdgeHelper
Callback method that gets the IOrthogonalEdgeHelper
instance associated with the given edge.
This implementation obtains the helper instance from the lookup of the edge.
Parameters
edge:IEdge — The edge to obtain the helper instance for.
|
IOrthogonalEdgeHelper — The helper instance to use or null , in which case the default behavior will be used.
|
See also
getSegmentOrientation | () | method |
public function getSegmentOrientation(edge:IEdge, segmentIndex:int):uint
Gets the declared segment orientation for the provided segment at the given edge.
This implementation uses the getOrthogonalEdgeHelper(edge).getSegmentOrientation
method to
yield the orientation.
Parameters
edge:IEdge — The edge to get the segment orientation for.
| |
segmentIndex:int — The index of the edge segment.
|
uint |
See also
initializeDrag | () | method |
public function initializeDrag(context:IInputModeContext):void
Called by client code when a drag is started about to be started.
This code needs to be called before any of the IDragHandler
implementations are initialized
so that they can then register the items they are going to modify with this instance.
After this method has been called, the handlers that perform the actual edit need to be initialized and
as soon as this has been done, dragInitialized
should be called.
Parameters
context:IInputModeContext — The context in which the edit is going to be performed.
|
See also
isOrthogonallyEditedEdge | () | method |
public function isOrthogonallyEditedEdge(inputModeContext:IInputModeContext, edge:IEdge):Boolean
Callback that can be used by IDragHandler
s and the like to determines whether
the given edge is orthogonally edited edge in the specified input mode context.
This implementation will always yield false
if orthogonalEdgeEditing
is disabled
globally. Otherwise getOrthogonalEdgeHelper
will be used to delegate the query
to IOrthogonalEdgeHelper.isOrthogonallyEdited
.
Parameters
inputModeContext:IInputModeContext — The input mode context which is editing the edge.
| |
edge:IEdge — The edge that will be edited.
|
Boolean — true if this edge should be orthogonally edited for the specified input mode context;
otherwise, false .
|
See also
lockPortMovement | () | method |
public function lockPortMovement(edge:IEdge):void
Locks the movement of the ports of the edges so that canBeMoved
will yield false
for the provided edge during the current edit.
This state will be reset after the current edit.
Parameters
edge:IEdge — The edge to lock the ports of.
|
See also
onCleanedUp | () | method |
protected function onCleanedUp():void
Raises the CleanedUp
event.
#CLEAN_UP
— |
onInitialized | () | method |
protected function onInitialized():void
Raises the OrthogonalEdgeEditingEvent.INITIALIZED
event.
#INITIALIZED
— |
See also
onInitializing | () | method |
protected function onInitializing():void
Raises the OrthogonalEdgeEditingEvent.INITIALIZING
event.
#INITIALIZING
— |
See also
prepareEdgePaths | () | method |
protected function prepareEdgePaths(graph:IGraph):void
Called during dragInitialized
to prepare the edge paths for orthogonal editing.
Parameters
graph:IGraph — The graph that contains the edges to be edited.
|
See also
prepareOrthogonalEdge | () | method |
protected function prepareOrthogonalEdge(graph:IGraph, edge:IEdge, orientations:Array, infos:Array):void
Helper method that inspects and prepares an orthogonal edge for the upcoming edit process. This method inspects an edge and possibly inserts new bends into an edge to assure that during editing the orthogonality won't be lost.
Parameters
graph:IGraph — The graph to use for modifying the bends.
| |
edge:IEdge — The edge to inspect.
| |
orientations:Array — The orientations of the segments - the array is of length (edge.bends.length + 1).
| |
infos:Array — The MovementInfo instances for the source end, the bends, and the target end.
This array contains either EdgeEndMovementInfo or PortMovementInfo instances at
the first and last position and BendMovementInfo s or null entries for the bends.
The length thus is (edge.bends.length + 2) and null entries indicate that there is no
information about the movement (in case the bend will only be moved implicitly later, if at all).
|
See also
registerAddedBend | () | method |
protected function registerAddedBend(bend:IBend):void
Can be used by subclasses during prepareOrthogonalEdge
to register added bends that
can later be removed in case the operation is canceled.
This method will only record the addition of bends if this instance is initialized
or still
initializing
.
Parameters
bend:IBend — The bend that has been added to guarantee orthogonality.
|
See also
removeAddedBends | () | method |
protected function removeAddedBends(graph:IGraph, addedBends:Iterable):void
Removes previously registered added bends.
Parameters
graph:IGraph — The graph to use for removing the bends.
| |
addedBends:Iterable — The added bends.
|
See also
cleanedUp | Event |
com.yworks.graph.input.snapLines.OrthogonalEdgeEditingEvent
OrthogonalEdgeEditingEvent.CLEANED_UP
Occurs when the recent edit operation of an OrthogonalEdgeEditingContext
has been cleaned up.
See also
initialized | Event |
com.yworks.graph.input.snapLines.OrthogonalEdgeEditingEvent
OrthogonalEdgeEditingEvent.INITIALIZED
Occurs when the edit has been initialized.
See also
initializing | Event |
com.yworks.graph.input.snapLines.OrthogonalEdgeEditingEvent
OrthogonalEdgeEditingEvent.INITIALIZING
Occurs when the edit is about to be initialized.
See also
segmentEpsilon | Constant |
public static const segmentEpsilon:Number = 0.01