langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
author mcimadamore
Fri, 16 Dec 2016 15:27:47 +0000
changeset 42828 cce89649f958
parent 38617 d93a7f64e231
permissions -rw-r--r--
8171371: Remove redundant type-arguments from generic method calls Reviewed-by: jjg, rfield, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     1
/*
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 25874
diff changeset
     2
 * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     4
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    10
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    15
 * accompanied this code).
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    16
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    20
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    23
 * questions.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    24
 */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    25
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    26
package com.sun.tools.doclets.formats.html.markup;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    27
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
    28
import java.io.IOException;
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
    29
import java.io.Writer;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    30
import java.util.*;
20257
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
    31
import java.nio.charset.*;
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
    32
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    33
import com.sun.tools.doclets.internal.toolkit.Content;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    34
import com.sun.tools.doclets.internal.toolkit.util.*;
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
    35
import com.sun.tools.doclets.formats.html.markup.HtmlAttr.Role;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    36
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    37
/**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    38
 * Class for generating HTML tree for javadoc output.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    39
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    40
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    41
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    42
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    43
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    44
 *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    45
 * @author Bhavesh Patel
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    46
 */
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 33920
diff changeset
    47
@Deprecated
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    48
public class HtmlTree extends Content {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    49
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    50
    private HtmlTag htmlTag;
42828
cce89649f958 8171371: Remove redundant type-arguments from generic method calls
mcimadamore
parents: 38617
diff changeset
    51
    private Map<HtmlAttr,String> attrs = Collections.emptyMap();
cce89649f958 8171371: Remove redundant type-arguments from generic method calls
mcimadamore
parents: 38617
diff changeset
    52
    private List<Content> content = Collections.emptyList();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    53
    public static final Content EMPTY = new StringContent("");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    54
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    55
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    56
     * Constructor to construct HtmlTree object.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    57
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    58
     * @param tag HTML tag for the HtmlTree object
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    59
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    60
    public HtmlTree(HtmlTag tag) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    61
        htmlTag = nullCheck(tag);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    62
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    63
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    64
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    65
     * Constructor to construct HtmlTree object.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    66
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    67
     * @param tag HTML tag for the HtmlTree object
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    68
     * @param contents contents to be added to the tree
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    69
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    70
    public HtmlTree(HtmlTag tag, Content... contents) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    71
        this(tag);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    72
        for (Content content: contents)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    73
            addContent(content);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    74
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    75
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    76
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    77
     * Adds an attribute for the HTML tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    78
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    79
     * @param attrName name of the attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    80
     * @param attrValue value of the attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    81
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    82
    public void addAttr(HtmlAttr attrName, String attrValue) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    83
        if (attrs.isEmpty())
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
    84
            attrs = new LinkedHashMap<>(3);
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
    85
        attrs.put(nullCheck(attrName), escapeHtmlChars(attrValue));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    86
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    87
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
    88
    public void setTitle(Content body) {
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
    89
        addAttr(HtmlAttr.TITLE, stripHtml(body));
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
    90
    }
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
    91
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
    92
    public void setRole(Role role) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
    93
        addAttr(HtmlAttr.ROLE, role.toString());
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
    94
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
    95
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    96
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    97
     * Adds a style for the HTML tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    98
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    99
     * @param style style to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   100
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   101
    public void addStyle(HtmlStyle style) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   102
        addAttr(HtmlAttr.CLASS, style.toString());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   103
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   104
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   105
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   106
     * Adds content for the HTML tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   107
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   108
     * @param tagContent tag content to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   109
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   110
    public void addContent(Content tagContent) {
21023
1192bdc59d82 8026370: javadoc creates empty <span class="italic"></span>
bpatel
parents: 20613
diff changeset
   111
        if (tagContent instanceof ContentBuilder) {
1192bdc59d82 8026370: javadoc creates empty <span class="italic"></span>
bpatel
parents: 20613
diff changeset
   112
            for (Content content: ((ContentBuilder)tagContent).contents) {
1192bdc59d82 8026370: javadoc creates empty <span class="italic"></span>
bpatel
parents: 20613
diff changeset
   113
                addContent(content);
1192bdc59d82 8026370: javadoc creates empty <span class="italic"></span>
bpatel
parents: 20613
diff changeset
   114
            }
1192bdc59d82 8026370: javadoc creates empty <span class="italic"></span>
bpatel
parents: 20613
diff changeset
   115
        }
1192bdc59d82 8026370: javadoc creates empty <span class="italic"></span>
bpatel
parents: 20613
diff changeset
   116
        else if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   117
            if (content.isEmpty())
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   118
                content = new ArrayList<>();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   119
            content.add(tagContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   120
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   121
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   122
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   123
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   124
     * This method adds a string content to the htmltree. If the last content member
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   125
     * added is a StringContent, append the string to that StringContent or else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   126
     * create a new StringContent and add it to the html tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   127
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   128
     * @param stringContent string content that needs to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   129
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   130
    public void addContent(String stringContent) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   131
        if (!content.isEmpty()) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   132
            Content lastContent = content.get(content.size() - 1);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   133
            if (lastContent instanceof StringContent)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   134
                lastContent.addContent(stringContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   135
            else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   136
                addContent(new StringContent(stringContent));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   137
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   138
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   139
            addContent(new StringContent(stringContent));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   140
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   141
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   142
    public int charCount() {
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   143
        int n = 0;
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   144
        for (Content c : content)
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   145
            n += c.charCount();
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   146
        return n;
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   147
    }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   148
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   149
    /**
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   150
     * Given a string, escape all special html characters and
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   151
     * return the result.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   152
     *
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   153
     * @param s The string to check.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   154
     * @return the original string with all of the HTML characters escaped.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   155
     */
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   156
    private static String escapeHtmlChars(String s) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   157
        for (int i = 0; i < s.length(); i++) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   158
            char ch = s.charAt(i);
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   159
            switch (ch) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   160
                // only start building a new string if we need to
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   161
                case '<': case '>': case '&':
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   162
                    StringBuilder sb = new StringBuilder(s.substring(0, i));
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   163
                    for ( ; i < s.length(); i++) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   164
                        ch = s.charAt(i);
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   165
                        switch (ch) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   166
                            case '<': sb.append("&lt;");  break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   167
                            case '>': sb.append("&gt;");  break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   168
                            case '&': sb.append("&amp;"); break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   169
                            default:  sb.append(ch);      break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   170
                        }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   171
                    }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   172
                    return sb.toString();
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   173
            }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   174
        }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   175
        return s;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   176
    }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   177
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   178
    /**
20257
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   179
     * A set of ASCII URI characters to be left unencoded.
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   180
     */
