01: package desktop;
02:
03: import org.wings.*;
04: import org.wings.io.Device;
05: import org.wings.plaf.css.AbstractComponentCG;
06:
07: import java.io.IOException;
08:
09: public class DpCG extends AbstractComponentCG implements
10: org.wings.plaf.DesktopPaneCG {
11:
12: private static final long serialVersionUID = 1L;
13:
14: public void installCG(SComponent component) {
15: super .installCG(component);
16: component.setPreferredSize(SDimension.FULLWIDTH);
17: }
18:
19: @Override
20: public void writeInternal(Device device, SComponent component)
21: throws IOException {
22: DesktopPane desktop = (DesktopPane) component;
23:
24: writeDivPrefix(device, desktop, null);
25: // is one window maximized? if yes, skip rendering of other windows
26: boolean maximized = false;
27:
28: device.print("<div class=\"spacer\"></div>");
29: int componentCount = desktop.getComponentCount();
30: for (int i = 0; i < componentCount; i++) {
31: if (desktop.getComponent(i) instanceof SInternalFrame) {
32: SInternalFrame frame = (SInternalFrame) desktop
33: .getComponent(i);
34: if (!frame.isClosed() && frame.isMaximized()) {
35: frame.write(device);
36: maximized = true;
37: }
38: }
39: }
40:
41: if (!maximized) {
42: for (int i = 0; i < componentCount; i++) {
43: if (desktop.getComponent(i) instanceof SInternalFrame) {
44: SInternalFrame frame = (SInternalFrame) desktop
45: .getComponent(i);
46: if (!frame.isClosed()) {
47: frame.write(device);
48: }
49: }
50: }
51: }
52:
53: for (int i = 0; i < componentCount; i++) {
54: if (desktop.getComponent(i) instanceof DropLabel) {
55: DropLabel label = (DropLabel) desktop.getComponent(i);
56: label.write(device);
57: }
58: }
59:
60: device.print("<div class=\"spacer\"></div>");
61:
62: writeDivSuffix(device, desktop);
63:
64: }
65:
66: }
|