1 package gboat2.base.view.components;
2
3 import javax.servlet.http.HttpServletRequest;
4 import javax.servlet.http.HttpServletResponse;
5
6 import org.apache.struts2.views.annotations.StrutsTag;
7 import org.apache.struts2.views.annotations.StrutsTagAttribute;
8
9 import com.opensymphony.xwork2.util.ValueStack;
10
11
12
13
14
15
16
17
18 @StrutsTag(
19 name="textarea",
20 tldTagClass="gboat2.base.view.jsp.TextareaTag",
21 description="创建一个文本域",
22 allowDynamicAttributes=true)
23 public class TextArea extends org.apache.struts2.components.TextArea {
24
25 protected String colspan;
26 protected String groupColumns;
27 protected String labelCssClass;
28 protected String labelCssStyle;
29 protected String helpText;
30
31 public TextArea(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
32 super(stack, request, response);
33 }
34
35 @Override
36 public void evaluateExtraParams() {
37 super.evaluateExtraParams();
38
39 if (colspan != null) {
40 addParameter("colspan", findValue(colspan, Integer.class));
41 }
42
43 if (groupColumns != null) {
44 addParameter("groupColumns", findValue(groupColumns, Integer.class));
45 }
46
47 if (labelCssClass != null) {
48 addParameter("labelCssClass", findString(labelCssClass));
49 }
50
51 if (labelCssStyle != null) {
52 addParameter("labelCssStyle", findString(labelCssStyle));
53 }
54
55 if (helpText != null) {
56 addParameter("helpText", findString(helpText));
57 }
58 }
59
60 @StrutsTagAttribute(description="控件所占的列数,只在水平布局的表单中才生效", type="Integer")
61 public void setColspan(String colspan) {
62 this.colspan = colspan;
63 }
64
65 @StrutsTagAttribute(description="控件所占栅栏布局的列数,如果设置了该值,则会为控件最外层的 DIV 加上 col-sm-* 的样式类", type="Integer")
66 public void setGroupColumns(String groupColumns) {
67 this.groupColumns = groupColumns;
68 }
69
70 @StrutsTagAttribute(description="标签的 CSS 样式类")
71 public void setLabelCssClass(String labelCssClass) {
72 this.labelCssClass = labelCssClass;
73 }
74
75 @StrutsTagAttribute(description="标签的 CSS 样式")
76 public void setLabelCssStyle(String labelCssStyle) {
77 this.labelCssStyle = labelCssStyle;
78 }
79
80 @StrutsTagAttribute(description="帮助文本,显示在文本框的下方")
81 public void setHelpText(String helpText) {
82 this.helpText = helpText;
83 }
84 }