1 package fr.improve.struts.taglib.layout; 2 3 import javax.servlet.jsp.JspException ; 4 5 import fr.improve.struts.taglib.layout.event.EndLayoutEvent; 6 import fr.improve.struts.taglib.layout.event.LayoutEventListener; 7 import fr.improve.struts.taglib.layout.event.StartLayoutEvent; 8 import fr.improve.struts.taglib.layout.util.LayoutUtils; 9 import fr.improve.struts.taglib.layout.util.TagUtils; 10 11 15 public class OrderedListTag extends LayoutTagSupport implements LayoutEventListener { 16 private String styleClass; 17 private String width; 18 19 public int doStartLayoutTag() throws JspException { 20 StringBuffer lc_td = new StringBuffer ("<td colspan=\""); 21 lc_td.append(LayoutUtils.getSkin(pageContext.getSession()).getFieldInterface().getColumnNumber()); 22 if (styleClass!=null) { 23 lc_td.append("\" class=\""); 24 lc_td.append(styleClass); 25 } 26 if (width!=null) { 27 lc_td.append("\" width=\""); 28 lc_td.append(width); 29 } 30 lc_td.append("\">"); 31 new StartLayoutEvent(this, lc_td.toString()).send(); 32 TagUtils.write(pageContext, "<ol"); 33 if (styleClass!=null) { 34 TagUtils.write(pageContext, " class=\""); 35 TagUtils.write(pageContext, styleClass); 36 TagUtils.write(pageContext, "\""); 37 } 38 TagUtils.write(pageContext, ">"); 39 return EVAL_BODY_INCLUDE; 40 } 41 public int doEndLayoutTag() throws JspException { 42 TagUtils.write(pageContext, "</ol>"); 43 new EndLayoutEvent(this, "</td>").send(); 44 return EVAL_PAGE; 45 46 } 47 public Object processStartLayoutEvent(StartLayoutEvent in_event) throws JspException { 48 TagUtils.write(in_event.getSource().getPageContext(), "<li>"); 49 return Boolean.FALSE; 50 } 51 public Object processEndLayoutEvent(EndLayoutEvent in_event) throws JspException { 52 TagUtils.write(in_event.getSource().getPageContext(), "</li>"); 53 return Boolean.FALSE; 54 } 55 56 public void release() { 57 super.release(); 58 styleClass = null; 59 width = null; 60 } 61 62 66 public void setStyleClass(String styleClass) { 67 this.styleClass = styleClass; 68 } 69 72 public final void setWidth(String width) 73 { 74 this.width = width; 75 } 76 } 77 | Popular Tags |