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-area-element <area>}
023 * element.
024 *
025 * <ul class='seealso'>
026 *    <li class='link'>{@doc DtoHtml5}
027 * </ul>
028 */
029@Bean(typeName="area")
030public class Area extends HtmlElementVoid {
031
032   /**
033    * Creates an empty {@link Area} element.
034    */
035   public Area() {}
036
037   /**
038    * Creates an {@link Area} element with the specified {@link Area#shape(String)}, {@link Area#coords(String)},
039    * and {@link Area#href(Object)} attributes.
040    *
041    * @param shape The {@link Area#shape(String)} attribute.
042    * @param coords The {@link Area#coords(String)} attribute.
043    * @param href The {@link Area#href(Object)} attribute.
044    */
045   public Area(String shape, String coords, Object href) {
046      shape(shape).coords(coords).href(href);
047   }
048
049   /**
050    * {@doc ExtHTML5.embedded-content-0#attr-area-alt alt} attribute.
051    *
052    * <p>
053    * Replacement text for use when images are not available.
054    *
055    * @param alt The new value for this attribute.
056    * @return This object (for method chaining).
057    */
058   public final Area alt(String alt) {
059      attr("alt", alt);
060      return this;
061   }
062
063   /**
064    * {@doc ExtHTML5.embedded-content-0#attr-area-coords coords}
065    * attribute.
066    *
067    * <p>
068    * Coordinates for the shape to be created in an image map.
069    *
070    * @param coords The new value for this attribute.
071    * @return This object (for method chaining).
072    */
073   public final Area coords(String coords) {
074      attr("coords", coords);
075      return this;
076   }
077
078   /**
079    * {@doc ExtHTML5.links#attr-hyperlink-download download} attribute.
080    *
081    * <p>
082    * Whether to download the resource instead of navigating to it, and its file name if so.
083    *
084    * @param download
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 Area download(Object download) {
090      attr("download", download);
091      return this;
092   }
093
094   /**
095    * {@doc ExtHTML5.links#attr-hyperlink-href href} attribute.
096    *
097    * <p>
098    * Address of the hyperlink.
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 href
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 Area href(Object href) {
113      attrUri("href", href);
114      return this;
115   }
116
117   /**
118    * {@doc ExtHTML5.links#attr-hyperlink-hreflang hreflang} attribute.
119    *
120    * <p>
121    * Language of the linked resource.
122    *
123    * @param hreflang The new value for this attribute.
124    * @return This object (for method chaining).
125    */
126   public final Area hreflang(String hreflang) {
127      attr("hreflang", hreflang);
128      return this;
129   }
130
131   /**
132    * {@doc ExtHTML5.links#attr-hyperlink-rel rel} attribute.
133    *
134    * <p>
135    * Relationship between the document containing the hyperlink and the destination resource.
136    *
137    * @param rel The new value for this attribute.
138    * @return This object (for method chaining).
139    */
140   public final Area rel(String rel) {
141      attr("rel", rel);
142      return this;
143   }
144
145   /**
146    * {@doc ExtHTML5.embedded-content-0#attr-area-shape shape} attribute.
147    *
148    * <p>
149    * The kind of shape to be created in an image map.
150    *
151    * @param shape The new value for this attribute.
152    * @return This object (for method chaining).
153    */
154   public final Area shape(String shape) {
155      attr("shape", shape);
156      return this;
157   }
158
159   /**
160    * {@doc ExtHTML5.links#attr-hyperlink-target target} attribute.
161    *
162    * <p>
163    * Browsing context for hyperlink navigation.
164    *
165    * @param target The new value for this attribute.
166    * @return This object (for method chaining).
167    */
168   public final Area target(String target) {
169      attr("target", target);
170      return this;
171   }
172
173   /**
174    * {@doc ExtHTML5.links#attr-hyperlink-type type} attribute.
175    *
176    * <p>
177    * Hint for the type of the referenced resource.
178    *
179    * @param type The new value for this attribute.
180    * @return This object (for method chaining).
181    */
182   public final Area type(String type) {
183      attr("type", type);
184      return this;
185   }
186
187
188   //-----------------------------------------------------------------------------------------------------------------
189   // Overridden methods
190   //-----------------------------------------------------------------------------------------------------------------
191
192   @Override /* HtmlElement */
193   public final Area _class(String _class) {
194      super._class(_class);
195      return this;
196   }
197
198   @Override /* HtmlElement */
199   public final Area id(String id) {
200      super.id(id);
201      return this;
202   }
203
204   @Override /* HtmlElement */
205   public final Area style(String style) {
206      super.style(style);
207      return this;
208   }
209}