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-audio-element <audio>} 023 * element. 024 * 025 * <ul class='seealso'> 026 * <li class='link'>{@doc DtoHtml5} 027 * </ul> 028 */ 029@Bean(typeName="audio") 030public class Audio extends HtmlElementContainer { 031 032 /** 033 * Creates an empty {@link Audio} element. 034 */ 035 public Audio() {} 036 037 /** 038 * Creates an {@link Audio} element with the specified {@link Audio#src(Object)} attribute. 039 * 040 * @param src The {@link Audio#src(Object)} attribute. 041 */ 042 public Audio(String src) { 043 src(src); 044 } 045 046 /** 047 * {@doc ExtHTML5.embedded-content-0#attr-media-autoplay autoplay} 048 * attribute. 049 * 050 * <p> 051 * Hint that the media resource can be started automatically when the page is loaded. 052 * 053 * @param autoplay 054 * The new value for this attribute. 055 * Typically a {@link Boolean} or {@link String}. 056 * @return This object (for method chaining). 057 */ 058 public final Audio autoplay(Object autoplay) { 059 attr("autoplay", deminimize(autoplay, "autoplay")); 060 return this; 061 } 062 063 /** 064 * {@doc ExtHTML5.embedded-content-0#attr-media-controls controls} 065 * attribute. 066 * 067 * <p> 068 * Show user agent controls. 069 * 070 * @param controls 071 * The new value for this attribute. 072 * Typically a {@link Boolean} or {@link String}. 073 * @return This object (for method chaining). 074 */ 075 public final Audio controls(Object controls) { 076 attr("controls", deminimize(controls, "controls")); 077 return this; 078 } 079 080 /** 081 * {@doc ExtHTML5.embedded-content-0#attr-media-crossorigin crossorigin} 082 * attribute. 083 * 084 * <p> 085 * How the element handles cross-origin requests. 086 * 087 * @param crossorigin The new value for this attribute. 088 * @return This object (for method chaining). 089 */ 090 public final Audio crossorigin(String crossorigin) { 091 attr("crossorigin", crossorigin); 092 return this; 093 } 094 095 /** 096 * {@doc ExtHTML5.embedded-content-0#attr-media-loop loop} attribute. 097 * 098 * <p> 099 * Whether to loop the media resource. 100 * 101 * @param loop 102 * The new value for this attribute. 103 * Typically a {@link Boolean} or {@link String}. 104 * @return This object (for method chaining). 105 */ 106 public final Audio loop(Object loop) { 107 attr("loop", loop); 108 return this; 109 } 110 111 /** 112 * {@doc ExtHTML5.embedded-content-0#attr-media-mediagroup mediagroup} 113 * attribute. 114 * 115 * <p> 116 * Groups media elements together with an implicit MediaController. 117 * 118 * @param mediagroup The new value for this attribute. 119 * @return This object (for method chaining). 120 */ 121 public final Audio mediagroup(String mediagroup) { 122 attr("mediagroup", mediagroup); 123 return this; 124 } 125 126 /** 127 * {@doc ExtHTML5.embedded-content-0#attr-media-muted muted} 128 * attribute. 129 * 130 * <p> 131 * Whether to mute the media resource by default. 132 * 133 * @param muted 134 * The new value for this attribute. 135 * Typically a {@link Boolean} or {@link String}. 136 * @return This object (for method chaining). 137 */ 138 public final Audio muted(Object muted) { 139 attr("muted", muted); 140 return this; 141 } 142 143 /** 144 * {@doc ExtHTML5.embedded-content-0#attr-media-preload preload} 145 * attribute. 146 * 147 * <p> 148 * Hints how much buffering the media resource will likely need. 149 * 150 * @param preload The new value for this attribute. 151 * @return This object (for method chaining). 152 */ 153 public final Audio preload(Object preload) { 154 attr("preload", preload); 155 return this; 156 } 157 158 /** 159 * {@doc ExtHTML5.embedded-content-0#attr-media-src src} attribute. 160 * 161 * <p> 162 * Address of the resource. 163 * 164 * <p> 165 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 166 * Strings must be valid URIs. 167 * 168 * <p> 169 * URIs defined by {@link UriResolver} can be used for values. 170 * 171 * @param src 172 * The new value for this attribute. 173 * Typically a {@link URL} or {@link String}. 174 * @return This object (for method chaining). 175 */ 176 public final Audio src(Object src) { 177 attrUri("src", src); 178 return this; 179 } 180 181 182 //----------------------------------------------------------------------------------------------------------------- 183 // Overridden methods 184 //----------------------------------------------------------------------------------------------------------------- 185 186 @Override /* HtmlElement */ 187 public final Audio _class(String _class) { 188 super._class(_class); 189 return this; 190 } 191 192 @Override /* HtmlElement */ 193 public final Audio id(String id) { 194 super.id(id); 195 return this; 196 } 197 198 @Override /* HtmlElement */ 199 public final Audio style(String style) { 200 super.style(style); 201 return this; 202 } 203 204 @Override /* HtmlElementContainer */ 205 public final Audio children(Object...children) { 206 super.children(children); 207 return this; 208 } 209 210 @Override /* HtmlElementContainer */ 211 public final Audio child(Object child) { 212 super.child(child); 213 return this; 214 } 215}