-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.charts.editor;\r
-\r
-import org.simantics.databoard.annotations.Optional;\r
-import org.simantics.db.Resource;\r
-import org.simantics.history.Collector;\r
-import org.simantics.history.HistoryManager;\r
-import org.simantics.simulation.data.Datasource;\r
-import org.simantics.simulation.experiment.IExperiment;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public final class ChartData {\r
-\r
- /**\r
- * The model for which this ChartData is valid, i.e. the model that contains\r
- * {@link #run} if {@link #run} is non<code>non-null</code>\r
- */\r
- @Optional\r
- public Resource model;\r
-\r
- /**\r
- * If just reading data from file system, not the database, this may be\r
- * <code>null</code>.\r
- */\r
- @Optional\r
- public Resource run;\r
-\r
- /**\r
- * Used for giving the chart access to the active experiment state.\r
- */\r
- @Optional\r
- public IExperiment experiment;\r
-\r
- /**\r
- * May be null if the chart data is not connected to a running experiment.\r
- */\r
- @Optional\r
- public Datasource datasource;\r
-\r
- @Optional\r
- public HistoryManager history;\r
-\r
- /**\r
- * Optional collector, Chart uses this to flush data right before drawing it\r
- */\r
- @Optional\r
- public Collector collector;\r
-\r
- public ChartData(Resource model, Resource run, IExperiment experiment, Datasource datasource, HistoryManager history, Collector collector) {\r
- this.model = model;\r
- this.run = run;\r
- this.experiment = experiment;\r
- this.datasource = datasource;\r
- this.history = history;\r
- this.collector = collector;\r
- }\r
- \r
- public void readFrom(ChartData other) {\r
- if (other==null) {\r
- this.model = null;\r
- this.run = null;\r
- this.experiment = null;\r
- this.datasource = null;\r
- this.history = null;\r
- this.collector = null;\r
- } else {\r
- this.model = other.model;\r
- this.run = other.run;\r
- this.experiment = other.experiment;\r
- this.datasource = other.datasource;\r
- this.history = other.history;\r
- this.collector = other.collector;\r
- }\r
- }\r
-\r
- /**\r
- * Dispose by closing history\r
- */\r
- public void dispose() {\r
- model = null;\r
- run = null;\r
- experiment = null;\r
- datasource = null;\r
- if (history != null) {\r
- history.close();\r
- history = null;\r
- }\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.charts.editor;
+
+import org.simantics.databoard.annotations.Optional;
+import org.simantics.db.Resource;
+import org.simantics.history.Collector;
+import org.simantics.history.HistoryManager;
+import org.simantics.simulation.data.Datasource;
+import org.simantics.simulation.experiment.IExperiment;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public final class ChartData {
+
+ /**
+ * The model for which this ChartData is valid, i.e. the model that contains
+ * {@link #run} if {@link #run} is non<code>non-null</code>
+ */
+ @Optional
+ public Resource model;
+
+ /**
+ * If just reading data from file system, not the database, this may be
+ * <code>null</code>.
+ */
+ @Optional
+ public Resource run;
+
+ /**
+ * Used for giving the chart access to the active experiment state.
+ */
+ @Optional
+ public IExperiment experiment;
+
+ /**
+ * May be null if the chart data is not connected to a running experiment.
+ */
+ @Optional
+ public Datasource datasource;
+
+ @Optional
+ public HistoryManager history;
+
+ /**
+ * Optional collector, Chart uses this to flush data right before drawing it
+ */
+ @Optional
+ public Collector collector;
+
+ public ChartData(Resource model, Resource run, IExperiment experiment, Datasource datasource, HistoryManager history, Collector collector) {
+ this.model = model;
+ this.run = run;
+ this.experiment = experiment;
+ this.datasource = datasource;
+ this.history = history;
+ this.collector = collector;
+ }
+
+ public void readFrom(ChartData other) {
+ if (other==null) {
+ this.model = null;
+ this.run = null;
+ this.experiment = null;
+ this.datasource = null;
+ this.history = null;
+ this.collector = null;
+ } else {
+ this.model = other.model;
+ this.run = other.run;
+ this.experiment = other.experiment;
+ this.datasource = other.datasource;
+ this.history = other.history;
+ this.collector = other.collector;
+ }
+ }
+
+ /**
+ * Dispose by closing history
+ */
+ public void dispose() {
+ model = null;
+ run = null;
+ experiment = null;
+ datasource = null;
+ if (history != null) {
+ history.close();
+ history = null;
+ }
+ }
+
+}