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 HTML5.embedded-content-0#the-img-element <img>}
023 * element.
024 *
025 * <ul class='seealso'>
026 *    <li class='link'>{@doc juneau-dto.HTML5}
027 * </ul>
028 */
029@Bean(typeName="img")
030public class Img extends HtmlElementVoid {
031
032   /**
033    * {@doc HTML5.embedded-content-0#attr-img-alt alt} attribute.
034    *
035    * <p>
036    * Replacement text for use when images are not available.
037    *
038    * @param alt The new value for this attribute.
039    * @return This object (for method chaining).
040    */
041   public final Img alt(String alt) {
042      attr("alt", alt);
043      return this;
044   }
045
046   /**
047    * {@doc HTML5.embedded-content-0#attr-img-crossorigin crossorigin}
048    * attribute.
049    *
050    * <p>
051    * How the element handles cross-origin requests.
052    *
053    * @param crossorigin The new value for this attribute.
054    * @return This object (for method chaining).
055    */
056   public final Img crossorigin(String crossorigin) {
057      attr("crossorigin", crossorigin);
058      return this;
059   }
060
061   /**
062    * {@doc HTML5.embedded-content-0#attr-dim-height height}
063    * attribute.
064    *
065    * <p>
066    * Vertical dimension.
067    *
068    * @param height
069    *    The new value for this attribute.
070    *    Typically a {@link Number} or {@link String}.
071    * @return This object (for method chaining).
072    */
073   public final Img height(Object height) {
074      attr("height", height);
075      return this;
076   }
077
078   /**
079    * {@doc HTML5.embedded-content-0#attr-img-ismap ismap} attribute.
080    *
081    * <p>
082    * Whether the image is a server-side image map.
083    *
084    * @param ismap
085    *    The new value for this attribute.
086    *    Typically a {@link Boolean} or {@link String}.
087    * @return This object (for method chaining).
088    */
089   public final Img ismap(Object ismap) {
090      attr("ismap", deminimize(ismap, "ismap"));
091      return this;
092   }
093
094   /**
095    * {@doc HTML5.embedded-content-0#attr-img-src src} attribute.
096    *
097    * <p>
098    * Address of the resource.
099    *
100    * <p>
101    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
102    * Strings must be valid URIs.
103    *
104    * <p>
105    * URIs defined by {@link UriResolver} can be used for values.
106    *
107    * @param src
108    *    The new value for this attribute.
109    *    Typically a {@link URL} or {@link String}.
110    * @return This object (for method chaining).
111    */
112   public final Img src(Object src) {
113      attrUri("src", src);
114      return this;
115   }
116
117   /**
118    * {@doc HTML5.embedded-content-0#attr-hyperlink-usemap usemap}
119    * attribute.
120    *
121    * <p>
122    * Name of image map to use.
123    *
124    * @param usemap The new value for this attribute.
125    * @return This object (for method chaining).
126    */
127   public final Img usemap(String usemap) {
128      attr("usemap", usemap);
129      return this;
130   }
131
132   /**
133    * {@doc HTML5.embedded-content-0#attr-dim-width width} attribute.
134    *
135    * <p>
136    * Horizontal dimension.
137    *
138    * @param width
139    *    The new value for this attribute.
140    *    Typically a {@link Number} or {@link String}.
141    * @return This object (for method chaining).
142    */
143   public final Img width(Object width) {
144      attr("width", width);
145      return this;
146   }
147
148
149   //-----------------------------------------------------------------------------------------------------------------
150   // Overridden methods
151   //-----------------------------------------------------------------------------------------------------------------
152
153   @Override /* HtmlElement */
154   public final Img _class(String _class) {
155      super._class(_class);
156      return this;
157   }
158
159   @Override /* HtmlElement */
160   public final Img id(String id) {
161      super.id(id);
162      return this;
163   }
164
165   @Override /* HtmlElement */
166   public final Img style(String style) {
167      super.style(style);
168      return this;
169   }
170}