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.TagSupport;
20
21 import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;
22 import org.extremecomponents.table.InputAttributes;
23 import org.extremecomponents.table.bean.Input;
24
25
26
27 /***
28 * @author jeff johnston
29 */
30 public class InputTag extends TagSupport implements InputAttributes
31 {
32 private String type;
33 private String name;
34 private String value;
35 private String onclick;
36
37 public String getType()
38 {
39 return type;
40 }
41
42 public void setType(String type)
43 {
44 this.type = type;
45 }
46
47 public String getName()
48 {
49 return name;
50 }
51
52 public void setName(String name)
53 {
54 this.name = name;
55 }
56
57 public String getValue()
58 {
59 return value;
60 }
61
62 public void setValue(String value)
63 {
64 this.value = value;
65 }
66
67 public String getOnclick()
68 {
69 return onclick;
70 }
71
72 public void setOnclick(String onclick)
73 {
74 this.onclick = onclick;
75 }
76
77 public int doEndTag()
78 throws JspException
79 {
80 TableTag tableTag = (TableTag) findAncestorWithClass(this, TableTag.class);
81
82 if (value != null)
83 {
84 value = (String) ExpressionEvaluatorManager.evaluate("value", value, String.class, this, pageContext);
85 }
86
87 Input input = new Input(tableTag.getModel());
88 input.setType(type);
89 input.setName(name);
90 input.setValue(value);
91 input.setOnclick(onclick);
92 tableTag.addInput(input);
93
94 cleanup();
95
96 return EVAL_PAGE;
97 }
98
99 public void cleanup()
100 {
101 type = null;
102 name = null;
103 value = null;
104 onclick = null;
105 }
106 }