org.jfree.chart

Class LegendItem

public class LegendItem extends Object implements Cloneable, Serializable

A temporary storage object for recording the properties of a legend item, without any consideration for layout issues.
Constructor Summary
LegendItem(String label)
Creates a legend item with the specified label.
LegendItem(String label, Paint paint)
Creates a legend item with the specified label and fill paint.
LegendItem(String label, String description, String toolTipText, String urlText, Shape shape, Paint fillPaint)
Creates a legend item with a filled shape.
LegendItem(String label, String description, String toolTipText, String urlText, Shape shape, Paint fillPaint, Stroke outlineStroke, Paint outlinePaint)
Creates a legend item with a filled and outlined shape.
LegendItem(String label, String description, String toolTipText, String urlText, Shape line, Stroke lineStroke, Paint linePaint)
Creates a legend item using a line.
LegendItem(String label, String description, String toolTipText, String urlText, boolean shapeVisible, Shape shape, boolean shapeFilled, Paint fillPaint, boolean shapeOutlineVisible, Paint outlinePaint, Stroke outlineStroke, boolean lineVisible, Shape line, Stroke lineStroke, Paint linePaint)
Creates a new legend item.
LegendItem(AttributedString label, String description, String toolTipText, String urlText, Shape shape, Paint fillPaint)
Creates a legend item with a filled shape.
LegendItem(AttributedString label, String description, String toolTipText, String urlText, Shape shape, Paint fillPaint, Stroke outlineStroke, Paint outlinePaint)
Creates a legend item with a filled and outlined shape.
LegendItem(AttributedString label, String description, String toolTipText, String urlText, Shape line, Stroke lineStroke, Paint linePaint)
Creates a legend item using a line.
LegendItem(AttributedString label, String description, String toolTipText, String urlText, boolean shapeVisible, Shape shape, boolean shapeFilled, Paint fillPaint, boolean shapeOutlineVisible, Paint outlinePaint, Stroke outlineStroke, boolean lineVisible, Shape line, Stroke lineStroke, Paint linePaint)
Creates a new legend item.
Method Summary
Objectclone()
Returns an independent copy of this object (except that the clone will still reference the same dataset as the original LegendItem).
booleanequals(Object obj)
Tests this item for equality with an arbitrary object.
AttributedStringgetAttributedLabel()
Returns the attributed label.
DatasetgetDataset()
Returns the dataset.
intgetDatasetIndex()
Returns the dataset index for this legend item.
StringgetDescription()
Returns the description for the legend item.
PaintgetFillPaint()
Returns the fill paint.
GradientPaintTransformergetFillPaintTransformer()
Returns the transformer used when the fill paint is an instance of GradientPaint.
StringgetLabel()
Returns the label.
FontgetLabelFont()
Returns the label font.
PaintgetLabelPaint()
Returns the paint used to draw the label.
ShapegetLine()
Returns the line.
PaintgetLinePaint()
Returns the paint used for lines.
StrokegetLineStroke()
Returns the line stroke for the series.
PaintgetOutlinePaint()
Returns the outline paint.
StrokegetOutlineStroke()
Returns the outline stroke.
intgetSeriesIndex()
Returns the series index for this legend item.
ComparablegetSeriesKey()
Returns the series key.
ShapegetShape()
Returns the shape used to label the series represented by this legend item.
StringgetToolTipText()
Returns the tool tip text.
StringgetURLText()
Returns the URL text.
booleanisLineVisible()
Returns a flag that indicates whether or not the line is visible.
booleanisShapeFilled()
Returns a flag that controls whether or not the shape is filled.
booleanisShapeOutlineVisible()
Returns the flag that controls whether or not the shape outline is visible.
booleanisShapeVisible()
Returns a flag that indicates whether or not the shape is visible.
voidsetDataset(Dataset dataset)
Sets the dataset.
voidsetDatasetIndex(int index)
Sets the dataset index for this legend item.
voidsetFillPaint(Paint paint)
Sets the fill paint.
voidsetFillPaintTransformer(GradientPaintTransformer transformer)
Sets the transformer used when the fill paint is an instance of GradientPaint.
voidsetLabelFont(Font font)
Sets the label font.
voidsetLabelPaint(Paint paint)
Sets the paint used to draw the label.
voidsetLinePaint(Paint paint)
Sets the line paint.
voidsetOutlinePaint(Paint paint)
Sets the outline paint.
voidsetSeriesIndex(int index)
Sets the series index for this legend item.
voidsetSeriesKey(Comparable key)
Sets the series key.

Constructor Detail

LegendItem

public LegendItem(String label)
Creates a legend item with the specified label. The remaining attributes take default values.

Parameters: label the label (null not permitted).

Since: 1.0.10

LegendItem

public LegendItem(String label, Paint paint)
Creates a legend item with the specified label and fill paint. The remaining attributes take default values.

Parameters: label the label (null not permitted). paint the paint (null not permitted).

