View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2005 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  package ch.elca.el4j.services.gui.swing;
18  
19  import javax.swing.JDesktopPane;
20  
21  import ch.elca.el4j.services.gui.swing.mdi.WindowManager;
22  import ch.elca.el4j.services.gui.swing.mdi.WindowMenu;
23  
24  
25  /**
26   * Parent class for MDI applications not using an XML GUI description.
27   * MDI Applications using XML GUIs should use {@link AbstractMDIApplication}.
28   *
29   * @svnLink $Revision: 3956 $;$Date: 2009-10-21 11:14:09 +0200 (Mi, 21. Okt 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/swing/src/main/java/ch/elca/el4j/services/gui/swing/MDIApplication.java $
30   *
31   * @author Stefan Wismer (SWI)
32   */
33  public abstract class MDIApplication extends AbstractMDIApplication {
34  	
35  	/**
36  	 * The desktop pane of this MDIApplication.
37  	 *  @see #createDefaultDesktopPane()
38  	 */
39  	protected JDesktopPane desktopPane;
40  
41  	/**
42  	 * Helps to manage the mdi menu and pane.
43  	 */
44  	protected WindowManager m_windowManager;
45  	
46  	
47  	/** {@inheritDoc} */
48  	@Override
49  	protected JDesktopPane getDesktopPane() {
50  		return desktopPane;
51  	}
52  
53  	/**
54  	 * Creates a default desktop pane with a default Menu This method could be
55  	 * overridden in case you would like another desktop pane. <br>
56  	 * Stores the created desktop pane in the {@link #desktopPane}
57  	 */
58  	protected void createDefaultDesktopPane() {
59  		desktopPane = new JDesktopPane();
60  
61  		// create window manager and add window menu
62  		WindowMenu windowMenu = new WindowMenu();
63  		m_windowManager = new WindowManager(desktopPane, windowMenu);
64  		windowMenu.setWindowManager(m_windowManager);
65  		getMainFrame().getJMenuBar().add(windowMenu,
66  			getMainFrame().getJMenuBar().getMenuCount() - 1);
67  	}
68  }