01: /*
02: * Copyright 2000,2005 wingS development team.
03: *
04: * This file is part of wingS (http://wingsframework.org).
05: *
06: * wingS is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * Please see COPYING for the complete licence.
12: */
13: package org.wings.plaf.css;
14:
15: import org.wings.SComponent;
16: import org.wings.SDesktopPane;
17: import org.wings.SDimension;
18: import org.wings.SInternalFrame;
19: import org.wings.io.Device;
20:
21: import java.io.IOException;
22:
23: public final class DesktopPaneCG extends AbstractComponentCG implements
24: org.wings.plaf.DesktopPaneCG {
25: private static final long serialVersionUID = 1L;
26:
27: public void installCG(SComponent component) {
28: super .installCG(component);
29: component.setPreferredSize(SDimension.FULLWIDTH);
30: }
31:
32: public void writeInternal(final Device device, final SComponent _c)
33: throws IOException {
34: SDesktopPane desktop = (SDesktopPane) _c;
35:
36: writeDivPrefix(device, desktop, null);
37: // is one window maximized? if yes, skip rendering of other windows
38: boolean maximized = false;
39:
40: device.print("<div class=\"spacer\"></div>");
41: int componentCount = desktop.getComponentCount();
42: for (int i = 0; i < componentCount; i++) {
43: SInternalFrame frame = (SInternalFrame) desktop
44: .getComponent(i);
45: if (!frame.isClosed() && frame.isMaximized()) {
46: frame.write(device);
47: maximized = true;
48: }
49: }
50:
51: if (!maximized) {
52: for (int i = 0; i < componentCount; i++) {
53: SInternalFrame frame = (SInternalFrame) desktop
54: .getComponent(i);
55: if (!frame.isClosed()) {
56: frame.write(device);
57: }
58: }
59: }
60: device.print("<div class=\"spacer\"></div>");
61:
62: writeDivSuffix(device, desktop);
63: }
64: }
|