1 18 package net.sf.uitags.tag.panel; 19 20 import javax.servlet.jsp.JspException ; 21 22 import net.sf.uitags.tag.AbstractUiTag; 23 import net.sf.uitags.tagutil.TaglibProperties; 24 import net.sf.uitags.tagutil.validation.RuntimeValidator; 25 import net.sf.uitags.util.StringUtils; 26 import net.sf.uitags.util.Template; 27 28 34 public class HideTag extends AbstractUiTag { 35 36 40 43 private static final long serialVersionUID = 100L; 44 45 46 50 private static final String PROP_EVENT = "panel.hide.on"; 51 private static final String PROP_DELAY = "panel.hide.delay"; 52 private static final String PROP_FORCE = "panel.hide.force"; 53 54 55 59 62 private String injectTo; 63 64 67 private String injectToName; 68 69 72 private String on; 73 74 77 private Integer delayInMillis; 78 79 82 private Boolean force; 83 84 85 89 94 public void setInjectTo(String val) { 95 this.injectTo = val; 96 } 97 98 103 public void setInjectToName(String val) { 104 this.injectToName = val; 105 } 106 107 112 public void setOn(String val) { 113 this.on = val; 114 } 115 116 121 public void setDelay(Integer val) { 122 this.delayInMillis = val; 123 } 124 125 130 public void setForce(Boolean force) { 131 this.force = force; 132 } 133 134 135 139 146 public int doStartTag() throws JspException { 147 return SKIP_BODY; 148 } 149 150 157 public int doEndTag() throws JspException { 158 RuntimeValidator.assertAttributeExclusive( 159 "injectTo", this.injectTo, "injectToName", this.injectToName); 160 RuntimeValidator.assertEitherSpecified( 161 "injectTo", this.injectTo, "injectToName", this.injectToName); 162 163 TaglibProperties props = TaglibProperties.getInstance(); 164 props.setRuntimeProperty(PROP_EVENT, this.on); 165 props.setRuntimeProperty(PROP_DELAY, StringUtils.toStringOrNull(this.delayInMillis)); 166 props.setRuntimeProperty(PROP_FORCE, StringUtils.toStringOrNull(this.force)); 167 168 Template tpl = Template.forName(Template.PANEL_HIDE); 169 tpl.map("triggerId", this.injectTo); 170 tpl.map("triggerName", this.injectToName); 171 tpl.map("triggerEvent", props.get(PROP_EVENT)); 172 tpl.map("delayInMillis", Integer.valueOf(props.get(PROP_DELAY))); 173 tpl.map("force", Boolean.valueOf(props.get(PROP_FORCE))); 174 175 PanelTag parent = (PanelTag) findParent(PanelTag.class); 176 parent.addChildJsCode(tpl.evalToString()); 177 178 return EVAL_PAGE; 179 } 180 } 181 | Popular Tags |