Packagecom.yworks.graph.model
Classpublic class DefaultArrow
InheritanceDefaultArrow Inheritance Object
Implements IArrow

An abstract base class for an IArrow that provides a number of convenience factory methods and singleton instances for default arrow types.

Instances should only be created using the create() method.

See also

com.yworks.graph.drawing.ArrowType


Public Properties
 PropertyDefined By
  cropLength : Number
[read-only] Gets the cropping length associated with this instance.
DefaultArrow
  length : Number
[read-only] Returns the length of the arrow, i.e.
DefaultArrow
  none : IArrow
[static] [read-only] A singleton IArrow instance that paints no arrow at all.
DefaultArrow
  scale : Number
The scale factor.
DefaultArrow
  type : uint
[read-only] Returns the type of the arrow as defined in ArrowType
DefaultArrow
Public Methods
 MethodDefined By
  
DefaultArrow(length:Number, cropLength:Number, scale:Number = 1.0)
Initializes a new instance of the DefaultArrow class using the given length, cropping length, and scale values.
DefaultArrow
  
create(arrowType:uint, stroke:IStroke = null, fill:IFill = null, cropLength:Number = 0.0, scale:Number = 1.0):IArrow
[static] Factory method that creates an arrow of the given type using the provided stroke, fill and and crop length.
DefaultArrow
  
createDefault(arrowType:uint):IArrow
[static] Factory method that creates an arrow of the given type using a black stroke and fill.
DefaultArrow
  
getBoundsProvider(edge:IEdge, atSource:Boolean, anchor:IPoint, direction:IPoint):IBoundsProvider
Gets an IBoundsProvider implementation that can yield this arrow's bounds if painted the given location using the given direction for the given edge.
DefaultArrow
  
getDisplayObjectCreator(edge:IEdge, atSource:Boolean, anchor:IPoint, direction:IPoint):IDisplayObjectCreator
Gets an implementation of IDisplayObjectCreator that will create the display object for the arrow.
DefaultArrow
Property Detail
cropLengthproperty
cropLength:Number  [read-only]

Gets the cropping length associated with this instance.

This value is used by IEdgeStyle implementations to let the edge appear to end shortly before it's actual target.


Implementation
    public function get cropLength():Number
lengthproperty 
length:Number  [read-only]

Returns the length of the arrow, i.e. the distance from the arrows tip to the position where the visual representation of the edge's path should begin.


Implementation
    public function get length():Number
noneproperty 
none:IArrow  [read-only]

A singleton IArrow instance that paints no arrow at all.


Implementation
    public static function get none():IArrow
scaleproperty 
scale:Number

The scale factor.


Implementation
    public function get scale():Number
    public function set scale(value:Number):void
typeproperty 
type:uint  [read-only]

Returns the type of the arrow as defined in ArrowType


Implementation
    public function get type():uint

See also

Constructor Detail
DefaultArrow()Constructor
public function DefaultArrow(length:Number, cropLength:Number, scale:Number = 1.0)

Initializes a new instance of the DefaultArrow class using the given length, cropping length, and scale values.

Programmers should never use this constructor to create new instances but use the create() method instead

Parameters
length:Number — The length of the arrow.
 
cropLength:Number — The length by which an edge's path needs to be cropped.
 
scale:Number (default = 1.0) — The scale factor to apply.
Method Detail
create()method
public static function create(arrowType:uint, stroke:IStroke = null, fill:IFill = null, cropLength:Number = 0.0, scale:Number = 1.0):IArrow

Factory method that creates an arrow of the given type using the provided stroke, fill and and crop length.

Parameters

arrowType:uint — The type of the arrow.
 
stroke:IStroke (default = null) — The stroke to draw the outline with or null.
 
fill:IFill (default = null) — The fill to fill the interior with or null.
 
cropLength:Number (default = 0.0) — Length of the crop.
 
scale:Number (default = 1.0)

Returns
IArrow — An arrow.

See also

ArrowType
createDefault()method 
public static function createDefault(arrowType:uint):IArrow

Factory method that creates an arrow of the given type using a black stroke and fill.

Parameters

arrowType:uint — The type of the arrow.

Returns
IArrow — An arrow.

See also

ArrowType
getBoundsProvider()method 
public function getBoundsProvider(edge:IEdge, atSource:Boolean, anchor:IPoint, direction:IPoint):IBoundsProvider

Gets an IBoundsProvider implementation that can yield this arrow's bounds if painted the given location using the given direction for the given edge.

Parameters

edge:IEdge — The edge this arrow belongs to
 
atSource:Boolean — Whether this will be the source arrow
 
anchor:IPoint — The anchor point for the tip of the arrow
 
direction:IPoint — The direction the arrow is pointing in

Returns
IBoundsProvider — An implementation of the IBoundsProvider interface that can subsequently be used to query the bounds. Clients will always call this method before using the implementation and may not cache the instance returned. This allows for applying the flyweight design pattern to implementations.
getDisplayObjectCreator()method 
public function getDisplayObjectCreator(edge:IEdge, atSource:Boolean, anchor:IPoint, direction:IPoint):IDisplayObjectCreator

Gets an implementation of IDisplayObjectCreator that will create the display object for the arrow.

This method may always return the same instance. By contract, clients will not cache instances returned, but will always call this method before the methods on the instance will be called.

This contract enables the use of the fly-weight design pattern. Implementations of this class can always return the same instance and configure this instance upon each call to this method.

Parameters

edge:IEdge — The edge this arrow belongs to
 
atSource:Boolean — Whether this will be the source arrow
 
anchor:IPoint — The anchor point for the tip of the arrow
 
direction:IPoint — The direction the arrow is pointing in

Returns
IDisplayObjectCreator — An implementation of the IDisplayObjectCreator interface that can subsequently be used to perform the actual painting.