DesktopManager.java 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /* DesktopManager.java --
  2. Copyright (C) 2002, 2004 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package javax.swing;
  32. /**
  33. * DesktopManagers are responsible for implementing the behaviours for the
  34. * JInternalFrames that belong to JDesktopPanes. Actions such as maximizing,
  35. * minimizing, iconifying, etc will be delegated to the DesktopManager.
  36. */
  37. public interface DesktopManager
  38. {
  39. /**
  40. * This method will cause the JInternalFrame to be displayed in the set
  41. * location. This usually is not needed since the user will add the
  42. * JInternalFrame to a Container separately.
  43. *
  44. * @param frame The JInternalFrame to open.
  45. */
  46. void openFrame(JInternalFrame frame);
  47. /**
  48. * This method should remove the JInternalFrame from its parent.
  49. *
  50. * @param frame The JInternalFrame to close.
  51. */
  52. void closeFrame(JInternalFrame frame);
  53. /**
  54. * This method should maximize the JInternalFrame to match its parent's
  55. * bounds.
  56. *
  57. * @param frame The JInternalFrame to maximize.
  58. */
  59. void maximizeFrame(JInternalFrame frame);
  60. /**
  61. * This method should restore the JInternalFrame to its normal bounds.
  62. *
  63. * @param frame The JInternalFrame to minimize.
  64. */
  65. void minimizeFrame(JInternalFrame frame);
  66. /**
  67. * This method should remove the JInternalFrame from its parent and replace
  68. * it with a JDesktopIcon.
  69. *
  70. * @param frame The JInternalFrame to iconify.
  71. */
  72. void iconifyFrame(JInternalFrame frame);
  73. /**
  74. * This method should remove the JDesktopIcon from its parent and replace it
  75. * with the JInternalFrame that the JDesktopIcon represents.
  76. *
  77. * @param frame The JInternalFrame to deiconify.
  78. */
  79. void deiconifyFrame(JInternalFrame frame);
  80. /**
  81. * This method should give focus to the JInternalFrame and its default focus
  82. * owner.
  83. *
  84. * @param vframe The JInternalFrame to activate.
  85. */
  86. void activateFrame(JInternalFrame vframe);
  87. /**
  88. * This method should be called when the JInternalFrame gets deselected and
  89. * subsequently loses focus.
  90. *
  91. * @param frame The JInternalFrame to deactivate.
  92. */
  93. void deactivateFrame(JInternalFrame frame);
  94. /**
  95. * This method should be called in preparation for dragging. This needs to
  96. * be called prior to dragFrame calls so that the DesktopManager can
  97. * prepare any state information.
  98. *
  99. * @param frame The JInternalFrame to prepare for dragging.
  100. */
  101. void beginDraggingFrame(JComponent frame);
  102. /**
  103. * This method drags the given JInternalFrame to the given x and y
  104. * coordinates.
  105. *
  106. * @param frame The JInternalFrame to drag.
  107. * @param x The new x coordinate.
  108. * @param y The new y coordinate.
  109. */
  110. void dragFrame(JComponent frame, int x, int y);
  111. /**
  112. * This method should be called after dragFrame calls. Any information used
  113. * by the DesktopManager for dragging the JInternalFrame can be cleared.
  114. *
  115. * @param frame The JInternalFrame that finished dragging.
  116. */
  117. void endDraggingFrame(JComponent frame);
  118. /**
  119. * This method should be called prior to any resizeFrame calls. Any state
  120. * information needed by the DesktopManager to resize the JInternalFrame
  121. * will be prepared here.
  122. *
  123. * @param frame The JInternalFrame to resize.
  124. * @param direction One of eight directions specified by SwingConstants.
  125. */
  126. void beginResizingFrame(JComponent frame, int direction);
  127. /**
  128. * This method is called to resize the given JInternalFrame to the given
  129. * bounds.
  130. *
  131. * @param frame The JInternalFrame to resize.
  132. * @param x The new x coordinate.
  133. * @param y The new y coordinate.
  134. * @param width The new width.
  135. * @param height The new height.
  136. */
  137. void resizeFrame(JComponent frame, int x, int y, int width, int height);
  138. /**
  139. * This method is called to signify that the resize is finished. Any
  140. * information used to resize the JInternalFrame can now be cleared.
  141. *
  142. * @param frame The JInternalFrame that just finished dragging.
  143. */
  144. void endResizingFrame(JComponent frame);
  145. /**
  146. * This method does the actual work for reshaping the JInternalFrame.
  147. *
  148. * @param frame The JInternalFrame to resize.
  149. * @param x The new x coordinate.
  150. * @param y The new y coordinate.
  151. * @param width The new width.
  152. * @param height The new height.
  153. */
  154. void setBoundsForFrame(JComponent frame, int x, int y, int width, int height);
  155. } // DesktopManager