1 package org.jahia.taglibs.field; 2 3 import javax.servlet.jsp.JspException ; 4 5 import org.jahia.data.JahiaData; 6 import org.jahia.data.fields.FieldTypes; 7 import org.jahia.gui.GuiBean; 8 9 10 16 public class ColorFieldTag extends AbstractFieldTag { 17 18 private int maxchar = 0; 19 20 public void setMaxchar(int maxchar) { 21 this.maxchar = maxchar; 22 } 23 24 public int getFieldType() { 25 return FieldTypes.COLOR; 26 } 27 28 public String readValue(JahiaData jData, String value) { 29 if (this.maxchar == 0) { 30 return value; 31 } else { 32 return GuiBean.glueTitle(value, this.maxchar); 33 } 34 } 35 36 public int doEndTag() throws JspException { 37 super.doEndTag(); 40 maxchar = 0; 41 return EVAL_PAGE; 42 } 43 44 } | Popular Tags |