1 20 package org.enhydra.barracuda.core.comp.helper; 21 22 import java.io.*; 23 import javax.servlet.*; 24 import javax.servlet.http.*; 25 26 import org.apache.log4j.*; 27 import org.w3c.dom.*; 28 29 import org.enhydra.barracuda.core.comp.*; 30 import org.enhydra.barracuda.core.util.dom.*; 31 32 38 public abstract class BTemplateGateway extends ComponentGateway { 39 40 protected static final Logger logger = Logger.getLogger(BTemplateGateway.class.getName()); 42 43 44 48 public abstract TemplateModel getTemplateModel(); 49 50 53 public abstract Class getTemplateClass(); 54 55 58 public Document handleDefault (BComponent root, ViewContext vc, HttpServletRequest req, HttpServletResponse resp) throws IOException { 59 Document page = DefaultDOMLoader.getGlobalInstance().getDOM(getTemplateClass(), vc.getViewCapabilities().getClientLocale()); 63 BTemplate templateComp = new BTemplate(getTemplateModel()); 67 templateComp.setView(new DefaultTemplateView(page.getDocumentElement())); 68 root.addChild(templateComp); 69 70 return page; 72 } 73 74 75 } 76 | Popular Tags |