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 * <h5 class='section'>See Also:</h5>
022 * <ul class='doctree'>
023 *    <li class='link'>{@doc juneau-dto.HTML5}
024 * </ul>
025 */
026@Bean(typeName="option")
027public class Option extends HtmlElementText {
028
029   /**
030    * {@doc HTML5.forms#attr-option-disabled disabled} 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", deminimize(disabled, "disabled"));
042      return this;
043   }
044
045   /**
046    * {@doc HTML5.forms#attr-option-label label} 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    * {@doc HTML5.forms#attr-option-selected selected} 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", deminimize(selected, "selected"));
072      return this;
073   }
074
075   /**
076    * {@doc HTML5.forms#attr-option-value value} 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}