return res;
}
if (o instanceof DataSourceCollection) {
DataSourceCollection dsc = (DataSourceCollection)o;
if (action.equals(resources.getStringValue("setXY1Yn"))) {
if (dsc.size()<1) return false;
new LongAction(0, new Object[] {dsc,action}) {
protected void doAction() {
DataSourceCollection dsc = (DataSourceCollection)((Object[])param)[0];
setPrimaryX((DataSource)dsc.get(0), false);
boolean hasValues = axesLimitsArray[PY].validity;
axesLimitsArray[PY].validity = true; // compute only once all curve are inserted
for (int i=1; i<dsc.size()-1; i++)
addPrimaryY((DataSource)dsc.get(i), false);
axesLimitsArray[PY].validity = hasValues;
if (dsc.size()>1) addPrimaryY((DataSource)dsc.get(dsc.size()-1), false);
Rectangle bounds = getBounds();
setTitle(DataInfo.getLabel(dsc));
repaintDiagram(bounds);
}
}.start();
return false;
}
if (action.equals(resources.getStringValue("addY1Yn"))) {
if (dsc.size()<1) return false;
new LongAction(0, new Object[] {dsc,action}) {
protected void doAction() {
DataSourceCollection dsc = (DataSourceCollection)((Object[])param)[0];
boolean hasValues = axesLimitsArray[PY].validity;
axesLimitsArray[PY].validity = true; // compute only once all curve are inserted
for (int i=0; i<dsc.size()-1; i++)
addPrimaryY((DataSource)dsc.get(i), false);
axesLimitsArray[PY].validity = hasValues;
if (dsc.size()>0) addPrimaryY((DataSource)dsc.get(dsc.size()-1), false);
Rectangle bounds = getBounds();
repaintDiagram(bounds);
}
}.start();
return false;
}
if (action.equals(resources.getStringValue("addSecY1Yn"))) {
if (dsc.size()<1) return false;
new LongAction(0, new Object[] {dsc,action}) {
protected void doAction() {
DataSourceCollection dsc = (DataSourceCollection)((Object[])param)[0];
boolean hasValues = axesLimitsArray[SY].validity;
boolean hasLabel = (axesLimitsArray[SY].label!=null);
axesLimitsArray[SY].validity = true; // compute only once all curve are inserted
for (int i=0; i<dsc.size()-1; i++)
addSecondaryY((DataSource)dsc.get(i), false);
axesLimitsArray[SY].validity = hasValues;
if (dsc.size()>0) addSecondaryY((DataSource)dsc.get(dsc.size()-1), false);
Rectangle bounds = getBounds();
if ((!hasLabel) && (dsc.size()>1)) {axesLimitsArray[SY].label = null; setLegendVisible(true);}
repaintDiagram(bounds);
}
}.start();
return false;
}
if (action.equals(resources.getStringValue("setSecXY1Yn"))) {
if (dsc.size()<1) return false;
new LongAction(0, new Object[] {dsc,action}) {
protected void doAction() {
DataSourceCollection dsc = (DataSourceCollection)((Object[])param)[0];
setSecondaryX((DataSource)dsc.get(0), false);
boolean hasValues = axesLimitsArray[SY].validity;
boolean hasLabel = (axesLimitsArray[SY].label!=null);
axesLimitsArray[SY].validity = true; // compute only once all curve are inserted
for (int i=1; i<dsc.size()-1; i++)
addSecondaryY((DataSource)dsc.get(i), false);
axesLimitsArray[SY].validity = hasValues;
if (dsc.size()>1) addSecondaryY((DataSource)dsc.get(dsc.size()-1), false);
Rectangle bounds = getBounds();
if ((!hasLabel) && (dsc.size()>2)) {axesLimitsArray[SY].label = null; setLegendVisible(true);}
repaintDiagram(bounds);
}
}.start();
return false;
}
if (action.equals(resources.getStringValue("addSecY1YnForSecX"))) {
if (dsc.size()<1) return false;
new LongAction(0, new Object[] {dsc,action}) {
protected void doAction() {
DataSourceCollection dsc = (DataSourceCollection)((Object[])param)[0];
boolean hasValues = axesLimitsArray[SY].validity;
boolean hasLabel = (axesLimitsArray[SY].label!=null);
axesLimitsArray[SY].validity = true; // compute only once all curve are inserted
for (int i=0; i<dsc.size()-1; i++)
addSecondaryYForSecondaryX((DataSource)dsc.get(i), false);
axesLimitsArray[SY].validity = hasValues;
if (dsc.size()>0) addSecondaryYForSecondaryX((DataSource)dsc.get(dsc.size()-1), false);
Rectangle bounds = getBounds();
if ((!hasLabel) && (dsc.size()>1)) {axesLimitsArray[SY].label = null; setLegendVisible(true);}
repaintDiagram(bounds);
}
}.start();
return false;
}