analysis.lami: Fix internal signaling with several views on the same report
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.lami.ui / src / org / eclipse / tracecompass / internal / provisional / analysis / lami / ui / viewers / ILamiViewer.java
CommitLineData
4208b510
AM
1/*******************************************************************************
2 * Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir
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
10package org.eclipse.tracecompass.internal.provisional.analysis.lami.ui.viewers;
11
12import org.eclipse.jface.viewers.TableViewer;
13import org.eclipse.swt.SWT;
14import org.eclipse.swt.widgets.Composite;
15import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiChartModel;
3f506e25 16import org.eclipse.tracecompass.internal.provisional.analysis.lami.ui.views.LamiReportViewTabPage;
4208b510
AM
17
18/**
19 * Common interface for all Lami viewers.
20 *
21 * @author Alexandre Montplaisir
22 */
23public interface ILamiViewer {
24
25 /**
26 * Dispose the viewer widget.
27 */
28 void dispose();
29
30 /**
31 * Factory method to create a new Table viewer.
32 *
33 * @param parent
34 * The parent composite
3f506e25
JR
35 * @param page
36 * The {@link LamiReportViewTabPage} parent page
4208b510
AM
37 * @return The new viewer
38 */
3f506e25 39 static ILamiViewer createLamiTable(Composite parent, LamiReportViewTabPage page) {
4208b510 40 TableViewer tableViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.VIRTUAL);
3f506e25 41 return new LamiTableViewer(tableViewer, page);
4208b510
AM
42 }
43
44 /**
45 * Factory method to create a new chart viewer. The chart type is specified
46 * by the 'chartModel' parameter.
47 *
48 * @param parent
49 * The parent composite
3f506e25
JR
50 * @param page
51 * The {@link LamiReportViewTabPage} parent page
4208b510
AM
52 * @param chartModel
53 * The information about the chart to display
54 * @return The new viewer
55 */
3f506e25 56 static ILamiViewer createLamiChart(Composite parent, LamiReportViewTabPage page, LamiChartModel chartModel) {
4208b510
AM
57 switch (chartModel.getChartType()) {
58 case BAR_CHART:
3f506e25 59 return new LamiBarChartViewer(parent, page, chartModel);
4208b510 60 case XY_SCATTER:
3f506e25 61 return new LamiScatterViewer(parent, page, chartModel);
4208b510
AM
62 case PIE_CHART:
63 default:
64 throw new UnsupportedOperationException("Unsupported chart type: " + chartModel.toString()); //$NON-NLS-1$
65 }
66 }
67}
This page took 0.038183 seconds and 5 git commands to generate.