1 |
/* DefaultDesktopManager.java -- |
/* DefaultDesktopManager.java -- |
2 |
Copyright (C) 2002, 2004 Free Software Foundation, Inc. |
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
38 |
|
|
39 |
package javax.swing; |
package javax.swing; |
40 |
|
|
41 |
import java.awt.Component; |
import java.awt.Component; |
91 |
*/ |
*/ |
92 |
public DefaultDesktopManager() |
public DefaultDesktopManager() |
93 |
{ |
{ |
94 |
} // DefaultDesktopManager() |
} |
95 |
|
|
96 |
/** |
/** |
97 |
* This method is not normally called since the user will typically add the |
* This method is not normally called since the user will typically add the |
112 |
c.remove(frame.getDesktopIcon()); |
c.remove(frame.getDesktopIcon()); |
113 |
c.add(frame); |
c.add(frame); |
114 |
frame.setVisible(true); |
frame.setVisible(true); |
115 |
} // openFrame() |
} |
116 |
|
|
117 |
/** |
/** |
118 |
* This method removes the JInternalFrame and JDesktopIcon (if one is |
* This method removes the JInternalFrame and JDesktopIcon (if one is |
133 |
c.remove(frame); |
c.remove(frame); |
134 |
c.repaint(); |
c.repaint(); |
135 |
} |
} |
136 |
} // closeFrame() |
} |
137 |
|
|
138 |
/** |
/** |
139 |
* This method resizes the JInternalFrame to match its parent's bounds. |
* This method resizes the JInternalFrame to match its parent's bounds. |
172 |
// Do nothing. |
// Do nothing. |
173 |
} |
} |
174 |
} |
} |
175 |
} // maximizeFrame() |
} |
176 |
|
|
177 |
/** |
/** |
178 |
* This method restores the JInternalFrame's bounds to what they were |
* This method restores the JInternalFrame's bounds to what they were |
201 |
|
|
202 |
setBoundsForFrame(frame, normalBounds.x, normalBounds.y, |
setBoundsForFrame(frame, normalBounds.x, normalBounds.y, |
203 |
normalBounds.width, normalBounds.height); |
normalBounds.width, normalBounds.height); |
204 |
} // minimizeFrame() |
} |
205 |
|
|
206 |
/** |
/** |
207 |
* This method removes the JInternalFrame from its parent and adds its |
* This method removes the JInternalFrame from its parent and adds its |
232 |
{ |
{ |
233 |
Rectangle r = getBoundsForIconOf(frame); |
Rectangle r = getBoundsForIconOf(frame); |
234 |
icon.setBounds(r); |
icon.setBounds(r); |
235 |
setWasIcon(frame, true); |
setWasIcon(frame, Boolean.TRUE); |
236 |
} |
} |
237 |
|
|
238 |
if (c != null) |
if (c != null) |
244 |
} |
} |
245 |
c.remove(frame); |
c.remove(frame); |
246 |
} |
} |
247 |
} // iconifyFrame() |
} |
248 |
|
|
249 |
/** |
/** |
250 |
* This method removes the JInternalFrame's JDesktopIcon representation and |
* This method removes the JInternalFrame's JDesktopIcon representation and |
280 |
} |
} |
281 |
|
|
282 |
c.invalidate(); |
c.invalidate(); |
283 |
} // deiconifyFrame() |
} |
284 |
|
|
285 |
/** |
/** |
286 |
* This method activates the JInternalFrame by moving it to the front and |
* This method activates the JInternalFrame by moving it to the front and |
306 |
} |
} |
307 |
|
|
308 |
frame.toFront(); |
frame.toFront(); |
309 |
} // activateFrame() |
} |
310 |
|
|
311 |
/** |
/** |
312 |
* This method is called when the JInternalFrame loses focus. |
* This method is called when the JInternalFrame loses focus. |
331 |
{ |
{ |
332 |
} |
} |
333 |
} |
} |
334 |
} // deactivateFrame() |
} |
335 |
|
|
336 |
/** |
/** |
337 |
* This method is called to indicate that the DesktopManager should prepare |
* This method is called to indicate that the DesktopManager should prepare |
355 |
currentDragMode = JDesktopPane.LIVE_DRAG_MODE; |
currentDragMode = JDesktopPane.LIVE_DRAG_MODE; |
356 |
else |
else |
357 |
currentDragMode = ((JDesktopPane) pane).getDragMode(); |
currentDragMode = ((JDesktopPane) pane).getDragMode(); |
358 |
} // beginDraggingFrame() |
} |
359 |
|
|
360 |
/** |
/** |
361 |
* This method is called to drag the JInternalFrame to a new location. |
* This method is called to drag the JInternalFrame to a new location. |
379 |
setBoundsForFrame((JInternalFrame) component, newX, newY, b.width, |
setBoundsForFrame((JInternalFrame) component, newX, newY, b.width, |
380 |
b.height); |
b.height); |
381 |
} |
} |
382 |
} // dragFrame() |
} |
383 |
|
|
384 |
/** |
/** |
385 |
* This method indicates that the dragging is done. Any state information |
* This method indicates that the dragging is done. Any state information |
397 |
dragCache = null; |
dragCache = null; |
398 |
} |
} |
399 |
component.repaint(); |
component.repaint(); |
400 |
} // endDraggingFrame() |
} |
401 |
|
|
402 |
/** |
/** |
403 |
* This method is called to indicate that the given JComponent will be |
* This method is called to indicate that the given JComponent will be |
418 |
currentDragMode = JDesktopPane.LIVE_DRAG_MODE; |
currentDragMode = JDesktopPane.LIVE_DRAG_MODE; |
419 |
else |
else |
420 |
currentDragMode = ((JDesktopPane) pane).getDragMode(); |
currentDragMode = ((JDesktopPane) pane).getDragMode(); |
421 |
} // beginResizingFrame() |
} |
422 |
|
|
423 |
/** |
/** |
424 |
* This method resizes the give JComponent. |
* This method resizes the give JComponent. |
441 |
else |
else |
442 |
setBoundsForFrame(component, dragCache.x, dragCache.y, dragCache.width, |
setBoundsForFrame(component, dragCache.x, dragCache.y, dragCache.width, |
443 |
dragCache.height); |
dragCache.height); |
444 |
} // resizeFrame() |
} |
445 |
|
|
446 |
/** |
/** |
447 |
* This method is called to indicate that the given JComponent has finished |
* This method is called to indicate that the given JComponent has finished |
460 |
dragCache = null; |
dragCache = null; |
461 |
} |
} |
462 |
component.repaint(); |
component.repaint(); |
463 |
} // endResizingFrame() |
} |
464 |
|
|
465 |
/** |
/** |
466 |
* This method calls setBounds with the given parameters and repaints the |
* This method calls setBounds with the given parameters and repaints the |
483 |
component.getParent().repaint(); |
component.getParent().repaint(); |
484 |
else |
else |
485 |
component.repaint(); |
component.repaint(); |
486 |
} // setBoundsForFrame() |
} |
487 |
|
|
488 |
/** |
/** |
489 |
* This is a helper method that removes the JDesktopIcon of the given |
* This is a helper method that removes the JDesktopIcon of the given |
497 |
Container c = icon.getParent(); |
Container c = icon.getParent(); |
498 |
if (c != null && icon != null) |
if (c != null && icon != null) |
499 |
c.remove(icon); |
c.remove(icon); |
500 |
} // removeIconFor() |
} |
501 |
|
|
502 |
/** |
/** |
503 |
* This method is called by iconifyFrame to determine the bounds of the |
* This method is called by iconifyFrame to determine the bounds of the |
571 |
} |
} |
572 |
|
|
573 |
return ideal; |
return ideal; |
574 |
} // getBoundsForIconOf() |
} |
575 |
|
|
576 |
/** |
/** |
577 |
* This method sets the bounds of the JInternalFrame right before the |
* This method sets the bounds of the JInternalFrame right before the |
583 |
protected void setPreviousBounds(JInternalFrame frame, Rectangle rect) |
protected void setPreviousBounds(JInternalFrame frame, Rectangle rect) |
584 |
{ |
{ |
585 |
frame.setNormalBounds(rect); |
frame.setNormalBounds(rect); |
586 |
} // setPreviousBounds() |
} |
587 |
|
|
588 |
/** |
/** |
589 |
* This method returns the normal bounds of the JInternalFrame from before |
* This method returns the normal bounds of the JInternalFrame from before |
596 |
protected Rectangle getPreviousBounds(JInternalFrame frame) |
protected Rectangle getPreviousBounds(JInternalFrame frame) |
597 |
{ |
{ |
598 |
return frame.getNormalBounds(); |
return frame.getNormalBounds(); |
599 |
} // getPreviousBounds() |
} |
600 |
|
|
601 |
/** |
/** |
602 |
* This method sets the value to true if the given JInternalFrame has been |
* This method sets the value to true if the given JInternalFrame has been |
606 |
* @param value True if the JInternalFrame has been iconized and the bounds |
* @param value True if the JInternalFrame has been iconized and the bounds |
607 |
* of the JDesktopIcon are valid. |
* of the JDesktopIcon are valid. |
608 |
*/ |
*/ |
609 |
protected void setWasIcon(JInternalFrame frame, boolean value) |
protected void setWasIcon(JInternalFrame frame, Boolean value) |
610 |
{ |
{ |
611 |
frame.setWasIcon(value, WAS_ICON_ONCE_PROPERTY); |
frame.setWasIcon(value.booleanValue(), WAS_ICON_ONCE_PROPERTY); |
612 |
} // setWasIcon() |
} |
613 |
|
|
614 |
/** |
/** |
615 |
* This method returns true if the given JInternalFrame has been iconized |
* This method returns true if the given JInternalFrame has been iconized |
623 |
protected boolean wasIcon(JInternalFrame frame) |
protected boolean wasIcon(JInternalFrame frame) |
624 |
{ |
{ |
625 |
return frame.getWasIcon(); |
return frame.getWasIcon(); |
626 |
} // wasIcon() |
} |
627 |
} // DefaultDesktopManager |
} |