Package org.jfree.chart.labels
Class AbstractCategoryItemLabelGenerator
java.lang.Object
org.jfree.chart.labels.AbstractCategoryItemLabelGenerator
- All Implemented Interfaces:
Serializable
,Cloneable
,PublicCloneable
- Direct Known Subclasses:
StandardCategoryItemLabelGenerator
,StandardCategoryToolTipGenerator
public abstract class AbstractCategoryItemLabelGenerator
extends Object
implements PublicCloneable, Cloneable, Serializable
A base class that can be used to create a label or tooltip generator that
can be assigned to a
CategoryItemRenderer
.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DateFormat
A date formatter used to preformat the value before it is passed to the MessageFormat object.private final String
The label format string used by aMessageFormat
object to combine the standard items: {0} = series name, {1} = category, {2} = value, {3} = value as a percentage of the column total.private final String
The string used to represent a null value.private NumberFormat
A number formatter used to preformat the value before it is passed to the MessageFormat object.private final NumberFormat
A number formatter used to preformat the percentage value before it is passed to the MessageFormat object.private static final long
For serialization. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractCategoryItemLabelGenerator
(String labelFormat, DateFormat formatter) Creates a label generator with the specified date formatter.protected
AbstractCategoryItemLabelGenerator
(String labelFormat, NumberFormat formatter) Creates a label generator with the specified number formatter.protected
AbstractCategoryItemLabelGenerator
(String labelFormat, NumberFormat formatter, NumberFormat percentFormatter) Creates a label generator with the specified number formatter. -
Method Summary
Modifier and TypeMethodDescriptionboolean
clone()
Returns an independent copy of the generator.protected Object[]
createItemArray
(CategoryDataset dataset, int row, int column) Creates the array of items that can be passed to theMessageFormat
class for creating labels.boolean
Tests this object for equality with an arbitrary object.generateColumnLabel
(CategoryDataset dataset, int column) Generates a label for the specified row.protected String
generateLabelString
(CategoryDataset dataset, int row, int column) Generates a for the specified item.generateRowLabel
(CategoryDataset dataset, int row) Generates a label for the specified row.Returns the date formatter.Returns the label format string.Returns the number formatter.int
hashCode()
Returns a hash code for this instance.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization.- See Also:
-
labelFormat
The label format string used by aMessageFormat
object to combine the standard items: {0} = series name, {1} = category, {2} = value, {3} = value as a percentage of the column total. -
nullValueString
The string used to represent a null value. -
numberFormat
A number formatter used to preformat the value before it is passed to the MessageFormat object. -
dateFormat
A date formatter used to preformat the value before it is passed to the MessageFormat object. -
percentFormat
A number formatter used to preformat the percentage value before it is passed to the MessageFormat object.
-
-
Constructor Details
-
AbstractCategoryItemLabelGenerator
Creates a label generator with the specified number formatter.- Parameters:
labelFormat
- the label format string (null
not permitted).formatter
- the number formatter (null
not permitted).
-
AbstractCategoryItemLabelGenerator
protected AbstractCategoryItemLabelGenerator(String labelFormat, NumberFormat formatter, NumberFormat percentFormatter) Creates a label generator with the specified number formatter.- Parameters:
labelFormat
- the label format string (null
not permitted).formatter
- the number formatter (null
not permitted).percentFormatter
- the percent formatter (null
not permitted).
-
AbstractCategoryItemLabelGenerator
Creates a label generator with the specified date formatter.- Parameters:
labelFormat
- the label format string (null
not permitted).formatter
- the date formatter (null
not permitted).
-
-
Method Details
-
generateRowLabel
Generates a label for the specified row.- Parameters:
dataset
- the dataset (null
not permitted).row
- the row index (zero-based).- Returns:
- The label.
-
generateColumnLabel
Generates a label for the specified row.- Parameters:
dataset
- the dataset (null
not permitted).column
- the column index (zero-based).- Returns:
- The label.
-
getLabelFormat
Returns the label format string.- Returns:
- The label format string (never
null
).
-
getNumberFormat
Returns the number formatter.- Returns:
- The number formatter (possibly
null
).
-
getDateFormat
Returns the date formatter.- Returns:
- The date formatter (possibly
null
).
-
generateLabelString
Generates a for the specified item.- Parameters:
dataset
- the dataset (null
not permitted).row
- the row index (zero-based).column
- the column index (zero-based).- Returns:
- The label (possibly
null
).
-
createItemArray
Creates the array of items that can be passed to theMessageFormat
class for creating labels.- Parameters:
dataset
- the dataset (null
not permitted).row
- the row index (zero-based).column
- the column index (zero-based).- Returns:
- The items (never
null
).
-
equals
Tests this object for equality with an arbitrary object. -
canEqual
-
hashCode
public int hashCode()Returns a hash code for this instance. -
clone
Returns an independent copy of the generator.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classObject
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- should not happen.
-