@Test public void testURL() { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("Alpha '1'", new Double(5.0)); dataset.setValue("Beta", new Double(5.5)); StandardPieURLGenerator g1 = new StandardPieURLGenerator( "chart.jsp", "category"); String url = g1.generateURL(dataset, "Beta", 0); assertEquals("chart.jsp?category=Beta&amp;pieIndex=0", url); url = g1.generateURL(dataset, "Alpha '1'", 0); assertEquals("chart.jsp?category=Alpha+%271%27&amp;pieIndex=0", url); }
@Override public String generateURL(PieDataset dataset, Comparable key, int pieIndex) { String url = this.prefix; if (url.indexOf("?") > -1) { url += "&amp;" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } else { url += "?" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } if (this.indexParameterName != null) { url += "&amp;" + this.indexParameterName + "=" + String.valueOf(pieIndex); } return url; }
StandardPieURLGenerator implements PieURLGenerator, Serializable { @Override public String generateURL(PieDataset dataset, Comparable key, int pieIndex) { String url = this.prefix; if (url.indexOf("?") > -1) { url += "&amp;" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } else { url += "?" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } if (this.indexParameterName != null) { url += "&amp;" + this.indexParameterName + "=" + String.valueOf(pieIndex); } return url; } }
StandardPieURLGenerator implements PieURLGenerator, Serializable { @Override public String generateURL(PieDataset dataset, Comparable key, int pieIndex) { String url = this.prefix; if (url.indexOf("?") > -1) { url += "&amp;" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } else { url += "?" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } if (this.indexParameterName != null) { url += "&amp;" + this.indexParameterName + "=" + String.valueOf(pieIndex); } return url; } StandardPieURLGenerator();  StandardPieURLGenerator(String prefix);  StandardPieURLGenerator(String prefix,
                                   String categoryParameterName);  StandardPieURLGenerator(String prefix,
                                   String categoryParameterName,
                                   String indexParameterName); }
StandardPieURLGenerator implements PieURLGenerator, Serializable { @Override public String generateURL(PieDataset dataset, Comparable key, int pieIndex) { String url = this.prefix; if (url.indexOf("?") > -1) { url += "&amp;" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } else { url += "?" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } if (this.indexParameterName != null) { url += "&amp;" + this.indexParameterName + "=" + String.valueOf(pieIndex); } return url; } StandardPieURLGenerator();  StandardPieURLGenerator(String prefix);  StandardPieURLGenerator(String prefix,
                                   String categoryParameterName);  StandardPieURLGenerator(String prefix,
                                   String categoryParameterName,
                                   String indexParameterName); @Override String generateURL(PieDataset dataset, Comparable key,
            int pieIndex); @Override boolean equals(Object obj); }
StandardPieURLGenerator implements PieURLGenerator, Serializable { @Override public String generateURL(PieDataset dataset, Comparable key, int pieIndex) { String url = this.prefix; if (url.indexOf("?") > -1) { url += "&amp;" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } else { url += "?" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } if (this.indexParameterName != null) { url += "&amp;" + this.indexParameterName + "=" + String.valueOf(pieIndex); } return url; } StandardPieURLGenerator();  StandardPieURLGenerator(String prefix);  StandardPieURLGenerator(String prefix,
                                   String categoryParameterName);  StandardPieURLGenerator(String prefix,
                                   String categoryParameterName,
                                   String indexParameterName); @Override String generateURL(PieDataset dataset, Comparable key,
            int pieIndex); @Override boolean equals(Object obj);  }