AFAIK all the URL generators in the org.jfree.chart.urls package contain a generateURL method. Each of these work the same, with the exception of the dataset needed.
Now these datasets do not inherit a common interface nor do they extend some common class.
What this leads to is a bit of a mess. IF the datasets all inherited from a common interface or abstract class, all the generators could inherit from a single interface that would only as for this uppermost "dataset" object. Each specific generator would then be responsible for casting to the appropriate dataset, blah blah blah.
If this were in place (we had a common top level URLGenerator interface and Dataset interface) and someone wanted to create a class that opened URLs into a new window, life could be as easy as:
Code: Select all
public class NewWindowURLGenerator implements SomeGenerateURLSuperInterface {
private SomeGenerateURLSuperInterface master;
private String windowName;
public NewWindowURLGenerator(SomeGenerateURLSuperInterface master, String windowName) {
this.master = master;
this.windowName = windowName;
}
public String generateURL(SomeDatasetSuperInterface data, int series, int category) {
String url = master.generateURL(data, series, category);
return "javascript:window.open('" + url + "', '" + windowName + "');";
}
}
I've not dug that deeply into (to be totally honest). However I'm sure there are a lot more cases of this type of thing.
Am I missing something horribly obvious that makes this impossible?