KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > taglibs > field > ColorFieldTag


1 package org.jahia.taglibs.field;
2
3 import javax.servlet.jsp.JspException JavaDoc;
4
5 import org.jahia.data.JahiaData;
6 import org.jahia.data.fields.FieldTypes;
7 import org.jahia.gui.GuiBean;
8
9
10 /**
11  * Class ColorFieldTag : displays a Jahia color field
12  * Extends the AbstractFieldTag by specifying the good field type
13  *
14  * @author Khue Nguyen
15  */

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 JavaDoc readValue(JahiaData jData, String JavaDoc 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 JavaDoc {
37         // let's reinitialize the tag variables to allow tag object reuse in
38
// pooling.
39
super.doEndTag();
40         maxchar = 0;
41         return EVAL_PAGE;
42     }
43
44 }
Popular Tags