summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainMenuWindowLayout.java
blob: 8448659e11112f5198f93afcd269e05cf2038294 (plain) (blame)
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
package org.openslx.dozmod.gui.window.layout;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;

import org.openslx.dozmod.Branding;
import org.openslx.dozmod.gui.helper.CompositePage;
import org.openslx.dozmod.gui.helper.GridManager;
import org.openslx.dozmod.gui.helper.I18n;
import org.openslx.dozmod.util.ResourceLoader;

@SuppressWarnings("serial")
public abstract class MainMenuWindowLayout extends CompositePage {
	// text for info for the vms selection
	protected String vmInfo = I18n.WINDOW_LAYOUT.getString("MainMenu.Label.vmInfo.text");

	// text for the info for the lecture selection
	protected String lecturesInfo = I18n.WINDOW_LAYOUT.getString("MainMenu.Label.lecturesInfo.text");

	// buttons
	protected final JLabel lblVirtualMachinesLogo;
	protected final JLabel lblLectureLogo;
	protected final JButton btnShowVirtualMachines;
	protected final JButton btnShowLectures;

	public MainMenuWindowLayout() {
		this.setBorder(BorderFactory.createTitledBorder(
				I18n.WINDOW_LAYOUT.getString("MainMenu.TitledBorder.title", Branding.getApplicationName())));
		GridManager grid = new GridManager(this, 2);

		lblVirtualMachinesLogo = new JLabel(ResourceLoader.getIcon("/img/virtualization.png",
				I18n.WINDOW_LAYOUT.getString("MainMenu.Label.vmLogo.description")));
		JLabel vmInfoLabel = new JLabel(vmInfo);
		vmInfoLabel.setVerticalAlignment(JLabel.TOP);
		lblLectureLogo = new JLabel(ResourceLoader.getIcon("/img/lecture.png",
				I18n.WINDOW_LAYOUT.getString("MainMenu.Label.lecturesLogo.description")));
		JLabel lecturesInfoLabel = new JLabel(lecturesInfo);
		lecturesInfoLabel.setVerticalAlignment(JLabel.TOP);
		btnShowVirtualMachines = new JButton(I18n.WINDOW_LAYOUT.getString("MainMenu.Button.showVMs.text"));
		btnShowLectures = new JButton(I18n.WINDOW_LAYOUT.getString("MainMenu.Button.showLectures.text"));
		grid.add(lblVirtualMachinesLogo).fill(true, false).expand(true, false);
		grid.add(lblLectureLogo).fill(true, false).expand(true, false);
		grid.nextRow();
		grid.add(btnShowVirtualMachines).fill(true, false).expand(true, false);
		grid.add(btnShowLectures).fill(true, false).expand(true, false);
		grid.nextRow();
		grid.add(vmInfoLabel).fill(true, true).expand(true, true);
		grid.add(lecturesInfoLabel).fill(true, true).expand(true, true);
		grid.nextRow();

		grid.finish(true);
	}

}