KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > plaf > css > DesktopPaneCG


1 /*
2  * $Id: DesktopPaneCG.java,v 1.17 2005/05/26 13:18:09 neurolabs Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings.plaf.css;
15
16
17 import java.io.IOException JavaDoc;
18
19 import org.wings.SComponent;
20 import org.wings.SDesktopPane;
21 import org.wings.SDimension;
22 import org.wings.SInternalFrame;
23 import org.wings.io.Device;
24
25 public class DesktopPaneCG extends AbstractComponentCG implements
26         org.wings.plaf.DesktopPaneCG {
27     public void installCG(SComponent component) {
28         super.installCG(component);
29         component.setPreferredSize(new SDimension("100%", null));
30     }
31
32     public void writeContent(final Device device, final SComponent _c)
33             throws IOException JavaDoc
34     {
35         final SDesktopPane component = (SDesktopPane) _c;
36         SDesktopPane desktop = (SDesktopPane) component;
37         // is one window maximized? if yes, skip rendering of other windows
38
boolean maximized = false;
39         
40         device.print("<div class=\"spacer\">&nbsp;</div>");
41         int componentCount = desktop.getComponentCount();
42         for (int i = 0; i < componentCount; i++) {
43             SInternalFrame frame = (SInternalFrame) desktop.getComponent(i);
44             if (!frame.isClosed() && frame.isMaximized()) {
45                 frame.write(device);
46                 maximized = true;
47             }
48         }
49         
50         if (!maximized) {
51             for (int i = 0; i < componentCount; i++) {
52                 SInternalFrame frame = (SInternalFrame) desktop.getComponent(i);
53                 if (!frame.isClosed() && !frame.isIconified()) {
54                     frame.write(device);
55                 }
56             }
57         }
58         device.print("<div class=\"spacer\">&nbsp;</div>");
59         if (!maximized) {
60             for (int i = 0; i < componentCount; i++) {
61                 SInternalFrame frame = (SInternalFrame) desktop.getComponent(i);
62                 if (!frame.isClosed() && frame.isIconified()) {
63                     frame.write(device);
64                 }
65             }
66         }
67         device.print("<div class=\"spacer\">&nbsp;</div>");
68         
69     }
70 }
71
Popular Tags