1 7 package org.ejtools.servlet.http.jsp.tagext.tree; 8 9 import javax.servlet.jsp.JspException ; 10 import javax.servlet.jsp.tagext.TagSupport ; 11 12 import org.apache.struts.util.RequestUtils; 13 import org.apache.struts.util.ResponseUtils; 14 15 23 public class TreeLeafTag extends TagSupport 24 { 25 26 protected String name = null; 27 28 protected String property = null; 29 30 protected String scope = null; 31 32 protected boolean value = false; 33 34 35 41 public int doStartTag() 42 throws JspException 43 { 44 String img = null; 45 boolean leaf = getValue(); 46 47 if (name != null) 48 { 49 if (property != null) 50 { 51 leaf = ((Boolean ) RequestUtils.lookup(pageContext, name, property, scope)).booleanValue(); 52 } 53 else 54 { 55 leaf = ((Boolean ) RequestUtils.lookup(pageContext, name, scope)).booleanValue(); 56 } 57 } 58 59 if (leaf) 60 { 61 img = "<img SRC=\"images/tree/join.gif\"/>"; 62 } 63 else 64 { 65 img = "<img SRC=\"images/tree/joinbottom.gif\"/>"; 66 } 67 68 ResponseUtils.write(pageContext, img); 69 70 return (SKIP_BODY); 72 } 73 74 75 81 public String getName() 82 { 83 return (this.name); 84 } 85 86 87 93 public String getProperty() 94 { 95 return (this.property); 96 } 97 98 99 105 public String getScope() 106 { 107 return (this.scope); 108 } 109 110 111 117 public boolean getValue() 118 { 119 return (this.value); 120 } 121 122 123 124 125 public void release() 126 { 127 super.release(); 128 value = false; 129 } 130 131 132 137 public void setName(String name) 138 { 139 this.name = name; 140 } 141 142 143 148 public void setProperty(String property) 149 { 150 this.property = property; 151 } 152 153 154 159 public void setScope(String scope) 160 { 161 this.scope = scope; 162 } 163 164 165 170 public void setValue(boolean value) 171 { 172 this.value = value; 173 } 174 175 } 176 177 | Popular Tags |