summaryrefslogblamecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java
blob: 1fa98797ff64088e9653c142e278f96323918a58 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                             
 
                             
                          
                     
 
                                 
                       

                             
                          

                               
                                                      
                                                                 
                                             
                                                   
                                                 
 
                           
                                                                   
 

                                                                                           
                                                                                                                                                 
                                                                                         
                                                                 
                                                                                   
                                                                        
                                                                       
                                                                     
                                                                                              
 
                                                 
                                          






                                                           
 
                                        
                                          
                                                                       



                                                                  
                                                               
                                                                             
                                                             
                                                             
                                                             
 
                                                                            
 
                                                         

                                                  
                                                                                   
                                                                                       






                                                                   
                                                                          


                                                
                                                                          
                                           
                                                            
                                               




                                                                          
                                                                                 



                                                                            
         
 
 
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 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;

	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);
		btnNewLecture = new JButton(newLectureButtonLabel);
		btnDelete = new JButton(deleteButtonLabel);
		btnEditDetails = new JButton(editButtonLabel);
		btnDownload = new JButton(downloadButtonLabel);
		btnSwitchView = new JButton(switchViewButtonLabel);
		buttonPanel.add(btnNewVm);
		buttonPanel.add(Box.createRigidArea(new Dimension(5, 0)));
		buttonPanel.add(btnNewLecture);
		buttonPanel.add(btnEditDetails);
		buttonPanel.add(btnDownload);
		buttonPanel.add(Box.createRigidArea(new Dimension(5, 0)));
		buttonPanel.add(btnDelete);
		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);
	}

}