public interface ICanvasObjectDescriptor
CanvasControl
to render elements from the scene graph.
Implementations will be queried using the user object obtained from UserObject
for
the corresponding implementations of the various aspects of the user object. Implementations of this interface need to
be provided by the application programmer to ICanvasObjectGroup
's ICanvasObjectGroup.addChild(Object, ICanvasObjectDescriptor)
method.
CanvasObjectDescriptors
Modifier and Type | Field and Description |
---|---|
static ICanvasObjectDescriptor |
ALWAYS_DIRTY_INSTANCE
An implementation that tries to cast the user object to the required interface.
|
static ICanvasObjectDescriptor |
ALWAYS_DIRTY_LOOKUP
An implementation that tries to lookup the instance from the user object if it is an
ILookup . |
static ICanvasObjectDescriptor |
DYNAMIC_DIRTY_INSTANCE
An implementation that tries to cast the user object to the required interface.
|
static ICanvasObjectDescriptor |
DYNAMIC_DIRTY_LOOKUP
An implementation that tries to lookup the instance from the user object if it is an
ILookup . |
static ICanvasObjectDescriptor |
VISUAL
An implementation that will cast the
UserObject to VISUAL and use that to
insert into the scene graph. |
static ICanvasObjectDescriptor |
VOID
An implementation that returns an
ICanvasObjectDescriptor that does nothing. |
Modifier and Type | Method and Description |
---|---|
IBoundsProvider |
getBoundsProvider(Object forUserObject)
Returns an implementation of
IBoundsProvider that can determine the visible bounds of the rendering of the user
object. |
IHitTestable |
getHitTestable(Object forUserObject)
Returns an implementation of
IHitTestable that can determine whether the rendering of the user object has been
hit at a given coordinate. |
IVisibilityTestable |
getVisibilityTestable(Object forUserObject)
Returns an implementation of
IVisibilityTestable that can determine if the rendering of the user object would be
visible in a given context. |
IVisualCreator |
getVisualCreator(Object forUserObject)
Returns an implementation of
IVisualCreator that will create the Node tree for the user
object. |
boolean |
isDirty(ICanvasContext context,
ICanvasObject canvasObject)
Determines whether the given canvas object is deemed dirty and needs updating.
|
static final ICanvasObjectDescriptor ALWAYS_DIRTY_INSTANCE
This implementation will treat always update the Visual
and will effectively ignore the Dirty
flag.
static final ICanvasObjectDescriptor ALWAYS_DIRTY_LOOKUP
ILookup
.
This implementation will treat always update the Visual
and will effectively ignore the Dirty
flag.
static final ICanvasObjectDescriptor DYNAMIC_DIRTY_INSTANCE
This implementation will respect the Dirty
flag.
static final ICanvasObjectDescriptor DYNAMIC_DIRTY_LOOKUP
static final ICanvasObjectDescriptor VISUAL
UserObject
to VISUAL
and use that to
insert into the scene graph.static final ICanvasObjectDescriptor VOID
ICanvasObjectDescriptor
that does nothing.IBoundsProvider getBoundsProvider(Object forUserObject)
IBoundsProvider
that can determine the visible bounds of the rendering of the user
object.
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 reconfigure this instance upon each call to this method.
forUserObject
- the user object to query the bounds fornull
if the bounds are not known, in which case the bounds are treated as infiniteIHitTestable getHitTestable(Object forUserObject)
IHitTestable
that can determine whether the rendering of the user object has been
hit at a given coordinate.
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 reconfigure this instance upon each call to this method.
forUserObject
- the user object to do the hit testing fornull
if the rendering cannot be hit testedIVisibilityTestable getVisibilityTestable(Object forUserObject)
IVisibilityTestable
that can determine if the rendering of the user object would be
visible in a given context.
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 reconfigure this instance upon each call to this method.
forUserObject
- the user object to query the bounds fornull
if the bounds are not known, in which case the bounds are treated as infiniteIVisualCreator getVisualCreator(Object forUserObject)
IVisualCreator
that will create the Node
tree for the user
object.
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 reconfigure this instance upon each call to this method.
forUserObject
- the user object to create a Visual fornull
if nothing shall be renderedboolean isDirty(ICanvasContext context, ICanvasObject canvasObject)
context
- The context that will be used for the update.canvasObject
- The object to check.