PageRenderTime 222ms CodeModel.GetById 69ms app.highlight 6ms RepoModel.GetById 143ms app.codeStats 0ms

/jEdit/tags/jedit-4-1-pre5/org/gjt/sp/jedit/gui/FloatingWindowContainer.java

#
Java | 118 lines | 64 code | 14 blank | 40 comment | 0 complexity | b3e10081a0b006cb1fc25bb7719c1c1e MD5 | raw file
  1/*
  2 * FloatingWindowContainer.java - holds dockable windows
  3 * :tabSize=8:indentSize=8:noTabs=false:
  4 * :folding=explicit:collapseFolds=1:
  5 *
  6 * Copyright (C) 2000, 2001, 2002 Slava Pestov
  7 *
  8 * This program is free software; you can redistribute it and/or
  9 * modify it under the terms of the GNU General Public License
 10 * as published by the Free Software Foundation; either version 2
 11 * of the License, or any later version.
 12 *
 13 * This program is distributed in the hope that it will be useful,
 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 * GNU General Public License for more details.
 17 *
 18 * You should have received a copy of the GNU General Public License
 19 * along with this program; if not, write to the Free Software
 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 21 */
 22
 23package org.gjt.sp.jedit.gui;
 24
 25//{{{ Imports
 26import javax.swing.*;
 27import java.awt.event.*;
 28import java.awt.image.*;
 29import java.awt.*;
 30import org.gjt.sp.jedit.*;
 31//}}}
 32
 33/**
 34 * A container for dockable windows. This class should never be used
 35 * directly.
 36 * @version $Id: FloatingWindowContainer.java 4272 2002-06-19 06:03:25Z spestov $
 37 * @since jEdit 4.0pre1
 38 */
 39public class FloatingWindowContainer extends JFrame implements DockableWindowContainer
 40{
 41	//{{{ FloatingWindowContainer constructor
 42	public FloatingWindowContainer(DockableWindowManager dockableWindowManager)
 43	{
 44		this.dockableWindowManager = dockableWindowManager;
 45		setIconImage(GUIUtilities.getPluginIcon());
 46		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
 47	} //}}}
 48
 49	//{{{ register() method
 50	public void register(DockableWindowManager.Entry entry)
 51	{
 52		this.entry = entry;
 53		setTitle(entry.title);
 54
 55		getContentPane().add(BorderLayout.CENTER,entry.win);
 56
 57		pack();
 58		GUIUtilities.loadGeometry(this,entry.factory.name);
 59		show();
 60	} //}}}
 61
 62	//{{{ add() method
 63	public void add(DockableWindowManager.Entry entry)
 64	{
 65	} //}}}
 66
 67	//{{{ save() method
 68	public void save(DockableWindowManager.Entry entry)
 69	{
 70		GUIUtilities.saveGeometry(this,entry.factory.name);
 71	} //}}}
 72
 73	//{{{ remove() method
 74	public void remove(DockableWindowManager.Entry entry)
 75	{
 76		super.dispose();
 77	} //}}}
 78
 79	//{{{ show() method
 80	public void show(final DockableWindowManager.Entry entry)
 81	{
 82		toFront();
 83		requestFocus();
 84		SwingUtilities.invokeLater(new Runnable()
 85		{
 86			public void run()
 87			{
 88				entry.win.requestDefaultFocus();
 89			}
 90		});
 91	} //}}}
 92
 93	//{{{ isVisible() method
 94	public boolean isVisible(DockableWindowManager.Entry entry)
 95	{
 96		return true;
 97	} //}}}
 98
 99	//{{{ dispose() method
100	public void dispose()
101	{
102		save(entry);
103		entry.container = null;
104		entry.win = null;
105		super.dispose();
106	} //}}}
107
108	//{{{ getMinimumSize() method
109	public Dimension getMinimumSize()
110	{
111		return new Dimension(0,0);
112	} //}}}
113
114	//{{{ Private members
115	private DockableWindowManager dockableWindowManager;
116	private DockableWindowManager.Entry entry;
117	//}}}
118}