org.jfree.chart.renderer
Class AbstractRenderer

java.lang.Object
  |
  +--org.jfree.chart.renderer.AbstractRenderer
All Implemented Interfaces:
Renderer, java.io.Serializable
Direct Known Subclasses:
AbstractCategoryItemRenderer, AbstractXYItemRenderer

public class AbstractRenderer
extends java.lang.Object
implements Renderer, java.io.Serializable

Base class providing common services for renderers.

Author:
David Gilbert
See Also:
Serialized Form

Field Summary
static java.awt.Paint DEFAULT_OUTLINE_PAINT
          The default outline paint.
static java.awt.Stroke DEFAULT_OUTLINE_STROKE
          The default outline stroke.
static java.awt.Paint DEFAULT_PAINT
          The default paint.
static java.awt.Shape DEFAULT_SHAPE
          The default shape.
static java.awt.Stroke DEFAULT_STROKE
          The default stroke.
 
Constructor Summary
AbstractRenderer()
          Default constructor.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a property change listener to the renderer.
protected  java.awt.Shape createTransformedShape(java.awt.Shape shape, double translateX, double translateY)
          Creates and returns a translated version of a shape.
 boolean equals(java.lang.Object obj)
          Tests this renderer for equality with another object.
protected  void firePropertyChanged(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Notifies registered listeners that a property of the renderer has changed.
 java.awt.Paint getDefaultOutlinePaint()
          Returns the default outline paint.
 java.awt.Stroke getDefaultOutlineStroke()
          Returns the default outline stroke.
 java.awt.Paint getDefaultPaint()
          Returns the default paint.
 java.awt.Shape getDefaultShape()
          Returns the default shape.
 java.awt.Stroke getDefaultStroke()
          Returns the default stroke.
 DrawingSupplier getDrawingSupplier()
          Returns the drawing supplier for the renderer.
 ChartRenderingInfo getInfo()
          Returns the chart rendering info.
 java.awt.Paint getItemOutlinePaint(int dataset, int row, int column)
          Returns the paint used to outline data items as they are drawn.
 java.awt.Stroke getItemOutlineStroke(int dataset, int row, int column)
          Returns the stroke used to outline data items.
 java.awt.Paint getItemPaint(int dataset, int row, int column)
          Returns the paint used to fill data items as they are drawn.
 java.awt.Shape getItemShape(int dataset, int row, int column)
          Returns a shape used to represent a data item.
 java.awt.Stroke getItemStroke(int dataset, int row, int column)
          Returns the stroke used to draw data items.
 Plot getPlot()
          Returns the plot that this renderer has been assigned to.
 java.awt.Paint getSeriesOutlinePaint(int dataset, int series)
          Returns the color used to outline an item drawn by the renderer.
 java.awt.Stroke getSeriesOutlineStroke(int dataset, int series)
          Returns the stroke used to outline the items in a series.
 java.awt.Paint getSeriesPaint(int dataset, int series)
          Returns the color used to fill an item drawn by the renderer.
 java.awt.Shape getSeriesShape(int dataset, int series)
          Returns a shape used to represent the items in a series.
 java.awt.Stroke getSeriesStroke(int dataset, int series)
          Returns the stroke used to draw the items in a series.
 boolean isOutlinePaintTableActive()
          Returns true if the outline paint table is being used, and false otherwise.
 boolean isOutlineStrokeTableActive()
          Returns true if the outline stroke table is being used, and false otherwise.
 boolean isPaintTableActive()
          Returns true if the paint table is being used, and false otherwise.
 boolean isShapeTableActive()
          Returns true if the shape table is being used, and false otherwise.
 boolean isStrokeTableActive()
          Returns true if the stroke table is being used, and false otherwise.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a property change listener from the renderer.
 void setDefaultOutlinePaint(java.awt.Paint paint)
          Sets the default outline paint.
 void setDefaultOutlineStroke(java.awt.Stroke stroke)
          Sets the default outline stroke.
 void setDefaultPaint(java.awt.Paint paint)
          Sets the default paint.
 void setDefaultShape(java.awt.Shape shape)
          Sets the default shape.
 void setDefaultStroke(java.awt.Stroke stroke)
          Sets the default stroke.
 void setDrawingSupplier(DrawingSupplier supplier)
          Sets the drawing supplier for the renderer.
 void setInfo(ChartRenderingInfo info)
          Sets the chart rendering info.
 void setOutlinePaintTableActive(boolean active)
          Sets the flag that controls whether the outline paint table is used or not.
 void setOutlineStrokeTableActive(boolean active)
          Sets the flag that controls whether the outline stroke table is used or not.
 void setPaintTableActive(boolean active)
          Sets the flag that controls whether the paint table is used or not.
 void setPlot(Plot plot)
          Sets the plot that this renderer has been assigned to.
 void setSeriesOutlinePaint(int dataset, int series, java.awt.Paint paint)
          Sets the paint used for a series outline.
 void setSeriesOutlinePaint(int series, java.awt.Paint paint)
          Sets the paint used for a series outline (in the primary dataset).
 void setSeriesOutlineStroke(int dataset, int series, java.awt.Stroke stroke)
          Sets the outline stroke used for a series.
 void setSeriesOutlineStroke(int series, java.awt.Stroke stroke)
          Sets the outline stroke used for a series (in the primary dataset).
 void setSeriesPaint(int dataset, int series, java.awt.Paint paint)
          Sets the paint used for a series.
 void setSeriesPaint(int series, java.awt.Paint paint)
          Sets the paint used for a series (in the primary dataset).
 void setSeriesShape(int dataset, int series, java.awt.Shape shape)
          Sets the shape used for a series.
 void setSeriesShape(int series, java.awt.Shape shape)
          Sets the shape used for a series (in the primary dataset).
 void setSeriesStroke(int dataset, int series, java.awt.Stroke stroke)
          Sets the stroke used for a series.
 void setSeriesStroke(int series, java.awt.Stroke stroke)
          Sets the stroke used for a series (in the primary dataset).
 void setShapeTableActive(boolean active)
          Sets the flag that controls whether the shape table is used or not.
 void setStrokeTableActive(boolean active)
          Sets the flag that controls whether the stroke table is used or not.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PAINT

public static final java.awt.Paint DEFAULT_PAINT
The default paint.


DEFAULT_OUTLINE_PAINT

public static final java.awt.Paint DEFAULT_OUTLINE_PAINT
The default outline paint.


DEFAULT_STROKE

public static final java.awt.Stroke DEFAULT_STROKE
The default stroke.


DEFAULT_OUTLINE_STROKE

public static final java.awt.Stroke DEFAULT_OUTLINE_STROKE
The default outline stroke.


DEFAULT_SHAPE

public static final java.awt.Shape DEFAULT_SHAPE
The default shape.

Constructor Detail

AbstractRenderer

public AbstractRenderer()
Default constructor.

Method Detail

getPlot

public Plot getPlot()
Returns the plot that this renderer has been assigned to.

Specified by:
getPlot in interface Renderer
Returns:
the plot.

setPlot

public void setPlot(Plot plot)
Sets the plot that this renderer has been assigned to.

Specified by:
setPlot in interface Renderer
Parameters:
plot - the plot.

getInfo

public ChartRenderingInfo getInfo()
Returns the chart rendering info.

Returns:
the chart rendering info.

setInfo

public void setInfo(ChartRenderingInfo info)
Sets the chart rendering info.

Parameters:
info - the chart rendering info.

getDrawingSupplier

public DrawingSupplier getDrawingSupplier()
Returns the drawing supplier for the renderer.

Specified by:
getDrawingSupplier in interface Renderer
Returns:
The drawing supplier.

setDrawingSupplier

public void setDrawingSupplier(DrawingSupplier supplier)
Sets the drawing supplier for the renderer. The drawing supplier is responsible for supplying a limitless (possibly repeating) sequence of Paint, Stroke and Shape objects that the renderer can use to populate its tables. The supplier can be shared among multiple renderers.

Specified by:
setDrawingSupplier in interface Renderer
Parameters:
supplier - the new supplier.

isPaintTableActive

public boolean isPaintTableActive()
Returns true if the paint table is being used, and false otherwise.

Specified by:
isPaintTableActive in interface Renderer
Returns:
The flag.

setPaintTableActive

public void setPaintTableActive(boolean active)
Sets the flag that controls whether the paint table is used or not. If it is not active, the default-paint attribute will be used instead.

Specified by:
setPaintTableActive in interface Renderer
Parameters:
active - the flag.

getItemPaint

public java.awt.Paint getItemPaint(int dataset,
                                   int row,
                                   int column)
Returns the paint used to fill data items as they are drawn.

The default implementation passes control to the getSeriesPaint method. You can override this method if you require different behaviour.

Parameters:
dataset - the dataset index (zero-based).
row - the row (or series) index (zero-based).
column - the column (or category) index (zero-based).
Returns:
The paint.

getSeriesPaint

public java.awt.Paint getSeriesPaint(int dataset,
                                     int series)
Returns the color used to fill an item drawn by the renderer.

Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
Returns:
The paint.

setSeriesPaint

public void setSeriesPaint(int series,
                           java.awt.Paint paint)
Sets the paint used for a series (in the primary dataset).

Specified by:
setSeriesPaint in interface Renderer
Parameters:
series - the series.
paint - the paint.

setSeriesPaint

public void setSeriesPaint(int dataset,
                           int series,
                           java.awt.Paint paint)
Sets the paint used for a series.

Specified by:
setSeriesPaint in interface Renderer
Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
paint - the paint.

getDefaultPaint

public java.awt.Paint getDefaultPaint()
Returns the default paint.

Specified by:
getDefaultPaint in interface Renderer
Returns:
The default paint.

setDefaultPaint

public void setDefaultPaint(java.awt.Paint paint)
Sets the default paint.

In most cases, the renderer's paint table will be active and so this default value will not be used.

Specified by:
setDefaultPaint in interface Renderer
Parameters:
paint - the paint.

isOutlinePaintTableActive

public boolean isOutlinePaintTableActive()
Returns true if the outline paint table is being used, and false otherwise.

Specified by:
isOutlinePaintTableActive in interface Renderer
Returns:
The flag.

setOutlinePaintTableActive

public void setOutlinePaintTableActive(boolean active)
Sets the flag that controls whether the outline paint table is used or not. If it is not active, the default-outline-paint attribute will be used instead.

Specified by:
setOutlinePaintTableActive in interface Renderer
Parameters:
active - the flag.

getItemOutlinePaint

public java.awt.Paint getItemOutlinePaint(int dataset,
                                          int row,
                                          int column)
Returns the paint used to outline data items as they are drawn.

The default implementation passes control to the getSeriesOutlinePaint method. You can override this method if you require different behaviour.

Parameters:
dataset - the dataset index (zero-based).
row - the row (or series) index (zero-based).
column - the column (or category) index (zero-based).
Returns:
The paint.

getSeriesOutlinePaint

public java.awt.Paint getSeriesOutlinePaint(int dataset,
                                            int series)
Returns the color used to outline an item drawn by the renderer.

Parameters:
dataset - the dataset (zero-based index).
series - the series (zero-based index).
Returns:
The paint.

setSeriesOutlinePaint

public void setSeriesOutlinePaint(int series,
                                  java.awt.Paint paint)
Sets the paint used for a series outline (in the primary dataset).

Parameters:
series - the series.
paint - the paint.

setSeriesOutlinePaint

public void setSeriesOutlinePaint(int dataset,
                                  int series,
                                  java.awt.Paint paint)
Sets the paint used for a series outline.

Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
paint - the paint.

getDefaultOutlinePaint

public java.awt.Paint getDefaultOutlinePaint()
Returns the default outline paint.

Specified by:
getDefaultOutlinePaint in interface Renderer
Returns:
The default outline paint.

setDefaultOutlinePaint

public void setDefaultOutlinePaint(java.awt.Paint paint)
Sets the default outline paint.

Specified by:
setDefaultOutlinePaint in interface Renderer
Parameters:
paint - the paint.

isStrokeTableActive

public boolean isStrokeTableActive()
Returns true if the stroke table is being used, and false otherwise.

Specified by:
isStrokeTableActive in interface Renderer
Returns:
The flag.

setStrokeTableActive

public void setStrokeTableActive(boolean active)
Sets the flag that controls whether the stroke table is used or not. If it is not active, the default-stroke attribute will be used instead.

Specified by:
setStrokeTableActive in interface Renderer
Parameters:
active - the flag.

getItemStroke

public java.awt.Stroke getItemStroke(int dataset,
                                     int row,
                                     int column)
Returns the stroke used to draw data items.

The default implementation passes control to the getSeriesStroke method. You can override this method if you require different behaviour.

Parameters:
dataset - the dataset index (zero-based).
row - the row (or series) index (zero-based).
column - the column (or category) index (zero-based).
Returns:
The stroke.

getSeriesStroke

public java.awt.Stroke getSeriesStroke(int dataset,
                                       int series)
Returns the stroke used to draw the items in a series.

Parameters:
dataset - the dataset (zero-based index).
series - the series (zero-based index).
Returns:
The stroke.

setSeriesStroke

public void setSeriesStroke(int series,
                            java.awt.Stroke stroke)
Sets the stroke used for a series (in the primary dataset).

Specified by:
setSeriesStroke in interface Renderer
Parameters:
series - the series.
stroke - the stroke.

setSeriesStroke

public void setSeriesStroke(int dataset,
                            int series,
                            java.awt.Stroke stroke)
Sets the stroke used for a series.

Specified by:
setSeriesStroke in interface Renderer
Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
stroke - the stroke.

getDefaultStroke

public java.awt.Stroke getDefaultStroke()
Returns the default stroke.

Specified by:
getDefaultStroke in interface Renderer
Returns:
The default stroke.

setDefaultStroke

public void setDefaultStroke(java.awt.Stroke stroke)
Sets the default stroke.

Specified by:
setDefaultStroke in interface Renderer
Parameters:
stroke - the stroke.

isOutlineStrokeTableActive

public boolean isOutlineStrokeTableActive()
Returns true if the outline stroke table is being used, and false otherwise.

Specified by:
isOutlineStrokeTableActive in interface Renderer
Returns:
The flag.

setOutlineStrokeTableActive

public void setOutlineStrokeTableActive(boolean active)
Sets the flag that controls whether the outline stroke table is used or not. If it is not active, the default-outline-stroke attribute will be used instead.

Specified by:
setOutlineStrokeTableActive in interface Renderer
Parameters:
active - the flag.

getItemOutlineStroke

public java.awt.Stroke getItemOutlineStroke(int dataset,
                                            int row,
                                            int column)
Returns the stroke used to outline data items.

The default implementation passes control to the getSeriesOutlineStroke method. You can override this method if you require different behaviour.

Parameters:
dataset - the dataset index (zero-based).
row - the row (or series) index (zero-based).
column - the column (or category) index (zero-based).
Returns:
The stroke.

getSeriesOutlineStroke

public java.awt.Stroke getSeriesOutlineStroke(int dataset,
                                              int series)
Returns the stroke used to outline the items in a series.

Parameters:
dataset - the dataset (zero-based index).
series - the series (zero-based index).
Returns:
The stroke.

setSeriesOutlineStroke

public void setSeriesOutlineStroke(int series,
                                   java.awt.Stroke stroke)
Sets the outline stroke used for a series (in the primary dataset).

Parameters:
series - the series.
stroke - the stroke.

setSeriesOutlineStroke

public void setSeriesOutlineStroke(int dataset,
                                   int series,
                                   java.awt.Stroke stroke)
Sets the outline stroke used for a series.

Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
stroke - the stroke.

getDefaultOutlineStroke

public java.awt.Stroke getDefaultOutlineStroke()
Returns the default outline stroke.

Specified by:
getDefaultOutlineStroke in interface Renderer
Returns:
The default outline stroke.

setDefaultOutlineStroke

public void setDefaultOutlineStroke(java.awt.Stroke stroke)
Sets the default outline stroke.

Specified by:
setDefaultOutlineStroke in interface Renderer
Parameters:
stroke - the default outline stroke.

createTransformedShape

protected java.awt.Shape createTransformedShape(java.awt.Shape shape,
                                                double translateX,
                                                double translateY)
Creates and returns a translated version of a shape.

Parameters:
shape - the base shape.
translateX - the x translation.
translateY - the y translation.
Returns:
The shape.

isShapeTableActive

public boolean isShapeTableActive()
Returns true if the shape table is being used, and false otherwise.

Specified by:
isShapeTableActive in interface Renderer
Returns:
The flag.

setShapeTableActive

public void setShapeTableActive(boolean active)
Sets the flag that controls whether the shape table is used or not. If it is not active, the default-shape attribute will be used instead.

Specified by:
setShapeTableActive in interface Renderer
Parameters:
active - the flag.

getItemShape

public java.awt.Shape getItemShape(int dataset,
                                   int row,
                                   int column)
Returns a shape used to represent a data item.

The default implementation passes control to the getSeriesShape method. You can override this method if you require different behaviour.

Parameters:
dataset - the dataset index (zero-based).
row - the row (or series) index (zero-based).
column - the column (or category) index (zero-based).
Returns:
The shape.

getSeriesShape

public java.awt.Shape getSeriesShape(int dataset,
                                     int series)
Returns a shape used to represent the items in a series.

Parameters:
dataset - the dataset (zero-based index).
series - the series (zero-based index).
Returns:
The shape.

setSeriesShape

public void setSeriesShape(int series,
                           java.awt.Shape shape)
Sets the shape used for a series (in the primary dataset).

Parameters:
series - the series.
shape - the shape.

setSeriesShape

public void setSeriesShape(int dataset,
                           int series,
                           java.awt.Shape shape)
Sets the shape used for a series.

Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
shape - the shape.

getDefaultShape

public java.awt.Shape getDefaultShape()
Returns the default shape.

Specified by:
getDefaultShape in interface Renderer
Returns:
The default shape.

setDefaultShape

public void setDefaultShape(java.awt.Shape shape)
Sets the default shape.

Specified by:
setDefaultShape in interface Renderer
Parameters:
shape - the shape.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a property change listener to the renderer.

Parameters:
listener - the listener.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a property change listener from the renderer.

Parameters:
listener - the listener.

firePropertyChanged

protected void firePropertyChanged(java.lang.String propertyName,
                                   java.lang.Object oldValue,
                                   java.lang.Object newValue)
Notifies registered listeners that a property of the renderer has changed.

Parameters:
propertyName - the name of the property.
oldValue - the old value.
newValue - the new value.

equals

public boolean equals(java.lang.Object obj)
Tests this renderer for equality with another object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object.
Returns:
true or false.