Package org.jfree.chart
Class LegendItem
java.lang.Object
org.jfree.chart.LegendItem
- All Implemented Interfaces:
Serializable,Cloneable
A temporary storage object for recording the properties of a legend item,
without any consideration for layout issues.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLegendItem(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, 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(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(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.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. -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns an independent copy of this object (except that the clone will still reference the same dataset as the originalLegendItem).booleanTests this item for equality with an arbitrary object.Returns the attributed label.Returns the dataset.intReturns the dataset index for this legend item.Returns the description for the legend item.Returns the fill paint.Returns the transformer used when the fill paint is an instance ofGradientPaint.getLabel()Returns the label.Returns the label font.Returns the paint used to draw the label.getLine()Returns the line.Returns the paint used for lines.Returns the line stroke for the series.Returns the outline paint.Returns the outline stroke.intReturns the series index for this legend item.Returns the series key.getShape()Returns the shape used to label the series represented by this legend item.Returns the tool tip text.Returns the URL text.inthashCode()booleanReturns a flag that indicates whether or not the line is visible.booleanReturns a flag that controls whether or not the shape is filled.booleanReturns the flag that controls whether or not the shape outline is visible.booleanReturns 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.voidsetDescription(String text) Sets the description 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 ofGradientPaint.voidsetLabelFont(Font font) Sets the label font.voidsetLabelPaint(Paint paint) Sets the paint used to draw the label.voidSets the line.voidsetLinePaint(Paint paint) Sets the line paint.voidsetLineStroke(Stroke stroke) Sets the line stroke.voidsetLineVisible(boolean visible) Sets the flag that controls whether or not the line shape is visible for this legend item.voidsetOutlinePaint(Paint paint) Sets the outline paint.voidsetOutlineStroke(Stroke stroke) Sets the outline stroke.voidsetSeriesIndex(int index) Sets the series index for this legend item.voidsetSeriesKey(Comparable key) Sets the series key.voidSets the shape for the legend item.voidsetShapeVisible(boolean visible) Sets the flag that controls whether or not the shape is visible.voidsetToolTipText(String text) Sets the tool tip text for this legend item.voidsetURLText(String text) Sets the URL text.
-
Constructor Details
-
LegendItem
Creates a legend item with the specified label. The remaining attributes take default values.- Parameters:
label- the label (nullnot permitted).
-
LegendItem
Creates a legend item with the specified label and fill paint. The remaining attributes take default values.- Parameters:
label- the label (nullnot permitted).paint- the paint (nullnot permitted).
-
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 (nullnot permitted).description- the description (nullpermitted).toolTipText- the tool tip text (nullpermitted).urlText- the URL text (nullpermitted).shape- the shape (nullnot permitted).fillPaint- the paint used to fill the shape (nullnot 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 (nullnot permitted).description- the description (nullpermitted).toolTipText- the tool tip text (nullpermitted).urlText- the URL text (nullpermitted).shape- the shape (nullnot permitted).fillPaint- the paint used to fill the shape (nullnot permitted).outlineStroke- the outline stroke (nullnot permitted).outlinePaint- the outline paint (nullnot 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 (nullnot permitted).description- the description (nullpermitted).toolTipText- the tool tip text (nullpermitted).urlText- the URL text (nullpermitted).line- the line (nullnot permitted).lineStroke- the line stroke (nullnot permitted).linePaint- the line paint (nullnot 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 (nullnot permitted).description- the description (not currently used,nullpermitted).toolTipText- the tool tip text (nullpermitted).urlText- the URL text (nullpermitted).shapeVisible- a flag that controls whether or not the shape is displayed.shape- the shape (nullpermitted).shapeFilled- a flag that controls whether or not the shape is filled.fillPaint- the fill paint (nullnot permitted).shapeOutlineVisible- a flag that controls whether or not the shape is outlined.outlinePaint- the outline paint (nullnot permitted).outlineStroke- the outline stroke (nullnot permitted).lineVisible- a flag that controls whether or not the line is visible.line- the line.lineStroke- the stroke (nullnot permitted).linePaint- the line paint (nullnot 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 (nullnot permitted).description- the description (nullpermitted).toolTipText- the tool tip text (nullpermitted).urlText- the URL text (nullpermitted).shape- the shape (nullnot permitted).fillPaint- the paint used to fill the shape (nullnot 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 (nullnot permitted).description- the description (nullpermitted).toolTipText- the tool tip text (nullpermitted).urlText- the URL text (nullpermitted).shape- the shape (nullnot permitted).fillPaint- the paint used to fill the shape (nullnot permitted).outlineStroke- the outline stroke (nullnot permitted).outlinePaint- the outline paint (nullnot 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 (nullnot permitted).description- the description (nullpermitted).toolTipText- the tool tip text (nullpermitted).urlText- the URL text (nullpermitted).line- the line (nullnot permitted).lineStroke- the line stroke (nullnot permitted).linePaint- the line paint (nullnot 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 (nullnot permitted).description- the description (not currently used,nullpermitted).toolTipText- the tool tip text (nullpermitted).urlText- the URL text (nullpermitted).shapeVisible- a flag that controls whether or not the shape is displayed.shape- the shape (nullpermitted).shapeFilled- a flag that controls whether or not the shape is filled.fillPaint- the fill paint (nullnot permitted).shapeOutlineVisible- a flag that controls whether or not the shape is outlined.outlinePaint- the outline paint (nullnot permitted).outlineStroke- the outline stroke (nullnot permitted).lineVisible- a flag that controls whether or not the line is visible.line- the line (nullnot permitted).lineStroke- the stroke (nullnot permitted).linePaint- the line paint (nullnot permitted).
-
-
Method Details
-
getDataset
Returns the dataset.- Returns:
- The dataset.
- See Also:
-
setDataset
Sets the dataset.- Parameters:
dataset- the dataset.
-
getDatasetIndex
Returns the dataset index for this legend item.- Returns:
- The dataset index.
- See Also:
-
setDatasetIndex
Sets the dataset index for this legend item.- Parameters:
index- the index.- See Also:
-
getSeriesKey
Returns the series key.- Returns:
- The series key.
- See Also:
-
setSeriesKey
Sets the series key.- Parameters:
key- the series key.
-
getSeriesIndex
Returns the series index for this legend item.- Returns:
- The series index.
-
setSeriesIndex
Sets the series index for this legend item.- Parameters:
index- the index.
-
getLabel
Returns the label.- Returns:
- The label (never
null).
-
getLabelFont
Returns the label font.- Returns:
- The label font (possibly
null).
-
setLabelFont
Sets the label font.- Parameters:
font- the font (nullpermitted).
-
getLabelPaint
Returns the paint used to draw the label.- Returns:
- The paint (possibly
null).
-
setLabelPaint
Sets the paint used to draw the label.- Parameters:
paint- the paint (nullpermitted).
-
getAttributedLabel
Returns the attributed label.- Returns:
- The attributed label (possibly
null).
-
getDescription
Returns the description for the legend item.- Returns:
- The description (possibly
null). - See Also:
-
setDescription
Sets the description for this legend item.- Parameters:
text- the description (nullpermitted).- See Also:
-
getToolTipText
Returns the tool tip text.- Returns:
- The tool tip text (possibly
null). - See Also:
-
setToolTipText
Sets the tool tip text for this legend item.- Parameters:
text- the text (nullpermitted).- See Also:
-
getURLText
Returns the URL text.- Returns:
- The URL text (possibly
null). - See Also:
-
setURLText
Sets the URL text.- Parameters:
text- the text (nullpermitted).- See Also:
-
isShapeVisible
Returns a flag that indicates whether or not the shape is visible.- Returns:
- A boolean.
- See Also:
-
setShapeVisible
Sets the flag that controls whether or not the shape is visible.- Parameters:
visible- the new flag value.- See Also:
-
getShape
Returns the shape used to label the series represented by this legend item.- Returns:
- The shape (never
null). - See Also:
-
setShape
Sets the shape for the legend item.- Parameters:
shape- the shape (nullnot permitted).- See Also:
-
isShapeFilled
Returns a flag that controls whether or not the shape is filled.- Returns:
- A boolean.
-
getFillPaint
Returns the fill paint.- Returns:
- The fill paint (never
null).
-
setFillPaint
Sets the fill paint.- Parameters:
paint- the paint (nullnot permitted).
-
isShapeOutlineVisible
Returns the flag that controls whether or not the shape outline is visible.- Returns:
- A boolean.
-
getLineStroke
Returns the line stroke for the series.- Returns:
- The stroke (never
null).
-
setLineStroke
Sets the line stroke.- Parameters:
stroke- the stroke (nullnot permitted).
-
getLinePaint
Returns the paint used for lines.- Returns:
- The paint (never
null).
-
setLinePaint
Sets the line paint.- Parameters:
paint- the paint (nullnot permitted).
-
getOutlinePaint
Returns the outline paint.- Returns:
- The outline paint (never
null).
-
setOutlinePaint
Sets the outline paint.- Parameters:
paint- the paint (nullnot permitted).
-
getOutlineStroke
Returns the outline stroke.- Returns:
- The outline stroke (never
null). - See Also:
-
setOutlineStroke
Sets the outline stroke.- Parameters:
stroke- the stroke (nullnot permitted).- See Also:
-
isLineVisible
Returns a flag that indicates whether or not the line is visible.- Returns:
- A boolean.
- See Also:
-
setLineVisible
Sets the flag that controls whether or not the line shape is visible for this legend item.- Parameters:
visible- the new flag value.- See Also:
-
getLine
Returns the line.- Returns:
- The line (never
null). - See Also:
-
setLine
Sets the line.- Parameters:
line- the line (nullnot permitted).- See Also:
-
getFillPaintTransformer
Returns the transformer used when the fill paint is an instance ofGradientPaint.- Returns:
- The transformer (never
null). - See Also:
-
setFillPaintTransformer
Sets the transformer used when the fill paint is an instance ofGradientPaint.- Parameters:
transformer- the transformer (nullnot permitted).- See Also:
-
equals
Tests this item for equality with an arbitrary object. -
hashCode
-
clone
Returns an independent copy of this object (except that the clone will still reference the same dataset as the originalLegendItem).- Overrides:
clonein classObject- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if the legend item cannot be cloned.
-