}
dst2.setDataSourceCollection((DataSourceCollection)o);
//If we got no secondary domain axis
if (plot.getSecondaryDomainAxis(0)==null) {
//we build a new one
NumberAxis axis = new NumberAxis();
axis.setAutoRange(true);
//and link it
plot.setSecondaryDomainAxis(0,axis);
}
//If we got no secondary range axis
if (plot.getSecondaryRangeAxis(0)==null) {
//We build a new one
NumberAxis axis = new NumberAxis();
axis.setAutoRange(true);
//and link it
plot.setSecondaryRangeAxis(0,axis);
}
//We reset the title
chart.setTitle(chart.getTitle().getText() + " and " + dst2.getName());
//We set Xlabel
plot.getSecondaryDomainAxis(0).setLabel(dst2.getXLabel(0));
//If necessary we set the renderer
if (plot.getSecondaryRenderer(0)==null) {
plot.setSecondaryRenderer(0,new JSynopticStandardXYItemRenderer(2));
}
//We map the secondary dataset to secondary domain axis
plot.mapSecondaryDatasetToDomainAxis(0,new Integer(0));
//We map the secondary dataset to secondary range axis
plot.mapSecondaryDatasetToRangeAxis(0,new Integer(0));
notifyChange();
} catch (ClassCastException cce) {
JSynoptic.setStatus(resources.getString("ErrorWhileSettingXDataSource"));
}
}
if (action.equals(resources.getString("addSecY1Yn"))) {
try {
XYPlot plot = chart.getXYPlot();
SourceXYDataset dst2 = (SourceXYDataset)plot.getSecondaryDataset(0);
dst2.addYSource((DataSource)o);
//If we got no secondary range axis
if (plot.getSecondaryRangeAxis(0)==null) {
//We build a new one
NumberAxis axis = new NumberAxis();
axis.setAutoRange(true);
//and link it
plot.setSecondaryRangeAxis(0,axis);
}
//We map the secondary dataset to secondary range axis
plot.mapSecondaryDatasetToRangeAxis(0,new Integer(0));
notifyChange();
} catch (ClassCastException cce) {
JSynoptic.setStatus(resources.getString("ErrorWhileAddingYDataSource"));
}
}
//for DataSource ----> dirty duplication...
if (action.equals(resources.getString("setX"))) {
try {
XYPlot plot = chart.getXYPlot();
SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
dst.setXSource((DataSource)o);
plot.getDomainAxis().setLabel(dst.getXLabel(0));
notifyChange();
} catch (ClassCastException cce) {
JSynoptic.setStatus(resources.getString("ErrorWhileSettingXDataSource"));
}
}
if (action.equals(resources.getString("addY"))) {
try {
XYPlot plot = chart.getXYPlot();
SourceXYDataset dst = (SourceXYDataset)plot.getDataset();
dst.addYSource((DataSource)o);
notifyChange();
} catch (ClassCastException cce) {
JSynoptic.setStatus(resources.getString("ErrorWhileAddingYDataSource"));
}
}
if (action.equals(resources.getString("setSecX"))) {
try {
XYPlot plot = chart.getXYPlot();
SourceXYDataset dst2 = (SourceXYDataset)plot.getSecondaryDataset(0);
//If not any previous Secondary Dataset was found
if (dst2==null) {
//we build a new one
dst2 = new SourceXYDataset();
//and link it
plot.setSecondaryDataset(0,dst2);
}
dst2.setXSource((DataSource)o);
//If we got no axis
if (plot.getSecondaryDomainAxis(0)==null) {
//we build a new one
NumberAxis axis = new NumberAxis();
axis.setAutoRange(true);
//and link it
plot.setSecondaryDomainAxis(0,axis);
}
//We set the label
plot.getSecondaryDomainAxis(0).setLabel(dst2.getXLabel(0));
//If necessary we set the renderer
if (plot.getSecondaryRenderer(0)==null) {
plot.setSecondaryRenderer(0,new JSynopticStandardXYItemRenderer(2));
}
//We map the secondary dataset to secondary domain axis
plot.mapSecondaryDatasetToDomainAxis(0,new Integer(0));
notifyChange();
} catch (ClassCastException cce) {
JSynoptic.setStatus(resources.getString("ErrorWhileSettingXDataSource"));
}
}
if (action.equals(resources.getString("addSecY"))) {
try {
XYPlot plot = chart.getXYPlot();
SourceXYDataset dst2 = (SourceXYDataset)plot.getSecondaryDataset(0);
dst2.addYSource((DataSource)o);
//If we got no axis
if (plot.getSecondaryRangeAxis(0)==null) {
//We build a new one
NumberAxis axis = new NumberAxis();
axis.setAutoRange(true);
//and link it
plot.setSecondaryRangeAxis(0,axis);
}
//We map the secondary dataset to secondary range axis
plot.mapSecondaryDatasetToRangeAxis(0,new Integer(0));