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

                                             
                          
                       





                                 
                          
                              
                             
 
                                  
                                             
                                                        
                                                      
                                                 



                                                   

                                            


                                             


                                                      
                                                                                  


                                                                                              
                                                            
 




                                                                                       

                                             
                                                                                    
 
                                                                                    


                                                                                    
                                            
                                                             

                                                                          
                                                                                      
 
                                                                                      



                                                                                     

                                                      
                                                                          

                                                        
                                                                                      

                              







                                                                            
                                                                   

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

import java.awt.Dimension;
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 javax.swing.JTextField;
import javax.swing.UIManager;

import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.control.QLabel;
import org.openslx.dozmod.gui.control.table.QScrollPane;
import org.openslx.dozmod.gui.control.table.UserTable;
import org.openslx.dozmod.gui.helper.GridManager;

@SuppressWarnings("serial")
public class UserListWindowLayout extends JDialog {

	protected final UserTable userTable;

	protected final JButton btnConfirm;
	protected final JButton btnCancel;
	protected final JTextField txtSearch;

	private static String title = "Benutzerliste";

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

		GridManager grid = new GridManager(this, 1);

		// --------------- filter field --------------------------------------
		JPanel filterPanel = new JPanel();
		filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.LINE_AXIS));
		filterPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
		filterPanel.add(new QLabel("Suchen: "));
		txtSearch = new JTextField();
		filterPanel.add(txtSearch);
		// --------------- end filter field --------------------------------

		// --------------- user table --------------------------------------
		JPanel listPane = new JPanel();
		listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
		listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		userTable = new UserTable();
		QScrollPane jsp = new QScrollPane(userTable);
		jsp.setBackground(UIManager.getColor("Table.background"));
		listPane.add(jsp);
		// --------------- end user table ------------------------------------

		// --------------- button panel --------------------------------------
		JPanel buttonPane = new JPanel();
		buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
		buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
		buttonPane.add(Box.createHorizontalGlue());
		btnCancel = new JButton("Schließen");
		buttonPane.add(btnCancel);
		buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
		btnConfirm = new JButton(buttonCaption);
		buttonPane.add(btnConfirm);
		// --------------- end button panel ----------------------------------

		// pack it all
		grid.add(filterPanel).fill(true, false).expand(true, false);
		grid.nextRow();
		grid.add(listPane).fill(true, true).expand(true, true);
		grid.nextRow();
		grid.add(buttonPane).fill(true, false).expand(true, false);
		grid.nextRow();
		grid.finish(false);

		setPreferredSize(Gui.getScaledDimension(300, 350));
		pack();
	}
}