1 14 package org.wings.plaf.css; 15 16 import org.wings.SBorderLayout; 17 import org.wings.SComponent; 18 import org.wings.SLayoutManager; 19 import org.wings.io.Device; 20 21 import java.io.IOException ; 22 23 public class BorderLayoutCG extends AbstractLayoutCG { 24 25 public void write(Device d, SLayoutManager l) 26 throws IOException { 27 final SBorderLayout layout = (SBorderLayout) l; 28 final SComponent north = (SComponent) layout.getComponents().get(SBorderLayout.NORTH); 29 final SComponent east = (SComponent) layout.getComponents().get(SBorderLayout.EAST); 30 final SComponent center = (SComponent) layout.getComponents().get(SBorderLayout.CENTER); 31 final SComponent west = (SComponent) layout.getComponents().get(SBorderLayout.WEST); 32 final SComponent south = (SComponent) layout.getComponents().get(SBorderLayout.SOUTH); 33 34 int cols = 0; 35 if (west != null) cols++; 36 if (center != null) cols++; 37 if (east != null) cols++; 38 39 printLayouterTableHeader(d, "SBorderLayout",layout.getHgap(), layout.getVgap(), layout.getBorder(),layout); 40 41 if (north != null) { 42 d.print("<tr style=\"height: 0%\">"); 43 Utils.printNewline(d, north); 44 d.print("<td colspan=\"").print(cols).print("\""); 45 Utils.printTableCellAlignment(d, north); 46 d.print(">"); 47 north.write(d); 48 d.print("</td>"); 49 Utils.printNewline(d, layout.getContainer()); 50 d.print("</tr>"); 51 Utils.printNewline(d, layout.getContainer()); 52 } 53 54 d.print("<tr style=\"height: 100%\">"); 55 56 if (west != null) { 57 Utils.printNewline(d, west); 58 d.print("<td"); 59 Utils.printTableCellAlignment(d, west); 60 d.print(">"); 61 west.write(d); 62 d.print("</td>"); 63 } 64 65 if (center != null) { 66 Utils.printNewline(d, center); 67 d.print("<td"); 68 Utils.printTableCellAlignment(d, center); 69 d.print(">"); 70 center.write(d); 71 d.print("</td>"); 72 } 73 74 if (east != null) { 75 Utils.printNewline(d, east); 76 d.print("<td"); 77 Utils.printTableCellAlignment(d, east); 78 d.print(">"); 79 east.write(d); 80 d.print("</td>"); 81 } 82 83 Utils.printNewline(d, layout.getContainer()); 84 d.print("</tr>"); 85 86 if (south != null) { 87 Utils.printNewline(d, layout.getContainer()); 88 d.print("<tr style=\"height: 0%\">"); 89 Utils.printNewline(d, south); 90 d.print("<td colspan=\"").print(cols).print("\""); 91 Utils.printTableCellAlignment(d, south); 92 south.write(d); 93 d.print("</td>"); 94 Utils.printNewline(d, layout.getContainer()); 95 d.print("</tr>"); 96 } 97 98 printLayouterTableFooter(d, "SBorderLayout", layout); 99 } 100 101 } 102 103 104 | Popular Tags |