View Javadoc

1   /*
2    * $Id: SubmitTag.java 490079 2006-12-24 22:46:07Z husted $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.struts2.views.jsp.ui;
22  
23  import javax.servlet.http.HttpServletRequest;
24  import javax.servlet.http.HttpServletResponse;
25  
26  import org.apache.struts2.components.Component;
27  import org.apache.struts2.components.Submit;
28  
29  import com.opensymphony.xwork2.util.ValueStack;
30  
31  /***
32   * @see Submit
33   */
34  public class SubmitTag extends AbstractUITag {
35  
36      private static final long serialVersionUID = 2179281109958301343L;
37  
38      protected String action;
39      protected String method;
40      protected String align;
41      protected String type;
42      protected String href;
43      protected String listenTopics;
44      protected String notifyTopics;
45      protected String loadingText;
46      protected String errorText;
47      protected String executeScripts;
48      protected String handler;
49      protected String formId;
50      protected String formFilter;
51      protected String src;
52      protected String showErrorTransportText;
53      protected String indicator;
54  
55      //these two are called "preInvokeJS" and "onLoadJS" on the tld
56      //Names changed here to keep some consistency
57      protected String beforeLoading;
58      protected String afterLoading;
59  
60      //this one is called "resultDivId" on the tld
61      protected String targets;
62  
63      public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
64          return new Submit(stack, req, res);
65      }
66  
67      protected void populateParams() {
68          super.populateParams();
69  
70          Submit submit = ((Submit) component);
71          submit.setAction(action);
72          submit.setMethod(method);
73          submit.setAlign(align);
74          submit.setType(type);
75          submit.setHref(href);
76          submit.setListenTopics(listenTopics);
77          submit.setLoadingText(loadingText);
78          submit.setErrorText(errorText);
79          submit.setAfterLoading(afterLoading);
80          submit.setBeforeLoading(beforeLoading);
81          submit.setExecuteScripts(executeScripts);
82          submit.setHandler(handler);
83          submit.setFormFilter(formFilter);
84          submit.setFormId(formId);
85          submit.setSrc(src);
86          submit.setTargets(targets);
87          submit.setNotifyTopics(notifyTopics);
88          submit.setShowErrorTransportText(showErrorTransportText);
89          submit.setIndicator(indicator);
90      }
91  
92      public void setAction(String action) {
93          this.action = action;
94      }
95  
96      public void setMethod(String method) {
97          this.method = method;
98      }
99  
100     public void setAlign(String align) {
101         this.align = align;
102     }
103 
104     public String getType() {
105         return type;
106     }
107 
108     public void setType(String type) {
109         this.type = type;
110     }
111 
112     public void setHref(String href) {
113         this.href = href;
114     }
115 
116     public void setErrorText(String errorText) {
117         this.errorText = errorText;
118     }
119 
120     public void setLoadingText(String loadingText) {
121         this.loadingText = loadingText;
122     }
123 
124     public void setListenTopics(String listenTopics) {
125         this.listenTopics = listenTopics;
126     }
127 
128     public void setExecuteScripts(String executeScripts) {
129         this.executeScripts = executeScripts;
130     }
131 
132     public void setHandler(String handler) {
133         this.handler = handler;
134     }
135 
136     public void setFormFilter(String formFilter) {
137         this.formFilter = formFilter;
138     }
139 
140     public void setFormId(String formId) {
141         this.formId = formId;
142     }
143 
144     public void setSrc(String src) {
145         this.src = src;
146     }
147 
148     public void setTargets(String targets) {
149         this.targets = targets;
150     }
151 
152     @Deprecated
153     public void setResultDivId(String id) {
154         this.targets = id;
155     }
156 
157     @Deprecated
158     public void setOnLoadJS(String postJS) {
159         this.afterLoading = postJS;
160     }
161 
162     @Deprecated
163     public void setPreInvokeJS(String preJS) {
164         this.beforeLoading = preJS;
165     }
166 
167     public void setNotifyTopics(String notifyTopics) {
168         this.notifyTopics = notifyTopics;
169     }
170 
171     public void setShowErrorTransportText(String showErrorTransportText) {
172         this.showErrorTransportText = showErrorTransportText;
173     }
174 
175     public void setIndicator(String indicator) {
176         this.indicator = indicator;
177     }
178 }