- java.lang.Object
-
- org.jfree.chart.urls.CustomPieURLGenerator
-
- All Implemented Interfaces:
Serializable,Cloneable,PublicCloneable,PieURLGenerator
public class CustomPieURLGenerator extends Object implements PieURLGenerator, Cloneable, PublicCloneable, Serializable
A custom URL generator for pie charts. This implementation supports both the standardPiePlotas well asMultiplePiePlot.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CustomPieURLGenerator()Creates a newCustomPieURLGeneratorinstance, initially empty.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddURLs(Map urlMap)Adds a map containing(key, URL)mappings where eachkeyis an instance ofComparable(corresponding to the key for an item in a pie dataset) and eachURLis aStringrepresenting a URL fragment.Objectclone()Returns a clone of the generator.booleanequals(Object o)Tests if this object is equal to another.StringgenerateURL(PieDataset dataset, Comparable<?> key, int plotIndex)Generates a URL fragment.intgetListCount()Returns the number of URL maps stored by the generator.StringgetURL(Comparable<?> key, int plotIndex)Returns the URL for a section in the specified map.intgetURLCount(int plotIndex)Returns the number of URLs in a given map (specified by its position in the map list).
-
-
-
Constructor Detail
-
CustomPieURLGenerator
public CustomPieURLGenerator()
Creates a newCustomPieURLGeneratorinstance, initially empty. CalladdURLs(Map)to specify the URL fragments to be used.
-
-
Method Detail
-
generateURL
public String generateURL(PieDataset dataset, Comparable<?> key, int plotIndex)
Generates a URL fragment.- Specified by:
generateURLin interfacePieURLGenerator- Parameters:
dataset- the dataset (ignored).key- the item key.plotIndex- the plot index.- Returns:
- A string containing the generated URL.
- See Also:
getURL(Comparable, int)
-
getListCount
public int getListCount()
Returns the number of URL maps stored by the generator. For a standard pie chart, only one map is required, but for aMultiplePiePlotthe generator will use multiple maps.- Returns:
- The list count.
- See Also:
addURLs(Map)
-
getURLCount
public int getURLCount(int plotIndex)
Returns the number of URLs in a given map (specified by its position in the map list).- Parameters:
plotIndex- the plot index (zero based).- Returns:
- The URL count.
- See Also:
getListCount()
-
getURL
public String getURL(Comparable<?> key, int plotIndex)
Returns the URL for a section in the specified map.- Parameters:
key- the key.plotIndex- the plot index.- Returns:
- The URL.
-
addURLs
public void addURLs(Map urlMap)
Adds a map containing(key, URL)mappings where eachkeyis an instance ofComparable(corresponding to the key for an item in a pie dataset) and eachURLis aStringrepresenting a URL fragment.
The map is appended to an internal list...you can add multiple maps if you are working with, say, aMultiplePiePlot.- Parameters:
urlMap- the URLs (nullpermitted).
-
clone
public Object clone() throws CloneNotSupportedException
Returns a clone of the generator.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classObject- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if cloning is not supported.
-
-