Packagecom.yworks.graph.input
Classpublic class ReparentStripePositionHandler
InheritanceReparentStripePositionHandler Inheritance flash.events.EventDispatcher
Implements IPositionHandler, IPoint

Customized IPositionHandler implementation that moves a stripe in the table hierarchy when the stripe is dragged.

This class is used by default by both ReparentStripeInputMode and StripeDropInputMode to perform the actual reparenting and insertion.

See also

com.yworks.canvas.input.IPositionHandler
ReparentStripeInputMode
StripeDropInputMode


Public Properties
 PropertyDefined By
  lastGesture : ReparentGesture
ReparentStripePositionHandler
  movedStripe : IStripe
Allows to query the moved stripe.
ReparentStripePositionHandler
  reparentToDifferentTableAllowed : Boolean
ReparentStripePositionHandler
  x : Number
[read-only] Gets the current x coordinate of this point.
ReparentStripePositionHandler
  y : Number
[read-only] Gets the current y coordinate of this point.
ReparentStripePositionHandler
Protected Properties
 PropertyDefined By
  inputModeContext : IInputModeContext
[read-only] The current IInputModeContext.
ReparentStripePositionHandler
Public Methods
 MethodDefined By
  
Creates a new instance of this position handler which moves the given stripe.
ReparentStripePositionHandler
  
cancelDrag(context:IInputModeContext, originalX:Number, originalY:Number):void
Called by clients to indicate that the dragging has been canceled by the user.
ReparentStripePositionHandler
  
dragFinished(context:IInputModeContext, originalX:Number, originalY:Number, newX:Number, newY:Number):void
Called by clients to indicate that the repositioning has just been finished.
ReparentStripePositionHandler
  
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.
ReparentStripePositionHandler
  
Called by clients to indicate that the element is going to be dragged.
ReparentStripePositionHandler
  
setPosition(x:Number, y:Number):void
Called by clients to set the position to the given coordinates.
ReparentStripePositionHandler
Protected Methods
 MethodDefined By
  
Create a visualization for the source region of the reparent gesture.
ReparentStripePositionHandler
  
Create a visualization for the target region of the reparent gesture.
ReparentStripePositionHandler
  
determineGesture(inputModeContext:IInputModeContext, newX:Number, newY:Number, sourceStripe:IStripe, targetDescriptor:StripeSubregionDescriptor, targetBounds:IRectangle):ReparentGesture
Determine the reparent gesture that would result from the given parameters.
ReparentStripePositionHandler
  
getTargetSubregion(newX:Number, newY:Number):Array
Find the target stripe subregion at the given location and its associated owner node.
ReparentStripePositionHandler
  
Called whenever a change in the table hierarchy occurs through this position handler.
ReparentStripePositionHandler
  
updateSourceVisualization(sourceVisualization:ICanvasObject, sourceStripe:IStripe, reparentGesture:ReparentGesture, inputModeContext:IInputModeContext):ICanvasObject
Modifies the source visualization itself.
ReparentStripePositionHandler
  
updateTargetVisualization(targetVisualization:ICanvasObject, targetStripe:IStripe, reparentGesture:ReparentGesture, targetBounds:IRectangle, inputModeContext:IInputModeContext):ICanvasObject
Modifies the target visualization itself.
ReparentStripePositionHandler
  
updateTargetVisualizationBounds(originalTargetBounds:IRectangle, gesture:ReparentGesture, targetStripe:IStripe):IRectangle
Updates the visualization bounds for the target visualization depending on the provided values.
ReparentStripePositionHandler
Events
 Event Summary Defined By
  Dispatched when a stripe (column or row) has been changed.ReparentStripePositionHandler
Property Detail
inputModeContextproperty
inputModeContext:IInputModeContext  [read-only]

The current IInputModeContext.


Implementation
    protected function get inputModeContext():IInputModeContext
lastGestureproperty 
lastGesture:ReparentGesture


Implementation
    public function get lastGesture():ReparentGesture
    public function set lastGesture(value:ReparentGesture):void
movedStripeproperty 
movedStripe:IStripe

Allows to query the moved stripe.


Implementation
    public function get movedStripe():IStripe
    public function set movedStripe(value:IStripe):void
reparentToDifferentTableAllowedproperty 
reparentToDifferentTableAllowed:Boolean


Implementation
    public function get reparentToDifferentTableAllowed():Boolean
    public function set reparentToDifferentTableAllowed(value:Boolean):void
xproperty 
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
yproperty 
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
Constructor Detail
ReparentStripePositionHandler()Constructor
public function ReparentStripePositionHandler(movedStripe:IStripe)

Creates a new instance of this position handler which moves the given stripe.

Parameters
movedStripe:IStripe — The stripe to move.
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.

createSourceGhostVisualization()method 
protected function createSourceGhostVisualization(inputModeContext:IInputModeContext):ICanvasObject

Create a visualization for the source region of the reparent gesture.

