001: /*
002: * $Id: TextArea.java 497654 2007-01-19 00:21:57Z rgielen $
003: *
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021: package org.apache.struts2.components;
022:
023: import javax.servlet.http.HttpServletRequest;
024: import javax.servlet.http.HttpServletResponse;
025:
026: import org.apache.struts2.views.annotations.StrutsTag;
027: import org.apache.struts2.views.annotations.StrutsTagAttribute;
028:
029: import com.opensymphony.xwork2.util.ValueStack;
030:
031: /**
032: * <!-- START SNIPPET: javadoc -->
033: * Render HTML textarea tag.</p>
034: * <!-- END SNIPPET: javadoc -->
035: *
036: * <p/> <b>Examples</b>
037: *
038: * <pre>
039: * <!-- START SNIPPET: example -->
040: * <s:textarea label="Comments" name="comments" cols="30" rows="8"/>
041: * <!-- END SNIPPET: example -->
042: * </pre>
043: *
044: * @see TabbedPanel
045: *
046: */
047: @StrutsTag(name="textarea",tldTagClass="org.apache.struts2.views.jsp.ui.TextareaTag",description="Render HTML textarea tag.")
048: public class TextArea extends UIBean {
049: final public static String TEMPLATE = "textarea";
050:
051: protected String cols;
052: protected String readonly;
053: protected String rows;
054: protected String wrap;
055:
056: public TextArea(ValueStack stack, HttpServletRequest request,
057: HttpServletResponse response) {
058: super (stack, request, response);
059: }
060:
061: protected String getDefaultTemplate() {
062: return TEMPLATE;
063: }
064:
065: public void evaluateExtraParams() {
066: super .evaluateExtraParams();
067:
068: if (readonly != null) {
069: addParameter("readonly", findValue(readonly, Boolean.class));
070: }
071:
072: if (cols != null) {
073: addParameter("cols", findString(cols));
074: }
075:
076: if (rows != null) {
077: addParameter("rows", findString(rows));
078: }
079:
080: if (wrap != null) {
081: addParameter("wrap", findString(wrap));
082: }
083: }
084:
085: @StrutsTagAttribute(description="HTML cols attribute",type="Integer")
086: public void setCols(String cols) {
087: this .cols = cols;
088: }
089:
090: @StrutsTagAttribute(description="Whether the textarea is readonly",type="Boolean",defaultValue="false")
091: public void setReadonly(String readonly) {
092: this .readonly = readonly;
093: }
094:
095: @StrutsTagAttribute(description="HTML rows attribute",type="Integer")
096: public void setRows(String rows) {
097: this .rows = rows;
098: }
099:
100: @StrutsTagAttribute(description="HTML wrap attribute")
101: public void setWrap(String wrap) {
102: this.wrap = wrap;
103: }
104: }
|