PageRenderTime 36ms CodeModel.GetById 9ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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. package org.gjt.sp.jedit.gui;
  23. //{{{ Imports
  24. import javax.swing.*;
  25. import java.awt.event.*;
  26. import java.awt.image.*;
  27. import java.awt.*;
  28. import org.gjt.sp.jedit.*;
  29. //}}}
  30. /**
  31. * A container for dockable windows. This class should never be used
  32. * directly.
  33. * @version $Id: FloatingWindowContainer.java 4272 2002-06-19 06:03:25Z spestov $
  34. * @since jEdit 4.0pre1
  35. */
  36. public class FloatingWindowContainer extends JFrame implements DockableWindowContainer
  37. {
  38. //{{{ FloatingWindowContainer constructor
  39. public FloatingWindowContainer(DockableWindowManager dockableWindowManager)
  40. {
  41. this.dockableWindowManager = dockableWindowManager;
  42. setIconImage(GUIUtilities.getPluginIcon());
  43. setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  44. } //}}}
  45. //{{{ register() method
  46. public void register(DockableWindowManager.Entry entry)
  47. {
  48. this.entry = entry;
  49. setTitle(entry.title);
  50. getContentPane().add(BorderLayout.CENTER,entry.win);
  51. pack();
  52. GUIUtilities.loadGeometry(this,entry.factory.name);
  53. show();
  54. } //}}}
  55. //{{{ add() method
  56. public void add(DockableWindowManager.Entry entry)
  57. {
  58. } //}}}
  59. //{{{ save() method
  60. public void save(DockableWindowManager.Entry entry)
  61. {
  62. GUIUtilities.saveGeometry(this,entry.factory.name);
  63. } //}}}
  64. //{{{ remove() method
  65. public void remove(DockableWindowManager.Entry entry)
  66. {
  67. super.dispose();
  68. } //}}}
  69. //{{{ show() method
  70. public void show(final DockableWindowManager.Entry entry)
  71. {
  72. toFront();
  73. requestFocus();
  74. SwingUtilities.invokeLater(new Runnable()
  75. {
  76. public void run()
  77. {
  78. entry.win.requestDefaultFocus();
  79. }
  80. });
  81. } //}}}
  82. //{{{ isVisible() method
  83. public boolean isVisible(DockableWindowManager.Entry entry)
  84. {
  85. return true;
  86. } //}}}
  87. //{{{ dispose() method
  88. public void dispose()
  89. {
  90. save(entry);
  91. entry.container = null;
  92. entry.win = null;
  93. super.dispose();
  94. } //}}}
  95. //{{{ getMinimumSize() method
  96. public Dimension getMinimumSize()
  97. {
  98. return new Dimension(0,0);
  99. } //}}}
  100. //{{{ Private members
  101. private DockableWindowManager dockableWindowManager;
  102. private DockableWindowManager.Entry entry;
  103. //}}}
  104. }