A custom URL generator for pie charts.
| Method from org.jfree.chart.urls.CustomPieURLGenerator Detail: |
public void addURLs(Map urlMap) {
this.urls.add(urlMap);
}
Adds a map containing (key, URL) mappings where each
key is an instance of Comparable
(corresponding to the key for an item in a pie dataset) and each
URL is a String representing a URL fragment.
The map is appended to an internal list...you can add multiple maps
if you are working with, say, a MultiplePiePlot . |
public Object clone() throws CloneNotSupportedException {
CustomPieURLGenerator urlGen = new CustomPieURLGenerator();
Map map;
Map newMap;
String key;
for (Iterator i = this.urls.iterator(); i.hasNext();) {
map = (Map) i.next();
newMap = new HashMap();
for (Iterator j = map.keySet().iterator(); j.hasNext();) {
key = (String) j.next();
newMap.put(key, map.get(key));
}
urlGen.addURLs(newMap);
newMap = null;
}
return urlGen;
}
Returns a clone of the generator. |
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof CustomPieURLGenerator) {
CustomPieURLGenerator generator = (CustomPieURLGenerator) o;
if (getListCount() != generator.getListCount()) {
return false;
}
Set keySet;
for (int pieItem = 0; pieItem < getListCount(); pieItem++) {
if (getURLCount(pieItem) != generator.getURLCount(pieItem)) {
return false;
}
keySet = ((HashMap) this.urls.get(pieItem)).keySet();
String key;
for (Iterator i = keySet.iterator(); i.hasNext();) {
key = (String) i.next();
if (!getURL(key, pieItem).equals(
generator.getURL(key, pieItem))) {
return false;
}
}
}
return true;
}
return false;
}
Tests if this object is equal to another. |
public String generateURL(PieDataset dataset,
Comparable key,
int pieIndex) {
return getURL(key, pieIndex);
}
Generates a URL fragment. |
public int getListCount() {
return this.urls.size();
}
Returns the number of URL maps stored by the renderer. |
public String getURL(Comparable key,
int mapIndex) {
String result = null;
if (mapIndex < getListCount()) {
Map urlMap = (Map) this.urls.get(mapIndex);
if (urlMap != null) {
result = (String) urlMap.get(key);
}
}
return result;
}
Returns the URL for a section in the specified map. |
public int getURLCount(int list) {
int result = 0;
Map urlMap = (Map) this.urls.get(list);
if (urlMap != null) {
result = urlMap.size();
}
return result;
}
Returns the number of URLs in a given map (specified by its position
in the map list). |