summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java
blob: 3fdff1c7716b54de87548c39072dad2c5b372a90 (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
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
package org.openslx.dozmod.gui.window.layout;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JPanel;

import org.apache.log4j.Logger;
import org.openslx.dozmod.gui.control.ImageListViewer;
import org.openslx.dozmod.gui.control.ImageListViewer.FilterType;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.helper.CompositePage;
import org.openslx.dozmod.gui.helper.GridManager;


@SuppressWarnings("serial")
public abstract class ImageListWindowLayout extends CompositePage {

	private final static Logger LOGGER = Logger.getLogger(ImageListWindowLayout.class);

	protected final static String infoTextString = "Hier können Sie Virtuelle Maschinen hochladen, herunterladen, bearbeiten und löschen.";
	protected final static String infoTitleString = "Übersicht Virtuelle Maschinen";
	protected final static String newButtonLabel = "Neue VM";
	protected final static String newLectureButtonLabel = "Neue Veranstaltung";
	protected final static String editButtonLabel = "Detailansicht";
	protected final static String downloadButtonLabel = "Download";
	protected final static String deleteButtonLabel = "Löschen";
	protected final static String switchViewButtonLabel = "Zu 'Veranstaltungen' wechseln";

	// --------------------------------------
	// search field, table and buttons
	protected final ImageListViewer imageListViewer;
	protected final JButton newButton;
	protected final JButton newLectureButton;
	protected final JButton editButton;
	protected final JButton downloadButton;
	protected final JButton deleteButton;
	protected final JButton switchViewButton;

	public ImageListWindowLayout() {
		super(new BorderLayout());
		setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

		// --------------------------------------
		// Info panel on the top with a search box
		JPanel infoPanel = new JPanel(new BorderLayout());
		QLabel infoTitle = new QLabel(infoTitleString);
		infoTitle.setFont(infoTitle.getFont().deriveFont(Font.BOLD));
		QLabel infoText = new QLabel(infoTextString);
		infoPanel.add(infoTitle, BorderLayout.NORTH);
		infoPanel.add(infoText, BorderLayout.CENTER);

		imageListViewer = new ImageListViewer(FilterType.USABLE);

		// --------------------------------------
		// the buttons at the bottom
		JPanel buttonPanel = new JPanel();
		buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
		buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
		newButton = new JButton(newButtonLabel);
		newLectureButton = new JButton(newLectureButtonLabel);
		deleteButton = new JButton(deleteButtonLabel);
		editButton = new JButton(editButtonLabel);
		downloadButton = new JButton(downloadButtonLabel);
		switchViewButton = new JButton(switchViewButtonLabel);
		buttonPanel.add(newButton);
		buttonPanel.add(Box.createRigidArea(new Dimension(5,  0)));
		buttonPanel.add(newLectureButton);
		buttonPanel.add(editButton);
		buttonPanel.add(downloadButton);
		buttonPanel.add(Box.createRigidArea(new Dimension(5,  0)));
		buttonPanel.add(deleteButton);
		buttonPanel.add(Box.createHorizontalGlue());
		buttonPanel.add(switchViewButton);

		// put everything together
		GridManager grid = new GridManager(this, 1);
		grid.add(infoPanel).fill(true, false).expand(true, false);
		grid.nextRow();
		grid.add(imageListViewer).fill(true, true).expand(true, true);
		grid.nextRow();
		grid.add(buttonPanel).fill(true, false).expand(true, false);
		grid.nextRow();
		grid.finish(false);
	}

}