1 package gboat2.base.view.components;
2
3 import gboat2.base.view.GboatViewUtil;
4
5 import javax.servlet.http.HttpServletRequest;
6 import javax.servlet.http.HttpServletResponse;
7
8 import org.apache.struts2.views.annotations.StrutsTag;
9 import org.apache.struts2.views.annotations.StrutsTagAttribute;
10
11 import com.opensymphony.xwork2.util.ValueStack;
12
13
14
15
16
17
18
19
20 @StrutsTag(
21 name = "radio",
22 tldTagClass = "gboat2.base.view.jsp.RadioTag",
23 description = "创建一组单选按钮",
24 allowDynamicAttributes = true)
25 public class Radio extends org.apache.struts2.components.Radio {
26
27 protected String colspan;
28 protected String groupColumns;
29 protected String labelCssClass;
30 protected String labelCssStyle;
31
32 public Radio(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
33 super(stack, request, response);
34 }
35
36 @Override
37 public void evaluateExtraParams() {
38 super.evaluateExtraParams();
39
40 if (colspan != null) {
41 addParameter("colspan", findValue(colspan, Integer.class));
42 }
43
44 if (groupColumns != null) {
45 addParameter("groupColumns", findValue(groupColumns, Integer.class));
46 }
47
48 if (labelCssClass != null) {
49 addParameter("labelCssClass", findString(labelCssClass));
50 }
51
52 if (labelCssStyle != null) {
53 addParameter("labelCssStyle", findString(labelCssStyle));
54 }
55
56 GboatViewUtil.addReadonlyParameter(this, request);
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 }