infovis.visualization
Interface ItemRenderer

All Known Implementing Classes:
AbstractItemRenderer, AbstractVisualColumn, DefaultFillingItemRenderer, DefaultStrokingItemRenderer, DefaultVisualLabel, Fill, GroupItemRenderer, LayoutVisual, NoVisual, SortPseudoVisualColumn, StaticItemRenderer, Stroke, TreemapItemRenderer, TreemapVisualLabel, VisualAlpha, VisualArea, VisualArrowHead, VisualClipBounds, VisualColor, VisualFilter, VisualFisheye, VisualImage, VisualLabel, VisualLabelUnder, VisualSelection, VisualShape, VisualSize, VisualStatistics, VisualStrokeSize, VisualStrokingLabel, VisualVisualization, WrappingVisualLabel

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 ItemRenderers 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.

ItemRenderers can also come into two flavors: prototypes and instances. Prototypes are meant to be cloned to create instances. When a tree of ItemRenderers does not reference a Visualization, they are prototypes whereas those referencing a Visualization are instances (there are currently two exceptions though).

Version:
$Revision: 1.5 $
Author:
Jean-Daniel Fekete

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

getName

String getName()
Returns the name of this pipeline object or null if it should not be seen from the outside (like a container).

Returns:
the name or null

getRenderer

ItemRenderer getRenderer(int index)
Returns the children of this ItemRenderer at the specified index.

Parameters:
index - the index.
Returns:
the children of this ItemRendered at the specified index.

getRendererCount

int getRendererCount()
Returns the number of children ItemRenderer.

Returns:
the number of children ItemRenderer.

insertRenderer

ItemRenderer insertRenderer(int index,
                            ItemRenderer r)

addRenderer

ItemRenderer addRenderer(ItemRenderer r)

removeRenderer

ItemRenderer removeRenderer(int index)

setRenderer

ItemRenderer setRenderer(int index,
                         ItemRenderer r)

getVisualization

Visualization getVisualization()

compile

ItemRenderer compile()

install

void install(Graphics2D graphics)

paint

void paint(Graphics2D graphics,
           int row,
           Shape shape)

uninstall

void uninstall(Graphics2D graphics)

pick

boolean pick(Rectangle2D hitBox,
             int row,
             Shape shape)

isPrototype

boolean isPrototype()

instantiate

ItemRenderer instantiate(Visualization vis)


Copyright 2005 by Jean-Daniel Fekete and INRIA, France All rights reserved.