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