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

                                             
                      



                                 


                             
                           
                          



                                                       
                                             




                                                            



                                                                           
                                                             


                                               
 


                                                                                                                 
 
                                                                                         
                                                            

                                                                                                                            
                                                             



                                                                       
                                                                                  



                                                                                    
                                        
                                                  

                                                            
                                          



                                                                            
                                   
                                                                   
                       


                                                                    

         
package org.openslx.dozmod.gui.window.layout;

import java.awt.Color;
import java.awt.Window;
import java.util.List;

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

import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.LocationSelector;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.control.WordWrapLabel;
import org.openslx.dozmod.gui.helper.GridManager;

public class LocationSelectionWindowLayout extends JDialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7722131149214063979L;
	protected final LocationSelector ctlLocationSelector;
	protected final JButton btnSaveChanges;
	protected final JButton btnClose;
	protected final QLabel lblError;

	public LocationSelectionWindowLayout(Window modalParent, List<Integer> locationList,
			boolean limitToLocations) {
		super(modalParent, modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);

		getRootPane().setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		GridManager grid = new GridManager(this, 1);
		WordWrapLabel header = new WordWrapLabel(
				"Hier können Sie die Räume auswählen, in denen diese Veranstaltung sichtbar sein soll.");
		ctlLocationSelector = new LocationSelector();
		grid.add(header).fill(true, false).expand(true, false);
		grid.nextRow();
		grid.add(new JSeparator());
		grid.nextRow();
		grid.add(ctlLocationSelector).fill(true, true).expand(true, true);
		grid.nextRow();
		// button panel on the bottom
		JPanel buttonPanel = new JPanel();
		buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
		lblError = new QLabel();
		lblError.setForeground(Color.RED);
		btnClose = new JButton("Abbrechen");
		btnSaveChanges = new JButton("Übernehmen");
		buttonPanel.add(lblError);
		buttonPanel.add(Box.createHorizontalGlue());
		buttonPanel.add(btnClose);
		buttonPanel.add(btnSaveChanges);
		grid.add(buttonPanel).fill(true, false).expand(true, false);
		grid.finish(false);
		setPreferredSize(Gui.getScaledDimension(550, 500));
		pack();
		if (modalParent != null) {
			Gui.centerShellOverShell(modalParent, this);
		}
	}
}