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