1 | package de.ugoe.cs.eventbench.swt;
|
---|
2 |
|
---|
3 | import org.eclipse.swt.widgets.Dialog;
|
---|
4 | import org.eclipse.swt.widgets.Display;
|
---|
5 | import org.eclipse.swt.widgets.Shell;
|
---|
6 | import org.eclipse.swt.widgets.List;
|
---|
7 | import org.eclipse.swt.SWT;
|
---|
8 | import org.eclipse.swt.widgets.Group;
|
---|
9 | import org.eclipse.swt.widgets.Label;
|
---|
10 | import org.eclipse.swt.widgets.Button;
|
---|
11 | import org.eclipse.swt.layout.GridLayout;
|
---|
12 | import org.eclipse.swt.layout.GridData;
|
---|
13 | import org.eclipse.swt.layout.FillLayout;
|
---|
14 |
|
---|
15 | public class ModelPropertiesDialog extends Dialog {
|
---|
16 |
|
---|
17 | protected Object result;
|
---|
18 | protected Shell shlModelProperties;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Create the dialog.
|
---|
22 | * @param parent
|
---|
23 | * @param style
|
---|
24 | */
|
---|
25 | public ModelPropertiesDialog(Shell parent, int style) {
|
---|
26 | super(parent, style);
|
---|
27 | setText("SWT Dialog");
|
---|
28 | }
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Open the dialog.
|
---|
32 | * @return the result
|
---|
33 | */
|
---|
34 | public Object open() {
|
---|
35 | createContents();
|
---|
36 | shlModelProperties.open();
|
---|
37 | shlModelProperties.layout();
|
---|
38 | Display display = getParent().getDisplay();
|
---|
39 | while (!shlModelProperties.isDisposed()) {
|
---|
40 | if (!display.readAndDispatch()) {
|
---|
41 | display.sleep();
|
---|
42 | }
|
---|
43 | }
|
---|
44 | return result;
|
---|
45 | }
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Create contents of the dialog.
|
---|
49 | */
|
---|
50 | private void createContents() {
|
---|
51 | shlModelProperties = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE);
|
---|
52 | shlModelProperties.setSize(230, 318);
|
---|
53 | shlModelProperties.setText("Model Properties");
|
---|
54 | shlModelProperties.setLayout(new GridLayout(2, false));
|
---|
55 |
|
---|
56 | Group grpEvents = new Group(shlModelProperties, SWT.NONE);
|
---|
57 | FillLayout fl_grpEvents = new FillLayout(SWT.HORIZONTAL);
|
---|
58 | fl_grpEvents.marginHeight = 5;
|
---|
59 | fl_grpEvents.marginWidth = 5;
|
---|
60 | grpEvents.setLayout(fl_grpEvents);
|
---|
61 | grpEvents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
|
---|
62 | grpEvents.setText("Events");
|
---|
63 |
|
---|
64 | List list = new List(grpEvents, SWT.BORDER | SWT.V_SCROLL);
|
---|
65 |
|
---|
66 | Group grpStatistics = new Group(shlModelProperties, SWT.NONE);
|
---|
67 | grpStatistics.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
|
---|
68 | grpStatistics.setText("Statistics");
|
---|
69 | grpStatistics.setLayout(new GridLayout(2, false));
|
---|
70 |
|
---|
71 | Label lblNumEvents = new Label(grpStatistics, SWT.NONE);
|
---|
72 | lblNumEvents.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
|
---|
73 | lblNumEvents.setText("Num. Events");
|
---|
74 |
|
---|
75 | Label label = new Label(grpStatistics, SWT.RIGHT);
|
---|
76 | label.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
|
---|
77 | label.setText("####");
|
---|
78 |
|
---|
79 | Label lblNumTrieLeafs = new Label(grpStatistics, SWT.NONE);
|
---|
80 | lblNumTrieLeafs.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
|
---|
81 | lblNumTrieLeafs.setText("Size (#Trie Leafs)");
|
---|
82 |
|
---|
83 | Label label_1 = new Label(grpStatistics, SWT.RIGHT);
|
---|
84 | label_1.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
|
---|
85 | label_1.setText("####");
|
---|
86 |
|
---|
87 | Label lblEntropy = new Label(grpStatistics, SWT.NONE);
|
---|
88 | lblEntropy.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
|
---|
89 | lblEntropy.setText("Entropy");
|
---|
90 |
|
---|
91 | Label label_2 = new Label(grpStatistics, SWT.RIGHT);
|
---|
92 | label_2.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
|
---|
93 | label_2.setText("####");
|
---|
94 |
|
---|
95 | Button btnCalculateEntropy = new Button(shlModelProperties, SWT.NONE);
|
---|
96 | btnCalculateEntropy.setText("Calculate Entropy");
|
---|
97 |
|
---|
98 | Button btnClose = new Button(shlModelProperties, SWT.NONE);
|
---|
99 | btnClose.setText("Close");
|
---|
100 |
|
---|
101 | }
|
---|
102 | }
|
---|