org.ujac.chart
Class DescriptionPattern

java.lang.Object
  extended by org.ujac.chart.DescriptionPattern

public class DescriptionPattern
extends Object

Name: DescriptionPattern
Description: Class for more flexible item descriptions. A class processing patterns for chart item descriptions. Valid pattern symbols are: %s: The segment label for the item to process. %a: The area label for the item to process. %p: The relative value in percent. %v: The absolute value of the item to process. %%: The percent sign

Author:
lauerc

Constructor Summary
DescriptionPattern(String pattern, NumberFormat valueNumberFormat, NumberFormat percentNumberFormat)
          Constructs a new DescriptionPattern instance with specific attributes.
 
Method Summary
 String apply(double value, double percent, String segmentLabel, String areaLabel)
          Applies the given values to the pattern.
 String getAreaLabel()
          Gets the current area label
 String getPercent()
          Gets the current percentage.
 String getSegmentLabel()
          Gets the current segment label
 String getValue()
          Gets the current value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DescriptionPattern

public DescriptionPattern(String pattern,
                          NumberFormat valueNumberFormat,
                          NumberFormat percentNumberFormat)
                   throws ChartException
Constructs a new DescriptionPattern instance with specific attributes.

Parameters:
pattern - The pattern string.
valueNumberFormat - The format for value output.
percentNumberFormat - The format for percent output.
Throws:
ChartException - in case the parsing of the pattern failed.
Method Detail

apply

public String apply(double value,
                    double percent,
                    String segmentLabel,
                    String areaLabel)
Applies the given values to the pattern.

Parameters:
value - The current value.
percent - The current percentage.
segmentLabel - The item's segment label.
areaLabel - The item's area label.
Returns:
The formatted string.

getSegmentLabel

public String getSegmentLabel()
Gets the current segment label

Returns:
The current segment label.

getAreaLabel

public String getAreaLabel()
Gets the current area label

Returns:
The current area label.

getValue

public String getValue()
Gets the current value.

Returns:
The current item value.

getPercent

public String getPercent()
Gets the current percentage.

Returns:
The current item percentage.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.