001/* DesktopManager.java --
002   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
003
004This file is part of GNU Classpath.
005
006GNU Classpath is free software; you can redistribute it and/or modify
007it under the terms of the GNU General Public License as published by
008the Free Software Foundation; either version 2, or (at your option)
009any later version.
010
011GNU Classpath is distributed in the hope that it will be useful, but
012WITHOUT ANY WARRANTY; without even the implied warranty of
013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014General Public License for more details.
015
016You should have received a copy of the GNU General Public License
017along with GNU Classpath; see the file COPYING.  If not, write to the
018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
01902110-1301 USA.
020
021Linking this library statically or dynamically with other modules is
022making a combined work based on this library.  Thus, the terms and
023conditions of the GNU General Public License cover the whole
024combination.
025
026As a special exception, the copyright holders of this library give you
027permission to link this library with independent modules to produce an
028executable, regardless of the license terms of these independent
029modules, and to copy and distribute the resulting executable under
030terms of your choice, provided that you also meet, for each linked
031independent module, the terms and conditions of the license of that
032module.  An independent module is a module which is not derived from
033or based on this library.  If you modify this library, you may extend
034this exception to your version of the library, but you are not
035obligated to do so.  If you do not wish to do so, delete this
036exception statement from your version. */
037
038package javax.swing;
039
040/**
041 * DesktopManagers are responsible for implementing the behaviours for the
042 * JInternalFrames that belong to JDesktopPanes. Actions such as maximizing,
043 * minimizing, iconifying, etc will be delegated to the DesktopManager.
044 */
045public interface DesktopManager
046{
047  /**
048   * This method will cause the JInternalFrame to be displayed in the set
049   * location. This usually is not needed since the user will add the
050   * JInternalFrame to a Container separately.
051   *
052   * @param frame The JInternalFrame to open.
053   */
054  void openFrame(JInternalFrame frame);
055
056  /**
057   * This method should remove the JInternalFrame from its parent.
058   *
059   * @param frame The JInternalFrame to close.
060   */
061  void closeFrame(JInternalFrame frame);
062
063  /**
064   * This method should maximize the JInternalFrame to match its parent's
065   * bounds.
066   *
067   * @param frame The JInternalFrame to maximize.
068   */
069  void maximizeFrame(JInternalFrame frame);
070
071  /**
072   * This method should restore the JInternalFrame to its normal bounds.
073   *
074   * @param frame The JInternalFrame to minimize.
075   */
076  void minimizeFrame(JInternalFrame frame);
077
078  /**
079   * This method should remove the JInternalFrame from its parent and replace
080   * it with a JDesktopIcon.
081   *
082   * @param frame The JInternalFrame to iconify.
083   */
084  void iconifyFrame(JInternalFrame frame);
085
086  /**
087   * This method should remove the JDesktopIcon from its parent and replace it
088   * with the JInternalFrame that the JDesktopIcon represents.
089   *
090   * @param frame The JInternalFrame to deiconify.
091   */
092  void deiconifyFrame(JInternalFrame frame);
093
094  /**
095   * This method should give focus to the JInternalFrame and its default focus
096   * owner.
097   *
098   * @param vframe The JInternalFrame to activate.
099   */
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