1 13 package com.tonbeller.wcf.table; 14 15 import java.net.MalformedURLException ; 16 import java.net.URL ; 17 18 import javax.servlet.jsp.JspException ; 19 20 import org.apache.log4j.Logger; 21 import org.w3c.dom.Document ; 22 23 import com.tonbeller.wcf.component.Component; 24 import com.tonbeller.wcf.component.ComponentTag; 25 import com.tonbeller.wcf.controller.RequestContext; 26 import com.tonbeller.wcf.form.FormDocument; 27 import com.tonbeller.wcf.utils.ResourceLocator; 28 import com.tonbeller.wcf.utils.XmlUtils; 29 30 35 public class TablePropertiesFormTag extends ComponentTag { 36 37 private String xmlUri; 38 private String table; 39 private boolean bookmarkable = false; 40 private boolean closable = true; 41 42 private static Logger logger = Logger.getLogger(TablePropertiesFormTag.class); 43 44 47 public Component createComponent(RequestContext context) throws JspException { 48 try { 49 50 URL url = ResourceLocator.getResource(context.getServletContext(), context.getLocale(), xmlUri); 51 Document doc = XmlUtils.parse(url); 52 53 FormDocument.replaceI18n(context, doc, null); 55 56 TableComponent tc = (TableComponent) context.getModelReference(table); 58 59 TablePropertiesFormComponent fc= new TablePropertiesFormComponent(id, null, doc, tc); 61 fc.setCloseable(closable); 62 fc.setBookmarkable(bookmarkable); 63 return fc; 64 65 } catch (MalformedURLException e) { 66 logger.error("exception caught", e); 67 throw new JspException (e); 68 } 69 } 70 71 public void setBookmarkable(boolean b) { 72 bookmarkable = b; 73 } 74 75 public void setTable(String string) { 76 table = string; 77 } 78 79 public void setXmlUri(String string) { 80 xmlUri = string; 81 } 82 83 public void setClosable(boolean b) { 84 closable = b; 85 } 86 87 } 88 | Popular Tags |