20265
8bd6f1a9ac24 8025491: Javac regression test tools/javac/T8003967/DetectMutableStaticFields.java failing
jlahoda
parents: 20257
diff changeset
   181
    public static final BitSet NONENCODING_CHARS = new BitSet(256);
20257
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   182
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   183
    static {
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   184
        // alphabetic characters
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   185
        for (int i = 'a'; i <= 'z'; i++) {
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   186
            NONENCODING_CHARS.set(i);
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   187
        }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   188
        for (int i = 'A'; i <= 'Z'; i++) {
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   189
            NONENCODING_CHARS.set(i);
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   190
        }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   191
        // numeric characters
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   192
        for (int i = '0'; i <= '9'; i++) {
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   193
            NONENCODING_CHARS.set(i);
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   194
        }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   195
        // Reserved characters as per RFC 3986. These are set of delimiting characters.
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   196
        String noEnc = ":/?#[]@!$&'()*+,;=";
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   197
        // Unreserved characters as per RFC 3986 which should not be percent encoded.
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   198
        noEnc += "-._~";
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   199
        for (int i = 0; i < noEnc.length(); i++) {
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   200
            NONENCODING_CHARS.set(noEnc.charAt(i));
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   201
        }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   202
    }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   203
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   204
    private static String encodeURL(String url) {
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   205
        StringBuilder sb = new StringBuilder();
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 21023
diff changeset
   206
        for (byte c : url.getBytes(Charset.forName("UTF-8"))) {
20257
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   207
            if (NONENCODING_CHARS.get(c & 0xFF)) {
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   208
                sb.append((char) c);
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   209
            } else {
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   210
                sb.append(String.format("%%%02X", c & 0xFF));
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   211
            }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   212
        }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   213
        return sb.toString();
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   214
    }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   215
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   216
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   217
     * Generates an HTML anchor tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   218
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   219
     * @param ref reference url for the anchor tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   220
     * @param body content for the anchor tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   221
     * @return an HtmlTree object
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   222
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   223
    public static HtmlTree A(String ref, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   224
        HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body));
20257
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   225
        htmltree.addAttr(HtmlAttr.HREF, encodeURL(ref));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   226
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   227
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   228
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   229
    /**
31297
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
   230
     * Generates an HTML anchor tag with an id or a name attribute and content.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   231
     *
31297
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
   232
     * @param htmlVersion the version of the generated HTML
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
   233
     * @param attr name or id attribute for the anchor tag
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   234
     * @param body content for the anchor tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   235
     * @return an HtmlTree object
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   236
     */
31297
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
   237
    public static HtmlTree A(HtmlVersion htmlVersion, String attr, Content body) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   238
        HtmlTree htmltree = new HtmlTree(HtmlTag.A);
31297
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
   239
        htmltree.addAttr((htmlVersion == HtmlVersion.HTML4)
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
   240
                ? HtmlAttr.NAME
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
   241
                : HtmlAttr.ID,
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
   242
                nullCheck(attr));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   243
        htmltree.addContent(nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   244
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   245
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   246
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   247
    /**
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   248
     * Generates an HTML anchor tag with id attribute and a body.
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   249
     *
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   250
     * @param id id for the anchor tag
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   251
     * @param body body for the anchor tag
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   252
     * @return an HtmlTree object
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   253
     */
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   254
    public static HtmlTree A_ID(String id, Content body) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   255
        HtmlTree htmltree = new HtmlTree(HtmlTag.A);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   256
        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   257
        htmltree.addContent(nullCheck(body));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   258
        return htmltree;
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   259
    }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   260
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   261
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   262
     * Generates a CAPTION tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   263
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   264
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   265
     * @return an HtmlTree object for the CAPTION tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   266
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   267
    public static HtmlTree CAPTION(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   268
        HtmlTree htmltree = new HtmlTree(HtmlTag.CAPTION, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   269
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   270
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   271
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   272
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   273
     * Generates a CODE tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   274
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   275
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   276
     * @return an HtmlTree object for the CODE tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   277
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   278
    public static HtmlTree CODE(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   279
        HtmlTree htmltree = new HtmlTree(HtmlTag.CODE, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   280
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   281
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   282
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   283
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   284
     * Generates a DD tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   285
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   286
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   287
     * @return an HtmlTree object for the DD tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   288
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   289
    public static HtmlTree DD(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   290
        HtmlTree htmltree = new HtmlTree(HtmlTag.DD, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   291
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   292
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   293
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   294
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   295
     * Generates a DL tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   296
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   297
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   298
     * @return an HtmlTree object for the DL tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   299
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   300
    public static HtmlTree DL(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   301
        HtmlTree htmltree = new HtmlTree(HtmlTag.DL, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   302
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   303
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   304
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   305
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   306
     * Generates a DIV tag with the style class attributes. It also encloses
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   307
     * a content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   308
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   309
     * @param styleClass stylesheet class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   310
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   311
     * @return an HtmlTree object for the DIV tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   312
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   313
    public static HtmlTree DIV(HtmlStyle styleClass, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   314
        HtmlTree htmltree = new HtmlTree(HtmlTag.DIV, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   315
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   316
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   317
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   318
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   319
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   320
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   321
     * Generates a DIV tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   322
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   323
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   324
     * @return an HtmlTree object for the DIV tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   325
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   326
    public static HtmlTree DIV(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   327
        return DIV(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   328
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   329
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   330
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   331
     * Generates a DT tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   332
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   333
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   334
     * @return an HtmlTree object for the DT tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   335
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   336
    public static HtmlTree DT(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   337
        HtmlTree htmltree = new HtmlTree(HtmlTag.DT, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   338
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   339
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   340
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   341
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   342
     * Generates a FOOTER tag with role attribute.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   343
     *
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   344
     * @return an HtmlTree object for the FOOTER tag
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   345
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   346
    public static HtmlTree FOOTER() {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   347
        HtmlTree htmltree = new HtmlTree(HtmlTag.FOOTER);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   348
        htmltree.setRole(Role.CONTENTINFO);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   349
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   350
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   351
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   352
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   353
     * Generates a HEADER tag with role attribute.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   354
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   355
     * @return an HtmlTree object for the HEADER tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   356
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   357
    public static HtmlTree HEADER() {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   358
        HtmlTree htmltree = new HtmlTree(HtmlTag.HEADER);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   359
        htmltree.setRole(Role.BANNER);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   360
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   361
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   362
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   363
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   364
     * Generates a heading tag (h1 to h6) with the title and style class attributes. It also encloses
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   365
     * a content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   366
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   367
     * @param headingTag the heading tag to be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   368
     * @param printTitle true if title for the tag needs to be printed else false
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   369
     * @param styleClass stylesheet class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   370
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   371
     * @return an HtmlTree object for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   372
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   373
    public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   374
            HtmlStyle styleClass, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   375
        HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   376
        if (printTitle)
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
   377
            htmltree.setTitle(body);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   378
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   379
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   380
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   381
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   382
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   383
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   384
     * Generates a heading tag (h1 to h6) with style class attribute. It also encloses
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   385
     * a content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   386
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   387
     * @param headingTag the heading tag to be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   388
     * @param styleClass stylesheet class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   389
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   390
     * @return an HtmlTree object for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   391
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   392
    public static HtmlTree HEADING(HtmlTag headingTag, HtmlStyle styleClass, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   393
        return HEADING(headingTag, false, styleClass, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   394
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   395
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   396
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   397
     * Generates a heading tag (h1 to h6) with the title attribute. It also encloses
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   398
     * a content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   399
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   400
     * @param headingTag the heading tag to be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   401
     * @param printTitle true if the title for the tag needs to be printed else false
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   402
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   403
     * @return an HtmlTree object for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   404
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   405
    public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   406
        return HEADING(headingTag, printTitle, null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   407
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   408
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   409
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   410
     * Generates a heading tag (h1 to h6)  with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   411
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   412
     * @param headingTag the heading tag to be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   413
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   414
     * @return an HtmlTree object for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   415
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   416
    public static HtmlTree HEADING(HtmlTag headingTag, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   417
        return HEADING(headingTag, false, null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   418
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   419
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   420
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   421
     * Generates an HTML tag with lang attribute. It also adds head and body
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   422
     * content to the HTML tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   423
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   424
     * @param lang language for the HTML document
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   425
     * @param head head for the HTML tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   426
     * @param body body for the HTML tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   427
     * @return an HtmlTree object for the HTML tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   428
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   429
    public static HtmlTree HTML(String lang, Content head, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   430
        HtmlTree htmltree = new HtmlTree(HtmlTag.HTML, nullCheck(head), nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   431
        htmltree.addAttr(HtmlAttr.LANG, nullCheck(lang));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   432
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   433
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   434
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   435
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   436
     * Generates a IFRAME tag.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   437
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   438
     * @param src the url of the document to be shown in the frame
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   439
     * @param name specifies the name of the frame
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   440
     * @param title the title for the frame
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   441
     * @return an HtmlTree object for the IFRAME tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   442
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   443
    public static HtmlTree IFRAME(String src, String name, String title) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   444
        HtmlTree htmltree = new HtmlTree(HtmlTag.IFRAME);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   445
        htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   446
        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   447
        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   448
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   449
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   450
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   451
    /**
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   452
     * Generates a INPUT tag with some id.
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   453
     *
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   454
     * @param type the type of input
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   455
     * @param id id for the tag
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   456
     * @return an HtmlTree object for the INPUT tag
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   457
     */
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   458
    public static HtmlTree INPUT(String type, String id) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   459
        HtmlTree htmltree = new HtmlTree(HtmlTag.INPUT);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   460
        htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   461
        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   462
        htmltree.addAttr(HtmlAttr.VALUE, " ");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   463
        htmltree.addAttr(HtmlAttr.DISABLED, "disabled");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   464
        return htmltree;
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   465
    }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   466
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   467
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   468
     * Generates a LI tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   469
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   470
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   471
     * @return an HtmlTree object for the LI tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   472
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   473
    public static HtmlTree LI(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   474
        return LI(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   475
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   476
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   477
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   478
     * Generates a LI tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   479
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   480
     * @param styleClass style for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   481
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   482
     * @return an HtmlTree object for the LI tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   483
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   484
    public static HtmlTree LI(HtmlStyle styleClass, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   485
        HtmlTree htmltree = new HtmlTree(HtmlTag.LI, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   486
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   487
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   488
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   489
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   490
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   491
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   492
     * Generates a LINK tag with the rel, type, href and title attributes.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   493
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   494
     * @param rel relevance of the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   495
     * @param type type of link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   496
     * @param href the path for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   497
     * @param title title for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   498
     * @return an HtmlTree object for the LINK tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   499
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   500
    public static HtmlTree LINK(String rel, String type, String href, String title) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   501
        HtmlTree htmltree = new HtmlTree(HtmlTag.LINK);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   502
        htmltree.addAttr(HtmlAttr.REL, nullCheck(rel));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   503
        htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   504
        htmltree.addAttr(HtmlAttr.HREF, nullCheck(href));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   505
        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   506
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   507
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   508
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   509
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   510
     * Generates a MAIN tag with role attribute.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   511
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   512
     * @return an HtmlTree object for the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   513
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   514
    public static HtmlTree MAIN() {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   515
        HtmlTree htmltree = new HtmlTree(HtmlTag.MAIN);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   516
        htmltree.setRole(Role.MAIN);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   517
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   518
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   519
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   520
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   521
     * Generates a MAIN tag with role attribute and some content.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   522
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   523
     * @param body content of the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   524
     * @return an HtmlTree object for the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   525
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   526
    public static HtmlTree MAIN(Content body) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   527
        HtmlTree htmltree = new HtmlTree(HtmlTag.MAIN, nullCheck(body));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   528
        htmltree.setRole(Role.MAIN);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   529
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   530
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   531
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   532
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   533
     * Generates a MAIN tag with role attribute, style attribute and some content.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   534
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   535
     * @param styleClass style of the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   536
     * @param body content of the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   537
     * @return an HtmlTree object for the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   538
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   539
    public static HtmlTree MAIN(HtmlStyle styleClass, Content body) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   540
        HtmlTree htmltree = HtmlTree.MAIN(body);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   541
        if (styleClass != null) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   542
            htmltree.addStyle(styleClass);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   543
        }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   544
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   545
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   546
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   547
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   548
     * Generates a META tag with the http-equiv, content and charset attributes.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   549
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 9087
diff changeset
   550
     * @param httpEquiv http equiv attribute for the META tag
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   551
     * @param content type of content
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 9087
diff changeset
   552
     * @param charSet character set used
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   553
     * @return an HtmlTree object for the META tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   554
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   555
    public static HtmlTree META(String httpEquiv, String content, String charSet) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   556
        HtmlTree htmltree = new HtmlTree(HtmlTag.META);
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents: 19254
diff changeset
   557
        String contentCharset = content + "; charset=" + charSet;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   558
        htmltree.addAttr(HtmlAttr.HTTP_EQUIV, nullCheck(httpEquiv));
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents: 19254
diff changeset
   559
        htmltree.addAttr(HtmlAttr.CONTENT, contentCharset);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   560
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   561
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   562
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   563
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   564
     * Generates a META tag with the name and content attributes.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   565
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   566
     * @param name name attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   567
     * @param content type of content
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   568
     * @return an HtmlTree object for the META tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   569
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   570
    public static HtmlTree META(String name, String content) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   571
        HtmlTree htmltree = new HtmlTree(HtmlTag.META);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   572
        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   573
        htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   574
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   575
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   576
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   577
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   578
     * Generates a NAV tag with the role attribute.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   579
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   580
     * @return an HtmlTree object for the NAV tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   581
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   582
    public static HtmlTree NAV() {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   583
        HtmlTree htmltree = new HtmlTree(HtmlTag.NAV);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   584
        htmltree.setRole(Role.NAVIGATION);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   585
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   586
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   587
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   588
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   589
     * Generates a NOSCRIPT tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   590
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   591
     * @param body content of the noscript tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   592
     * @return an HtmlTree object for the NOSCRIPT tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   593
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   594
    public static HtmlTree NOSCRIPT(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   595
        HtmlTree htmltree = new HtmlTree(HtmlTag.NOSCRIPT, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   596
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   597
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   598
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   599
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   600
     * Generates a P tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   601
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   602
     * @param body content of the Paragraph tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   603
     * @return an HtmlTree object for the P tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   604
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   605
    public static HtmlTree P(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   606
        return P(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   607
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   608
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   609
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   610
     * Generates a P tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   611
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   612
     * @param styleClass style of the Paragraph tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   613
     * @param body content of the Paragraph tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   614
     * @return an HtmlTree object for the P tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   615
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   616
    public static HtmlTree P(HtmlStyle styleClass, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   617
        HtmlTree htmltree = new HtmlTree(HtmlTag.P, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   618
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   619
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   620
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   621
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   622
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   623
    /**
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   624
     * Generates a SCRIPT tag with the type and src attributes.
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   625
     *
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   626
     * @param type type of link
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   627
     * @param src the path for the script
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   628
     * @return an HtmlTree object for the SCRIPT tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   629
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   630
    public static HtmlTree SCRIPT(String src) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   631
        HtmlTree htmltree = HtmlTree.SCRIPT();
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   632
        htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   633
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   634
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   635
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   636
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   637
     * Generates a SCRIPT tag with the type attribute.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   638
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   639
     * @return an HtmlTree object for the SCRIPT tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   640
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   641
    public static HtmlTree SCRIPT() {
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   642
        HtmlTree htmltree = new HtmlTree(HtmlTag.SCRIPT);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   643
        htmltree.addAttr(HtmlAttr.TYPE, "text/javascript");
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   644
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   645
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   646
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   647
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   648
     * Generates a SECTION tag with role attribute.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   649
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   650
     * @return an HtmlTree object for the SECTION tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   651
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   652
    public static HtmlTree SECTION() {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   653
        HtmlTree htmltree = new HtmlTree(HtmlTag.SECTION);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   654
        htmltree.setRole(Role.REGION);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   655
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   656
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   657
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   658
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   659
     * Generates a SECTION tag with role attribute and some content.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   660
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   661
     * @param body content of the section tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   662
     * @return an HtmlTree object for the SECTION tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   663
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   664
    public static HtmlTree SECTION(Content body) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   665
        HtmlTree htmltree = new HtmlTree(HtmlTag.SECTION, nullCheck(body));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   666
        htmltree.setRole(Role.REGION);
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   667
        return htmltree;
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   668
    }
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   669
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   670
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   671
     * Generates a SMALL tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   672
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   673
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   674
     * @return an HtmlTree object for the SMALL tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   675
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   676
    public static HtmlTree SMALL(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   677
        HtmlTree htmltree = new HtmlTree(HtmlTag.SMALL, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   678
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   679
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   680
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   681
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   682
     * Generates a SPAN tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   683
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   684
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   685
     * @return an HtmlTree object for the SPAN tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   686
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   687
    public static HtmlTree SPAN(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   688
        return SPAN(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   689
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   690
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   691
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   692
     * Generates a SPAN tag with style class attribute and some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   693
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   694
     * @param styleClass style class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   695
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   696
     * @return an HtmlTree object for the SPAN tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   697
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   698
    public static HtmlTree SPAN(HtmlStyle styleClass, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   699
        HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   700
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   701
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   702
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   703
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   704
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   705
    /**
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   706
     * Generates a SPAN tag with id and style class attributes. It also encloses
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   707
     * a content.
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   708
     *
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   709
     * @param id the id for the tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   710
     * @param styleClass stylesheet class for the tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   711
     * @param body content for the tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   712
     * @return an HtmlTree object for the SPAN tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   713
     */
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   714
    public static HtmlTree SPAN(String id, HtmlStyle styleClass, Content body) {
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   715
        HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   716
        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   717
        if (styleClass != null)
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   718
            htmltree.addStyle(styleClass);
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   719
        return htmltree;
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   720
    }
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   721
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   722
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   723
     * Generates a Table tag with style class and summary attributes and some content.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   724
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   725
     * @param styleClass style of the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   726
     * @param summary summary for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   727
     * @param body content for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   728
     * @return an HtmlTree object for the TABLE tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   729
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   730
    public static HtmlTree TABLE(HtmlStyle styleClass, String summary, Content body) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   731
        HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   732
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   733
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   734
        htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   735
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   736
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   737
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   738
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   739
     * Generates a Table tag with style class attribute and some content.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   740
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   741
     * @param styleClass style of the table
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   742
     * @param body content for the table
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   743
     * @return an HtmlTree object for the TABLE tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   744
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   745
    public static HtmlTree TABLE(HtmlStyle styleClass, Content body) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   746
        HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   747
        if (styleClass != null) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   748
            htmltree.addStyle(styleClass);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   749
        }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   750
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   751
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   752
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   753
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   754
     * Generates a TD tag with style class attribute and some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   755
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   756
     * @param styleClass style for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   757
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   758
     * @return an HtmlTree object for the TD tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   759
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   760
    public static HtmlTree TD(HtmlStyle styleClass, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   761
        HtmlTree htmltree = new HtmlTree(HtmlTag.TD, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   762
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   763
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   764
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   765
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   766
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   767
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   768
     * Generates a TD tag for an HTML table with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   769
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   770
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   771
     * @return an HtmlTree object for the TD tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   772
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   773
    public static HtmlTree TD(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   774
        return TD(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   775
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   776
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   777
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   778
     * Generates a TH tag with style class and scope attributes and some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   779
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   780
     * @param styleClass style for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   781
     * @param scope scope of the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   782
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   783
     * @return an HtmlTree object for the TH tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   784
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   785
    public static HtmlTree TH(HtmlStyle styleClass, String scope, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   786
        HtmlTree htmltree = new HtmlTree(HtmlTag.TH, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   787
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   788
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   789
        htmltree.addAttr(HtmlAttr.SCOPE, nullCheck(scope));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   790
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   791
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   792
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   793
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   794
     * Generates a TH tag with scope attribute and some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   795
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   796
     * @param scope scope of the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   797
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   798
     * @return an HtmlTree object for the TH tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   799
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   800
    public static HtmlTree TH(String scope, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   801
        return TH(null, scope, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   802
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   803
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   804
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   805
     * Generates a TITLE tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   806
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   807
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   808
     * @return an HtmlTree object for the TITLE tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   809
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   810
    public static HtmlTree TITLE(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   811
        HtmlTree htmltree = new HtmlTree(HtmlTag.TITLE, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   812
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   813
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   814
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   815
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   816
     * Generates a TR tag for an HTML table with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   817
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   818
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   819
     * @return an HtmlTree object for the TR tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   820
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   821
    public static HtmlTree TR(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   822
        HtmlTree htmltree = new HtmlTree(HtmlTag.TR, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   823
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   824
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   825
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   826
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   827
     * Generates a UL tag with the style class attribute and some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   828
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   829
     * @param styleClass style for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   830
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   831
     * @return an HtmlTree object for the UL tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   832
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   833
    public static HtmlTree UL(HtmlStyle styleClass, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   834
        HtmlTree htmltree = new HtmlTree(HtmlTag.UL, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   835
        htmltree.addStyle(nullCheck(styleClass));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   836
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   837
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   838
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   839
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   840
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   841
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   842
    public boolean isEmpty() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   843
        return (!hasContent() && !hasAttrs());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   844
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   845
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   846
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   847
     * Returns true if the HTML tree has content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   848
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   849
     * @return true if the HTML tree has content else return false
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   850
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   851
    public boolean hasContent() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   852
        return (!content.isEmpty());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   853
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   854
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   855
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   856
     * Returns true if the HTML tree has attributes.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   857
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   858
     * @return true if the HTML tree has attributes else return false
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   859
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   860
    public boolean hasAttrs() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   861
        return (!attrs.isEmpty());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   862
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   863
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   864
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   865
     * Returns true if the HTML tree has a specific attribute.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   866
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   867
     * @param attrName name of the attribute to check within the HTML tree
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   868
     * @return true if the HTML tree has the specified attribute else return false
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   869
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   870
    public boolean hasAttr(HtmlAttr attrName) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   871
        return (attrs.containsKey(attrName));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   872
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   873
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   874
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   875
     * Returns true if the HTML tree is valid. This check is more specific to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   876
     * standard doclet and not exactly similar to W3C specifications. But it
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   877
     * ensures HTML validation.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   878
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   879
     * @return true if the HTML tree is valid
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   880
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   881
    public boolean isValid() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   882
        switch (htmlTag) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   883
            case A :
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   884
                return (hasAttr(HtmlAttr.NAME) || hasAttr(HtmlAttr.ID) || (hasAttr(HtmlAttr.HREF) && hasContent()));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   885
            case BR :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   886
                return (!hasContent() && (!hasAttrs() || hasAttr(HtmlAttr.CLEAR)));
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 25874
diff changeset
   887
            case IFRAME :
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   888
                return (hasAttr(HtmlAttr.SRC) && !hasContent());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   889
            case HR :
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   890
            case INPUT:
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   891
                return (!hasContent());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   892
            case IMG :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   893
                return (hasAttr(HtmlAttr.SRC) && hasAttr(HtmlAttr.ALT) && !hasContent());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   894
            case LINK :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   895
                return (hasAttr(HtmlAttr.HREF) && !hasContent());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   896
            case META :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   897
                return (hasAttr(HtmlAttr.CONTENT) && !hasContent());
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   898
            case SCRIPT :
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   899
                return ((hasAttr(HtmlAttr.TYPE) && hasAttr(HtmlAttr.SRC) && !hasContent()) ||
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   900
                        (hasAttr(HtmlAttr.TYPE) && hasContent()));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   901
            default :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   902
                return hasContent();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   903
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   904
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   905
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   906
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   907
     * Returns true if the element is an inline element.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   908
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   909
     * @return true if the HTML tag is an inline element
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   910
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   911
    public boolean isInline() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   912
        return (htmlTag.blockType == HtmlTag.BlockType.INLINE);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   913
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   914
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   915
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   916
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   917
     */
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   918
    @Override
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   919
    public boolean write(Writer out, boolean atNewline) throws IOException {
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   920
        if (!isInline() && !atNewline)
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   921
            out.write(DocletConstants.NL);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   922
        String tagString = htmlTag.toString();
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   923
        out.write("<");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   924
        out.write(tagString);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   925
        Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   926
        HtmlAttr key;
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
   927
        String value;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   928
        while (iterator.hasNext()) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   929
            key = iterator.next();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   930
            value = attrs.get(key);
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   931
            out.write(" ");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   932
            out.write(key.toString());
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
   933
            if (!value.isEmpty()) {
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   934
                out.write("=\"");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   935
                out.write(value);
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   936
                out.write("\"");
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
   937
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   938
        }
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   939
        out.write(">");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   940
        boolean nl = false;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   941
        for (Content c : content)
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   942
            nl = c.write(out, nl);
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
   943
        if (htmlTag.endTagRequired()) {
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   944
            out.write("</");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   945
            out.write(tagString);
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   946
            out.write(">");
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
   947
        }
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   948
        if (!isInline()) {
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   949
            out.write(DocletConstants.NL);
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   950
            return true;
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   951
        } else {
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   952
            return false;
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   953
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   954
    }
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   955
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   956
    /**
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   957
     * Given a Content node, strips all html characters and
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   958
     * return the result.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   959
     *
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   960
     * @param body The content node to check.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   961
     * @return the plain text from the content node
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   962
     *
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   963
     */
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   964
    private static String stripHtml(Content body) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   965
        String rawString = body.toString();
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   966
        // remove HTML tags
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   967
        rawString = rawString.replaceAll("\\<.*?>", " ");
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   968
        // consolidate multiple spaces between a word to a single space
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   969
        rawString = rawString.replaceAll("\\b\\s{2,}\\b", " ");
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   970
        // remove extra whitespaces
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   971
        return rawString.trim();
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   972
    }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   973
}