| 1 package fr.improve.struts.taglib.layout; 2 3 import javax.servlet.jsp.JspException ; 4 5 import fr.improve.struts.taglib.layout.el.Expression; 6 import fr.improve.struts.taglib.layout.event.EndLayoutEvent; 7 import fr.improve.struts.taglib.layout.event.LayoutEventListener; 8 import fr.improve.struts.taglib.layout.event.StartLayoutEvent; 9 import fr.improve.struts.taglib.layout.util.LayoutUtils; 10 import fr.improve.struts.taglib.layout.util.TagUtils; 11 12 15 public class ColumnTag extends LayoutTagSupport implements LayoutEventListener { 16 private String styleClass; 17 private String width; 18 private String styleId; 19 20 private String style; 21 private String jspStyle; 22 23 public int doStartLayoutTag() throws JspException { 24 StringBuffer lc_td = new StringBuffer ("<td colspan=\""); 25 lc_td.append(LayoutUtils.getSkin(pageContext.getSession()).getFieldInterface().getColumnNumber()); 26 if (styleClass!=null) { 27 lc_td.append("\" class=\""); 28 lc_td.append(styleClass); 29 } 30 if (width!=null) { 31 lc_td.append("\" width=\""); 32 lc_td.append(width); 33 } 34 if (styleId!=null) { 35 lc_td.append("\" id=\""); 36 lc_td.append(styleId); 37 } 38 if (style!=null) { 39 lc_td.append("\" style=\""); 40 lc_td.append(style); 41 } 42 lc_td.append("\">"); 43 new StartLayoutEvent(this, lc_td.toString()).send(); 44 TagUtils.write(pageContext, "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"); 45 return EVAL_BODY_INCLUDE; 46 } 47 public int doEndLayoutTag() throws JspException { 48 TagUtils.write(pageContext, "</table>"); 49 new EndLayoutEvent(this, "</td>").send(); 50 return EVAL_PAGE; 51 52 } 53 public Object processStartLayoutEvent(StartLayoutEvent in_event) throws JspException { 54 return in_event.consume(pageContext, "<tr>"); 55 } 56 public Object processEndLayoutEvent(EndLayoutEvent in_event) throws JspException { 57 return in_event.consume(pageContext, "</tr>"); 58 } 59 60 public void release() { 61 super.release(); 62 styleClass = null; 63 width = null; 64 style = null; 65 styleId = null; 66 } 67 68 72 public void setStyleClass(String styleClass) { 73 this.styleClass = styleClass; 74 } 75 78 public final void setWidth(String width) 79 { 80 this.width = width; 81 } 82 public void setStyle(String style) { 83 this.style = style; 84 } 85 public void setStyleId(String styleId) { 86 this.styleId = styleId; 87 } 88 protected void initDynamicValues() { 89 super.initDynamicValues(); 90 jspStyle = style; 91 style = Expression.evaluate(style, pageContext); 92 } 93 protected void reset() { 94 super.reset(); 95 style = jspStyle; 96 } 97 } 98 | Popular Tags |