View Javadoc

    1   /*
    2    * $Id: SubmitTag.java 508280 2007-02-16 02:07:56Z musachy $
    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      protected String showLoadingText;
    55
    56      //these two are called "preInvokeJS" and "onLoadJS" on the tld
    57      //Names changed here to keep some consistency
    58      protected String beforeLoading;
    59      protected String afterLoading;
    60
    61      //this one is called "resultDivId" on the tld
    62      protected String targets;
    63
    64      public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
    65          return new Submit(stack, req, res);
    66      }
    67
    68      protected void populateParams() {
    69          super.populateParams();
    70
    71          Submit submit = ((Submit) component);
    72          submit.setAction(action);
    73          submit.setMethod(method);
    74          submit.setAlign(align);
    75          submit.setType(type);
    76          submit.setHref(href);
    77          submit.setListenTopics(listenTopics);
    78          submit.setLoadingText(loadingText);
    79          submit.setErrorText(errorText);
    80          submit.setAfterLoading(afterLoading);
    81          submit.setBeforeLoading(beforeLoading);
    82          submit.setExecuteScripts(executeScripts);
    83          submit.setHandler(handler);
    84          submit.setFormFilter(formFilter);
    85          submit.setFormId(formId);
    86          submit.setSrc(src);
    87          submit.setTargets(targets);
    88          submit.setNotifyTopics(notifyTopics);
    89          submit.setShowErrorTransportText(showErrorTransportText);
    90          submit.setIndicator(indicator);
    91          submit.setShowLoadingText(showLoadingText);
    92      }
    93
    94      public void setAction(String action) {
    95          this.action = action;
    96      }
    97
    98      public void setMethod(String method) {
    99          this.method = method;
    100     }
    101
    102     public void setAlign(String align) {
    103         this.align = align;
    104     }
    105
    106     public String getType() {
    107         return type;
    108     }
    109
    110     public void setType(String type) {
    111         this.type = type;
    112     }
    113
    114     public void setHref(String href) {
    115         this.href = href;
    116     }
    117
    118     public void setErrorText(String errorText) {
    119         this.errorText = errorText;
    120     }
    121
    122     public void setLoadingText(String loadingText) {
    123         this.loadingText = loadingText;
    124     }
    125
    126     public void setListenTopics(String listenTopics) {
    127         this.listenTopics = listenTopics;
    128     }
    129
    130     public void setExecuteScripts(String executeScripts) {
    131         this.executeScripts = executeScripts;
    132     }
    133
    134     public void setHandler(String handler) {
    135         this.handler = handler;
    136     }
    137
    138     public void setFormFilter(String formFilter) {
    139         this.formFilter = formFilter;
    140     }
    141
    142     public void setFormId(String formId) {
    143         this.formId = formId;
    144     }
    145
    146     public void setSrc(String src) {
    147         this.src = src;
    148     }
    149
    150     public void setTargets(String targets) {
    151         this.targets = targets;
    152     }
    153
    154     @Deprecated
    155     public void setResultDivId(String id) {
    156         this.targets = id;
    157     }
    158
    159     @Deprecated
    160     public void setOnLoadJS(String postJS) {
    161         this.afterLoading = postJS;
    162     }
    163
    164     @Deprecated
    165     public void setPreInvokeJS(String preJS) {
    166         this.beforeLoading = preJS;
    167     }
    168
    169     public void setNotifyTopics(String notifyTopics) {
    170         this.notifyTopics = notifyTopics;
    171     }
    172
    173     public void setShowErrorTransportText(String showErrorTransportText) {
    174         this.showErrorTransportText = showErrorTransportText;
    175     }
    176
    177     public void setIndicator(String indicator) {
    178         this.indicator = indicator;
    179     }
    180
    181     public void setShowLoadingText(String showLoadingText) {
    182         this.showLoadingText = showLoadingText;
    183     }
    184 }