1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.charts.editor;
\r
14 import org.simantics.databoard.annotations.Optional;
\r
15 import org.simantics.db.Resource;
\r
16 import org.simantics.history.Collector;
\r
17 import org.simantics.history.HistoryManager;
\r
18 import org.simantics.simulation.data.Datasource;
\r
19 import org.simantics.simulation.experiment.IExperiment;
\r
22 * @author Tuukka Lehtonen
\r
24 public final class ChartData {
\r
27 * The model for which this ChartData is valid, i.e. the model that contains
\r
28 * {@link #run} if {@link #run} is non<code>non-null</code>
\r
31 public Resource model;
\r
34 * If just reading data from file system, not the database, this may be
\r
35 * <code>null</code>.
\r
38 public Resource run;
\r
41 * Used for giving the chart access to the active experiment state.
\r
44 public IExperiment experiment;
\r
47 * May be null if the chart data is not connected to a running experiment.
\r
50 public Datasource datasource;
\r
53 public HistoryManager history;
\r
56 * Optional collector, Chart uses this to flush data right before drawing it
\r
59 public Collector collector;
\r
61 public ChartData(Resource model, Resource run, IExperiment experiment, Datasource datasource, HistoryManager history, Collector collector) {
\r
64 this.experiment = experiment;
\r
65 this.datasource = datasource;
\r
66 this.history = history;
\r
67 this.collector = collector;
\r
70 public void readFrom(ChartData other) {
\r
74 this.experiment = null;
\r
75 this.datasource = null;
\r
76 this.history = null;
\r
77 this.collector = null;
\r
79 this.model = other.model;
\r
80 this.run = other.run;
\r
81 this.experiment = other.experiment;
\r
82 this.datasource = other.datasource;
\r
83 this.history = other.history;
\r
84 this.collector = other.collector;
\r
89 * Dispose by closing history
\r
91 public void dispose() {
\r
96 if (history != null) {
\r