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.Group;
|
---|
7 | import org.eclipse.swt.SWT;
|
---|
8 | import org.eclipse.swt.widgets.Text;
|
---|
9 | import org.eclipse.swt.widgets.Button;
|
---|
10 | import org.eclipse.swt.widgets.Spinner;
|
---|
11 | import org.eclipse.swt.widgets.Label;
|
---|
12 | import org.eclipse.ui.forms.widgets.FormToolkit;
|
---|
13 | import org.eclipse.swt.layout.GridLayout;
|
---|
14 | import org.eclipse.swt.layout.GridData;
|
---|
15 |
|
---|
16 | public class GenerateSequencesDialog extends Dialog {
|
---|
17 |
|
---|
18 | protected Object result;
|
---|
19 | protected Shell shlGenerateSequences;
|
---|
20 | private Text text;
|
---|
21 | private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Create the dialog.
|
---|
25 | * @param parent
|
---|
26 | * @param style
|
---|
27 | */
|
---|
28 | public GenerateSequencesDialog(Shell parent, int style) {
|
---|
29 | super(parent, style);
|
---|
30 | setText("SWT Dialog");
|
---|
31 | }
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Open the dialog.
|
---|
35 | * @return the result
|
---|
36 | */
|
---|
37 | public Object open() {
|
---|
38 | createContents();
|
---|
39 | shlGenerateSequences.open();
|
---|
40 | shlGenerateSequences.layout();
|
---|
41 | Display display = getParent().getDisplay();
|
---|
42 | while (!shlGenerateSequences.isDisposed()) {
|
---|
43 | if (!display.readAndDispatch()) {
|
---|
44 | display.sleep();
|
---|
45 | }
|
---|
46 | }
|
---|
47 | return result;
|
---|
48 | }
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Create contents of the dialog.
|
---|
52 | */
|
---|
53 | private void createContents() {
|
---|
54 | shlGenerateSequences = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
|
---|
55 | shlGenerateSequences.setSize(201, 248);
|
---|
56 | shlGenerateSequences.setText("Generate Sequences");
|
---|
57 | shlGenerateSequences.setLayout(new GridLayout(2, false));
|
---|
58 |
|
---|
59 | Group group = new Group(shlGenerateSequences, SWT.NONE);
|
---|
60 | group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
|
---|
61 | group.setText("Name");
|
---|
62 | group.setLayout(new GridLayout(1, false));
|
---|
63 |
|
---|
64 | text = new Text(group, SWT.BORDER);
|
---|
65 | text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
---|
66 |
|
---|
67 | Group grpNumber = new Group(shlGenerateSequences, SWT.NONE);
|
---|
68 | grpNumber.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
|
---|
69 | grpNumber.setText("Number");
|
---|
70 | grpNumber.setLayout(new GridLayout(2, false));
|
---|
71 |
|
---|
72 | Spinner spinner = new Spinner(grpNumber, SWT.BORDER);
|
---|
73 | spinner.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
---|
74 |
|
---|
75 | Button btnAll = new Button(grpNumber, SWT.CHECK);
|
---|
76 | btnAll.setText("All");
|
---|
77 |
|
---|
78 | Group grpLength = new Group(shlGenerateSequences, SWT.NONE);
|
---|
79 | grpLength.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
|
---|
80 | grpLength.setText("Length");
|
---|
81 | grpLength.setLayout(new GridLayout(4, false));
|
---|
82 |
|
---|
83 | Button btnAll_1 = new Button(grpLength, SWT.CHECK);
|
---|
84 | btnAll_1.setText("All");
|
---|
85 | new Label(grpLength, SWT.NONE);
|
---|
86 | new Label(grpLength, SWT.NONE);
|
---|
87 | new Label(grpLength, SWT.NONE);
|
---|
88 |
|
---|
89 | Label label = new Label(grpLength, SWT.NONE);
|
---|
90 | label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
|
---|
91 | label.setText("Min.");
|
---|
92 |
|
---|
93 | Spinner spinner_2 = new Spinner(grpLength, SWT.BORDER);
|
---|
94 | spinner_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
---|
95 |
|
---|
96 | Label label_1 = new Label(grpLength, SWT.NONE);
|
---|
97 | label_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
|
---|
98 | label_1.setText("Max.");
|
---|
99 |
|
---|
100 | Spinner spinner_1 = new Spinner(grpLength, SWT.BORDER);
|
---|
101 | spinner_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
---|
102 | spinner_1.setToolTipText("0 means no limitations");
|
---|
103 |
|
---|
104 | Button btnGenerate = formToolkit.createButton(shlGenerateSequences, "Generate!", SWT.NONE);
|
---|
105 |
|
---|
106 | Button btnAbort = formToolkit.createButton(shlGenerateSequences, "Abort", SWT.NONE);
|
---|
107 |
|
---|
108 | }
|
---|
109 | }
|
---|