| 1 | package de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.views; |
| 2 | |
| 3 | import java.util.ArrayList; |
| 4 | import java.util.Collection; |
| 5 | import java.util.Collections; |
| 6 | import java.util.List; |
| 7 | |
| 8 | import org.eclipse.swt.SWT; |
| 9 | import org.eclipse.swt.browser.Browser; |
| 10 | import org.eclipse.swt.widgets.Composite; |
| 11 | |
| 12 | import de.uka.ipd.sdq.sensorframework.adapter.DataAdapter; |
| 13 | import de.uka.ipd.sdq.sensorframework.entities.SensorAndMeasurements; |
| 14 | import de.uka.ipd.sdq.sensorframework.visualisation.IVisualisation; |
| 15 | import de.uka.ipd.sdq.sensorframework.visualisation.editor.AbstractReportView; |
| 16 | |
| 17 | public abstract class AbstractHtmlReportView extends AbstractReportView implements IVisualisation < SensorAndMeasurements >{ |
| 18 | |
| 19 | /**Reference to the browser window in which the report is displayed. */ |
| 20 | protected Browser browser; |
| 21 | |
| 22 | public AbstractHtmlReportView() { |
| 23 | super(); |
| 24 | } |
| 25 | |
| 26 | /** {@inheritDoc} |
| 27 | */ |
| 28 | @SuppressWarnings("unchecked") |
| 29 | @Override |
| 30 | protected void createReportControls(final Composite parent) { |
| 31 | browser = new Browser(parent, SWT.BORDER); |
| 32 | setInput(Collections.EMPTY_LIST); |
| 33 | } |
| 34 | |
| 35 | /** {@inheritDoc} |
| 36 | */ |
| 37 | @Override |
| 38 | public void setFocus() { |
| 39 | browser.setFocus(); |
| 40 | } |
| 41 | |
| 42 | /** {@inheritDoc} |
| 43 | */ |
| 44 | public void addInput(final Collection < SensorAndMeasurements > c) { |
| 45 | // The implementation is not necessary. |
| 46 | } |
| 47 | |
| 48 | /** {@inheritDoc} |
| 49 | */ |
| 50 | public void deleteInput(final Collection < SensorAndMeasurements > c) { |
| 51 | // The implementation is not necessary. |
| 52 | } |
| 53 | |
| 54 | /** {@inheritDoc} |
| 55 | */ |
| 56 | @Override |
| 57 | protected void generateVisualization(final List < DataAdapter > list) { |
| 58 | ArrayList<SensorAndMeasurements> viewerInput = |
| 59 | new ArrayList<SensorAndMeasurements>(); |
| 60 | for (DataAdapter a : list) { |
| 61 | viewerInput.add((SensorAndMeasurements) a.getAdaptedObject()); |
| 62 | } |
| 63 | this.setInput(viewerInput); |
| 64 | } |
| 65 | |
| 66 | } |