Remove all existing @since annotations
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / views / TmfChartView.java
CommitLineData
d7d40e67 1/**********************************************************************
60ae41e1 2 * Copyright (c) 2013, 2014 Ericsson
d7d40e67
BH
3 *
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
8 *
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
2bdf0193 12package org.eclipse.tracecompass.tmf.ui.views;
d7d40e67 13
d7d40e67 14import org.eclipse.swt.widgets.Composite;
2bdf0193
AM
15import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
16import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.TmfXYChartViewer;
d7d40e67
BH
17
18/**
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.
22 *
23 * @author Bernd Hufmann
d7d40e67
BH
24 */
25abstract public class TmfChartView extends TmfView {
26
27 // ------------------------------------------------------------------------
28 // Attributes
29 // ------------------------------------------------------------------------
30 /** The TMF XY Chart reference */
31 private TmfXYChartViewer fChartViewer;
32 /** The Trace reference */
33 private ITmfTrace fTrace;
34
35 // ------------------------------------------------------------------------
36 // Constructors
37 // ------------------------------------------------------------------------
38 /**
39 * Standard Constructor
40 *
41 * @param viewName
42 * The view name
43 */
44 public TmfChartView(String viewName) {
45 super(viewName);
46 }
47
48 // ------------------------------------------------------------------------
49 // Accessors
50 // ------------------------------------------------------------------------
51 /**
52 * Returns the TMF XY chart viewer implementation.
53 *
54 * @return the TMF XY chart viewer {@link TmfXYChartViewer}
55 */
56 protected TmfXYChartViewer getChartViewer() {
57 return fChartViewer;
58 }
59
60 /**
61 * Sets the TMF XY chart viewer implementation.
62 *
63 * @param chartViewer
64 * The TMF XY chart viewer {@link TmfXYChartViewer}
65 */
66 protected void setChartViewer(TmfXYChartViewer chartViewer) {
67 fChartViewer = chartViewer;
68 }
69
70 /**
71 * Returns the ITmfTrace implementation
72 *
73 * @return the ITmfTrace implementation {@link ITmfTrace}
74 */
75 protected ITmfTrace getTrace() {
76 return fTrace;
77 }
78
79 /**
80 * Sets the ITmfTrace implementation
81 *
82 * @param trace
83 * The ITmfTrace implementation {@link ITmfTrace}
84 */
85 protected void setTrace(ITmfTrace trace) {
86 fTrace = trace;
87 }
88
89 // ------------------------------------------------------------------------
90 // Operations
91 // ------------------------------------------------------------------------
92 @Override
93 public void createPartControl(Composite parent) {
94 ITmfTrace trace = getActiveTrace();
95 if (trace != null) {
96 setTrace(trace);
97 loadTrace();
98 }
99 }
100
101 @Override
102 public void dispose() {
103 if (fChartViewer != null) {
104 fChartViewer.dispose();
105 }
106 }
107
108 /**
109 * Load the trace into view.
110 */
111 protected void loadTrace() {
112 if (fChartViewer != null) {
113 fChartViewer.loadTrace(fTrace);
114 }
115 }
116
117}
This page took 0.053182 seconds and 5 git commands to generate.