The default implementation uses the return value of IStripeInputVisualizationHelper.getDisplayObjectCreator() with type StripeVisualizationType.DRAG_SOURCE.

Parameters

inputModeContext:IInputModeContext — The current input mode context.

Returns
ICanvasObject — A display object creator that is used to visualize the source region.

See also

createTargetGhostVisualization()method 
protected function createTargetGhostVisualization(inputModeContext:IInputModeContext, stripe:IStripe):ICanvasObject

Create a visualization for the target region of the reparent gesture.

The default implementation uses the return value of IStripeInputVisualizationHelper.getDisplayObjectCreator() with type StripeVisualizationType.DROP_TARGET.

Parameters

inputModeContext:IInputModeContext — The current input mode context.
 
stripe:IStripe — The stripe for which the visualization should be created.

Returns
ICanvasObject — A display object creator that is used to visualize the target region.

See also

determineGesture()method 
protected function determineGesture(inputModeContext:IInputModeContext, newX:Number, newY:Number, sourceStripe:IStripe, targetDescriptor:StripeSubregionDescriptor, targetBounds:IRectangle):ReparentGesture

Determine the reparent gesture that would result from the given parameters.

The target region has already been determined by getTargetSubregion

Parameters

inputModeContext:IInputModeContext — The current input mode context.
 
newX:Number — The x coordinate of the current drag location.
 
newY:Number — The y coordinate of the current drag location.
 
sourceStripe:IStripe — The stripe that is moved.
 
targetDescriptor:StripeSubregionDescriptor — The stripe subregion for the target.
 
targetBounds:IRectangle — The target bounds

Returns
ReparentGesture — An enumeration value of ReparentGesture that encodes the operation to perform.
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.

getTargetSubregion()method 
protected function getTargetSubregion(newX:Number, newY:Number):Array

Find the target stripe subregion at the given location and its associated owner node.

Parameters

newX:Number — The x coordinate of the hit location.
 
newY:Number — The y coordinate of the hit location.

Returns
Array — An array whose first element is the node where the table region is associated to and whose second element is the StripeSubregionDescriptor: [tableNode, descriptor]. If no such region can be found [null, null] is returned.
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.

onStripeChanged()method 
protected function onStripeChanged(stripe:IStripe):void

Called whenever a change in the table hierarchy occurs through this position handler.

Parameters

stripe:IStripe — The changed stripe.

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

Called by clients to set the position to the given coordinates.

It is up to the implementation to decide how the position of the element in question should be interpreted. This may be the upper left corner of the element, its center or anything else. The implementation may decide to not use the values provided or use different values internally.

Parameters

x:Number — The new x coordinate.
 
y:Number — The new y coordinate.

updateSourceVisualization()method 
protected function updateSourceVisualization(sourceVisualization:ICanvasObject, sourceStripe:IStripe, reparentGesture:ReparentGesture, inputModeContext:IInputModeContext):ICanvasObject

Modifies the source visualization itself.

The default does not change sourceVisualization.

Parameters

sourceVisualization:ICanvasObject — The canvas object for the source visualization.
 
sourceStripe:IStripe — The source of the reparent gesture.
 
reparentGesture:ReparentGesture — The gesture.
 
inputModeContext:IInputModeContext — The current input mode context.

Returns
ICanvasObject — The canvas object which represents the visualization.
updateTargetVisualization()method 
protected function updateTargetVisualization(targetVisualization:ICanvasObject, targetStripe:IStripe, reparentGesture:ReparentGesture, targetBounds:IRectangle, inputModeContext:IInputModeContext):ICanvasObject

Modifies the target visualization itself.

The default implementation only hides targetVisualization iff reparentGesture is ReparentGesture.INVALID.

Parameters

targetVisualization:ICanvasObject — The canvas object for the target visualization.
 
targetStripe:IStripe — The target for the reparent gesture.
 
reparentGesture:ReparentGesture — The gesture.
 
targetBounds:IRectangle — The current visualization bounds that have been computed with updateTargetVisualizationBounds.
 
inputModeContext:IInputModeContext — The current input mode context.

Returns
ICanvasObject — The canvas object which represents the visualization.
updateTargetVisualizationBounds()method 
protected function updateTargetVisualizationBounds(originalTargetBounds:IRectangle, gesture:ReparentGesture, targetStripe:IStripe):IRectangle

Updates the visualization bounds for the target visualization depending on the provided values.

Parameters

originalTargetBounds:IRectangle — The target bounds prior to this method call.
 
gesture:ReparentGesture — The reparent gesture.
 
targetStripe:IStripe — The target stripe which has been determined by the input mode.

Returns
IRectangle — Updated bounds for the target visualization.
Event Detail
stripeChanged Event
Event Object Type: com.yworks.graph.model.StripeEvent
StripeEvent.type property = com.yworks.graph.model.StripeEvent.STRIPE_CHANGED

Dispatched when a stripe (column or row) has been changed.

The new stripe can be retrieved from the event's stripe property.

Event which is dispatched when a stripe (column or row) has been changed.