EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.sensorframework.visualisation.dialogs]

COVERAGE SUMMARY FOR SOURCE FILE [ExperimentRunsDialog.java]

nameclass, %method, %block, %line, %
ExperimentRunsDialog.java0%   (0/4)0%   (0/17)0%   (0/386)0%   (0/81)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ExperimentRunsDialog0%   (0/1)0%   (0/11)0%   (0/325)0%   (0/67)
ExperimentRunsDialog (Shell): void 0%   (0/1)0%   (0/10)0%   (0/4)
access$0 (ExperimentRunsDialog, TreeObject): void 0%   (0/1)0%   (0/4)0%   (0/1)
access$1 (ExperimentRunsDialog): TreeObject 0%   (0/1)0%   (0/3)0%   (0/1)
access$2 (ExperimentRunsDialog, TreeObject): void 0%   (0/1)0%   (0/4)0%   (0/1)
access$3 (ExperimentRunsDialog): Button 0%   (0/1)0%   (0/3)0%   (0/1)
configureShell (Shell): void 0%   (0/1)0%   (0/13)0%   (0/4)
createButtonsForButtonBar (Composite): void 0%   (0/1)0%   (0/28)0%   (0/7)
createDialogArea (Composite): Control 0%   (0/1)0%   (0/238)0%   (0/44)
getInitialSize (): Point 0%   (0/1)0%   (0/6)0%   (0/1)
getResult (): TreeObject 0%   (0/1)0%   (0/3)0%   (0/1)
setSelectedField (TreeObject): void 0%   (0/1)0%   (0/13)0%   (0/4)
     
class ExperimentRunsDialog$10%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
ExperimentRunsDialog$1 (ExperimentRunsDialog): void 0%   (0/1)0%   (0/6)0%   (0/2)
shellClosed (ShellEvent): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class ExperimentRunsDialog$20%   (0/1)0%   (0/2)0%   (0/39)0%   (0/11)
ExperimentRunsDialog$2 (ExperimentRunsDialog): void 0%   (0/1)0%   (0/6)0%   (0/2)
selectionChanged (SelectionChangedEvent): void 0%   (0/1)0%   (0/33)0%   (0/9)
     
class ExperimentRunsDialog$30%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
ExperimentRunsDialog$3 (ExperimentRunsDialog): void 0%   (0/1)0%   (0/6)0%   (0/2)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/5)0%   (0/2)

