Package org.jfree.chart.urls
Class CustomPieURLGenerator
- java.lang.Object
-
- org.jfree.chart.urls.CustomPieURLGenerator
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,PieURLGenerator,PublicCloneable
public class CustomPieURLGenerator extends java.lang.Object implements PieURLGenerator, java.lang.Cloneable, PublicCloneable, java.io.Serializable
A custom URL generator for pie charts.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDFor serialization.private java.util.ArrayListurlsStorage for the URLs.
-
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(java.util.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.java.lang.Objectclone()Returns a clone of the generator.booleanequals(java.lang.Object o)Tests if this object is equal to another.java.lang.StringgenerateURL(PieDataset dataset, java.lang.Comparable key, int pieIndex)Generates a URL fragment.intgetListCount()Returns the number of URL maps stored by the renderer.java.lang.StringgetURL(java.lang.Comparable key, int mapIndex)Returns the URL for a section in the specified map.intgetURLCount(int list)Returns the number of URLs in a given map (specified by its position in the map list).
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
urls
private java.util.ArrayList urls
Storage for the URLs.
-
-
Constructor Detail
-
CustomPieURLGenerator
public CustomPieURLGenerator()
Creates a newCustomPieURLGeneratorinstance, initially empty. CalladdURLs(Map)to specify the URL fragments to be used.
-
-
Method Detail
-
generateURL
public java.lang.String generateURL(PieDataset dataset, java.lang.Comparable key, int pieIndex)
Generates a URL fragment.- Specified by:
generateURLin interfacePieURLGenerator- Parameters:
dataset- the dataset (ignored).key- the item key.pieIndex- the pie 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 renderer.- Returns:
- The list count.
- See Also:
addURLs(Map)
-
getURLCount
public int getURLCount(int list)
Returns the number of URLs in a given map (specified by its position in the map list).- Parameters:
list- the list index (zero based).- Returns:
- The URL count.
- See Also:
getListCount()
-
getURL
public java.lang.String getURL(java.lang.Comparable key, int mapIndex)Returns the URL for a section in the specified map.- Parameters:
key- the key.mapIndex- the map index.- Returns:
- The URL.
-
addURLs
public void addURLs(java.util.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).
-
equals
public boolean equals(java.lang.Object o)
Tests if this object is equal to another.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the other object.- Returns:
- A boolean.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionReturns a clone of the generator.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classjava.lang.Object- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException- if cloning is not supported.
-
-