public abstract class AbstractStripeStyle extends Object implements IStripeStyle, Cloneable
IStripeStyle
.
The only method that needs to be implemented by subclasses is createVisual(IRenderContext, IStripe)
, however to
improve rendering performance it is highly recommended to implement at least
updateVisual(IRenderContext, Node, IStripe)
, too.
This implementation differs from the straightforward IStripeStyle
implementation in that there is no visible
separation between the style and its
IStripeStyleRenderer
. Instead the renderer used by the base class is fixed and delegates all calls back to
the style instance.
Modifier | Constructor and Description |
---|---|
protected |
AbstractStripeStyle()
Initializes a new instance of the
AbstractStripeStyle class. |
Modifier and Type | Method and Description |
---|---|
AbstractStripeStyle |
clone()
Creates a new object that is a copy of the current instance.
|
protected abstract Node |
createVisual(IRenderContext context,
IStripe stripe)
Callback that creates the visual.
|
IStripeStyleRenderer |
getRenderer()
Gets the renderer implementation for this instance.
|
protected Object |
lookup(IStripe stripe,
Class type)
Performs the
ILookup.lookup(Class) operation for the IStripeStyleRenderer.getContext(IStripe, IStripeStyle)
that has been queried from the Renderer . |
protected Node |
updateVisual(IRenderContext context,
Node oldVisual,
IStripe stripe)
Callback that updates the visual previously created by
createVisual(IRenderContext, IStripe) . |
protected AbstractStripeStyle()
AbstractStripeStyle
class.public AbstractStripeStyle clone()
Immutable subclasses should consider returning this
.
clone
in interface ICloneable
clone
in class Object
Object.clone()
.Object.clone()
protected abstract Node createVisual(IRenderContext context, IStripe stripe)
This method is called in response to a IVisualCreator.createVisual(IRenderContext)
call to the instance that has
been queried from the Renderer
.
stripe
- The stripe to which this style instance is assigned.IVisualCreator.createVisual(IRenderContext)
interface.updateVisual(IRenderContext, Node, IStripe)
public final IStripeStyleRenderer getRenderer()
The private implementation will delegate all API calls back to this instance.
getRenderer
in interface IStripeStyle
protected Object lookup(IStripe stripe, Class type)
ILookup.lookup(Class)
operation for the IStripeStyleRenderer.getContext(IStripe, IStripeStyle)
that has been queried from the Renderer
.
This implementation yields null
for everything but:
For these interfaces an implementation will be returned that delegates to the methods in this instance.
stripe
- The stripe to use for the context lookup.type
- The type to query.type
or null
.protected Node updateVisual(IRenderContext context, Node oldVisual, IStripe stripe)
createVisual(IRenderContext, IStripe)
.
This method is called in response to a IVisualCreator.updateVisual(IRenderContext, Node)
call to the instance
that has been queried from the Renderer
. This implementation simply delegates to createVisual(IRenderContext, IStripe)
so subclasses should override to improve rendering performance.
oldVisual
- The visual that has been created in the call to createVisual(IRenderContext, IStripe)
.stripe
- The stripe to which this style instance is assigned.IVisualCreator.createVisual(IRenderContext)
interface.createVisual(IRenderContext, IStripe)