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