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.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 = "Neu"; protected final static String newLectureButtonLabel = "Neue Veranstaltung"; protected final static String editButtonLabel = "Bearbeiten"; 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(); // -------------------------------------- // 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); } }