public class

AbstractPieItemLabelGenerator

extends Object
implements Serializable
java.lang.Object
   ↳ org.jfree.chart.labels.AbstractPieItemLabelGenerator
Known Direct Subclasses

Class Overview

A base class used for generating pie chart item labels.

Summary

Protected Constructors
AbstractPieItemLabelGenerator(String labelFormat, NumberFormat numberFormat, NumberFormat percentFormat)
Creates an item label generator using the specified number formatters.
Public Methods
Object clone()
Returns an independent copy of the generator.
boolean equals(Object obj)
Tests the generator for equality with an arbitrary object.
String getLabelFormat()
Returns the label format string.
NumberFormat getNumberFormat()
Returns the number formatter.
NumberFormat getPercentFormat()
Returns the percent formatter.
int hashCode()
Returns a hash code for this instance.
Protected Methods
Object[] createItemArray(PieDataset dataset, Comparable key)
Creates the array of items that can be passed to the MessageFormat class for creating labels.
String generateSectionLabel(PieDataset dataset, Comparable key)
Generates a label for a pie section.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected AbstractPieItemLabelGenerator (String labelFormat, NumberFormat numberFormat, NumberFormat percentFormat)

Creates an item label generator using the specified number formatters.

Parameters
labelFormat the label format string (null not permitted).
numberFormat the format object for the values (null not permitted).
percentFormat the format object for the percentages (null not permitted).

Public Methods

public Object clone ()

Returns an independent copy of the generator.

Returns
  • A clone.
Throws
CloneNotSupportedException should not happen.

public boolean equals (Object obj)

Tests the generator for equality with an arbitrary object.

Parameters
obj the object to test against (null permitted).
Returns
  • A boolean.

public String getLabelFormat ()

Returns the label format string.

Returns
  • The label format string (never null).

public NumberFormat getNumberFormat ()

Returns the number formatter.

Returns
  • The formatter (never null).

public NumberFormat getPercentFormat ()

Returns the percent formatter.

Returns
  • The formatter (never null).

public int hashCode ()

Returns a hash code for this instance.

Returns
  • A hash code.

Protected Methods

protected Object[] createItemArray (PieDataset dataset, Comparable key)

Creates the array of items that can be passed to the MessageFormat class for creating labels. The returned array contains four values:

  • result[0] = the section key converted to a String;
  • result[1] = the formatted data value;
  • result[2] = the formatted percentage (of the total);
  • result[3] = the formatted total value.

Parameters
dataset the dataset (null not permitted).
key the key (null not permitted).
Returns
  • The items (never null).

protected String generateSectionLabel (PieDataset dataset, Comparable key)

Generates a label for a pie section.

Parameters
dataset the dataset (null not permitted).
key the section key (null not permitted).
Returns
  • The label (possibly null).