1. /*
  2. * @(#)DesktopManager.java 1.9 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing;
  8. /** DesktopManager objects are owned by a JDesktopPane object. They are responsible
  9. * for implementing L&F specific behaviors for the JDesktopPane. JInternalFrame
  10. * implementations should delegate specific behaviors to the DesktopManager. For
  11. * instance, if a JInternalFrame was asked to iconify, it should try:
  12. * <PRE>
  13. * getDesktopPane().getDesktopManager().iconifyFrame(frame);
  14. * </PRE>
  15. * This delegation allows each L&F to provide custom behaviors for desktop-specific
  16. * actions. (For example, how and where the internal frame's icon would appear.)
  17. *
  18. * @see JDesktopPane
  19. * @see JInternalFrame
  20. * @see JInternalFrame.JDesktopIcon
  21. *
  22. * @version 1.9 11/29/01
  23. * @author David Kloba
  24. */
  25. public interface DesktopManager
  26. {
  27. /** If possible, display this frame in an appropriate location.
  28. * Normally, this is not called, as the creator of the JInternalFrame
  29. * will add the frame to the appropriate parent.
  30. */
  31. void openFrame(JInternalFrame f);
  32. /** Generally, this call should remove the frame from it's parent. */
  33. void closeFrame(JInternalFrame f);
  34. /** Generally, the frame should be resized to match it's parents bounds. */
  35. void maximizeFrame(JInternalFrame f);
  36. /** Generally, this indicates that the frame should be restored to it's
  37. * size and position prior to a maximizeFrame() call.
  38. */
  39. void minimizeFrame(JInternalFrame f);
  40. /** Generally, remove this frame from it's parent and add an iconic representation. */
  41. void iconifyFrame(JInternalFrame f);
  42. /** Generally, remove any iconic representation that is present and restore the
  43. * frame to it's original size and location.
  44. */
  45. void deiconifyFrame(JInternalFrame f);
  46. /**
  47. * Generally, indicate that this frame has focus. This is usually called after
  48. * the JInternalFrame's IS_SELECTED_PROPERTY has been set to true.
  49. */
  50. void activateFrame(JInternalFrame f);
  51. /**
  52. * Generally, indicate that this frame has lost focus. This is usually called
  53. * after the JInternalFrame's IS_SELECTED_PROPERTY has been set to false.
  54. */
  55. void deactivateFrame(JInternalFrame f);
  56. /** This method is normally called when the user has indicated that
  57. * they will begin dragging a component around. This method should be called
  58. * prior to any dragFrame() calls to allow the DesktopManager to prepare any
  59. * necessary state. Normally <b>f</b> will be a JInternalFrame.
  60. */
  61. void beginDraggingFrame(JComponent f);
  62. /** The user has moved the frame. Calls to this method will be preceeded by calls
  63. * to beginDraggingFrame().
  64. * Normally <b>f</b> will be a JInternalFrame.
  65. */
  66. void dragFrame(JComponent f, int newX, int newY);
  67. /** This method signals the end of the dragging session. Any state maintained by
  68. * the DesktopManager can be removed here. Normally <b>f</b> will be a JInternalFrame.
  69. */
  70. void endDraggingFrame(JComponent f);
  71. /** This methods is normally called when the user has indicated that
  72. * they will begin resizing the frame. This method should be called
  73. * prior to any resizeFrame() calls to allow the DesktopManager to prepare any
  74. * necessary state. Normally <b>f</b> will be a JInternalFrame.
  75. */
  76. void beginResizingFrame(JComponent f, int direction);
  77. /** The user has resized the component. Calls to this method will be preceeded by calls
  78. * to beginResizingFrame().
  79. * Normally <b>f</b> will be a JInternalFrame.
  80. */
  81. void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight);
  82. /** This method signals the end of the resize session. Any state maintained by
  83. * the DesktopManager can be removed here. Normally <b>f</b> will be a JInternalFrame.
  84. */
  85. void endResizingFrame(JComponent f);
  86. /** This is a primative reshape method.*/
  87. void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight);
  88. }