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
.ui
.viewers
.xycharts
.TmfXYChartViewer
;
19 * Base class to be used with a chart viewer {@link TmfXYChartViewer}.
20 * It is responsible to instantiate the viewer class and load the trace
21 * into the viewer when the view is created.
23 * @author Bernd Hufmann
25 abstract public class TmfChartView
extends TmfView
{
27 // ------------------------------------------------------------------------
29 // ------------------------------------------------------------------------
30 /** The TMF XY Chart reference */
31 private TmfXYChartViewer fChartViewer
;
32 /** The Trace reference */
33 private ITmfTrace fTrace
;
35 // ------------------------------------------------------------------------
37 // ------------------------------------------------------------------------
39 * Standard Constructor
44 public TmfChartView(String viewName
) {
48 // ------------------------------------------------------------------------
50 // ------------------------------------------------------------------------
52 * Returns the TMF XY chart viewer implementation.
54 * @return the TMF XY chart viewer {@link TmfXYChartViewer}
56 protected TmfXYChartViewer
getChartViewer() {
61 * Sets the TMF XY chart viewer implementation.
64 * The TMF XY chart viewer {@link TmfXYChartViewer}
66 protected void setChartViewer(TmfXYChartViewer chartViewer
) {
67 fChartViewer
= chartViewer
;
71 * Returns the ITmfTrace implementation
73 * @return the ITmfTrace implementation {@link ITmfTrace}
75 protected ITmfTrace
getTrace() {
80 * Sets the ITmfTrace implementation
83 * The ITmfTrace implementation {@link ITmfTrace}
85 protected void setTrace(ITmfTrace trace
) {
89 // ------------------------------------------------------------------------
91 // ------------------------------------------------------------------------
93 public void createPartControl(Composite parent
) {
94 ITmfTrace trace
= getActiveTrace();
102 public void dispose() {
103 if (fChartViewer
!= null) {
104 fChartViewer
.dispose();
109 * Load the trace into view.
111 protected void loadTrace() {
112 if (fChartViewer
!= null) {
113 fChartViewer
.loadTrace(fTrace
);