Source for javax.swing.DesktopManager

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