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