blob: 8a050fe0d26e9e3dfdef225ae4a6c3c6088f8b15 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1997-2002 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package javax.swing;
27
28/** DesktopManager objects are owned by a JDesktopPane object. They are responsible
29 * for implementing L&F specific behaviors for the JDesktopPane. JInternalFrame
30 * implementations should delegate specific behaviors to the DesktopManager. For
31 * instance, if a JInternalFrame was asked to iconify, it should try:
32 * <PRE>
33 * getDesktopPane().getDesktopManager().iconifyFrame(frame);
34 * </PRE>
35 * This delegation allows each L&F to provide custom behaviors for desktop-specific
36 * actions. (For example, how and where the internal frame's icon would appear.)
37 * <p>This class provides a policy for the various JInternalFrame methods, it is not
38 * meant to be called directly rather the various JInternalFrame methods will call
39 * into the DesktopManager.</p>
40 *
41 * @see JDesktopPane
42 * @see JInternalFrame
43 * @see JInternalFrame.JDesktopIcon
44 *
45 * @author David Kloba
46 */
47public interface DesktopManager
48{
49 /** If possible, display this frame in an appropriate location.
50 * Normally, this is not called, as the creator of the JInternalFrame
51 * will add the frame to the appropriate parent.
52 */
53 void openFrame(JInternalFrame f);
54
55 /** Generally, this call should remove the frame from it's parent. */
56 void closeFrame(JInternalFrame f);
57
58 /** Generally, the frame should be resized to match it's parents bounds. */
59 void maximizeFrame(JInternalFrame f);
60 /** Generally, this indicates that the frame should be restored to it's
61 * size and position prior to a maximizeFrame() call.
62 */
63 void minimizeFrame(JInternalFrame f);
64 /** Generally, remove this frame from it's parent and add an iconic representation. */
65 void iconifyFrame(JInternalFrame f);
66 /** Generally, remove any iconic representation that is present and restore the
67 * frame to it's original size and location.
68 */
69 void deiconifyFrame(JInternalFrame f);
70
71 /**
72 * Generally, indicate that this frame has focus. This is usually called after
73 * the JInternalFrame's IS_SELECTED_PROPERTY has been set to true.
74 */
75 void activateFrame(JInternalFrame f);
76
77 /**
78 * Generally, indicate that this frame has lost focus. This is usually called
79 * after the JInternalFrame's IS_SELECTED_PROPERTY has been set to false.
80 */
81 void deactivateFrame(JInternalFrame f);
82
83 /** This method is normally called when the user has indicated that
84 * they will begin dragging a component around. This method should be called
85 * prior to any dragFrame() calls to allow the DesktopManager to prepare any
86 * necessary state. Normally <b>f</b> will be a JInternalFrame.
87 */
88 void beginDraggingFrame(JComponent f);
89
90 /** The user has moved the frame. Calls to this method will be preceded by calls
91 * to beginDraggingFrame().
92 * Normally <b>f</b> will be a JInternalFrame.
93 */
94 void dragFrame(JComponent f, int newX, int newY);
95 /** This method signals the end of the dragging session. Any state maintained by
96 * the DesktopManager can be removed here. Normally <b>f</b> will be a JInternalFrame.
97 */
98 void endDraggingFrame(JComponent f);
99
100 /** This methods is normally called when the user has indicated that
101 * they will begin resizing the frame. This method should be called
102 * prior to any resizeFrame() calls to allow the DesktopManager to prepare any
103 * necessary state. Normally <b>f</b> will be a JInternalFrame.
104 */
105 void beginResizingFrame(JComponent f, int direction);
106 /** The user has resized the component. Calls to this method will be preceded by calls
107 * to beginResizingFrame().
108 * Normally <b>f</b> will be a JInternalFrame.
109 */
110 void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight);
111 /** This method signals the end of the resize session. Any state maintained by
112 * the DesktopManager can be removed here. Normally <b>f</b> will be a JInternalFrame.
113 */
114 void endResizingFrame(JComponent f);
115
116 /** This is a primitive reshape method.*/
117 void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight);
118}