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.document-metadata#the-base-element <base>}
023 * element.
024 *
025 * <ul class='seealso'>
026 *    <li class='link'>{@doc DtoHtml5}
027 * </ul>
028 */
029@Bean(typeName="base")
030public class Base extends HtmlElementVoid {
031
032   /**
033    * Creates an empty {@link Base} element.
034    */
035   public Base() {}
036
037   /**
038    * Creates a {@link Base} element with the specified {@link Base#href(Object)} attribute.
039    *
040    * @param href The {@link Base#href(Object)} attribute.
041    */
042   public Base(Object href) {
043      href(href);
044   }
045
046   /**
047    * {@doc ExtHTML5.document-metadata#attr-base-href href} attribute.
048    *
049    * <p>
050    * Document base URL.
051    *
052    * <p>
053    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
054    * Strings must be valid URIs.
055    *
056    * <p>
057    * URIs defined by {@link UriResolver} can be used for values.
058    *
059    * @param href
060    *    The new value for this attribute.
061    *    Typically a {@link URL} or {@link String}.
062    * @return This object (for method chaining).
063    */
064   public final Base href(Object href) {
065      attrUri("href", href);
066      return this;
067   }
068
069   /**
070    * {@doc ExtHTML5.document-metadata#attr-base-target target}
071    * attribute.
072    *
073    * <p>
074    * Default browsing context for hyperlink navigation and form submission.
075    *
076    * @param target The new value for this attribute.
077    * @return This object (for method chaining).
078    */
079   public final Base target(String target) {
080      attr("target", target);
081      return this;
082   }
083
084
085   //-----------------------------------------------------------------------------------------------------------------
086   // Overridden methods
087   //-----------------------------------------------------------------------------------------------------------------
088
089   @Override /* HtmlElement */
090   public final Base _class(String _class) {
091      super._class(_class);
092      return this;
093   }
094
095   @Override /* HtmlElement */
096   public final Base id(String id) {
097      super.id(id);
098      return this;
099   }
100
101   @Override /* HtmlElement */
102   public final Base style(String style) {
103      super.style(style);
104      return this;
105   }
106}