01: /*
02: * $RCSfile: CascadeWindowsAction.java,v $
03: * @modification $Date: 2001/09/28 19:31:19 $
04: * @version $Id: CascadeWindowsAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
05: *
06: */
07:
08: package com.memoire.vainstall.builder.action;
09:
10: import com.memoire.vainstall.builder.*;
11: import com.memoire.vainstall.builder.gui.*;
12:
13: import java.awt.Rectangle;
14:
15: import javax.swing.*;
16:
17: /**
18: * This action cascades all internal frames on the desktop pane
19: * that is not iconified.
20: *
21: * @see com.memoire.vainstall.builder.util.AbstractVAIBuilderAction
22: * @see javax.swing.JDesktopPane
23: *
24: * @author Henrik Falk
25: * @version $Id: CascadeWindowsAction.java,v 1.1 2001/09/28 19:31:19 hfalk Exp $
26: */
27: public class CascadeWindowsAction extends AbstractVAIBuilderAction {
28:
29: /**
30: * Default constructor
31: */
32: public CascadeWindowsAction() {
33: super ();
34: }
35:
36: /**
37: * Implements the runnit method
38: */
39: public void runnit() {
40:
41: JDesktopPane pane = ((VAIBuilderFrame) getController()
42: .getFrame()).getDesktopPane();
43:
44: JInternalFrame iframes[] = pane.getAllFrames();
45:
46: int activeCount = 0;
47: for (int i = 0; i < iframes.length; i++) {
48: if (iframes[i].isIcon() == false) {
49: activeCount++;
50: }
51: }
52:
53: JInternalFrame[] activeFrames = new JInternalFrame[activeCount];
54:
55: activeCount = 0;
56: for (int i = 0; i < iframes.length; i++) {
57: if (iframes[i].isIcon() == false) {
58: activeFrames[activeCount] = iframes[i];
59: activeCount++;
60: }
61: }
62:
63: int down = activeCount - 1;
64:
65: for (int i = 0; i < activeCount; i++) {
66: activeFrames[i].setBounds(down * 40, down * 40,
67: activeFrames[i].getWidth(), activeFrames[i]
68: .getHeight());
69: down--;
70: }
71:
72: }
73:
74: }
|