1 23 package org.infoglue.cms.workflow.taglib; 24 25 import javax.servlet.jsp.JspException ; 26 27 32 public abstract class ElementTag extends WorkflowTag 33 { 34 37 private Element element; 38 39 42 ElementTag() 43 { 44 super(); 45 } 46 47 53 public int doEndTag() throws JspException 54 { 55 if(getElement() != null) 56 { 57 write(getElement().toString()); 58 } 59 element = null; 60 return EVAL_PAGE; 61 } 62 63 68 protected final Element getElement() 69 { 70 if(element == null) 71 { 72 element = createElement(); 73 } 74 return element; 75 } 76 77 82 protected abstract Element createElement(); 83 84 88 94 public void setIdAttr(final String id) throws JspException 95 { 96 getElement().addAttribute("id", evaluateString("element", "idAttr", id)); 97 } 98 99 105 public void setCssClass(final String cssClass) throws JspException 106 { 107 getElement().addAttribute("class", evaluateString("element", "cssClass", cssClass)); 108 } 109 110 116 public void setTitle(final String title) throws JspException 117 { 118 getElement().addAttribute("title", evaluateString("element", "title", title)); 119 } 120 121 127 public void setStyle(final String style) throws JspException 128 { 129 getElement().addAttribute("style", evaluateString("element", "style", style)); 130 } 131 } 132 | Popular Tags |