Package | com.yworks.graph.drawing |
Class | public class DelegatingStyleRenderer |
Inheritance | DelegatingStyleRenderer AbstractStyleRenderer Object |
Implements | INodeStyleRenderer, IEdgeStyleRenderer, ILabelStyleRenderer, IPortStyleRenderer, IDisplayObjectCreator |
Subclasses | FilterNodeStyleRenderer |
IDelegatingStyle
. This implementation
delegates to the renderer of the wrapped style.
Developers usually have to override only the paint
method.
If the style should be serializable, the serializer
property
has also to be overridden to return an appropriate serializer. In that case,
the corresponding deserializer has to be registered to the RoundtripHandler
or IOHandler
See also
Method | Defined By | ||
---|---|---|---|
[override]
This implementation delegates to the renderer of the wrapped style. | DelegatingStyleRenderer | ||
createDisplayObject(context:IDisplayObjectContext):DisplayObject [override]
This implementation delegates to the renderer of the wrapped style. | DelegatingStyleRenderer | ||
Configures the style and item parameters,
calls configure and returns this. | AbstractStyleRenderer | ||
Configures the style and item parameters,
does not call configure and returns this. | AbstractStyleRenderer | ||
Gets an appropriate style descriptor for the given style. | DelegatingStyleRenderer | ||
Configures the style and item parameters,
calls configure and returns this. | AbstractStyleRenderer | ||
Configures the style and item parameters,
calls configure and returns this. | AbstractStyleRenderer | ||
Configures the style and item parameters,
calls configure and returns this. | AbstractStyleRenderer | ||
Gets an implementation of the IPathGeometry interface that can
handle the provided edge and its associated style. | DelegatingStyleRenderer | ||
Calculates the ILabel.preferredSize of a given label using the
associated style. | DelegatingStyleRenderer | ||
Gets an implementation of the IShapeGeometry interface that can
handle the provided node and its associated style. | DelegatingStyleRenderer | ||
Installs the model in the canvas at the given group using the styleDescriptor. | AbstractStyleRenderer | ||
isHit(x:Number, y:Number, ctx:ICanvasContext):Boolean [override]
This implementation delegates to the renderer of the wrapped style. | DelegatingStyleRenderer | ||
[override]
This implementation delegates to the renderer of the wrapped style. | DelegatingStyleRenderer | ||
Calls configure and tests the item using the style
for a visible intersection with the clip bounds. | AbstractStyleRenderer | ||
lookup(type:Class):Object [override]
ILookup implementation of this style renderer. | DelegatingStyleRenderer | ||
updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject [override]
This implementation delegates to the renderer of the wrapped style. | DelegatingStyleRenderer |
Method | Defined By | ||
---|---|---|---|
configure():void [override]
This implementation does nothing. | DelegatingStyleRenderer | ||
A ISerializer which can serialize DelegatingStyle instances. | DelegatingStyleRenderer | ||
Factory method for the StyleDescriptor property. | AbstractStyleRenderer | ||
setItem(item:IModelItem):void
Called by the various descriptor getters to initialize the item. | AbstractStyleRenderer | ||
setStyle(style:IVisualStyle):void
Called by the various descriptor getters to initialize the style. | AbstractStyleRenderer | ||
updateLayout(obj:DisplayObject, context:IDisplayObjectContext):void
Updates the layout (size and coordinates) of the given display object. | DelegatingStyleRenderer |
calculateBounds | () | method |
override public function calculateBounds(scratch:IMutableRectangle, ctx:ICanvasContext):IRectangle
This implementation delegates to the renderer of the wrapped style. Returns a tight rectangular area where the whole rendering would fit into.
Implementations can use the scratch
rectangle to put their
results in and return it as the result of the operation.
Client has to always provide a non-null
instance as
a parameter. They may however decide to return an internally
cached or dynamically created IRectangle
implementation and
disregard the scratch parameter.
If calculating the bounds is too expensive or the painting is not
bound to a certain area, this method may return null
.
If nothing is painted, this method should return an empty rectangle, where
either or both the width and height is non-positive or
ImmutableRectangle.Empty
.
Parameters
scratch:IMutableRectangle — An instance that can optionally be used to fill with the
corresponding values and be returned
| |
ctx:ICanvasContext — The context to calculate the bounds for (currently not used)
|
IRectangle — The bounds or null to indicate an unbound area
|
configure | () | method |
override protected function configure():void
This implementation does nothing. Prepares this instance for subsequent calls after the style and item have been initialized.
Upon invocation the style
and item
fields have
been populated by the getDisplayObjectCreator
or getBoundsProvider
methods.
createDisplayObject | () | method |
override public function createDisplayObject(context:IDisplayObjectContext):DisplayObject
This implementation delegates to the renderer of the wrapped style.
When subclassed, a call to super.createDisplayObject(context)
will
create the display object using the wrapped renderer.
Parameters
context:IDisplayObjectContext — The display object context
|
DisplayObject — The display object created by the creator of the wrapped renderer
|
createSerializer | () | method |
protected function createSerializer():ISerializer
A ISerializer
which can serialize DelegatingStyle
instances.
Subclasses must override this to return an appropriate serializer or
null
if the style is not intended to be serialized.
ISerializer — A suitable serializer or null .
|
getDescriptorForStyle | () | method |
public function getDescriptorForStyle(style:IVisualStyle):ICanvasObjectDescriptor
Gets an appropriate style descriptor for the given style.
Styles which implement the install()
can call this method
to get an appropriate instance of ICanvasObjectDescriptor
.
Parameters
style:IVisualStyle — The style to get the descriptor for.
|
ICanvasObjectDescriptor — An appropriate descriptor for the given style.
|
getPathGeometry | () | method |
public function getPathGeometry(edge:IEdge, style:IEdgeStyle):IPathGeometry
Gets an implementation of the IPathGeometry
interface that can
handle the provided edge and its associated style.
If the DelegatingStyle
wraps an IEdgeStyle
,
this implementation delegates to the renderer of the wrapped style,
otherwise it returns null.
Parameters
edge:IEdge — The edge to provide an instance for.
| |
style:IEdgeStyle — The style to use for the painting.
|
IPathGeometry — An implementation that may be used to subsequently query geometry information from.
Clients should not cache this instance and must always call
this method immediately before using the value returned. This enables the
use of the flyweight design pattern for implementations
|
getPreferredSize | () | method |
public function getPreferredSize(label:ILabel, style:ILabelStyle):ISize
Calculates the ILabel.preferredSize
of a given label using the
associated style.
If the DelegatingStyle
wraps an ILabelStyle
,
this implementation delegates to the renderer of the wrapped style,
otherwise it returns null.
Parameters
label:ILabel — The label to determine the preferred size for
| |
style:ILabelStyle — The style instance that uses this instance as its ILabelStyle.styleRenderer .
|
ISize — A size that can be used as the ILabel.preferredSize
if this renderer paints the label using the associated style. May return
null if there is no such thing like a preferred size for this
style.
|
getShapeGeometry | () | method |
public function getShapeGeometry(node:INode, style:INodeStyle):IShapeGeometry
Gets an implementation of the IShapeGeometry
interface that can
handle the provided node and its associated style.
If the IDelegatingStyle
wraps an INodeStyle
,
this implementation delegates to the renderer of the wrapped style,
otherwise it returns null.
Parameters
node:INode — The node to provide an instance for
| |
style:INodeStyle — The style to use for the painting
|
IShapeGeometry — An implementation that may be used to subsequently query geometry information from.
Clients should not cache this instance and must always call
this method immediately before using the value returned. This enables the
use of the flyweight design pattern for implementations
|
isHit | () | method |
override public function isHit(x:Number, y:Number, ctx:ICanvasContext):Boolean
This implementation delegates to the renderer of the wrapped style. Hit tests the item by trying to apply the flash internal hit testing.
This implementation does not take ICanvasContext.hitTestRadius into account.
Parameters
x:Number | |
y:Number | |
ctx:ICanvasContext |
Boolean |
isInBox | () | method |
override public function isInBox(box:IRectangle, ctx:ICanvasContext):Boolean
This implementation delegates to the renderer of the wrapped style.
Returns true
if the corresponding
item is considered to intersect the given rectangular box.
This method may return false
if the item cannot be
selected using a selection marquee or optionally if the
item is only partially contained within the box.
Parameters
box:IRectangle — The box describing the marquee's bounds
| |
ctx:ICanvasContext — The current canvas context
|
Boolean — true if the item is considered to be captured by the marquee
|
lookup | () | method |
override public function lookup(type:Class):Object
ILookup
implementation of this style renderer.
If asked for an ISerializer
it returns the result of
createSerializer
(may be null). Otherwise it returns itself,
if the renderer implements the asked type. If not and if the renderer of the
wrapped style implements ILookup
, that renderer's lookup will
be queried.
Parameters
type:Class — The type to look for.
|
Object — An instance of the asked type if available, otherwise null.
|
updateDisplayObject | () | method |
override public function updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject
This implementation delegates to the renderer of the wrapped style.
When subclassed, a call to super.updateDisplayObject(oldDisplayObject, context)
will
update the display object using the wrapped renderer.
Parameters
oldDisplayObject:DisplayObject — The display object to update.
| |
context:IDisplayObjectContext — The display object context.
|
DisplayObject — The updated display object returned by the creator of the wrapped renderer.
|
updateLayout | () | method |
protected function updateLayout(obj:DisplayObject, context:IDisplayObjectContext):void
Updates the layout (size and coordinates) of the given display object.
Parameters
obj:DisplayObject — The display object whose layout should be updated.
| |
context:IDisplayObjectContext — The context to update the layout for.
|