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