|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ItemRenderer
A ItemRenderer
performs one or several stages of painting and picking
for each item of a Visualization. It adheres to the Composite
Design Pattern.
An item renderer object performs one or several stage for painting a visualization
item. Several pipeline objects are used to perform the whole rendering of one
item. Item renderers form a tree. For example, when each visualized objects should be
assigned a color and filled, the tree is simply a list of the following form:
ItemRenderer ir = new VisualColor(new Fill());
Default renderers are more complex. They can also render a stroke outside each item and a label over them such as:
ItemRenderer ir = new VisualGroup( new VisualColor(new Fill()), new VisualSelect(new Stroke()), new VisualLabel());
Item Renderers can be created directly and set to a Visualization
, either
at construction time or later. However, they are more often created through the
ItemRendererFactory
. They most often derive from two
classes: DefaultFillingItemRenderer
or
DefaultStrokingItemRenderer
. Looking at these classes
should help understand how to specify or change the default ones.
Most classes implementing the ItemRenderer
also implement the
VisualColumnDescriptor
interface. When a tree of
ItemRenderer
s is associated with a visualization, all the ones also implementing
the VisualColumnDescriptor
interface are registered as visual columns.
Item Renderers have a name (see getName()
), and should implement the
install(Graphics2D)
,
paint(Graphics2D,int,Shape)
,
uninstall(Graphics2D)
and
pick(Rectangle2D,int,Shape)
methods.
install
is called by the visualization before any rendering is done. It is used
to initialize the parameters of the renderer that depends on the current settings of the
visualization or of the environment.
uninstall
is called by the visualization after all the rendering is done. It is
used to release any resource allocated during the rendering.
paint
is called when rendering each item in turn.
pick
is called for picking.
Each of these methods are called on each items of the tree so their implementation should
usually propagate the operations to the subtree. The
AbstractItemRenderer
base class implements the propagation
along the tree.
ItemRenderer
s can also come into two flavors: prototypes and instances. Prototypes
are meant to be cloned to create instances. When a tree of ItemRenderer
s does not reference
a Visualization
, they are prototypes whereas those referencing a Visualization
are instances (there are currently two exceptions though).
Method Summary | |
---|---|
ItemRenderer |
addRenderer(ItemRenderer r)
|
ItemRenderer |
compile()
|
String |
getName()
Returns the name of this pipeline object or null if it
should not be seen from the outside (like a container). |
ItemRenderer |
getRenderer(int index)
Returns the children of this ItemRenderer at the specified index. |
int |
getRendererCount()
Returns the number of children ItemRenderer . |
Visualization |
getVisualization()
|
ItemRenderer |
insertRenderer(int index,
ItemRenderer r)
|
void |
install(Graphics2D graphics)
|
ItemRenderer |
instantiate(Visualization vis)
|
boolean |
isPrototype()
|
void |
paint(Graphics2D graphics,
int row,
Shape shape)
|
boolean |
pick(Rectangle2D hitBox,
int row,
Shape shape)
|
ItemRenderer |
removeRenderer(int index)
|
ItemRenderer |
setRenderer(int index,
ItemRenderer r)
|
void |
uninstall(Graphics2D graphics)
|
Method Detail |
---|
String getName()
null
if it
should not be seen from the outside (like a container).
null
ItemRenderer getRenderer(int index)
index
- the index.
int getRendererCount()
ItemRenderer
.
ItemRenderer
.ItemRenderer insertRenderer(int index, ItemRenderer r)
ItemRenderer addRenderer(ItemRenderer r)
ItemRenderer removeRenderer(int index)
ItemRenderer setRenderer(int index, ItemRenderer r)
Visualization getVisualization()
ItemRenderer compile()
void install(Graphics2D graphics)
void paint(Graphics2D graphics, int row, Shape shape)
void uninstall(Graphics2D graphics)
boolean pick(Rectangle2D hitBox, int row, Shape shape)
boolean isPrototype()
ItemRenderer instantiate(Visualization vis)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |