001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.dto.html5;
014
015import org.apache.juneau.annotation.*;
016
017/**
018 * DTO for an HTML {@doc HTML5.forms#the-textarea-element <textarea>}
019 * element.
020 *
021 * <h5 class='section'>See Also:</h5>
022 * <ul class='doctree'>
023 *    <li class='link'>{@doc juneau-dto.HTML5}
024 * </ul>
025 */
026@Bean(typeName="textarea")
027public class Textarea extends HtmlElementRawText {
028
029   /**
030    * {@doc HTML5.forms#attr-fe-autocomplete autocomplete} attribute.
031    *
032    * <p>
033    * Hint for form auto-fill feature.
034    *
035    * @param autocomplete The new value for this attribute.
036    * @return This object (for method chaining).
037    */
038   public final Textarea autocomplete(String autocomplete) {
039      attr("autocomplete", autocomplete);
040      return this;
041   }
042
043   /**
044    * {@doc HTML5.forms#attr-fe-autofocus autofocus} attribute.
045    *
046    * <p>
047    * Automatically focus the form control when the page is loaded.
048    *
049    * @param autofocus
050    *    The new value for this attribute.
051    *    Typically a {@link Boolean} or {@link String}.
052    * @return This object (for method chaining).
053    */
054   public final Textarea autofocus(Boolean autofocus) {
055      attr("autofocus", autofocus);
056      return this;
057   }
058
059   /**
060    * {@doc HTML5.forms#attr-textarea-cols cols} attribute.
061    *
062    * <p>
063    * Maximum number of characters per line.
064    *
065    * @param cols
066    *    The new value for this attribute.
067    *    Typically a {@link Number} or {@link String}.
068    * @return This object (for method chaining).
069    */
070   public final Textarea cols(Object cols) {
071      attr("cols", cols);
072      return this;
073   }
074
075   /**
076    * {@doc HTML5.forms#attr-fe-dirname dirname} attribute.
077    *
078    * <p>
079    * Name of form field to use for sending the element's directionality in form submission.
080    *
081    * @param dirname The new value for this attribute.
082    * @return This object (for method chaining).
083    */
084   public final Textarea dirname(String dirname) {
085      attr("dirname", dirname);
086      return this;
087   }
088
089   /**
090    * {@doc HTML5.forms#attr-fe-disabled disabled} attribute.
091    *
092    * <p>
093    * Whether the form control is disabled.
094    *
095    * @param disabled
096    *    The new value for this attribute.
097    *    Typically a {@link Boolean} or {@link String}.
098    * @return This object (for method chaining).
099    */
100   public final Textarea disabled(Object disabled) {
101      attr("disabled", deminimize(disabled, "disabled"));
102      return this;
103   }
104
105   /**
106    * {@doc HTML5.forms#attr-fae-form form} attribute.
107    *
108    * <p>
109    * Associates the control with a form element.
110    *
111    * @param form The new value for this attribute.
112    * @return This object (for method chaining).
113    */
114   public final Textarea form(String form) {
115      attr("form", form);
116      return this;
117   }
118
119   /**
120    * {@doc HTML5.forms#inputmode inputmode} attribute.
121    *
122    * <p>
123    * Hint for selecting an input modality.
124    *
125    * @param inputmode The new value for this attribute.
126    * @return This object (for method chaining).
127    */
128   public final Textarea inputmode(String inputmode) {
129      attr("inputmode", inputmode);
130      return this;
131   }
132
133   /**
134    * {@doc HTML5.forms#attr-textarea-maxlength maxlength} attribute.
135    *
136    * <p>
137    * Maximum length of value.
138    *
139    * @param maxlength
140    *    The new value for this attribute.
141    *    Typically a {@link Number} or {@link String}.
142    * @return This object (for method chaining).
143    */
144   public final Textarea maxlength(Object maxlength) {
145      attr("maxlength", maxlength);
146      return this;
147   }
148
149   /**
150    * {@doc HTML5.forms#attr-textarea-minlength minlength} attribute.
151    *
152    * <p>
153    * Minimum length of value.
154    *
155    * @param minlength
156    *    The new value for this attribute.
157    *    Typically a {@link Number} or {@link String}.
158    * @return This object (for method chaining).
159    */
160   public final Textarea minlength(Object minlength) {
161      attr("minlength", minlength);
162      return this;
163   }
164
165   /**
166    * {@doc HTML5.forms#attr-fe-name name} attribute.
167    *
168    * <p>
169    * Name of form control to use for form submission and in the form.elements API.
170    *
171    * @param name The new value for this attribute.
172    * @return This object (for method chaining).
173    */
174   public final Textarea name(String name) {
175      attr("name", name);
176      return this;
177   }
178
179   /**
180    * {@doc HTML5.forms#attr-textarea-placeholder placeholder}
181    * attribute.
182    *
183    * <p>
184    * User-visible label to be placed within the form control.
185    *
186    * @param placeholder The new value for this attribute.
187    * @return This object (for method chaining).
188    */
189   public final Textarea placeholder(String placeholder) {
190      attr("placeholder", placeholder);
191      return this;
192   }
193
194   /**
195    * {@doc HTML5.forms#attr-textarea-readonly readonly} attribute.
196    *
197    * <p>
198    * Whether to allow the value to be edited by the user.
199    *
200    * @param readonly
201    *    The new value for this attribute.
202    *    Typically a {@link Boolean} or {@link String}.
203    * @return This object (for method chaining).
204    */
205   public final Textarea readonly(Object readonly) {
206      attr("readonly", readonly);
207      return this;
208   }
209
210   /**
211    * {@doc HTML5.forms#attr-textarea-required required} attribute.
212    *
213    * <p>
214    * Whether the control is required for form submission.
215    *
216    * @param required
217    *    The new value for this attribute.
218    *    Typically a {@link Boolean} or {@link String}.
219    * @return This object (for method chaining).
220    */
221   public final Textarea required(Object required) {
222      attr("required", required);
223      return this;
224   }
225
226   /**
227    * {@doc HTML5.forms#attr-textarea-rows rows} attribute.
228    *
229    * <p>
230    * Number of lines to show.
231    *
232    * @param rows
233    *    The new value for this attribute.
234    *    Typically a {@link Number} or {@link String}.
235    * @return This object (for method chaining).
236    */
237   public final Textarea rows(Number rows) {
238      attr("rows", rows);
239      return this;
240   }
241
242   /**
243    * {@doc HTML5.forms#attr-textarea-wrap wrap} attribute.
244    *
245    * <p>
246    * How the value of the form control is to be wrapped for form submission.
247    *
248    * @param wrap The new value for this attribute.
249    * @return This object (for method chaining).
250    */
251   public final Textarea wrap(String wrap) {
252      attr("wrap", wrap);
253      return this;
254   }
255
256
257   //-----------------------------------------------------------------------------------------------------------------
258   // Overridden methods
259   //-----------------------------------------------------------------------------------------------------------------
260
261   @Override /* HtmlElement */
262   public final Textarea _class(String _class) {
263      super._class(_class);
264      return this;
265   }
266
267   @Override /* HtmlElement */
268   public final Textarea id(String id) {
269      super.id(id);
270      return this;
271   }
272
273   @Override /* HtmlElement */
274   public final Textarea style(String style) {
275      super.style(style);
276      return this;
277   }
278
279   @Override /* HtmlElementText */
280   public Textarea text(Object text) {
281      super.text(text);
282      return this;
283   }
284}