1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.extremecomponents.table.tag;
17
18 import javax.servlet.jsp.JspException;
19 import javax.servlet.jsp.tagext.BodyTagSupport;
20
21 import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
22
23
24 /***
25 * Override/Add properties to the table.
26 *
27 * @author Jeff Johnston
28 */
29 public class PropertyTag extends BodyTagSupport
30 {
31 private String name;
32 private String value;
33
34 public String getName()
35 {
36 return name;
37 }
38
39 public void setName(String name)
40 {
41 this.name = name;
42 }
43
44 public String getValue()
45 {
46 return value;
47 }
48
49 public void setValue(String value)
50 {
51 this.value = value;
52 }
53
54 public int doEndTag()
55 throws JspException
56 {
57 TableTag tableTag = (TableTag) findAncestorWithClass(this, TableTag.class);
58
59 if (tableTag.getModelRowsSize() > 0)
60 {
61 return EVAL_PAGE;
62 }
63
64 if (this.bodyContent != null)
65 {
66 value = getBodyContent().getString();
67 }
68
69 if (value != null)
70 {
71 value = (String) ExpressionEvaluatorManager.evaluate("value", value.toString(), String.class, this, pageContext);
72 }
73
74 tableTag.addProperty(name, value);
75
76 cleanup();
77
78 return EVAL_PAGE;
79 }
80
81 public void cleanup()
82 {
83 name = null;
84 value = null;
85 setBodyContent(null);
86 }
87 }