/** * Generates a URL. * * @param dataset the dataset (ignored). * @param key the item key (<code>null</code> not permitted). * @param pieIndex the pie index. * * @return A string containing the generated URL. */ public String generateURL(PieDataset dataset, Comparable key, int pieIndex) { String url = this.prefix; if (url.indexOf("?") > -1) { url += "&" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } else { url += "?" + this.categoryParameterName + "=" + URLUtilities.encode(key.toString(), "UTF-8"); } if (this.indexParameterName != null) { url += "&" + this.indexParameterName + "=" + String.valueOf(pieIndex); } return url; }
/** * Generates a URL for a particular item within a series. * * @param dataset the dataset. * @param series the series index (zero-based). * @param category the category index (zero-based). * * @return The generated URL. */ public String generateURL(CategoryDataset dataset, int series, int category) { String url = this.prefix; Comparable seriesKey = dataset.getRowKey(series); Comparable categoryKey = dataset.getColumnKey(category); boolean firstParameter = url.indexOf("?") == -1; url += firstParameter ? "?" : "&"; url += this.seriesParameterName + "=" + URLUtilities.encode( seriesKey.toString(), "UTF-8"); url += "&" + this.categoryParameterName + "=" + URLUtilities.encode(categoryKey.toString(), "UTF-8"); return url; }
/** * Generates a URL for a particular item within a series. * * @param dataset the dataset (<code>null</code> not permitted). * @param series the series number (zero-based index). * @param item the item number (zero-based index). * * @return The generated URL. */ public String generateURL(XYDataset dataset, int series, int item) { String result = this.prefix; boolean firstParameter = result.indexOf("?") == -1; Comparable seriesKey = dataset.getSeriesKey(series); if (seriesKey != null) { result += firstParameter ? "?" : "&"; result += this.seriesParameterName + "=" + URLUtilities.encode( seriesKey.toString(), "UTF-8"); firstParameter = false; } long x = (long) dataset.getXValue(series, item); String xValue = this.dateFormat.format(new Date(x)); result += firstParameter ? "?" : "&"; result += this.itemParameterName + "=" + URLUtilities.encode(xValue, "UTF-8"); return result; }