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 ExtHTML5.embedded-content-0#the-track-element <track>}
023 * element.
024 *
025 * <ul class='seealso'>
026 *    <li class='link'>{@doc DtoHtml5}
027 * </ul>
028 */
029@Bean(typeName="track")
030public class Track extends HtmlElementVoid {
031
032   /**
033    * Creates an empty {@link Track} element.
034    */
035   public Track() {}
036
037   /**
038    * Creates a {@link Track} element with the specified {@link Track#src(Object)} and {@link Track#kind(String)}
039    * attributes.
040    *
041    * @param src The {@link Track#src(Object)} attribute.
042    * @param kind The {@link Track#kind(String)} attribute.
043    */
044   public Track(Object src, String kind) {
045      src(src).kind(kind);
046   }
047
048   /**
049    * {@doc ExtHTML5.embedded-content-0#attr-track-default default}
050    * attribute.
051    *
052    * <p>
053    * Enable the track if no other text track is more suitable.
054    *
055    * @param _default The new value for this attribute.
056    * @return This object (for method chaining).
057    */
058   public final Track _default(String _default) {
059      attr("default", _default);
060      return this;
061   }
062
063   /**
064    * {@doc ExtHTML5.embedded-content-0#attr-track-kind kind} attribute.
065    *
066    * <p>
067    * The type of text track.
068    *
069    * @param kind The new value for this attribute.
070    * @return This object (for method chaining).
071    */
072   public final Track kind(String kind) {
073      attr("kind", kind);
074      return this;
075   }
076
077   /**
078    * {@doc ExtHTML5.embedded-content-0#attr-track-label label} attribute.
079    *
080    * <p>
081    * User-visible label.
082    *
083    * @param label The new value for this attribute.
084    * @return This object (for method chaining).
085    */
086   public final Track label(String label) {
087      attr("label", label);
088      return this;
089   }
090
091   /**
092    * {@doc ExtHTML5.embedded-content-0#attr-track-src src} attribute.
093    *
094    * <p>
095    * Address of the resource.
096    *
097    * <p>
098    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
099    * Strings must be valid URIs.
100    *
101    * <p>
102    * URIs defined by {@link UriResolver} can be used for values.
103    *
104    * @param src
105    *    The new value for this attribute.
106    *    Typically a {@link URL} or {@link String}.
107    * @return This object (for method chaining).
108    */
109   public final Track src(Object src) {
110      attrUri("src", src);
111      return this;
112   }
113
114   /**
115    * {@doc ExtHTML5.embedded-content-0#attr-track-srclang srclang}
116    * attribute.
117    *
118    * <p>
119    * Language of the text track.
120    *
121    * @param srclang The new value for this attribute.
122    * @return This object (for method chaining).
123    */
124   public final Track srclang(String srclang) {
125      attr("srclang", srclang);
126      return this;
127   }
128
129
130   //-----------------------------------------------------------------------------------------------------------------
131   // Overridden methods
132   //-----------------------------------------------------------------------------------------------------------------
133
134   @Override /* HtmlElement */
135   public final Track _class(String _class) {
136      super._class(_class);
137      return this;
138   }
139
140   @Override /* HtmlElement */
141   public final Track id(String id) {
142      super.id(id);
143      return this;
144   }
145}