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

import java.awt.Window;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.UIManager;

import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.control.table.ImagePublishedTable;
import org.openslx.dozmod.gui.control.table.QScrollPane;
import org.openslx.dozmod.gui.helper.GridManager;

@SuppressWarnings("serial")
public class ImagePublishedWindowLayout extends JDialog {

	protected final ImagePublishedTable imagePublishedTable;

	private static final int ICON_SIZE_Y = 24;
	protected final JTextField txtSearch;
	protected final JButton btnDownload;
	protected final JButton btnSatDownload;
	protected final JButton btnClose;

	private static String title = "Öffentliche VMs";

	protected ImagePublishedWindowLayout(Window modalParent) {
		super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL
				: ModalityType.MODELESS);

		GridManager grid = new GridManager(this, 1);
		// --------------- filter field --------------------------------------
		JPanel filterPanel = new JPanel();
		filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.LINE_AXIS));
		filterPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
		filterPanel.add(new QLabel("Suchen: "));
		txtSearch = new JTextField();
		filterPanel.add(txtSearch);
		// --------------- end filter field --------------------------------

		// --------------- user table --------------------------------------
		JPanel listPane = new JPanel();
		listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
		listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		imagePublishedTable = new ImagePublishedTable();
		QScrollPane jsp = new QScrollPane(imagePublishedTable);
		jsp.setBackground(UIManager.getColor("Table.background"));
		listPane.add(jsp);
		// --------------- end user table ------------------------------------

		// --------------- button panel --------------------------------------
		JPanel buttonPanel = new JPanel();
		buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
		buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
		btnDownload = new JButton("Herunterladen", Gui.getScaledIconResource("/img/download-icon.png",
				"Herunterladen", ICON_SIZE_Y, buttonPanel));
		buttonPanel.add(btnDownload);
		btnSatDownload = new JButton("Auf Satellit herunterladen", Gui.getScaledIconResource("/img/download-to-sat-icon.png",
				"Auf Satellit herunterladen", ICON_SIZE_Y, buttonPanel));
		buttonPanel.add(btnSatDownload);
		buttonPanel.add(Box.createHorizontalGlue());
		btnClose = new JButton("Schließen");
		buttonPanel.add(btnClose);
		// --------------- end button panel ----------------------------------

		// pack it all
		grid.add(filterPanel).fill(true, false).expand(true, false);
		grid.nextRow();
		grid.add(listPane).fill(true, true).expand(true, true);
		grid.nextRow();
		grid.add(buttonPanel).fill(true, false).expand(true, false);
		grid.nextRow();
		grid.finish(false);

		setPreferredSize(Gui.getScaledDimension(950, 400));
		pack();
	}
}