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
106
107
108
109
110
|
package org.openslx.dozmod.gui.window.layout;
import java.awt.BorderLayout;
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.openslx.dozmod.gui.Gui;
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;
import org.openslx.dozmod.gui.helper.I18n;
public abstract class ImageListWindowLayout extends CompositePage {
/**
* Version for serialization.
*/
private static final long serialVersionUID = 2558709606798079473L;
private static final int ICON_SIZE_Y = 24;
protected final static String infoTextString = I18n.WINDOW_LAYOUT.getString("ImageList.Label.title.text");
protected final static String infoTitleString = I18n.WINDOW_LAYOUT.getString("ImageList.Label.info.text");
protected final static String newButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.newVM.text");
protected final static String newLectureButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.newLecture.text");
protected final static String editButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.edit.text");
protected final static String downloadButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.download.text");
protected final static String deleteButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.delete.text");
protected final static String switchViewButtonLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.switchView.text");
protected final static String showPublishedImagesLabel = I18n.WINDOW_LAYOUT.getString("ImageList.Button.showPublishedImages.text");
// --------------------------------------
// search field, table and buttons
protected final ImageListViewer ctlImageListViewer;
protected final JButton btnNewVm;
protected final JButton btnNewLecture;
protected final JButton btnEditDetails;
protected final JButton btnDownload;
protected final JButton btnDelete;
protected final JButton btnSwitchView;
protected final JButton btnShowPublishedImages;
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);
ctlImageListViewer = 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));
btnNewVm = new JButton(newButtonLabel, Gui.getScaledIconResource("/img/new-vm-icon.png",
I18n.WINDOW_LAYOUT.getString("ImageList.Button.newVM.description"), ICON_SIZE_Y, buttonPanel));
btnEditDetails = new JButton(editButtonLabel, Gui.getScaledIconResource("/img/edit-icon.png",
I18n.WINDOW_LAYOUT.getString("ImageList.Button.edit.description"), ICON_SIZE_Y, buttonPanel));
btnDelete = new JButton(deleteButtonLabel, Gui.getScaledIconResource("/img/delete-icon.png",
I18n.WINDOW_LAYOUT.getString("ImageList.Button.delete.description"), ICON_SIZE_Y, buttonPanel));
btnDownload = new JButton(downloadButtonLabel, Gui.getScaledIconResource("/img/download-icon.png",
I18n.WINDOW_LAYOUT.getString("ImageList.Button.download.description"), ICON_SIZE_Y, buttonPanel));
btnNewLecture = new JButton(newLectureButtonLabel, Gui.getScaledIconResource("/img/new-lecture-icon.png",
I18n.WINDOW_LAYOUT.getString("ImageList.Button.newLecture.description"), ICON_SIZE_Y, buttonPanel));
btnShowPublishedImages = new JButton(showPublishedImagesLabel,
Gui.getScaledIconResource("/img/published-vm-icon.png",
I18n.WINDOW_LAYOUT.getString("ImageList.Button.showPublishedImages.description"),
ICON_SIZE_Y, buttonPanel));
btnShowPublishedImages.setVisible(false); // this gets enabled later when the API version can be queried
btnSwitchView = new JButton(switchViewButtonLabel, Gui.getScaledIconResource("/img/switch-icon.png",
I18n.WINDOW_LAYOUT.getString("ImageList.Button.switchView.description"), ICON_SIZE_Y, buttonPanel));
buttonPanel.add(btnNewVm);
buttonPanel.add(btnEditDetails);
buttonPanel.add(btnDelete);
buttonPanel.add(Box.createHorizontalStrut(5));
buttonPanel.add(btnDownload);
buttonPanel.add(Box.createHorizontalStrut(5));
buttonPanel.add(btnNewLecture);
buttonPanel.add(Box.createHorizontalStrut(5));
buttonPanel.add(btnShowPublishedImages);
buttonPanel.add(Box.createHorizontalGlue());
buttonPanel.add(btnSwitchView);
// put everything together
GridManager grid = new GridManager(this, 1);
grid.add(infoPanel).fill(true, false).expand(true, false);
grid.nextRow();
grid.add(ctlImageListViewer).fill(true, true).expand(true, true);
grid.nextRow();
grid.add(buttonPanel).fill(true, false).expand(true, false);
grid.nextRow();
grid.finish(false);
}
}
|