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

                                             









                                 
                                  
                                                      
                                                                 

                                                 



                                                
                                                       
 
                                                                                              






                                         







                                                        
                                                                    
 
                                                                










                                                                                              
                                                                         
















                                                                                     
                                                                                

                       
                                                   

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

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 org.apache.log4j.Logger;
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.helper.GridManager;

/**
 * Layout for the ChangeLinkedImage of a lecture
 */
@SuppressWarnings("serial")
public class LectureChangeImageLayout extends JDialog {

	private static final Logger LOGGER = Logger.getLogger(LectureChangeImageLayout.class);

	/**
	 * Buttons
	 */
	protected final JButton btnOk;
	protected final JButton btnClose;

	/**
	 * The ListViewer to use.
	 */
	protected final ImageListViewer imageListViewer;

	/**
	 * The title of the window.
	 */
	private static String title = "VM zum Verlinken auswählen";

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

		// Panel to add everything into, needed for the border.
		JPanel contentPanel = new JPanel();
		contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
		add(contentPanel);

		GridManager grid = new GridManager(contentPanel, 1);

		// create the imageListViewer and add it to the pane.
		imageListViewer = new ImageListViewer(FilterType.USABLE);

		// Panel for the buttons at the bottom
		JPanel buttonPane = new JPanel();
		buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
		btnOk = new JButton("Übernehmen");
		buttonPane.add(Box.createGlue());
		buttonPane.add(btnOk);
		btnClose = new JButton("Abbrechen");
		buttonPane.add(btnClose);

		// Put everything into the grid
		grid.add(imageListViewer).fill(true, true).expand(true, true);
		grid.nextRow();
		grid.add(buttonPane).fill(true, false).expand(false, false);
		grid.nextRow();
		grid.finish(false);

		contentPanel.setPreferredSize(Gui.getScaledDimension(480, 350));

		pack();
		setLocationRelativeTo(modalParent);
	}
}