Since: 1.0.12

LegendItem

public LegendItem(String label, String description, String toolTipText, String urlText, Shape shape, Paint fillPaint)
Creates a legend item with a filled shape. The shape is not outlined, and no line is visible.

Parameters: label the label (null not permitted). description the description (null permitted). toolTipText the tool tip text (null permitted). urlText the URL text (null permitted). shape the shape (null not permitted). fillPaint the paint used to fill the shape (null not permitted).

LegendItem

public LegendItem(String label, String description, String toolTipText, String urlText, Shape shape, Paint fillPaint, Stroke outlineStroke, Paint outlinePaint)
Creates a legend item with a filled and outlined shape.

Parameters: label the label (null not permitted). description the description (null permitted). toolTipText the tool tip text (null permitted). urlText the URL text (null permitted). shape the shape (null not permitted). fillPaint the paint used to fill the shape (null not permitted). outlineStroke the outline stroke (null not permitted). outlinePaint the outline paint (null not permitted).

LegendItem

public LegendItem(String label, String description, String toolTipText, String urlText, Shape line, Stroke lineStroke, Paint linePaint)
Creates a legend item using a line.

Parameters: label the label (null not permitted). description the description (null permitted). toolTipText the tool tip text (null permitted). urlText the URL text (null permitted). line the line (null not permitted). lineStroke the line stroke (null not permitted). linePaint the line paint (null not permitted).

LegendItem

public LegendItem(String label, String description, String toolTipText, String urlText, boolean shapeVisible, Shape shape, boolean shapeFilled, Paint fillPaint, boolean shapeOutlineVisible, Paint outlinePaint, Stroke outlineStroke, boolean lineVisible, Shape line, Stroke lineStroke, Paint linePaint)
Creates a new legend item.

Parameters: label the label (null not permitted). description the description (not currently used, null permitted). toolTipText the tool tip text (null permitted). urlText the URL text (null permitted). shapeVisible a flag that controls whether or not the shape is displayed. shape the shape (null permitted). shapeFilled a flag that controls whether or not the shape is filled. fillPaint the fill paint (null not permitted). shapeOutlineVisible a flag that controls whether or not the shape is outlined. outlinePaint the outline paint (null not permitted). outlineStroke the outline stroke (null not permitted). lineVisible a flag that controls whether or not the line is visible. line the line. lineStroke the stroke (null not permitted). linePaint the line paint (null not permitted).

LegendItem

public LegendItem(AttributedString label, String description, String toolTipText, String urlText, Shape shape, Paint fillPaint)
Creates a legend item with a filled shape. The shape is not outlined, and no line is visible.

Parameters: label the label (null not permitted). description the description (null permitted). toolTipText the tool tip text (null permitted). urlText the URL text (null permitted). shape the shape (null not permitted). fillPaint the paint used to fill the shape (null not permitted).

LegendItem

public LegendItem(AttributedString label, String description, String toolTipText, String urlText, Shape shape, Paint fillPaint, Stroke outlineStroke, Paint outlinePaint)
Creates a legend item with a filled and outlined shape.

Parameters: label the label (null not permitted). description the description (null permitted). toolTipText the tool tip text (null permitted). urlText the URL text (null permitted). shape the shape (null not permitted). fillPaint the paint used to fill the shape (null not permitted). outlineStroke the outline stroke (null not permitted). outlinePaint the outline paint (null not permitted).

LegendItem

public LegendItem(AttributedString label, String description, String toolTipText, String urlText, Shape line, Stroke lineStroke, Paint linePaint)
Creates a legend item using a line.

Parameters: label the label (null not permitted). description the description (null permitted). toolTipText the tool tip text (null permitted). urlText the URL text (null permitted). line the line (null not permitted). lineStroke the line stroke (null not permitted). linePaint the line paint (null not permitted).

LegendItem

public LegendItem(AttributedString label, String description, String toolTipText, String urlText, boolean shapeVisible, Shape shape, boolean shapeFilled, Paint fillPaint, boolean shapeOutlineVisible, Paint outlinePaint, Stroke outlineStroke, boolean lineVisible, Shape line, Stroke lineStroke, Paint linePaint)
Creates a new legend item.

Parameters: label the label (null not permitted). description the description (not currently used, null permitted). toolTipText the tool tip text (null permitted). urlText the URL text (null permitted). shapeVisible a flag that controls whether or not the shape is displayed. shape the shape (null permitted). shapeFilled a flag that controls whether or not the shape is filled. fillPaint the fill paint (null not permitted). shapeOutlineVisible a flag that controls whether or not the shape is outlined. outlinePaint the outline paint (null not permitted). outlineStroke the outline stroke (null not permitted). lineVisible a flag that controls whether or not the line is visible. line the line (null not permitted). lineStroke the stroke (null not permitted). linePaint the line paint (null not permitted).

Method Detail

clone

