Package | com.yworks.graph.drawing |
Class | public class SimpleAbstractLabelStyle |
Inheritance | SimpleAbstractLabelStyle Object |
Implements | ILabelStyle |
Subclasses | TLFLabelStyle |
createDisplayObject
, updateDisplayObject
,
calculateBounds
, isVisible
, isHit
, isInBox
and
lookup
methods implemented in the style.
To use this style, one has to subclass SimpleAbstractLabelStyle
and override at least
the paintContent
and getPreferredSize
methods. The default implementations of the other
methods do use the label's layout rectangle e.g. for hit tests and to determine the bounds and edge intersection.
Property | Defined By | ||
---|---|---|---|
styleRenderer : IStyleRenderer [read-only]
Gets the renderer implementation that has been supplied to
this instance upon creation. | SimpleAbstractLabelStyle |
Method | Defined By | ||
---|---|---|---|
Creates a new instance
| SimpleAbstractLabelStyle | ||
clone():Object
Returns this instance. | SimpleAbstractLabelStyle | ||
Prepares the rendering of an IModelItem in a CanvasComponent by
adding ICanvasObject's to the provided canvas. | SimpleAbstractLabelStyle |
Method | Defined By | ||
---|---|---|---|
Calculates the bounds for the label in the given context. | SimpleAbstractLabelStyle | ||
This style's renderer delegates the display object creation to this method. | SimpleAbstractLabelStyle | ||
Callback that returns the preferred size of the label. | SimpleAbstractLabelStyle | ||
Returns a transform according to the label's layout and isAutoFlip property. | SimpleAbstractLabelStyle | ||
isAutoFlip():Boolean
Determines whether the label's style should automatically flip the painting contents if the
layout is upside down. | SimpleAbstractLabelStyle | ||
Determines whether the visual representation of the label has been hit at the given location. | SimpleAbstractLabelStyle | ||
Determines whether the visualization for the specified node is included in the marquee selection. | SimpleAbstractLabelStyle | ||
Determines whether the visualization for the specified label is visible in the context. | SimpleAbstractLabelStyle | ||
Performs the lookup operation for the lookup calls to the renderer. | SimpleAbstractLabelStyle | ||
updateDisplayObject(label:ILabel, oldDisplayObject:DisplayObject, ctx:IDisplayObjectContext):DisplayObject
This style's renderer delegates updating the display object to this method. | SimpleAbstractLabelStyle |
styleRenderer | property |
styleRenderer:IStyleRenderer
[read-only] Gets the renderer implementation that has been supplied to this instance upon creation.
public function get styleRenderer():IStyleRenderer
SimpleAbstractLabelStyle | () | Constructor |
public function SimpleAbstractLabelStyle()
Creates a new instance
calculateBounds | () | method |
protected function calculateBounds(label:ILabel, scratch:IMutableRectangle, ctx:ICanvasContext):IRectangle
Calculates the bounds for the label in the given context.
This method is called in response to a calculateBounds
call to the instance that has
been queried from the renderer.
This implementation sets the bounding box of the label layout.
Parameters
label:ILabel — The label 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(label:ILabel, 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
label:ILabel — The display object context.
| |
ctx:IDisplayObjectContext — The label to render.
|
DisplayObject |
IllegalOperationError — if not overridden.
|
See also
getPreferredSize | () | method |
protected function getPreferredSize(label:ILabel):ISize
Callback that returns the preferred size of the label.
Subclasses have to override this method and return the preferred size for their style.
The utility method YGraphics.getTextSize
can be used to calculate the size of a given text
and text format as described in our Custom Style tutorial.
Parameters
label:ILabel — The label to which this style instance is assigned.
|
ISize — The preferred size.
|
See also
getTransform | () | method |
protected function getTransform(ctx:IDisplayObjectContext, label:ILabel):Matrix
Returns a transform according to the label's layout and isAutoFlip
property.
The label can be painted into the
<0,0> - <label.layout.width, label.layout.height>
rectangle. In createDisplayObject
or updateDisplayObject
the Matrix
which is returned by this method has to be set as the DisplayObject
's
transform.matrix
Parameters
ctx:IDisplayObjectContext — The paint context
| |
label:ILabel — The label to render
|
Matrix — A matrix with the correct rotation and translation to place the label's DisplayObject .
|
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.
|
isAutoFlip | () | method |
protected function isAutoFlip():Boolean
Determines whether the label's style should automatically flip the painting contents if the
layout
is upside down.
Boolean — true
|
isHit | () | method |
protected function isHit(label:ILabel, x:Number, y:Number, ctx:ICanvasContext):Boolean
Determines whether the visual representation of the label 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 label layout to determine whether the label has been hit.
Parameters
label:ILabel — The label 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 label representation is hit; false otherwise.
|
See also
isInBox | () | method |
protected function isInBox(label:ILabel, box:IRectangle, ctx:ICanvasContext):Boolean
Determines whether the visualization for the specified node 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 label layout intersect the marquee box.
Parameters
label:ILabel — The label to which this style instance is assigned.
| |
box:IRectangle — The marquee selection box.
| |
ctx:ICanvasContext — The canvas context.
|
Boolean — true if the specified label is selected by the marquee rectangle; false otherwise.
|
See also
isVisible | () | method |
protected function isVisible(label:ILabel, clip:IRectangle, ctx:ICanvasContext):Boolean
Determines whether the visualization for the specified label 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
label:ILabel — The label to which this style instance is assigned.
| |
clip:IRectangle — The clipping rectangle.
| |
ctx:ICanvasContext — The canvas context.
|
Boolean — true if the specified label is visible in the clipping rectangle, false otherwise.
|
See also
lookup | () | method |
protected function lookup(label:ILabel, type:Class):Object
Performs the lookup
operation for the lookup
calls to the renderer.
This implementation yields null
for everything but:
Parameters
label:ILabel — The label 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(label:ILabel, 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
label:ILabel — The display object context.
| |
oldDisplayObject:DisplayObject — The label to render.
| |
ctx:IDisplayObjectContext — The display object to update.
|
DisplayObject |
See also