1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
package gui.core;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class MainWindowComposite extends Composite {
// text for info for the vms selection
String vmInfo = "Infotext VMs.";
// text for the info for the lecture selection
String lecturesInfo = "Infotext Veranstaltungen.";
public MainWindowComposite(final Shell mainShell) {
super(mainShell, SWT.NONE);
this.setLayout(new GridLayout(2, true));
// group for the vm selection
Group vmGroup = new Group(this, SWT.NONE);
vmGroup.setLayout(new GridLayout());
vmGroup.setText("VMs");
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
vmGroup.setLayoutData(gridData);
Button vmButton = new Button(vmGroup, SWT.PUSH);
vmButton.setText("VM - Übersicht");
gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true);
vmButton.setLayoutData(gridData);
Label vmInfoLabel = new Label(vmGroup, SWT.NONE);
vmInfoLabel.setText(vmInfo);
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
vmInfoLabel.setLayoutData(gridData);
//g group for the lecture selection
Group lecturesGroup = new Group(this, SWT.NONE);
lecturesGroup.setLayout(new GridLayout());
lecturesGroup.setText("Veranstaltungen");
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
lecturesGroup.setLayoutData(gridData);
Button lecturesButton = new Button(lecturesGroup, SWT.PUSH);
lecturesButton.setText("Veranstanstaltungen");
gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true);
lecturesButton.setLayoutData(gridData);
Label lecturesInfoLabel = new Label(lecturesGroup, SWT.NONE);
lecturesInfoLabel.setText(lecturesInfo);
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
lecturesInfoLabel.setLayoutData(gridData);
// function for vmButton
vmButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
clickedVMButton();
}
});
// function for lecturesButton
lecturesButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
clickedLecturesButton();
}
});
}
//
// logical functions for GUI
//
/**
* function for the VMButton
*/
protected void clickedVMButton() {
System.out.println("VM-Button clicked!");
}
/**
* function for the lecturesButton
*/
protected void clickedLecturesButton() {
System.out.println("lecturesButton clicked!");
}
}
|