1 14 package org.wings; 15 16 import org.apache.commons.logging.Log; 17 import org.apache.commons.logging.LogFactory; 18 19 import java.io.File ; 20 import java.io.IOException ; 21 import java.net.URL ; 22 23 32 public class SRootLayout extends STemplateLayout { 33 private final static transient Log log = LogFactory.getLog(SRootLayout.class); 34 35 38 public SRootLayout() { 39 try { 40 setTemplate(getClass().getResource("template/default.thtml")); 41 } catch (IOException e) { 42 log.error("Unable to get template/default.thtml",e); 43 } 44 } 45 46 51 public SRootLayout(String tmplFileName) throws IOException { 52 setTemplate(new File (tmplFileName)); 53 } 54 55 60 public SRootLayout(File tmplFile) throws IOException { 61 setTemplate(tmplFile); 62 } 63 64 68 public SRootLayout(URL url) throws java.io.IOException { 69 setTemplate(url); 70 } 71 72 public void addComponent(SComponent c, Object constraint, int index) {} 73 74 public void removeComponent(SComponent comp) {} 75 76 public SComponent getComponent(String name) { 77 if (!"content".equals(name)) 78 return null; 79 80 int topmost = container.getComponentCount() - 1; 81 return container.getComponent(topmost); 82 } 83 84 public void setContainer(SContainer container) { 87 this.container = container; 88 } 89 } 90 | Popular Tags |