1 /**********************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.tracecompass
.tmf
.ui
.views
;
14 import org
.eclipse
.swt
.widgets
.Composite
;
15 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
16 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceManager
;
17 import org
.eclipse
.tracecompass
.tmf
.ui
.viewers
.xycharts
.TmfXYChartViewer
;
20 * Base class to be used with a chart viewer {@link TmfXYChartViewer}.
21 * It is responsible to instantiate the viewer class and load the trace
22 * into the viewer when the view is created.
24 * @author Bernd Hufmann
26 abstract public class TmfChartView
extends TmfView
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
31 /** The TMF XY Chart reference */
32 private TmfXYChartViewer fChartViewer
;
33 /** The Trace reference */
34 private ITmfTrace fTrace
;
36 // ------------------------------------------------------------------------
38 // ------------------------------------------------------------------------
40 * Standard Constructor
45 public TmfChartView(String viewName
) {
49 // ------------------------------------------------------------------------
51 // ------------------------------------------------------------------------
53 * Returns the TMF XY chart viewer implementation.
55 * @return the TMF XY chart viewer {@link TmfXYChartViewer}
57 protected TmfXYChartViewer
getChartViewer() {
62 * Sets the TMF XY chart viewer implementation.
65 * The TMF XY chart viewer {@link TmfXYChartViewer}
67 protected void setChartViewer(TmfXYChartViewer chartViewer
) {
68 fChartViewer
= chartViewer
;
72 * Returns the ITmfTrace implementation
74 * @return the ITmfTrace implementation {@link ITmfTrace}
76 protected ITmfTrace
getTrace() {
81 * Sets the ITmfTrace implementation
84 * The ITmfTrace implementation {@link ITmfTrace}
86 protected void setTrace(ITmfTrace trace
) {
90 // ------------------------------------------------------------------------
92 // ------------------------------------------------------------------------
94 public void createPartControl(Composite parent
) {
95 ITmfTrace trace
= TmfTraceManager
.getInstance().getActiveTrace();
103 public void dispose() {
104 if (fChartViewer
!= null) {
105 fChartViewer
.dispose();
110 * Load the trace into view.
112 protected void loadTrace() {
113 if (fChartViewer
!= null) {
114 fChartViewer
.loadTrace(fTrace
);