| Constructor and Description |
|---|
ArrowRenderer() |
| Modifier and Type | Method and Description |
|---|---|
CanvasSize |
getCanvasSize(Item item,
PreviewProperties properties)
Compute the canvas size of the item to render.
|
String |
getDisplayName()
Provides an user friendly name for the renderer.
|
PreviewProperty[] |
getProperties()
Returns all associated properties for this renderer.
|
boolean |
isRendererForitem(Item item,
PreviewProperties properties)
Based on
properties, determine whether this renderer is
valid to render Item. |
boolean |
needsItemBuilder(ItemBuilder itemBuilder,
PreviewProperties properties)
Based on the
itemBuilder class and the properties,
determine whether this renderer needs the given itemBuilder to be
executed before rendering. |
void |
preProcess(PreviewModel previewModel)
This method is called before rendering for all renderers and initializes
items' additional attributes or run complex algorithms.
|
void |
render(Item item,
RenderTarget target,
PreviewProperties properties)
Render
item to target using the global properties
and item data. |
public void preProcess(PreviewModel previewModel)
Renderer
This method has access to any item using the getItems() methods
of the preview model.
No data should be stored in the renderer itself but put in items using
Item.setData(java.lang.String, java.lang.Object). Global states can
be stored in properties using
PreviewProperties.putValue(java.lang.String, java.lang.Object).
preProcess in interface RendererpreviewModel - the model to get items frompublic void render(Item item, RenderTarget target, PreviewProperties properties)
Rendererpublic CanvasSize getCanvasSize(Item item, PreviewProperties properties)
RendererCanvasSize has to embed the whole item to
render. If the canvas size cannot be computed, a CanvasSize
with both width and height equlal to zero is returned.getCanvasSize in interface Rendereritem - the item to get the canvas sizeproperties - the current propertiespublic PreviewProperty[] getProperties()
RendererPreviewProperty.createProperty() methods.getProperties in interface Rendererpublic boolean isRendererForitem(Item item, PreviewProperties properties)
Rendererproperties, determine whether this renderer is
valid to render Item.
Additional states in properties helps to make a decision,
including:
true if the user is currently moving the canvas. Renderers
other than the node renderer usually render nothing while the user is moving
to speeds things up.isRendererForitem in interface Rendereritem - the item to be testedproperties - the current propertiestrue if item can be rendered by this
renderer, false otherwisepublic boolean needsItemBuilder(ItemBuilder itemBuilder, PreviewProperties properties)
RendereritemBuilder class and the properties,
determine whether this renderer needs the given itemBuilder to be
executed before rendering.
This is used for avoiding building unnecessary items while refreshing preview.
You can simply return true if the builder builds items that this renderer renders, but you can also check the current properties to see if your renderer is going to produce any graphic.
Additional states in properties helps to make a decision,
including:
true if the user is currently moving the canvas. Renderers
other than the node renderer usually render nothing while the user is moving
to speeds things up.needsItemBuilder in interface RendereritemBuilder - builder that your renderer may needproperties - the current propertiestrue if you are going to use built items for rendering, false otherwisepublic String getDisplayName()
RenderergetDisplayName in interface RendererCopyright © 2007–2017. All rights reserved.