summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureChangeImageLayout.java
blob: d24db283279572f9c179ce04a5a3a22e32c3951a (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
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 org.apache.log4j.Logger;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.ImageListViewer;
import org.openslx.dozmod.gui.control.ImageListViewer.FilterType;
import org.openslx.dozmod.gui.helper.GridManager;

/**
 * Layout for the ChangeLinkedImage of a lecture
 */
@SuppressWarnings("serial")
public class LectureChangeImageLayout extends JDialog {

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

	/**
	 * Buttons
	 */
	protected final JButton btnOk;
	protected final JButton btnClose;

	/**
	 * The ListViewer to use.
	 */
	protected final ImageListViewer imageListViewer;

	/**
	 * The title of the window.
	 */
	private static String title = "VM zum Verlinken auswählen";

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

		// Panel to add everything into, needed for the border.
		JPanel contentPanel = new JPanel();
		contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
		add(contentPanel);

		GridManager grid = new GridManager(contentPanel, 1);

		// create the imageListViewer and add it to the pane.
		imageListViewer = new ImageListViewer(FilterType.USABLE);

		// Panel for the buttons at the bottom
		JPanel buttonPane = new JPanel();
		buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
		btnOk = new JButton("Übernehmen");
		buttonPane.add(Box.createGlue());
		buttonPane.add(btnOk);
		btnClose = new JButton("Abbrechen");
		buttonPane.add(btnClose);

		// Put everything into the grid
		grid.add(imageListViewer).fill(true, true).expand(true, true);
		grid.nextRow();
		grid.add(buttonPane).fill(true, false).expand(false, false);
		grid.nextRow();
		grid.finish(false);

		contentPanel.setPreferredSize(Gui.getScaledDimension(480, 350));

		pack();
		setLocationRelativeTo(modalParent);
	}
}