Package | com.yworks.graph.drawing |
Class | public class SimpleAbstractPortStyle |
Inheritance | SimpleAbstractPortStyle Object |
Implements | IPortStyle |
paint
, calculateBounds
,
isVisible
, isHit
, isInBox
and lookup
methods implemented in
the style.
To use this style, one has to subclass SimpleAbstractPortStyle
and override at least
the paint
and calculateBounds
method. The default implementations of the other methods
do use the port's bounds rectangle e.g. for hit or visibility tests.
Property | Defined By | ||
---|---|---|---|
styleRenderer : IStyleRenderer [read-only]
Gets the renderer implementation that has been supplied to
this instance upon creation. | SimpleAbstractPortStyle |
Method | Defined By | ||
---|---|---|---|
Creates a new instance
| SimpleAbstractPortStyle | ||
clone():Object
Returns this instance. | SimpleAbstractPortStyle | ||
Prepares the rendering of an IModelItem in a CanvasComponent by
adding ICanvasObject's to the provided canvas. | SimpleAbstractPortStyle |
Method | Defined By | ||
---|---|---|---|
Calculates the bounds for the port in the given context. | SimpleAbstractPortStyle | ||
This style's renderer delegates the display object creation to this method. | SimpleAbstractPortStyle | ||
Determines whether the visual representation of the port has been hit at the given location. | SimpleAbstractPortStyle | ||
Determines whether the visualization for the specified port is included in the marquee selection. | SimpleAbstractPortStyle | ||
Determines whether the visualization for the specified port is visible in the context. | SimpleAbstractPortStyle | ||
Performs the lookup operation for the lookup calls to the renderer. | SimpleAbstractPortStyle | ||
updateDisplayObject(port:IPort, oldDisplayObject:DisplayObject, ctx:IDisplayObjectContext):DisplayObject
This style's renderer delegates updating the display object to this method. | SimpleAbstractPortStyle |
styleRenderer | property |
styleRenderer:IStyleRenderer
[read-only] Gets the renderer implementation that has been supplied to this instance upon creation.
public function get styleRenderer():IStyleRenderer
SimpleAbstractPortStyle | () | Constructor |
public function SimpleAbstractPortStyle()
Creates a new instance
calculateBounds | () | method |
protected function calculateBounds(port:IPort, scratch:IMutableRectangle, ctx:ICanvasContext):IRectangle
Calculates the bounds for the port in the given context.
This method is called in response to a calculateBounds
call to the instance that has
been queried from the renderer.
Subclasses have to override this method.
Parameters
port:IPort — The port to which this style instance is assigned.
| |
scratch:IMutableRectangle — The mutable rectangle to set the calculated bounds.
| |
ctx:ICanvasContext — The canvas context.
|
IRectangle — The visual bounds of the visual representation.
|
See also
clone | () | method |
public function clone():Object
Returns this instance.
If subclasses implement properties which should be set in the clone, too, this method has to be overridden.
ReturnsObject — this ;
|
createDisplayObject | () | method |
protected function createDisplayObject(port:IPort, ctx:IDisplayObjectContext):DisplayObject
This style's renderer delegates the display object creation to this method.
Subclasses have to override this method and implement their own createDisplayObject
method.
Parameters
port:IPort — The display object context.
| |
ctx:IDisplayObjectContext — The port to render.
|
DisplayObject |
IllegalOperationError — if not overridden.
|
See also
install | () | method |
public function install(canvas:CanvasComponent, group:ICanvasObjectGroup, modelItem:IModelItem):Array
Prepares the rendering of an IModelItem
in a CanvasComponent
by
adding ICanvasObject
's to the provided canvas.
Implementations may add zero or more ICanvasObject
instances to
the given CanvasComponent
. The group
parameter
can be used as a hint for implementations. They can add their newly created
canvas objects to the given group. However they are not obliged to do that.
Parameters
canvas:CanvasComponent — The canvas to install the canvas objects in.
| |
group:ICanvasObjectGroup — A hint that tells the implementation where to add the canvas objects.
| |
modelItem:IModelItem — The item to install a visual representation for.
|
Array — An array of zero or more canvas objects that have been installed
in the canvas by this method or null if nothing was installed.
|
isHit | () | method |
protected function isHit(port:IPort, x:Number, y:Number, ctx:ICanvasContext):Boolean
Determines whether the visual representation of the port has been hit at the given location.
This method is called in response to a isHit
call to the instance that has benn queried from
the renderer.
This implementation uses the port bounds to determine whether the port has been hit.
Parameters
port:IPort — The port to which this style instance is assigned.
| |
x:Number — The x coordinate to test.
| |
y:Number — The y coordinate to test.
| |
ctx:ICanvasContext — The canvas context.
|
Boolean — true if the specified port representation is hit; false otherwise.
|
See also
isInBox | () | method |
protected function isInBox(port:IPort, box:IRectangle, ctx:ICanvasContext):Boolean
Determines whether the visualization for the specified port is included in the marquee selection.
This method is called in response to a isInBox
call to the instance that has been queried
from the renderer.
This implementation simply tests whether the port bounds intersect the marquee box.
Parameters
port:IPort — The port to which this style instance is assigned.
| |
box:IRectangle — The marquee selection box.
| |
ctx:ICanvasContext — The canvas context.
|
Boolean — true if the specified port is selected by the marquee rectangle; false otherwise.
|
See also
isVisible | () | method |
protected function isVisible(port:IPort, clip:IRectangle, ctx:ICanvasContext):Boolean
Determines whether the visualization for the specified port is visible in the context.
This method is called in response to a isVisible
call to the instance that has been queried
from the renderer.
This implementation simply tests whether the bounds intersect the clip.
Parameters
port:IPort — The port to which this style instance is assigned.
| |
clip:IRectangle — The clipping rectangle.
| |
ctx:ICanvasContext — The canvas context.
|
Boolean — true if the specified port is visible in the clipping rectangle, false otherwise.
|
See also
lookup | () | method |
protected function lookup(port:IPort, type:Class):Object
Performs the lookup
operation for the lookup
calls to the renderer.
This implementation yields null
for everything but:
Parameters
port:IPort — The port to use for the context query.
| |
type:Class — The type to query.
|
Object — An implementation of the type or null .
|
updateDisplayObject | () | method |
protected function updateDisplayObject(port:IPort, oldDisplayObject:DisplayObject, ctx:IDisplayObjectContext):DisplayObject
This style's renderer delegates updating the display object to this method.
This implementation just delegates to createDisplayObject
so subclasses should
override this method to improve rendering performance.
Parameters
port:IPort — The display object context.
| |
oldDisplayObject:DisplayObject — The port to render.
| |
ctx:IDisplayObjectContext — The display object to update.
|
DisplayObject |
See also