1package de.uka.ipd.sdq.sensorframework.visualisation.dialogs;
2 
3import java.util.ArrayList;
4 
5import org.eclipse.jface.dialogs.IDialogConstants;
6import org.eclipse.jface.dialogs.TitleAreaDialog;
7import org.eclipse.jface.viewers.ISelectionChangedListener;
8import org.eclipse.jface.viewers.IStructuredSelection;
9import org.eclipse.jface.viewers.SelectionChangedEvent;
10import org.eclipse.jface.viewers.TreeViewer;
11import org.eclipse.swt.SWT;
12import org.eclipse.swt.events.SelectionAdapter;
13import org.eclipse.swt.events.SelectionEvent;
14import org.eclipse.swt.events.ShellAdapter;
15import org.eclipse.swt.events.ShellEvent;
16import org.eclipse.swt.graphics.Point;
17import org.eclipse.swt.layout.FormAttachment;
18import org.eclipse.swt.layout.FormData;
19import org.eclipse.swt.layout.FormLayout;
20import org.eclipse.swt.layout.GridData;
21import org.eclipse.swt.layout.GridLayout;
22import org.eclipse.swt.widgets.Button;
23import org.eclipse.swt.widgets.Composite;
24import org.eclipse.swt.widgets.Control;
25import org.eclipse.swt.widgets.Label;
26import org.eclipse.swt.widgets.Shell;
27import org.eclipse.swt.widgets.Tree;
28 
29import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun;
30import de.uka.ipd.sdq.sensorframework.visualisation.views.TreeLabelProvider;
31import de.uka.ipd.sdq.sensorframework.visualisation.views.TreeObject;
32 
33/** @author roman */
34public class ExperimentRunsDialog extends TitleAreaDialog {
35 
36        private TreeObject selectedObject = null;
37 
38        private Label selectedField;
39        private Button okButton,cancelButton;
40 
41        public ExperimentRunsDialog(Shell parentShell) {
42                super(parentShell);
43                this.setShellStyle(SWT.RESIZE|SWT.MAX|SWT.CLOSE);
44        }
45 
46        /* (non-Javadoc)
47         * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
48         */
49        @Override
50        protected void configureShell(Shell newShell) {
51                super.configureShell(newShell);
52                newShell.setText("Select Run");
53                newShell.addShellListener(new ShellAdapter(){
54 
55                        /* (non-Javadoc)
56                         * @see org.eclipse.swt.events.ShellAdapter#shellClosed(org.eclipse.swt.events.ShellEvent)
57                         */
58                        @Override
59                        public void shellClosed(ShellEvent e) {
60                                selectedObject = null;
61                        }
62                });
63        }
64 
65        /* (non-Javadoc)
66         * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
67         */
68        @Override
69        protected Control createDialogArea(Composite parent) {
70                Composite area = (Composite) super.createDialogArea(parent);
71                Composite container = new Composite(area, SWT.NONE);
72                container.setLayout(new FormLayout());
73                container.setLayoutData(new GridData(GridData.FILL_BOTH));
74 
75                final TreeViewer viewer = new TreeViewer(container, SWT.BORDER);
76                final Tree tree = viewer.getTree();
77                final FormData fd_tree = new FormData();
78                fd_tree.bottom = new FormAttachment(100, -50);
79                fd_tree.right = new FormAttachment(100, -5);
80                fd_tree.top = new FormAttachment(0, 5);
81                fd_tree.left = new FormAttachment(0, 5);
82                tree.setLayoutData(fd_tree);
83 
84                viewer.setContentProvider(new ExperimentRunsDialogContentProvider());
85                viewer.setLabelProvider(new TreeLabelProvider());
86                viewer.setInput(new ArrayList<Object>());
87                viewer.addSelectionChangedListener(new ISelectionChangedListener() {
88                        public void selectionChanged(SelectionChangedEvent event) {
89 
90                                IStructuredSelection sel = (IStructuredSelection) event
91                                                .getSelection();
92                                Object objeckt = sel.getFirstElement();
93 
94                                if (objeckt instanceof TreeObject) {
95                                        selectedObject = (TreeObject) objeckt;
96                                        setSelectedField(selectedObject);
97                                        okButton.setEnabled(true);
98                                } else
99                                        okButton.setEnabled(false);
100                        }
101                });
102 
103                Label selectedRunLabel;
104                selectedRunLabel = new Label(container, SWT.NONE);
105                final FormData fd_selectedRunLabel = new FormData();
106                fd_selectedRunLabel.top = new FormAttachment(tree, 10, SWT.DEFAULT);
107                fd_selectedRunLabel.bottom = new FormAttachment(100, -20);
108                fd_selectedRunLabel.left = new FormAttachment(0, 10);
109                selectedRunLabel.setLayoutData(fd_selectedRunLabel);
110                GridLayout labelLayout = new GridLayout();
111                labelLayout.numColumns = 2;
112                selectedRunLabel.setText("Selected Run:");
113 
114                selectedField = new Label(container, SWT.NONE);
115                fd_selectedRunLabel.right = new FormAttachment(selectedField, -5,
116                                SWT.LEFT);
117                final FormData fd_label = new FormData();
118                fd_label.top = new FormAttachment(tree, 10, SWT.DEFAULT);
119                fd_label.bottom = new FormAttachment(100, -27);
120                fd_label.left = new FormAttachment(0, 95);
121                fd_label.right = new FormAttachment(tree, 0, SWT.RIGHT);
122                selectedField.setLayoutData(fd_label);
123                selectedField.setText("...");
124 
125                Label separator = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
126                final FormData fd_separator = new FormData();
127                fd_separator.top = new FormAttachment(selectedField, 12, SWT.DEFAULT);
128                fd_separator.left = new FormAttachment(0, 5);
129                fd_separator.right = new FormAttachment(100, -5);
130                fd_separator.bottom = new FormAttachment(100, -5);
131                separator.setLayoutData(fd_separator);
132 
133                setMessage("Select you run...");
134                //
135                return area;
136        }
137 
138        /** set selectedField value */
139        private void setSelectedField(TreeObject treeObject) {
140                ExperimentRun run = (ExperimentRun) treeObject.getObject();
141 
142                if (selectedField != null)
143                        selectedField.setText(run.getExperimentDateTime());
144        }
145        
146        /* (non-Javadoc)
147         * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
148         */
149        @Override
150        protected void createButtonsForButtonBar(Composite parent) {
151                cancelButton =createButton(parent, IDialogConstants.CANCEL_ID,
152                                IDialogConstants.CANCEL_LABEL, false);
153                cancelButton.addSelectionListener(new SelectionAdapter(){
154 
155                        /* (non-Javadoc)
156                         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
157                         */
158                        @Override
159                        public void widgetSelected(SelectionEvent e) {
160                                selectedObject = null;
161                        }
162                });
163                okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
164                                true);
165                okButton.setEnabled(false);
166        }
167 
168        /* (non-Javadoc)
169         * @see org.eclipse.jface.dialogs.TitleAreaDialog#getInitialSize()
170         */
171        @Override
172        protected Point getInitialSize() {
173                return new Point(397, 372);
174        }
175 
176        public TreeObject getResult() {
177                return selectedObject;
178        }
179}

[all classes][de.uka.ipd.sdq.sensorframework.visualisation.dialogs]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov