1 23 package org.infoglue.deliver.taglib.common; 24 25 import java.util.HashMap ; 26 import java.util.Map ; 27 28 import javax.servlet.jsp.JspException ; 29 30 import org.infoglue.deliver.taglib.component.ComponentLogicTag; 31 32 38 public class TextRenderTag extends ComponentLogicTag 39 { 40 private static final long serialVersionUID = 523722286871322906L; 41 42 private Object result; 43 44 private String text = null; 45 46 private String propertyName = null; 47 48 private Integer contentId = null; 49 50 private Map renderAttributes = null; 51 52 public TextRenderTag() 53 { 54 super(); 55 } 56 57 public int doEndTag() throws JspException 58 { 59 if ( contentId != null ) 60 { 61 result = this.getController().getRenderedTextUrl( contentId, text, renderAttributes ); 62 } 63 else if ( propertyName != null ) 64 { 65 result = this.getComponentLogic().getRenderedTextUrl( propertyName, text, renderAttributes ); 66 } 67 else 68 { 69 result = this.getController().getRenderedTextUrl( text, renderAttributes ); 70 } 71 72 this.produceResult( result ); 73 74 return EVAL_PAGE; 75 } 76 77 private void setAttribute( String key, Object value ) 78 { 79 if ( renderAttributes == null ) 80 { 81 renderAttributes = new HashMap (); 82 } 83 if ( key != null && value != null ) 84 { 85 renderAttributes.put( key, value.toString() ); 86 } 87 } 88 89 92 public void setPropertyName( String propertyName ) throws JspException 93 { 94 this.propertyName = evaluateString( "textRender", "propertyName", propertyName ); 95 } 96 97 100 public void setContentId( final String contentId ) throws JspException 101 { 102 this.contentId = evaluateInteger( "textRender", "contentId", contentId ); 103 } 104 105 108 public void setText( String text ) throws JspException 109 { 110 this.text = evaluateString( "textRender", "text", text ); 111 } 112 113 116 public void setAlign( String align ) throws JspException 117 { 118 this.setAttribute( "align", evaluateInteger( "textRender", "align", align ) ); 119 } 120 121 124 public void setBackgroundImageUrl( String backgroundImageUrl ) throws JspException 125 { 126 this.setAttribute( "backgroundImageUrl", 127 evaluateString( "textRender", "backgroundImageUrl", backgroundImageUrl ) ); 128 } 129 130 133 public void setBgColor( String bgColor ) throws JspException 134 { 135 this.setAttribute( "bgColor", evaluateString( "textRender", "bgColor", bgColor ) ); 136 } 137 138 141 public void setFgColor( String fgColor ) throws JspException 142 { 143 this.setAttribute( "fgColor", evaluateString( "textRender", "fgColor", fgColor ) ); 144 } 145 146 149 public void setFontName( String fontName ) throws JspException 150 { 151 this.setAttribute( "fontName", evaluateString( "textRender", "fontName", fontName ) ); 152 } 153 154 157 public void setFontSize( String fontSize ) throws JspException 158 { 159 this.setAttribute( "fontSize", evaluateInteger( "textRender", "fontSize", fontSize ) ); 160 } 161 162 165 public void setFontStyle( String fontStyle ) throws JspException 166 { 167 this.setAttribute( "fontStyle", evaluateInteger( "textRender", "fontStyle", fontStyle ) ); 168 } 169 170 173 public void setImageType( String imageType ) throws JspException 174 { 175 this.setAttribute( "imageType", evaluateInteger( "textRender", "imageType", imageType ) ); 176 } 177 178 181 public void setMaxRows( String maxRows ) throws JspException 182 { 183 this.setAttribute( "maxRows", evaluateInteger( "textRender", "maxRows", maxRows ) ); 184 } 185 186 189 public void setPad( String pad ) throws JspException 190 { 191 this.setAttribute( "pad", evaluateInteger( "textRender", "pad", pad ) ); 192 } 193 194 197 public void setPadBottom( String padBottom ) throws JspException 198 { 199 this.setAttribute( "padBottom", evaluateInteger( "textRender", "padBottom", padBottom ) ); 200 } 201 202 205 public void setPadLeft( String padLeft ) throws JspException 206 { 207 this.setAttribute( "padLeft", evaluateInteger( "textRender", "padLeft", padLeft ) ); 208 } 209 210 213 public void setPadRight( String padRight ) throws JspException 214 { 215 this.setAttribute( "padRight", evaluateInteger( "textRender", "padRight", padRight ) ); 216 } 217 218 221 public void setPadTop( String padTop ) throws JspException 222 { 223 this.setAttribute( "padTop", evaluateInteger( "textRender", "padTop", padTop ) ); 224 } 225 226 229 public void setRenderWidth( String renderWidth ) throws JspException 230 { 231 this.setAttribute( "renderWidth", evaluateInteger( "textRender", "renderWidth", renderWidth ) ); 232 } 233 234 237 public void setTileBackgroundImage( String tileBackgroundImage ) throws JspException 238 { 239 this.setAttribute( "tileBackgroundImage", evaluateInteger( "textRender", "tileBackgroundImage", 240 tileBackgroundImage ) ); 241 } 242 243 246 public void setTrimEdges( String trimEdges ) throws JspException 247 { 248 this.setAttribute( "trimEdges", evaluateInteger( "textRender", "trimEdges", trimEdges ) ); 249 } 250 } | Popular Tags |