Save This Page
Home » struts-2.1.8.1-src » org.apache » struts2 » components » [javadoc | source]
    1   /*
    2    * $Id: TextArea.java 651946 2008-04-27 13:41:38Z apetrelli $
    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   
   22   package org.apache.struts2.components;
   23   
   24   import javax.servlet.http.HttpServletRequest;
   25   import javax.servlet.http.HttpServletResponse;
   26   
   27   import org.apache.struts2.views.annotations.StrutsTag;
   28   import org.apache.struts2.views.annotations.StrutsTagAttribute;
   29   
   30   import com.opensymphony.xwork2.util.ValueStack;
   31   
   32   /**
   33    * <!-- START SNIPPET: javadoc -->
   34    * Render HTML textarea tag.</p>
   35    * <!-- END SNIPPET: javadoc -->
   36    *
   37    * <p/> <b>Examples</b>
   38    *
   39    * <pre>
   40    * <!-- START SNIPPET: example -->
   41    * &lt;s:textarea label="Comments" name="comments" cols="30" rows="8"/&gt;
   42    * <!-- END SNIPPET: example -->
   43    * </pre>
   44    *
   45    * @see TabbedPanel
   46    *
   47    */
   48   @StrutsTag(
   49       name="textarea",
   50       tldTagClass="org.apache.struts2.views.jsp.ui.TextareaTag",
   51       description="Render HTML textarea tag.",
   52       allowDynamicAttributes=true)
   53   public class TextArea extends UIBean {
   54       final public static String TEMPLATE = "textarea";
   55   
   56       protected String cols;
   57       protected String readonly;
   58       protected String rows;
   59       protected String wrap;
   60   
   61       public TextArea(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
   62           super(stack, request, response);
   63       }
   64   
   65       protected String getDefaultTemplate() {
   66           return TEMPLATE;
   67       }
   68   
   69       public void evaluateExtraParams() {
   70           super.evaluateExtraParams();
   71   
   72           if (readonly != null) {
   73               addParameter("readonly", findValue(readonly, Boolean.class));
   74           }
   75   
   76           if (cols != null) {
   77               addParameter("cols", findString(cols));
   78           }
   79   
   80           if (rows != null) {
   81               addParameter("rows", findString(rows));
   82           }
   83   
   84           if (wrap != null) {
   85               addParameter("wrap", findString(wrap));
   86           }
   87       }
   88   
   89       @StrutsTagAttribute(description="HTML cols attribute", type="Integer")
   90       public void setCols(String cols) {
   91           this.cols = cols;
   92       }
   93   
   94       @StrutsTagAttribute(description="Whether the textarea is readonly", type="Boolean", defaultValue="false")
   95       public void setReadonly(String readonly) {
   96           this.readonly = readonly;
   97       }
   98   
   99       @StrutsTagAttribute(description="HTML rows attribute", type="Integer")
  100       public void setRows(String rows) {
  101           this.rows = rows;
  102       }
  103   
  104       @StrutsTagAttribute(description="HTML wrap attribute")
  105       public void setWrap(String wrap) {
  106           this.wrap = wrap;
  107       }
  108   }

Save This Page
Home » struts-2.1.8.1-src » org.apache » struts2 » components » [javadoc | source]