View Javadoc
1   /**
2    * Copyright By Grandsoft Company Limited.  
3    * 2014年4月9日 下午6:54:06
4    */
5   package gboat2.base.view.jsp;
6   
7   import gboat2.base.view.GboatViewUtil;
8   import gboat2.base.view.components.Button;
9   
10  import javax.servlet.http.HttpServletRequest;
11  import javax.servlet.http.HttpServletResponse;
12  
13  import org.apache.struts2.components.Component;
14  import org.apache.struts2.views.jsp.ui.AbstractUITag;
15  
16  import com.opensymphony.xwork2.util.ValueStack;
17  
18  /**
19   * 创建一个按钮
20   * @author <a href="mailto:[email protected]">何明旺</a>
21   * @since 3.0
22   * @date 2014年4月9日
23   */
24  public class ButtonTag extends AbstractUITag {
25  
26      private static final long serialVersionUID = -1;
27  
28      /** 按钮类型,可选值有:button、reset、submit */
29      protected String type;
30      
31      /** 按钮展现方式,可选值有:default、primary、success、info、warning、danger、link */
32      protected String category;
33      
34      /** 按钮大小,可选值有:lg、sm、xs */
35      protected String size;
36      
37      /** 是否显示为块级元素:true|false */
38      protected String block;
39      
40      /** 是否为活动状态:true|false */
41      protected String active;
42      
43      /** 点击按钮后显示的文本 */
44      protected String loadingValue;
45  
46      /** 用于权限控制的code,和Action方法中的Operation的code保持一致 */
47      protected String code;
48      
49      @Override
50      public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
51          return new Button(stack, req, res);
52      }
53  
54      @Override
55      protected void populateParams() {
56          super.populateParams();
57          GboatViewUtil.populateParams(this, component);
58      }
59  
60      public void setType(String type) {
61          this.type = type;
62      }
63  
64      public void setCategory(String category) {
65          this.category = category;
66      }
67  
68      public void setSize(String size) {
69          this.size = size;
70      }
71  
72      public void setBlock(String block) {
73          this.block = block;
74      }
75  
76      public void setActive(String active) {
77          this.active = active;
78      }
79  
80      public void setLoadingValue(String loadingValue) {
81          this.loadingValue = loadingValue;
82      }
83  
84      public void setCode(String code) {
85          this.code = code;
86      }
87  }