1 14 package org.wings.plaf.css; 15 16 import org.wings.SLayoutManager; 17 import org.wings.STemplateLayout; 18 import org.wings.io.Device; 19 import org.wings.plaf.LayoutCG; 20 import org.wings.template.*; 21 import org.wings.template.parser.PageParser; 22 23 import java.io.IOException ; 24 25 29 public class TemplateLayoutCG implements LayoutCG { 30 33 static { 34 PageParser parser = PageParser.getInstance(); 35 parser.addTagHandler("OBJECT", RangeTagHandler.class); 36 parser.addTagHandler("WINGSOBJECT", RangeTagHandler.class); 37 parser.addTagHandler("TEXTAREA", RangeTagHandler.class); 38 parser.addTagHandler("SELECT", RangeTagHandler.class); 39 parser.addTagHandler("INPUT", SimpleTagHandler.class); 40 parser.addTagHandler("LABEL", LabelTagHandler.class); 41 } 42 43 44 private void write(Device device, STemplateLayout layout) 45 throws IOException { 46 final TemplateSource source = layout.getTemplateSource(); 47 48 if (source == null) { 49 device.print("Unable to open template-file <em>'"); 50 device.print(source); 51 device.print("'</em>"); 52 } else { 53 layout.getPageParser().process(source, new TemplateParseContext(device, layout)); 54 } 55 } 56 57 62 public void write(Device device, SLayoutManager manager) 63 throws IOException { 64 write(device, (STemplateLayout) manager); 65 } 66 } 67 68 69 | Popular Tags |