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