View Javadoc
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   * @date 2014年5月21日
17   * @author <a href="mailto:[email protected]">何明旺</a>
18   * @since 3.0.0-SNAPSHOT
19   */
20  @StrutsTag(
21          name="checkboxlist",
22          tldTagClass="gboat2.base.view.jsp.CheckboxListTag",
23          description="创建一组多选框")
24  public class CheckboxList extends org.apache.struts2.components.CheckboxList {
25      
26      protected String colspan;
27      protected String groupColumns;
28      protected String labelCssClass;
29      protected String labelCssStyle;
30  
31      public CheckboxList(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          GboatViewUtil.addReadonlyParameter(this, request);
56      }
57      
58      @StrutsTagAttribute(description="控件所占的列数,只在水平布局的表单中才生效", type="Integer")
59      public void setColspan(String colspan) {
60          this.colspan = colspan;
61      }
62  
63      @StrutsTagAttribute(description="控件所占栅栏布局的列数,如果设置了该值,则会为控件最外层的 DIV 加上 col-sm-* 的样式类", type="Integer")
64      public void setGroupColumns(String groupColumns) {
65          this.groupColumns = groupColumns;
66      }
67  
68      @StrutsTagAttribute(description="标签的 CSS 样式类")
69      public void setLabelCssClass(String labelCssClass) {
70          this.labelCssClass = labelCssClass;
71      }
72  
73      @StrutsTagAttribute(description="标签的 CSS 样式")
74      public void setLabelCssStyle(String labelCssStyle) {
75          this.labelCssStyle = labelCssStyle;
76      }
77  }