1 package org.gnomekr.potron.web.tag; 2 3 import javax.faces.component.UIComponent; 4 5 import org.apache.myfaces.taglib.html.HtmlOutputTextTag; 6 7 /*** 8 * TruncateOutputTextTag.java 9 * @author Xavier Cho 10 * @version $Revision 1.1 $ $Date: 2005/07/19 18:01:50 $ 11 * @jsp:tag 12 * name="truncateOutputText" 13 * body-content="JSP" 14 */ 15 public class TruncateOutputTextTag extends HtmlOutputTextTag { 16 17 public static final String RENDERER_TYPE = "TruncateOutputText"; 18 19 private String value; 20 private String escape; 21 private String upper; 22 private String lower; 23 private String appendEnd; 24 25 /*** 26 * @return Returns the appendEnd. 27 * @jsp.attribute 28 * required = "false" 29 * rtexprvalue = "true" 30 */ 31 public String getAppendEnd() { 32 return appendEnd; 33 } 34 35 /*** 36 * @param appendEnd The appendEnd to set. 37 */ 38 public void setAppendEnd(String appendEnd) { 39 this.appendEnd = appendEnd; 40 } 41 42 /*** 43 * @return Returns the lower. 44 * @jsp.attribute 45 * required = "false" 46 * rtexprvalue = "true" 47 */ 48 public String getLower() { 49 return lower; 50 } 51 52 /*** 53 * @param lower The lower to set. 54 */ 55 public void setLower(String lower) { 56 this.lower = lower; 57 } 58 59 /*** 60 * @return Returns the upper. 61 * @jsp.attribute 62 * required = "true" 63 * rtexprvalue = "true" 64 */ 65 public String getUpper() { 66 return upper; 67 } 68 69 /*** 70 * @param upper The upper to set. 71 */ 72 public void setUpper(String upper) { 73 this.upper = upper; 74 } 75 76 /*** 77 * @return Returns the value. 78 * @jsp.attribute 79 * required = "true" 80 * rtexprvalue = "true" 81 */ 82 public String getValue() { 83 return value; 84 } 85 86 /*** 87 * @see org.apache.myfaces.taglib.UIComponentTagBase#setValue(java.lang.String) 88 */ 89 public void setValue(String value) { 90 this.value = value; 91 super.setValue(value); 92 } 93 94 /*** 95 * @return Returns the escape. 96 * @jsp.attribute 97 * required = "false" 98 * rtexprvalue = "true" 99 */ 100 public String getEscape() { 101 return escape; 102 } 103 104 /*** 105 * @see org.apache.myfaces.taglib.html.HtmlOutputTextTagBase#setEscape(java.lang.String) 106 */ 107 public void setEscape(String escape) { 108 this.escape = escape; 109 super.setEscape(escape); 110 } 111 112 /*** 113 * @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent) 114 */ 115 @SuppressWarnings("unchecked") 116 protected void setProperties(UIComponent component) { 117 super.setProperties(component); 118 119 if (appendEnd != null) { 120 if (isValueReference(appendEnd)) { 121 component.setValueBinding("appendEnd", getFacesContext() 122 .getApplication().createValueBinding(appendEnd)); 123 } else { 124 component.getAttributes().put("appendEnd", appendEnd); 125 } 126 } 127 128 if (upper != null) { 129 if (isValueReference(upper)) { 130 component.setValueBinding("upper", getFacesContext() 131 .getApplication().createValueBinding(upper)); 132 } else { 133 component.getAttributes().put("upper", Integer.parseInt(upper)); 134 } 135 } 136 137 if (lower != null) { 138 if (isValueReference(lower)) { 139 component.setValueBinding("lower", getFacesContext() 140 .getApplication().createValueBinding(lower)); 141 } else { 142 component.getAttributes().put("lower", Integer.parseInt(lower)); 143 } 144 } 145 } 146 147 /*** 148 * @see org.apache.myfaces.taglib.core.VerbatimTag#getRendererType() 149 */ 150 @Override 151 public String getRendererType() { 152 return RENDERER_TYPE; 153 } 154 }