public Object clone()
Returns an independent copy of this object (except that the clone will still reference the same dataset as the original LegendItem).

Returns: A clone.

Throws: CloneNotSupportedException if the legend item cannot be cloned.

Since: 1.0.10

equals

public boolean equals(Object obj)
Tests this item for equality with an arbitrary object.

Parameters: obj the object (null permitted).

Returns: A boolean.

getAttributedLabel

public AttributedString getAttributedLabel()
Returns the attributed label.

Returns: The attributed label (possibly null).

getDataset

public Dataset getDataset()
Returns the dataset.

Returns: The dataset.

Since: 1.0.6

See Also: LegendItem

getDatasetIndex

public int getDatasetIndex()
Returns the dataset index for this legend item.

Returns: The dataset index.

Since: 1.0.2

See Also: LegendItem getDataset

getDescription

public String getDescription()
Returns the description for the legend item.

Returns: The description.

getFillPaint

public Paint getFillPaint()
Returns the fill paint.

Returns: The fill paint (never null).

getFillPaintTransformer

public GradientPaintTransformer getFillPaintTransformer()
Returns the transformer used when the fill paint is an instance of GradientPaint.

Returns: The transformer (never null).

Since: 1.0.4

See Also: setFillPaintTransformer

getLabel

public String getLabel()
Returns the label.

Returns: The label (never null).

getLabelFont

public Font getLabelFont()
Returns the label font.

Returns: The label font (possibly null).

Since: 1.0.11

getLabelPaint

public Paint getLabelPaint()
Returns the paint used to draw the label.

Returns: The paint (possibly null).

Since: 1.0.11

getLine

public Shape getLine()
Returns the line.

Returns: The line (never null).

getLinePaint

public Paint getLinePaint()
Returns the paint used for lines.

Returns: The paint (never null).

getLineStroke

public Stroke getLineStroke()
Returns the line stroke for the series.

Returns: The stroke (never null).

getOutlinePaint

public Paint getOutlinePaint()
Returns the outline paint.

Returns: The outline paint (never null).

getOutlineStroke

public Stroke getOutlineStroke()
Returns the outline stroke.

Returns: The outline stroke (never null).

getSeriesIndex

public int getSeriesIndex()
Returns the series index for this legend item.

Returns: The series index.

Since: 1.0.2

getSeriesKey

public Comparable getSeriesKey()
Returns the series key.

Returns: The series key.

Since: 1.0.6

See Also: setSeriesKey

getShape

public Shape getShape()
Returns the shape used to label the series represented by this legend item.

Returns: The shape (never null).

getToolTipText

public String getToolTipText()
Returns the tool tip text.

Returns: The tool tip text (possibly null).

getURLText

public String getURLText()
Returns the URL text.

Returns: The URL text (possibly null).

isLineVisible

public boolean isLineVisible()
Returns a flag that indicates whether or not the line is visible.

Returns: A boolean.

isShapeFilled

public boolean isShapeFilled()
Returns a flag that controls whether or not the shape is filled.

Returns: A boolean.

isShapeOutlineVisible

public boolean isShapeOutlineVisible()
Returns the flag that controls whether or not the shape outline is visible.

Returns: A boolean.

isShapeVisible

public boolean isShapeVisible()
Returns a flag that indicates whether or not the shape is visible.

Returns: A boolean.

setDataset

public void setDataset(Dataset dataset)
Sets the dataset.

Parameters: dataset the dataset.

Since: 1.0.6

setDatasetIndex

public void setDatasetIndex(int index)
Sets the dataset index for this legend item.

Parameters: index the index.

Since: 1.0.2

See Also: getDatasetIndex

setFillPaint

public void setFillPaint(Paint paint)
Sets the fill paint.

Parameters: paint the paint (null not permitted).

Since: 1.0.11

setFillPaintTransformer

public void setFillPaintTransformer(GradientPaintTransformer transformer)
Sets the transformer used when the fill paint is an instance of GradientPaint.

Parameters: transformer the transformer (null not permitted).

Since: 1.0.4

See Also: getFillPaintTransformer

setLabelFont

public void setLabelFont(Font font)
Sets the label font.

Parameters: font the font (null permitted).

Since: 1.0.11

setLabelPaint

public void setLabelPaint(Paint paint)
Sets the paint used to draw the label.

Parameters: paint the paint (null permitted).

Since: 1.0.11

setLinePaint

public void setLinePaint(Paint paint)
Sets the line paint.

Parameters: paint the paint (null not permitted).

Since: 1.0.11

setOutlinePaint

public void setOutlinePaint(Paint paint)
Sets the outline paint.

Parameters: paint the paint (null not permitted).

Since: 1.0.11

setSeriesIndex

public void setSeriesIndex(int index)
Sets the series index for this legend item.

Parameters: index the index.

Since: 1.0.2

setSeriesKey

public void setSeriesKey(Comparable key)
Sets the series key.

Parameters: key the series key.

Since: 1.0.6

Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.