Commit 9120deb2 authored by Locatelli's avatar Locatelli

Add plotyVersion server property

Do switch stuff between this version
parent 788e5c82
......@@ -191,7 +191,9 @@ public class MainWindow implements ServerConfigurationChangeListener, ServerEnde
} finally {
PlotyManager.getInstance().closePlots();
if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyManager.getInstance().closePlots();
}
ServerConnection.getInstance(CommandZoneWrapper.SERVER_ID).reset();
......
......@@ -118,14 +118,16 @@ public class Startup {
if (displayDebugMessages) {
System.out.println("Step " + currentStep + " " + MainWindow.getElapsedTime());
}
boolean plotyOk = PlotyManager.getInstance().init();
// if connection unsuccessful, do not go to next step
if (!plotyOk) {
advanceToNextStep = false;
informationKey = "Failled ploty2 connection";
} else {
// set information key for next stage
informationKey = "";
if (ConfigManager.getInstance().getPlotyVersion() == 2) {
boolean plotyOk = PlotyManager.getInstance().init();
// if connection unsuccessful, do not go to next step
if (!plotyOk) {
advanceToNextStep = false;
informationKey = "Failled ploty2 connection";
} else {
// set information key for next stage
informationKey = "";
}
}
break;
......@@ -191,7 +193,9 @@ public class Startup {
}
// construct the main window
MainWindowPeer.getInstance().constructDisplay();
PlotyManager.getInstance().restorePlots();
if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyManager.getInstance().restorePlots();
}
break;
case 8:
if (displayDebugMessages) {
......
......@@ -1068,8 +1068,12 @@ public abstract class ControllerPluginPeer extends PluginPeer {
} else if (widgetDescriptor.getType().equals(ControllerViewParser.TAG_PLOT)) {
if (plotDatas != null) {
Property numorProperty = controllerPlugin.getNumorProperty();
// widget = PWidgetFactory.getInstance().createPlotLauncherImageButton(pContainer, plotDatas, widgetDescriptor.getTitle(), widgetDescriptor.getWidth(), widgetDescriptor.getHeight(), widgetDescriptor.getXAxisTitle(), widgetDescriptor.getYAxisTitle(), titleProperty, xAxisTitleProperty, yAxisTitleProperty, numorProperty);
widget = PWidgetFactory.getInstance().createPlotLauncherExternImageButton(pContainer, plotDatas, widgetDescriptor.getTitle(), widgetDescriptor.getWidth(), widgetDescriptor.getHeight(), widgetDescriptor.getXAxisTitle(), widgetDescriptor.getYAxisTitle(), titleProperty, xAxisTitleProperty, yAxisTitleProperty, numorProperty);
if (ConfigManager.getInstance().getPlotyVersion() == 1) {
widget = PWidgetFactory.getInstance().createPlotLauncherImageButton(pContainer, plotDatas, widgetDescriptor.getTitle(), widgetDescriptor.getWidth(), widgetDescriptor.getHeight(), widgetDescriptor.getXAxisTitle(), widgetDescriptor.getYAxisTitle(), titleProperty, xAxisTitleProperty, yAxisTitleProperty, numorProperty);
}
else if (ConfigManager.getInstance().getPlotyVersion() == 2) {
widget = PWidgetFactory.getInstance().createPlotLauncherExternImageButton(pContainer, plotDatas, widgetDescriptor.getTitle(), widgetDescriptor.getWidth(), widgetDescriptor.getHeight(), widgetDescriptor.getXAxisTitle(), widgetDescriptor.getYAxisTitle(), titleProperty, xAxisTitleProperty, yAxisTitleProperty, numorProperty);
}
if (plotWidgets == null) {
plotWidgets = new ArrayList<NomadWidget>();
}
......
......@@ -74,17 +74,20 @@ public abstract class PlotLauncher extends NomadWidget implements IPlotDataHolde
}
protected void onClick() {
PlotyManager.getInstance().plot(PlotManager.getInstance().computePlotTabKey(plotDatas), plotDatas, title, title, xAxisTitle, yAxisTitle, titleProperty,
xAxisTitleProperty, yAxisTitleProperty);
// int previousMode = WidgetFactory.CURRENT_MODE;
// WidgetFactory.CURRENT_MODE = WidgetFactory.PLOT_WINDOW_MODE;
// MainWindowPeer.getInstance().setCursorToWait();
// plotKey = PlotManager.getInstance().activatePlot(plotDatas, title, xAxisTitle, yAxisTitle, titleProperty,
// xAxisTitleProperty, yAxisTitleProperty, numorProperty);
// PlotManager.getInstance().openPlotWindow();
// MainWindowPeer.getInstance().setCursorToDefault();
// WidgetFactory.CURRENT_MODE = previousMode;
if (ConfigManager.getInstance().getPlotyVersion() == 1) {
int previousMode = WidgetFactory.CURRENT_MODE;
WidgetFactory.CURRENT_MODE = WidgetFactory.PLOT_WINDOW_MODE;
MainWindowPeer.getInstance().setCursorToWait();
plotKey = PlotManager.getInstance().activatePlot(plotDatas, title, xAxisTitle, yAxisTitle, titleProperty,
xAxisTitleProperty, yAxisTitleProperty, numorProperty);
PlotManager.getInstance().openPlotWindow();
MainWindowPeer.getInstance().setCursorToDefault();
WidgetFactory.CURRENT_MODE = previousMode;
}
else if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyManager.getInstance().plot(PlotManager.getInstance().computePlotTabKey(plotDatas), plotDatas, title, title, xAxisTitle, yAxisTitle, titleProperty,
xAxisTitleProperty, yAxisTitleProperty);
}
}
public void updatePlotData(List<PlotData> plotDatas) {
......
......@@ -30,6 +30,7 @@ import fr.ill.ics.client.view.widget.PContainer;
import fr.ill.ics.core.property.Property;
import fr.ill.ics.nscclient.ploty.PlotyInstance;
import fr.ill.ics.nscclient.ploty.SpyPlotChangeListener;
import fr.ill.ics.util.ConfigManager;
public abstract class PlotLauncherExternImageButton extends PlotLauncher implements SpyPlotChangeListener {
......@@ -78,7 +79,9 @@ public abstract class PlotLauncherExternImageButton extends PlotLauncher impleme
}
imageKey = key + ".png";
PlotyInstance.getInstance().addSpyPlotChangeListener(this);
if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyInstance.getInstance().addSpyPlotChangeListener(this);
}
// File parentDirectory = FileUtils.getFile(System.getenv("HOME") + "/offscreenImages/spy");
// FileAlterationObserver observer = new FileAlterationObserver(parentDirectory);
//
......@@ -114,7 +117,9 @@ public abstract class PlotLauncherExternImageButton extends PlotLauncher impleme
}
protected void closePlotWindow() {
PlotyInstance.getInstance().removeSpyPlotChangeListener(this);
if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyInstance.getInstance().removeSpyPlotChangeListener(this);
}
// try {
// monitor.stop();
// } catch (Exception e) {
......
......@@ -238,11 +238,14 @@ public abstract class MultiplotWindow implements IPropertyChangeListener {
String yAxisTitlePropertyName = PlotManager.getInstance().getPlotDataProperties(simplePlotDataKey).getyAxisTitleProperty();
Property yAxisTitleProperty = PropertyManager.getInstance().getProperty(controller, yAxisTitlePropertyName + "." + plotIndex, PluginType.GENERAL);
PlotyManager.getInstance().plot(PlotManager.getInstance().computePlotTabKey(plots), plots, title, title, xAxisTitle, yAxisTitle, titleProperty,
xAxisTitleProperty, yAxisTitleProperty);
// PlotManager.getInstance().activatePlot(plots, title, xAxisTitle, yAxisTitle, titleProperty, xAxisTitleProperty, yAxisTitleProperty, null);
// PlotManager.getInstance().openPlotWindow();
if (ConfigManager.getInstance().getPlotyVersion() == 1) {
PlotManager.getInstance().activatePlot(plots, title, xAxisTitle, yAxisTitle, titleProperty, xAxisTitleProperty, yAxisTitleProperty, null);
PlotManager.getInstance().openPlotWindow();
}
else if (ConfigManager.getInstance().getPlotyVersion() == 2) {
PlotyManager.getInstance().plot(PlotManager.getInstance().computePlotTabKey(plots), plots, title, title, xAxisTitle, yAxisTitle, titleProperty,
xAxisTitleProperty, yAxisTitleProperty);
}
}
} catch (PropertyNotFoundException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment