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 org.apache.juneau.marshall.*;
020
021/**
022 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#the-map-element">&lt;map&gt;</a>
023 * element.
024 *
025 * <p>
026 * The map element defines an image map, which is an image with clickable areas. It contains area
027 * elements that define the clickable regions within the image. The map element is referenced by
028 * img elements using the usemap attribute to create interactive images.
029 *
030 * <h5 class='section'>Examples:</h5>
031 * <p class='bcode w800'>
032 *    <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*;
033 *
034 *    <jc>// Simple image map with rectangular areas</jc>
035 *    Map <jv>map1</jv> = <jsm>map</jsm>(<js>"navigation"</js>,
036 *       <jsm>area</jsm>(<js>"rect"</js>, <js>"0,0,100,50"</js>, <js>"https://example.com/home"</js>),
037 *       <jsm>area</jsm>(<js>"rect"</js>, <js>"100,0,200,50"</js>, <js>"https://example.com/about"</js>),
038 *       <jsm>area</jsm>(<js>"rect"</js>, <js>"200,0,300,50"</js>, <js>"https://example.com/contact"</js>)
039 *    );
040 *
041 *    <jc>// Image map with different area shapes</jc>
042 *    Map <jv>map2</jv> = <jsm>map</jsm>(<js>"shapes"</js>,
043 *       <jsm>area</jsm>(<js>"circle"</js>, <js>"150,75,50"</js>, <js>"https://example.com/circle"</js>),
044 *       <jsm>area</jsm>(<js>"poly"</js>, <js>"0,0,100,0,50,100"</js>, <js>"https://example.com/triangle"</js>),
045 *       <jsm>area</jsm>(<js>"default"</js>, <jk>null</jk>, <js>"https://example.com/default"</js>)
046 *    );
047 *
048 *    <jc>// Image map with accessibility</jc>
049 *    Map <jv>map3</jv> = <jsm>map</jsm>(<js>"accessible"</js>,
050 *       <jsm>area</jsm>(<js>"rect"</js>, <js>"0,0,100,100"</js>, <js>"https://example.com/region1"</js>)
051 *          .alt(<js>"Click here for region 1"</js>),
052 *       <jsm>area</jsm>(<js>"rect"</js>, <js>"100,0,200,100"</js>, <js>"https://example.com/region2"</js>)
053 *          .alt(<js>"Click here for region 2"</js>)
054 *    );
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@Marshalled(typeName = "map")
062public class Map extends HtmlElementContainer<Map> {
063
064   /**
065    * Creates an empty {@link Map} element.
066    */
067   public Map() {}
068
069   /**
070    * Creates a {@link Map} element with the specified child nodes.
071    *
072    * @param children The child nodes. Must not be <jk>null</jk>.
073    */
074   public Map(Object...children) {
075      children(children);
076   }
077
078   /**
079    * <a class="doclink" href="https://www.w3.org/TR/html5/embedded-content-0.html#attr-map-name">name</a> attribute.
080    *
081    * <p>
082    * Specifies the name of the image map. This name is used by img elements with the usemap attribute
083    * to reference this map for defining clickable areas.
084    *
085    * <p>
086    * The name should be unique within the document and should not contain spaces or special characters.
087    *
088    * @param value The name of the image map for referencing from img elements. Can be <jk>null</jk> to unset the attribute.
089    * @return This object.
090    */
091   public Map name(String value) {
092      attr("name", value);
093      return this;
094   }
095
096}