1 64 65 package com.jcorporate.expresso.ext.struts.taglib.html; 66 67 73 74 import com.jcorporate.expresso.core.misc.StringUtil; 75 76 import javax.servlet.jsp.JspException ; 77 78 119 120 121 126 public class ExRadioLayerTag extends ExRadioTag { 127 128 private static String STR_JS_LAYER = "%action%%id%(\'%type%\');"; 129 130 private String id = ""; 131 132 private static String SHOW_JS = "showLayer"; 133 134 private static String HIDE_JS = "hideLayer"; 135 136 private static String EXPAND = "EXPAND"; 137 138 private static String COLLAPSE = "COLLAPSE"; 139 140 private String action = HIDE_JS; 141 142 private String node = EXPAND; 143 144 145 150 public int doStartTag() throws JspException { 151 String onClick = STR_JS_LAYER; 152 onClick += StringUtil.notNull(getOnclick()); 153 onClick = StringUtil.replaceString(onClick, "%id%", id); 154 onClick = StringUtil.replaceString(onClick, "%action%", action); 155 onClick = StringUtil.replaceString(onClick, "%type%", node); 156 super.setOnclick(onClick); 157 return super.doStartTag(); 158 } 159 160 165 public String getId() { 166 return id; 167 } 168 169 174 public void setId(String id) { 175 this.id = id; 176 } 177 178 179 184 public String getAction() { 185 return action; 186 } 187 188 193 public void setAction(String action) throws JspException { 194 if (action.equalsIgnoreCase("SHOW")) { 195 this.action = SHOW_JS; 196 } else { 197 if (action.equalsIgnoreCase("HIDE")) { 198 this.action = HIDE_JS; 199 } else { 200 throw new JspException ("action must be 'Show' or 'Hide'"); 201 } 202 } 203 } 204 205 206 211 public String getNode() { 212 return node; 213 } 214 215 220 public void setNode(String node) throws JspException { 221 if (node.equalsIgnoreCase(EXPAND)) { 222 this.node = EXPAND; 223 } else { 224 if (node.equalsIgnoreCase(COLLAPSE)) { 225 this.node = COLLAPSE; 226 } else { 227 throw new JspException ("node must be 'collapse' or 'expand'"); 228 } 229 } 230 } 231 232 233 } 234 235 236 | Popular Tags |