- 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 aCategoryItemRenderer.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractCategoryItemLabelGenerator(String labelFormat, DateFormat formatter)Creates a label generator with the specified date formatter.protectedAbstractCategoryItemLabelGenerator(String labelFormat, NumberFormat formatter)Creates a label generator with the specified number formatter.protectedAbstractCategoryItemLabelGenerator(String labelFormat, NumberFormat formatter, NumberFormat percentFormatter)Creates a label generator with the specified number formatter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()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 theMessageFormatclass for creating labels.booleanequals(Object obj)Tests this object for equality with an arbitrary object.StringgenerateColumnLabel(CategoryDataset dataset, int column)Generates a label for the specified row.protected StringgenerateLabelString(CategoryDataset dataset, int row, int column)Generates a for the specified item.StringgenerateRowLabel(CategoryDataset dataset, int row)Generates a label for the specified row.DateFormatgetDateFormat()Returns the date formatter.StringgetLabelFormat()Returns the label format string.NumberFormatgetNumberFormat()Returns the number formatter.inthashCode()Returns a hash code for this instance.
-
-
-
Constructor Detail
-
AbstractCategoryItemLabelGenerator
protected AbstractCategoryItemLabelGenerator(String labelFormat, NumberFormat formatter)
Creates a label generator with the specified number formatter.- Parameters:
labelFormat- the label format string (nullnot permitted).formatter- the number formatter (nullnot 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 (nullnot permitted).formatter- the number formatter (nullnot permitted).percentFormatter- the percent formatter (nullnot permitted).
-
AbstractCategoryItemLabelGenerator
protected AbstractCategoryItemLabelGenerator(String labelFormat, DateFormat formatter)
Creates a label generator with the specified date formatter.- Parameters:
labelFormat- the label format string (nullnot permitted).formatter- the date formatter (nullnot permitted).
-
-
Method Detail
-
generateRowLabel
public String generateRowLabel(CategoryDataset dataset, int row)
Generates a label for the specified row.- Parameters:
dataset- the dataset (nullnot permitted).row- the row index (zero-based).- Returns:
- The label.
-
generateColumnLabel
public String generateColumnLabel(CategoryDataset dataset, int column)
Generates a label for the specified row.- Parameters:
dataset- the dataset (nullnot permitted).column- the column index (zero-based).- Returns:
- The label.
-
getLabelFormat
public String getLabelFormat()
Returns the label format string.- Returns:
- The label format string (never
null).
-
getNumberFormat
public NumberFormat getNumberFormat()
Returns the number formatter.- Returns:
- The number formatter (possibly
null).
-
getDateFormat
public DateFormat getDateFormat()
Returns the date formatter.- Returns:
- The date formatter (possibly
null).
-
generateLabelString
protected String generateLabelString(CategoryDataset dataset, int row, int column)
Generates a for the specified item.- Parameters:
dataset- the dataset (nullnot permitted).row- the row index (zero-based).column- the column index (zero-based).- Returns:
- The label (possibly
null).
-
createItemArray
protected Object[] createItemArray(CategoryDataset dataset, int row, int column)
Creates the array of items that can be passed to theMessageFormatclass for creating labels.- Parameters:
dataset- the dataset (nullnot permitted).row- the row index (zero-based).column- the column index (zero-based).- Returns:
- The items (never
null).
-
hashCode
public int hashCode()
Returns a hash code for this instance.
-
clone
public Object clone() throws CloneNotSupportedException
Returns an independent copy of the generator.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classObject- Returns:
- A clone.
- Throws:
CloneNotSupportedException- should not happen.
-
-