001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.bean.html5;
018
019import java.net.*;
020
021import org.apache.juneau.*;
022import org.apache.juneau.annotation.*;
023import org.apache.juneau.internal.*;
024
025/**
026 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#the-area-element">&lt;area&gt;</a>
027 * element.
028 *
029 * <p>
030 * The area element defines a clickable region within an image map. It is used in conjunction with
031 * the map element to create interactive images with multiple clickable areas, each linking to
032 * different destinations.
033 *
034 * <h5 class='section'>Examples:</h5>
035 * <p class='bcode w800'>
036 *    <jc>// Rectangular clickable area</jc>
037 *    Area <jv>area1</jv> = <jsm>area</jsm>().shape(<js>"rect"</js>).coords(<js>"0,0,100,50"</js>).href(<js>"https://example.com/page1"</js>);
038 * 
039 *    <jc>// Circular clickable area</jc>
040 *    Area <jv>area2</jv> = <jsm>area</jsm>().shape(<js>"circle"</js>).coords(<js>"150,75,50"</js>).href(<js>"https://example.com/page2"</js>);
041 * 
042 *    <jc>// Area with alternative text and target</jc>
043 *    Area <jv>area3</jv> = <jsm>area</jsm>().shape(<js>"rect"</js>).coords(<js>"200,0,300,100"</js>).href(<js>"https://example.com/page3"</js>)
044 *       .alt(<js>"Click here for more info"</js>)
045 *       .target(<js>"_blank"</js>);
046 * </p>
047 *
048 * <p>
049 * The following convenience methods are provided for constructing instances of this bean:
050 * <ul class='javatree'>
051 *    <li class='jc'>{@link HtmlBuilder}
052 *    <ul class='javatree'>
053 *       <li class='jm'>{@link HtmlBuilder#area() area()}
054 *    </ul>
055 * </ul>
056 * </p>
057 *
058 * <h5 class='section'>See Also:</h5><ul>
059 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a>
060 * </ul>
061 */
062@Bean(typeName="area")
063public class Area extends HtmlElementVoid {
064
065   /**
066    * Creates an empty {@link Area} element.
067    */
068   public Area() {}
069
070   /**
071    * Creates an {@link Area} element with the specified {@link Area#shape(String)}, {@link Area#coords(String)},
072    * and {@link Area#href(Object)} attributes.
073    *
074    * @param shape The {@link Area#shape(String)} attribute.
075    * @param coords The {@link Area#coords(String)} attribute.
076    * @param href The {@link Area#href(Object)} attribute.
077    */
078   public Area(String shape, String coords, Object href) {
079      shape(shape).coords(coords).href(href);
080   }
081
082   /**
083    * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-area-alt">alt</a> attribute.
084    *
085    * <p>
086    * Specifies alternative text for the area. This text is displayed when the image map cannot be loaded
087    * and is used by screen readers for accessibility.
088    *
089    * <p>
090    * The alt text should be descriptive and convey the same information as the clickable area.
091    *
092    * @param alt Alternative text for the area.
093    * @return This object.
094    */
095   public Area alt(String value) {
096      attr("alt", value);
097      return this;
098   }
099
100   /**
101    * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-area-coords">coords</a>
102    * attribute.
103    *
104    * <p>
105    * Specifies the coordinates of the clickable area within the image map. The format depends on the shape:
106    *
107    * <p>
108    * Coordinate formats:
109    * <ul>
110    *    <li><js>"rect"</js> - x1,y1,x2,y2 (top-left and bottom-right corners)</li>
111    *    <li><js>"circle"</js> - x,y,radius (center point and radius)</li>
112    *    <li><js>"poly"</js> - x1,y1,x2,y2,x3,y3,... (polygon vertices)</li>
113    *    <li><js>"default"</js> - No coordinates needed</li>
114    * </ul>
115    *
116    * @param coords The coordinates defining the clickable area.
117    * @return This object.
118    */
119   public Area coords(String value) {
120      attr("coords", value);
121      return this;
122   }
123
124   /**
125    * <a class="doclink" href="https://www.w3.org/TR/html5/links.html#attr-hyperlink-download">download</a> attribute.
126    *
127    * <p>
128    * Whether to download the resource instead of navigating to it, and its file name if so.
129    *
130    * @param download
131    *    The new value for this attribute.
132    *    Typically a {@link Boolean} or {@link String}.
133    * @return This object.
134    */
135   public Area download(Object value) {
136      attr("download", value);
137      return this;
138   }
139
140   /**
141    * <a class="doclink" href="https://www.w3.org/TR/html5/links.html#attr-hyperlink-href">href</a> attribute.
142    *
143    * <p>
144    * Address of the hyperlink.
145    *
146    * <p>
147    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
148    * Strings must be valid URIs.
149    *
150    * <p>
151    * URIs defined by {@link UriResolver} can be used for values.
152    *
153    * @param href
154    *    The new value for this attribute.
155    *    Typically a {@link URL} or {@link String}.
156    * @return This object.
157    */
158   public Area href(Object value) {
159      attrUri("href", value);
160      return this;
161   }
162
163   /**
164    * <a class="doclink" href="https://www.w3.org/TR/html5/links.html#attr-hyperlink-hreflang">hreflang</a> attribute.
165    *
166    * <p>
167    * Specifies the language of the linked resource. Used for SEO and accessibility purposes.
168    *
169    * <p>
170    * Examples:
171    * <ul>
172    *    <li><js>"en"</js> - English</li>
173    *    <li><js>"es"</js> - Spanish</li>
174    *    <li><js>"fr"</js> - French</li>
175    *    <li><js>"de"</js> - German</li>
176    *    <li><js>"zh"</js> - Chinese</li>
177    *    <li><js>"ja"</js> - Japanese</li>
178    * </ul>
179    *
180    * @param hreflang The language code of the linked resource.
181    * @return This object.
182    */
183   public Area hreflang(String value) {
184      attr("hreflang", value);
185      return this;
186   }
187
188   /**
189    * <a class="doclink" href="https://www.w3.org/TR/html5/links.html#attr-hyperlink-rel">rel</a> attribute.
190    *
191    * <p>
192    * Specifies the relationship between the current document and the linked resource.
193    *
194    * <p>
195    * Common values:
196    * <ul>
197    *    <li><js>"alternate"</js> - Alternative version of the page</li>
198    *    <li><js>"author"</js> - Link to the author of the page</li>
199    *    <li><js>"bookmark"</js> - Permalink for bookmarking</li>
200    *    <li><js>"external"</js> - External link</li>
201    *    <li><js>"help"</js> - Link to help documentation</li>
202    *    <li><js>"license"</js> - Link to license information</li>
203    *    <li><js>"next"</js> - Next page in a sequence</li>
204    *    <li><js>"nofollow"</js> - Don't follow this link for SEO</li>
205    *    <li><js>"noreferrer"</js> - Don't send referrer information</li>
206    *    <li><js>"prev"</js> - Previous page in a sequence</li>
207    *    <li><js>"search"</js> - Link to search functionality</li>
208    *    <li><js>"tag"</js> - Tag for the current page</li>
209    * </ul>
210    *
211    * @param rel The relationship between the document and linked resource.
212    * @return This object.
213    */
214   public Area rel(String value) {
215      attr("rel", value);
216      return this;
217   }
218
219   /**
220    * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-area-shape">shape</a> attribute.
221    *
222    * <p>
223    * Specifies the shape of the clickable area in an image map.
224    *
225    * <p>
226    * Possible values:
227    * <ul>
228    *    <li><js>"rect"</js> - Rectangular area (default)</li>
229    *    <li><js>"circle"</js> - Circular area</li>
230    *    <li><js>"poly"</js> - Polygonal area</li>
231    *    <li><js>"default"</js> - Entire image area</li>
232    * </ul>
233    *
234    * @param shape The shape of the clickable area.
235    * @return This object.
236    */
237   public Area shape(String value) {
238      attr("shape", value);
239      return this;
240   }
241
242   /**
243    * <a class="doclink" href="https://www.w3.org/TR/html5/links.html#attr-hyperlink-target">target</a> attribute.
244    *
245    * <p>
246    * Specifies where to open the linked resource when the area is clicked.
247    *
248    * <p>
249    * Common values:
250    * <ul>
251    *    <li><js>"_blank"</js> - Open in a new window/tab</li>
252    *    <li><js>"_self"</js> - Open in the same frame (default)</li>
253    *    <li><js>"_parent"</js> - Open in the parent frame</li>
254    *    <li><js>"_top"</js> - Open in the full body of the window</li>
255    *    <li><js>"framename"</js> - Open in a named frame</li>
256    * </ul>
257    *
258    * @param target Where to open the linked resource.
259    * @return This object.
260    */
261   public Area target(String value) {
262      attr("target", value);
263      return this;
264   }
265
266   /**
267    * <a class="doclink" href="https://www.w3.org/TR/html5/links.html#attr-hyperlink-type">type</a> attribute.
268    *
269    * <p>
270    * Specifies the MIME type of the linked resource. Helps browsers determine how to handle the resource.
271    *
272    * <p>
273    * Common values:
274    * <ul>
275    *    <li><js>"text/html"</js> - HTML document</li>
276    *    <li><js>"text/css"</js> - CSS stylesheet</li>
277    *    <li><js>"application/pdf"</js> - PDF document</li>
278    *    <li><js>"image/png"</js> - PNG image</li>
279    *    <li><js>"application/zip"</js> - ZIP archive</li>
280    * </ul>
281    *
282    * @param type The MIME type of the linked resource.
283    * @return This object.
284    */
285   public Area type(String value) {
286      attr("type", value);
287      return this;
288   }
289
290   //-----------------------------------------------------------------------------------------------------------------
291   // Overridden methods
292   //-----------------------------------------------------------------------------------------------------------------
293   @Override /* Overridden from HtmlElement */
294   public Area _class(String value) {  // NOSONAR - Intentional naming.
295      super._class(value);
296      return this;
297   }
298
299   @Override /* Overridden from HtmlElement */
300   public Area accesskey(String value) {
301      super.accesskey(value);
302      return this;
303   }
304
305   @Override /* Overridden from HtmlElement */
306   public Area contenteditable(Object value) {
307      super.contenteditable(value);
308      return this;
309   }
310
311   @Override /* Overridden from HtmlElement */
312   public Area dir(String value) {
313      super.dir(value);
314      return this;
315   }
316
317   @Override /* Overridden from HtmlElement */
318   public Area hidden(Object value) {
319      super.hidden(value);
320      return this;
321   }
322
323   @Override /* Overridden from HtmlElement */
324   public Area id(String value) {
325      super.id(value);
326      return this;
327   }
328
329   @Override /* Overridden from HtmlElement */
330   public Area lang(String value) {
331      super.lang(value);
332      return this;
333   }
334
335   @Override /* Overridden from HtmlElement */
336   public Area onabort(String value) {
337      super.onabort(value);
338      return this;
339   }
340
341   @Override /* Overridden from HtmlElement */
342   public Area onblur(String value) {
343      super.onblur(value);
344      return this;
345   }
346
347   @Override /* Overridden from HtmlElement */
348   public Area oncancel(String value) {
349      super.oncancel(value);
350      return this;
351   }
352
353   @Override /* Overridden from HtmlElement */
354   public Area oncanplay(String value) {
355      super.oncanplay(value);
356      return this;
357   }
358
359   @Override /* Overridden from HtmlElement */
360   public Area oncanplaythrough(String value) {
361      super.oncanplaythrough(value);
362      return this;
363   }
364
365   @Override /* Overridden from HtmlElement */
366   public Area onchange(String value) {
367      super.onchange(value);
368      return this;
369   }
370
371   @Override /* Overridden from HtmlElement */
372   public Area onclick(String value) {
373      super.onclick(value);
374      return this;
375   }
376
377   @Override /* Overridden from HtmlElement */
378   public Area oncuechange(String value) {
379      super.oncuechange(value);
380      return this;
381   }
382
383   @Override /* Overridden from HtmlElement */
384   public Area ondblclick(String value) {
385      super.ondblclick(value);
386      return this;
387   }
388
389   @Override /* Overridden from HtmlElement */
390   public Area ondurationchange(String value) {
391      super.ondurationchange(value);
392      return this;
393   }
394
395   @Override /* Overridden from HtmlElement */
396   public Area onemptied(String value) {
397      super.onemptied(value);
398      return this;
399   }
400
401   @Override /* Overridden from HtmlElement */
402   public Area onended(String value) {
403      super.onended(value);
404      return this;
405   }
406
407   @Override /* Overridden from HtmlElement */
408   public Area onerror(String value) {
409      super.onerror(value);
410      return this;
411   }
412
413   @Override /* Overridden from HtmlElement */
414   public Area onfocus(String value) {
415      super.onfocus(value);
416      return this;
417   }
418
419   @Override /* Overridden from HtmlElement */
420   public Area oninput(String value) {
421      super.oninput(value);
422      return this;
423   }
424
425   @Override /* Overridden from HtmlElement */
426   public Area oninvalid(String value) {
427      super.oninvalid(value);
428      return this;
429   }
430
431   @Override /* Overridden from HtmlElement */
432   public Area onkeydown(String value) {
433      super.onkeydown(value);
434      return this;
435   }
436
437   @Override /* Overridden from HtmlElement */
438   public Area onkeypress(String value) {
439      super.onkeypress(value);
440      return this;
441   }
442
443   @Override /* Overridden from HtmlElement */
444   public Area onkeyup(String value) {
445      super.onkeyup(value);
446      return this;
447   }
448
449   @Override /* Overridden from HtmlElement */
450   public Area onload(String value) {
451      super.onload(value);
452      return this;
453   }
454
455   @Override /* Overridden from HtmlElement */
456   public Area onloadeddata(String value) {
457      super.onloadeddata(value);
458      return this;
459   }
460
461   @Override /* Overridden from HtmlElement */
462   public Area onloadedmetadata(String value) {
463      super.onloadedmetadata(value);
464      return this;
465   }
466
467   @Override /* Overridden from HtmlElement */
468   public Area onloadstart(String value) {
469      super.onloadstart(value);
470      return this;
471   }
472
473   @Override /* Overridden from HtmlElement */
474   public Area onmousedown(String value) {
475      super.onmousedown(value);
476      return this;
477   }
478
479   @Override /* Overridden from HtmlElement */
480   public Area onmouseenter(String value) {
481      super.onmouseenter(value);
482      return this;
483   }
484
485   @Override /* Overridden from HtmlElement */
486   public Area onmouseleave(String value) {
487      super.onmouseleave(value);
488      return this;
489   }
490
491   @Override /* Overridden from HtmlElement */
492   public Area onmousemove(String value) {
493      super.onmousemove(value);
494      return this;
495   }
496
497   @Override /* Overridden from HtmlElement */
498   public Area onmouseout(String value) {
499      super.onmouseout(value);
500      return this;
501   }
502
503   @Override /* Overridden from HtmlElement */
504   public Area onmouseover(String value) {
505      super.onmouseover(value);
506      return this;
507   }
508
509   @Override /* Overridden from HtmlElement */
510   public Area onmouseup(String value) {
511      super.onmouseup(value);
512      return this;
513   }
514
515   @Override /* Overridden from HtmlElement */
516   public Area onmousewheel(String value) {
517      super.onmousewheel(value);
518      return this;
519   }
520
521   @Override /* Overridden from HtmlElement */
522   public Area onpause(String value) {
523      super.onpause(value);
524      return this;
525   }
526
527   @Override /* Overridden from HtmlElement */
528   public Area onplay(String value) {
529      super.onplay(value);
530      return this;
531   }
532
533   @Override /* Overridden from HtmlElement */
534   public Area onplaying(String value) {
535      super.onplaying(value);
536      return this;
537   }
538
539   @Override /* Overridden from HtmlElement */
540   public Area onprogress(String value) {
541      super.onprogress(value);
542      return this;
543   }
544
545   @Override /* Overridden from HtmlElement */
546   public Area onratechange(String value) {
547      super.onratechange(value);
548      return this;
549   }
550
551   @Override /* Overridden from HtmlElement */
552   public Area onreset(String value) {
553      super.onreset(value);
554      return this;
555   }
556
557   @Override /* Overridden from HtmlElement */
558   public Area onresize(String value) {
559      super.onresize(value);
560      return this;
561   }
562
563   @Override /* Overridden from HtmlElement */
564   public Area onscroll(String value) {
565      super.onscroll(value);
566      return this;
567   }
568
569   @Override /* Overridden from HtmlElement */
570   public Area onseeked(String value) {
571      super.onseeked(value);
572      return this;
573   }
574
575   @Override /* Overridden from HtmlElement */
576   public Area onseeking(String value) {
577      super.onseeking(value);
578      return this;
579   }
580
581   @Override /* Overridden from HtmlElement */
582   public Area onselect(String value) {
583      super.onselect(value);
584      return this;
585   }
586
587   @Override /* Overridden from HtmlElement */
588   public Area onshow(String value) {
589      super.onshow(value);
590      return this;
591   }
592
593   @Override /* Overridden from HtmlElement */
594   public Area onstalled(String value) {
595      super.onstalled(value);
596      return this;
597   }
598
599   @Override /* Overridden from HtmlElement */
600   public Area onsubmit(String value) {
601      super.onsubmit(value);
602      return this;
603   }
604
605   @Override /* Overridden from HtmlElement */
606   public Area onsuspend(String value) {
607      super.onsuspend(value);
608      return this;
609   }
610
611   @Override /* Overridden from HtmlElement */
612   public Area ontimeupdate(String value) {
613      super.ontimeupdate(value);
614      return this;
615   }
616
617   @Override /* Overridden from HtmlElement */
618   public Area ontoggle(String value) {
619      super.ontoggle(value);
620      return this;
621   }
622
623   @Override /* Overridden from HtmlElement */
624   public Area onvolumechange(String value) {
625      super.onvolumechange(value);
626      return this;
627   }
628
629   @Override /* Overridden from HtmlElement */
630   public Area onwaiting(String value) {
631      super.onwaiting(value);
632      return this;
633   }
634
635   @Override /* Overridden from HtmlElement */
636   public Area spellcheck(Object value) {
637      super.spellcheck(value);
638      return this;
639   }
640
641   @Override /* Overridden from HtmlElement */
642   public Area style(String value) {
643      super.style(value);
644      return this;
645   }
646
647   @Override /* Overridden from HtmlElement */
648   public Area tabindex(Object value) {
649      super.tabindex(value);
650      return this;
651   }
652
653   @Override /* Overridden from HtmlElement */
654   public Area title(String value) {
655      super.title(value);
656      return this;
657   }
658
659   @Override /* Overridden from HtmlElement */
660   public Area translate(Object value) {
661      super.translate(value);
662      return this;
663   }
664}