public class TableNodeStyleRenderer extends Object implements INodeStyleRenderer, IShapeGeometry, IBoundsProvider, IVisibilityTestable, IMarqueeTestable, IHitTestable, ILookup, IVisualCreator
TableNodeStyle
instances.EMPTY, UNBOUNDED
ALWAYS, NEVER
ALWAYS, NEVER
ALWAYS, NEVER
Constructor and Description |
---|
TableNodeStyleRenderer() |
Modifier and Type | Method and Description |
---|---|
protected void |
configure()
Prepares this instance for subsequent calls after the style and node have been initialized.
|
Node |
createVisual(IRenderContext context)
This method is called by the framework to create a
Node that will be included into the IRenderContext . |
protected INodeStyle |
getBackgroundStyle()
Get the
background style that is currently used by this renderer. |
RectD |
getBounds(ICanvasContext context)
Returns a tight rectangular area where the whole rendering would fit into.
|
IBoundsProvider |
getBoundsProvider(INode node,
INodeStyle style)
Gets an implementation of the
IBoundsProvider interface that can handle the provided node and its associated
style. |
ILookup |
getContext(INode node,
INodeStyle style)
Gets a temporary context instance that can be used to query additional information for the node's style.
|
IHitTestable |
getHitTestable(INode node,
INodeStyle style)
Gets an implementation of the
IHitTestable interface that can handle the provided node and its associated
style. |
PointD |
getIntersection(PointD inner,
PointD outer)
Returns the intersection for the given line with this shape's geometry.
|
IMarqueeTestable |
getMarqueeTestable(INode node,
INodeStyle style)
Gets an implementation of the
IMarqueeTestable interface that can handle the provided node and its associated
style. |
protected INode |
getNode()
Gets the currently configured node.
|
GeneralPath |
getOutline()
Returns the outline of the shape or
null . |
IShapeGeometry |
getShapeGeometry(INode node,
INodeStyle style)
Gets an implementation of the
IShapeGeometry interface that can handle the provided node and its associated
style. |
protected TableNodeStyle |
getStyle()
Gets the currently configured style.
|
protected ITable |
getTable()
Gets the table object that should be used for rendering.
|
protected TableRenderingOrder |
getTableRenderingOrder()
Get the
TableRenderingOrder that is currently used by this renderer. |
IVisibilityTestable |
getVisibilityTestable(INode node,
INodeStyle style)
Gets an implementation of the
IVisibilityTestable interface that can handle the provided node and its associated
style. |
IVisualCreator |
getVisualCreator(INode node,
INodeStyle style)
Gets an implementation of the
IVisualCreator interface that can handle the provided node and its associated
style. |
boolean |
isHit(IInputModeContext context,
PointD location)
Determines if something has been hit at the given coordinates in the world coordinate system.
|
boolean |
isInBox(IInputModeContext context,
RectD rectangle)
This callback returns
true if the corresponding item is considered to intersect the given rectangular box. |
boolean |
isInside(PointD location)
Checks whether the given coordinate is deemed to lie within the shape's geometric bounds.
|
boolean |
isVisible(ICanvasContext context,
RectD rectangle)
Determines whether an element might intersect the visible region for a given context.
|
<TLookup> TLookup |
lookup(Class<TLookup> type)
Returns an instance that implements the given type or
null . |
protected void |
setNode(INode value)
Sets the currently configured node.
|
protected void |
setStyle(TableNodeStyle value)
Sets the currently configured style.
|
Node |
updateVisual(IRenderContext context,
Node oldVisual)
This method updates or replaces a previously created
Node for inclusion in the IRenderContext . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fromRectangle
create
createDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, safeLookup
protected void configure()
Upon invocation the Style
and Node
properties have been populated by the
getVisualCreator(INode, INodeStyle)
, getBoundsProvider(INode, INodeStyle)
,
getHitTestable(INode, INodeStyle)
, or getMarqueeTestable(INode, INodeStyle)
methods.
This is an empty implementation. Subclasses might have to override this method.
public Node createVisual(IRenderContext context)
IVisualCreator
Node
that will be included into the IRenderContext
.
CanvasControl
uses this interface through the ICanvasObjectDescriptor
to populate the visual canvas object tree.
createVisual
in interface IVisualCreator
context
- The context that describes where the visual will be used.null
.IVisualCreator.updateVisual(IRenderContext, Node)
protected INodeStyle getBackgroundStyle()
background style
that is currently used by this renderer.
This implementation retrieves the BackgroundStyle
from the owning style
background style
that is currently used by this renderer.public RectD getBounds(ICanvasContext context)
IBoundsProvider
If calculating the bounds is too expensive or the rendering is not bound to a certain area, this method may return
RectD.INFINITE
. If nothing is rendered, this method should return an empty rectangle, where either or both
the width and height is non-positive or RectD.EMPTY
.
getBounds
in interface IBoundsProvider
context
- the context to calculate the bounds forRectD.EMPTY
to indicate an unbound areapublic IBoundsProvider getBoundsProvider(INode node, INodeStyle style)
INodeStyleRenderer
IBoundsProvider
interface that can handle the provided node and its associated
style.
This method may return a flyweight implementation.
getBoundsProvider
in interface INodeStyleRenderer
node
- The node to provide an instance forstyle
- The style to use for the calculating the painting boundspublic ILookup getContext(INode node, INodeStyle style)
INodeStyleRenderer
Implementations may return ILookup.EMPTY
if they don't support this, but may not return null
.
getContext
in interface INodeStyleRenderer
node
- The node to provide a context instance for.style
- The style to use for the context.null
lookup implementation.ILookup.EMPTY
,
ILookup
public IHitTestable getHitTestable(INode node, INodeStyle style)
INodeStyleRenderer
IHitTestable
interface that can handle the provided node and its associated
style.
This method may return a flyweight implementation.
getHitTestable
in interface INodeStyleRenderer
node
- The node to provide an instance forstyle
- The style to use for the querying hit testsnull
to indicate that the node cannot be hit tested.public PointD getIntersection(PointD inner, PointD outer)
IShapeGeometry
getIntersection
in interface IShapeGeometry
inner
- The first point of the line that is inside the shape.outer
- The second point of the line that is outside the shape.public IMarqueeTestable getMarqueeTestable(INode node, INodeStyle style)
INodeStyleRenderer
IMarqueeTestable
interface that can handle the provided node and its associated
style.
This method may return a flyweight implementation.
getMarqueeTestable
in interface INodeStyleRenderer
node
- The node to provide an instance forstyle
- The style to use for the querying marquee intersection test.protected final INode getNode()
setNode(INode)
public GeneralPath getOutline()
IShapeGeometry
null
.getOutline
in interface IShapeGeometry
null
if no outline can be provided.public IShapeGeometry getShapeGeometry(INode node, INodeStyle style)
INodeStyleRenderer
IShapeGeometry
interface that can handle the provided node and its associated
style.
This method may return a flyweight implementation.
getShapeGeometry
in interface INodeStyleRenderer
node
- The node to provide an instance forstyle
- The style to use for the renderingprotected final TableNodeStyle getStyle()
setStyle(TableNodeStyle)
protected ITable getTable()
This implementation delegates to the Table provided by the Table
property.
protected TableRenderingOrder getTableRenderingOrder()
TableRenderingOrder
that is currently used by this renderer.
This implementation retrieves the TableRenderingOrder
from the owning style
TableRenderingOrder
that is currently used by this renderer.public IVisibilityTestable getVisibilityTestable(INode node, INodeStyle style)
INodeStyleRenderer
IVisibilityTestable
interface that can handle the provided node and its associated
style.
This method may return a flyweight implementation.
getVisibilityTestable
in interface INodeStyleRenderer
node
- The node to provide an instance forstyle
- The style to use for the testing the visibilitypublic IVisualCreator getVisualCreator(INode node, INodeStyle style)
INodeStyleRenderer
IVisualCreator
interface that can handle the provided node and its associated
style.
This method may return a flyweight implementation, but never null
.
getVisualCreator
in interface INodeStyleRenderer
node
- The node to provide an instance forstyle
- The style to use for the creation of the visualnull
but should yield a void
implementation instead.VoidVisualCreator.INSTANCE
public boolean isHit(IInputModeContext context, PointD location)
IHitTestable
Implementations should inspect the HitTestRadius
and
take the value into account when performing hit tests. This allows the user to hit elements even if the zoom level is
very small and allows for accurate hit tests at greater zoom levels.
isHit
in interface IHitTestable
context
- the context the hit test is performed inlocation
- the coordinates in world coordinate systempublic boolean isInBox(IInputModeContext context, RectD rectangle)
IMarqueeTestable
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.
Implementations should respect the HitTestRadius
if
marquee selections should behave differently on different zoom levels.
isInBox
in interface IMarqueeTestable
context
- the current input mode contextrectangle
- the box describing the marquee's boundstrue
if the item is considered to be captured by the marqueepublic boolean isInside(PointD location)
IShapeGeometry
isInside
in interface IShapeGeometry
location
- The point to test.public boolean isVisible(ICanvasContext context, RectD rectangle)
IVisibilityTestable
Conservative implementations can always return true
.
isVisible
in interface IVisibilityTestable
context
- The context to determine the visibility for.rectangle
- The visible region clip.false
if and only if it is safe not to paint the element because it would not affect the given clipping region.public <TLookup> TLookup lookup(Class<TLookup> type)
ILookup
null
.
Typically, this method will be called in order to obtain a different view or
aspect of the current instance. This is quite similar to casting or using
a super type or interface of this instance, but is not limited to inheritance or
compile time constraints. An instance implementing this method is not
required to return non-null
implementations for the types, nor does it
have to return the same instance any time. Also it depends on the
type and context whether the instance returned stays up to date or needs to
be reobtained for subsequent use.protected final void setNode(INode value)
value
- The Node to set.getNode()
protected final void setStyle(TableNodeStyle value)
value
- The Style to set.getStyle()
public Node updateVisual(IRenderContext context, Node oldVisual)
IVisualCreator
Node
for inclusion in the IRenderContext
.
The CanvasControl
uses this method to give implementations a chance to update an existing
Visual that has previously been created by the same instance during a call to IVisualCreator.createVisual(IRenderContext)
.
Implementation may update the oldVisual
and return that same reference, or create a new visual and return the
new instance or null
.
updateVisual
in interface IVisualCreator
context
- The context that describes where the visual will be used in.oldVisual
- The visual instance that had been returned the last time the IVisualCreator.createVisual(IRenderContext)
method was called on
this instance.oldVisual
, if this instance modified the visual, or a new visual that should replace the existing one in the
canvas object visual tree.IVisualCreator.createVisual(IRenderContext)
,
ICanvasObjectDescriptor
,
CanvasControl