source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swt/TrainModelDialog.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.9 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.Button;
7import org.eclipse.swt.SWT;
8import org.eclipse.swt.widgets.Group;
9import org.eclipse.swt.widgets.Label;
10import org.eclipse.swt.widgets.Text;
11import org.eclipse.swt.widgets.Spinner;
12import org.eclipse.swt.layout.GridLayout;
13import org.eclipse.swt.layout.GridData;
14
15public class TrainModelDialog extends Dialog {
16
17        protected Object result;
18        protected Shell shlTrainUsageModel;
19        private Text text_1;
20
21        /**
22         * Create the dialog.
23         * @param parent
24         * @param style
25         */
26        public TrainModelDialog(Shell parent, int style) {
27                super(parent, style);
28                setText("SWT Dialog");
29        }
30
31        /**
32         * Open the dialog.
33         * @return the result
34         */
35        public Object open() {
36                createContents();
37                shlTrainUsageModel.open();
38                shlTrainUsageModel.layout();
39                Display display = getParent().getDisplay();
40                while (!shlTrainUsageModel.isDisposed()) {
41                        if (!display.readAndDispatch()) {
42                                display.sleep();
43                        }
44                }
45                return result;
46        }
47
48        /**
49         * Create contents of the dialog.
50         */
51        private void createContents() {
52                shlTrainUsageModel = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.MIN | SWT.APPLICATION_MODAL);
53                shlTrainUsageModel.setSize(219, 279);
54                shlTrainUsageModel.setText("Train Usage Model");
55                shlTrainUsageModel.setLayout(new GridLayout(2, false));
56               
57                Group grpGeneralInformation = new Group(shlTrainUsageModel, SWT.NONE);
58                grpGeneralInformation.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
59                grpGeneralInformation.setText("Name");
60                grpGeneralInformation.setLayout(new GridLayout(1, false));
61               
62                text_1 = new Text(grpGeneralInformation, SWT.BORDER);
63                text_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
64               
65                Group grpType = new Group(shlTrainUsageModel, SWT.NONE);
66                grpType.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
67                grpType.setText("Type");
68                grpType.setLayout(new GridLayout(1, false));
69               
70                Button btnFirstorderMarkovModel = new Button(grpType, SWT.RADIO);
71                btnFirstorderMarkovModel.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1));
72                btnFirstorderMarkovModel.setText("First-Order Markov Model");
73               
74                Button btnHighorderMarkovModel = new Button(grpType, SWT.RADIO);
75                btnHighorderMarkovModel.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1));
76                btnHighorderMarkovModel.setText("High-Order Markov Model");
77               
78                Button btnPredictionByPartial = new Button(grpType, SWT.RADIO);
79                btnPredictionByPartial.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1));
80                btnPredictionByPartial.setText("Prediction by Partial Match");
81               
82                Button btnDeterministicFiniteAutomaton = new Button(grpType, SWT.RADIO);
83                btnDeterministicFiniteAutomaton.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1));
84                btnDeterministicFiniteAutomaton.setText("Deterministic Finite Automaton");
85               
86                Group grpModelProperties = new Group(shlTrainUsageModel, SWT.NONE);
87                grpModelProperties.setLayout(new GridLayout(4, false));
88                grpModelProperties.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 2, 1));
89                grpModelProperties.setText("Order");
90               
91                Label lblMin = new Label(grpModelProperties, SWT.NONE);
92                lblMin.setText("Min.");
93               
94                Spinner spinner_1 = new Spinner(grpModelProperties, SWT.BORDER);
95               
96                Label lblMax = new Label(grpModelProperties, SWT.NONE);
97                lblMax.setText("Max.");
98               
99                Spinner spinner = new Spinner(grpModelProperties, SWT.BORDER);
100                new Label(grpModelProperties, SWT.NONE);
101                new Label(grpModelProperties, SWT.NONE);
102                new Label(grpModelProperties, SWT.NONE);
103                new Label(grpModelProperties, SWT.NONE);
104               
105                Button btnTrain = new Button(shlTrainUsageModel, SWT.NONE);
106                btnTrain.setText("Train!");
107               
108                Button btnAbort = new Button(shlTrainUsageModel, SWT.NONE);
109                btnAbort.setText("Abort");
110
111        }
112}
Note: See TracBrowser for help on using the repository browser.