1 | package de.uka.ipd.sdq.sensorframework.visualisation.jfreechartvisualisation.editor; |
2 | |
3 | import java.util.ArrayList; |
4 | import java.util.Collection; |
5 | import java.util.List; |
6 | |
7 | import org.eclipse.swt.widgets.Composite; |
8 | import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; |
9 | |
10 | import de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.TimeSeries; |
11 | import de.uka.ipd.sdq.sensorframework.adapter.DataAdapter; |
12 | import de.uka.ipd.sdq.sensorframework.visualisation.IVisualisation; |
13 | import de.uka.ipd.sdq.sensorframework.visualisation.editor.AbstractReportView; |
14 | import de.uka.ipd.sdq.sensorframework.visualisation.jfreechartvisualisation.JFreeChartTimeSeriesViewer; |
15 | |
16 | public class JFreeChartTimeSeriesReport extends AbstractReportView implements |
17 | ITabbedPropertySheetPageContributor, IVisualisation<TimeSeries> { |
18 | |
19 | public static String EDITOR_ID = "de.uka.ipd.sdq.simucomframework.visualisation.JFreeChartTimeSeriesReport"; |
20 | JFreeChartTimeSeriesViewer viewer; |
21 | |
22 | /* (non-Javadoc) |
23 | * @see de.uka.ipd.sdq.sensorframework.visualisation.editor.AbstractReportView#createReportControls(org.eclipse.swt.widgets.Composite) |
24 | */ |
25 | @Override |
26 | protected void createReportControls(Composite parent) { |
27 | viewer = new JFreeChartTimeSeriesViewer(parent, 0); |
28 | } |
29 | |
30 | /* (non-Javadoc) |
31 | * @see de.uka.ipd.sdq.sensorframework.visualisation.editor.AbstractReportView#setInput(java.util.List) |
32 | */ |
33 | @Override |
34 | protected void generateVisualization(List<DataAdapter> list) { |
35 | ArrayList<TimeSeries> viewerInput = new ArrayList<TimeSeries>(); |
36 | for (DataAdapter a : list) |
37 | viewerInput.add((TimeSeries) a.getAdaptedObject()); |
38 | this.setInput(viewerInput); |
39 | } |
40 | |
41 | |
42 | /* (non-Javadoc) |
43 | * @see de.uka.ipd.sdq.sensorframework.visualisation.IVisualisation#addInput(java.util.Collection) |
44 | */ |
45 | public void addInput(Collection<TimeSeries> c) { |
46 | // The implementation is not necessary. |
47 | } |
48 | |
49 | /* (non-Javadoc) |
50 | * @see de.uka.ipd.sdq.sensorframework.visualisation.IVisualisation#deleteInput(java.util.Collection) |
51 | */ |
52 | public void deleteInput(Collection<TimeSeries> c) { |
53 | // The implementation is not necessary. |
54 | } |
55 | |
56 | /* (non-Javadoc) |
57 | * @see de.uka.ipd.sdq.sensorframework.visualisation.IVisualisation#setInput(java.util.Collection) |
58 | */ |
59 | public void setInput(Collection<TimeSeries> c) { |
60 | viewer.setData(c); |
61 | } |
62 | |
63 | |
64 | /* (non-Javadoc) |
65 | * @see org.eclipse.ui.part.WorkbenchPart#setFocus() |
66 | */ |
67 | @Override |
68 | public void setFocus() { |
69 | viewer.setFocus(); |
70 | } |
71 | |
72 | } |