source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swt/ModelProperties.java @ 190

Last change on this file since 190 was 188, checked in by sherbold, 13 years ago

Added a first prototype of a GUI for the application. The GUI is still incomplete, many functions are not yet implemented. The GUI is based on SWT. It has only been tested on Windows 7, 32 Bit; the SWT-jar-files are from Eclipse 3.7 32 bit Windows and may not be sufficient for other operating systems.

  • Property svn:mime-type set to text/plain
File size: 3.3 KB
Line 
1package de.ugoe.cs.eventbench.swt;
2
3import org.eclipse.swt.widgets.Dialog;
4import org.eclipse.swt.widgets.Display;
5import org.eclipse.swt.widgets.Shell;
6import org.eclipse.swt.widgets.List;
7import org.eclipse.swt.SWT;
8import org.eclipse.swt.widgets.Group;
9import org.eclipse.swt.widgets.Label;
10import org.eclipse.swt.widgets.Button;
11import org.eclipse.swt.layout.GridLayout;
12import org.eclipse.swt.layout.GridData;
13import org.eclipse.swt.layout.FillLayout;
14
15public class ModelProperties 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 ModelProperties(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}
Note: See TracBrowser for help on using the repository browser.