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 <a class="doclink" href="https://www.w3.org/TR/html5/forms.html#the-option-element"><option></a> 019 * element. 020 * 021 * <h5 class='section'>See Also:</h5> 022 * <ul class='doctree'> 023 * <li class='link'><a class='doclink' href='../../../../../overview-summary.html#juneau-dto.HTML5'>Overview > juneau-dto > HTML5</a> 024 * </ul> 025 */ 026@Bean(typeName="option") 027public class Option extends HtmlElementText { 028 029 /** 030 * <a class="doclink" href="https://www.w3.org/TR/html5/forms.html#attr-option-disabled">disabled</a> attribute. 031 * 032 * <p> 033 * Whether the form control is disabled. 034 * 035 * @param disabled 036 * The new value for this attribute. 037 * Typically a {@link Boolean} or {@link String}. 038 * @return This object (for method chaining). 039 */ 040 public final Option disabled(Object disabled) { 041 attr("disabled", disabled); 042 return this; 043 } 044 045 /** 046 * <a class="doclink" href="https://www.w3.org/TR/html5/forms.html#attr-option-label">label</a> attribute. 047 * 048 * <p> 049 * User-visible label. 050 * 051 * @param label The new value for this attribute. 052 * @return This object (for method chaining). 053 */ 054 public final Option label(String label) { 055 attr("label", label); 056 return this; 057 } 058 059 /** 060 * <a class="doclink" href="https://www.w3.org/TR/html5/forms.html#attr-option-selected">selected</a> attribute. 061 * 062 * <p> 063 * Whether the option is selected by default. 064 * 065 * @param selected 066 * The new value for this attribute. 067 * Typically a {@link Boolean} or {@link String}. 068 * @return This object (for method chaining). 069 */ 070 public final Option selected(Object selected) { 071 attr("selected", selected); 072 return this; 073 } 074 075 /** 076 * <a class="doclink" href="https://www.w3.org/TR/html5/forms.html#attr-option-value">value</a> attribute. 077 * 078 * <p> 079 * Value to be used for form submission. 080 * 081 * @param value 082 * The new value for this attribute. 083 * Typically a {@link Number} or {@link String}. 084 * @return This object (for method chaining). 085 */ 086 public final Option value(Object value) { 087 attr("value", value); 088 return this; 089 } 090 091 092 //-------------------------------------------------------------------------------- 093 // Overridden methods 094 //-------------------------------------------------------------------------------- 095 096 @Override /* HtmlElement */ 097 public final Option _class(String _class) { 098 super._class(_class); 099 return this; 100 } 101 102 @Override /* HtmlElement */ 103 public final Option id(String id) { 104 super.id(id); 105 return this; 106 } 107 108 @Override /* HtmlElement */ 109 public final Option style(String style) { 110 super.style(style); 111 return this; 112 } 113 114 @Override /* HtmlElementText */ 115 public Option text(Object text) { 116 super.text(text); 117 return this; 118 } 119}