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 java.net.*;
016import java.net.URI;
017
018import org.apache.juneau.*;
019import org.apache.juneau.annotation.*;
020
021/**
022 * DTO for an HTML {@doc HTML5.forms#the-form-element <form>}
023 * element.
024 *
025 * <ul class='seealso'>
026 *    <li class='link'>{@doc juneau-dto.HTML5}
027 * </ul>
028 */
029@Bean(typeName="form")
030public class Form extends HtmlElementMixed {
031
032   /**
033    * {@doc HTML5.forms#attr-form-accept-charset accept-charset}
034    * attribute.
035    *
036    * <p>
037    * Character encodings to use for form submission.
038    *
039    * @param acceptcharset The new value for this attribute.
040    * @return This object (for method chaining).
041    */
042   public final Form acceptcharset(String acceptcharset) {
043      attr("accept-charset", acceptcharset);
044      return this;
045   }
046
047   /**
048    * {@doc HTML5.forms#attr-fs-action action} attribute.
049    *
050    * <p>
051    * URL to use for form submission.
052    *
053    * <p>
054    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
055    * Strings must be valid URIs.
056    *
057    * <p>
058    * URIs defined by {@link UriResolver} can be used for values.
059    *
060    * @param action The new value for this attribute.
061    * @return This object (for method chaining).
062    */
063   public final Form action(String action) {
064      attrUri("action", action);
065      return this;
066   }
067
068   /**
069    * {@doc HTML5.forms#attr-form-autocomplete autocomplete}
070    * attribute.
071    *
072    * <p>
073    * Default setting for auto-fill feature for controls in the form.
074    *
075    * @param autocomplete The new value for this attribute.
076    * @return This object (for method chaining).
077    */
078   public final Form autocomplete(String autocomplete) {
079      attr("autocomplete", autocomplete);
080      return this;
081   }
082
083   /**
084    * {@doc HTML5.forms#attr-fs-enctype enctype} attribute.
085    *
086    * <p>
087    * Form data set encoding type to use for form submission.
088    *
089    * @param enctype The new value for this attribute.
090    * @return This object (for method chaining).
091    */
092   public final Form enctype(String enctype) {
093      attr("enctype", enctype);
094      return this;
095   }
096
097   /**
098    * {@doc HTML5.forms#attr-fs-method method} attribute.
099    *
100    * <p>
101    * HTTP method to use for form submission.
102    *
103    * @param method The new value for this attribute.
104    * @return This object (for method chaining).
105    */
106   public final Form method(String method) {
107      attr("method", method);
108      return this;
109   }
110
111   /**
112    * {@doc HTML5.forms#attr-form-name name} attribute.
113    *
114    * <p>
115    * Name of form to use in the document.forms API.
116    *
117    * @param name The new value for this attribute.
118    * @return This object (for method chaining).
119    */
120   public final Form name(String name) {
121      attr("name", name);
122      return this;
123   }
124
125   /**
126    * {@doc HTML5.forms#attr-fs-novalidate novalidate} attribute.
127    *
128    * <p>
129    * Bypass form control validation for form submission.
130    *
131    * @param novalidate The new value for this attribute.
132    * Typically a {@link Boolean} or {@link String}.
133    * @return This object (for method chaining).
134    */
135   public final Form novalidate(Boolean novalidate) {
136      attr("novalidate", novalidate);
137      return this;
138   }
139
140   /**
141    * {@doc HTML5.forms#attr-fs-target target} attribute.
142    *
143    * <p>
144    * Browsing context for form submission.
145    *
146    * @param target The new value for this attribute.
147    * @return This object (for method chaining).
148    */
149   public final Form target(String target) {
150      attr("target", target);
151      return this;
152   }
153
154
155   //-----------------------------------------------------------------------------------------------------------------
156   // Overridden methods
157   //-----------------------------------------------------------------------------------------------------------------
158
159
160   @Override /* HtmlElement */
161   public final Form _class(String _class) {
162      super._class(_class);
163      return this;
164   }
165
166   @Override /* HtmlElement */
167   public final Form id(String id) {
168      super.id(id);
169      return this;
170   }
171
172   @Override /* HtmlElement */
173   public final Form style(String style) {
174      super.style(style);
175      return this;
176   }
177
178   @Override /* HtmlElementMixed */
179   public Form children(Object...children) {
180      super.children(children);
181      return this;
182   }
183
184   @Override /* HtmlElementMixed */
185   public Form child(Object child) {
186      super.child(child);
187      return this;
188   }
189}