src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
author pmuthuswamy
Wed, 30 Jan 2019 16:39:26 +0530
changeset 53562 0d9dee001667
parent 49427 d2fd2581325b
child 54060 53a95878619f
permissions -rw-r--r--
8215577: Remove javadoc support for HTML 4 Reviewed-by: jjg, hannesw
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
/*
44567
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
     2
 * Copyright (c) 2010, 2017, 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
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html.markup;
7614
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;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    30
import java.nio.charset.Charset;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    31
import java.util.ArrayList;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    32
import java.util.BitSet;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    33
import java.util.Collections;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    34
import java.util.Iterator;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    35
import java.util.LinkedHashMap;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    36
import java.util.List;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    37
import java.util.Map;
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
    38
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    39
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr.Role;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    40
import jdk.javadoc.internal.doclets.toolkit.Content;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    41
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    42
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    43
/**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    44
 * 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
    45
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    46
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    47
 *  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
    48
 *  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
    49
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    50
 *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    51
 * @author Bhavesh Patel
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    52
 */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    53
public class HtmlTree extends Content {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    54
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    55
    public final HtmlTag htmlTag;
42828
cce89649f958 8171371: Remove redundant type-arguments from generic method calls
mcimadamore
parents: 41157
diff changeset
    56
    private Map<HtmlAttr,String> attrs = Collections.emptyMap();
cce89649f958 8171371: Remove redundant type-arguments from generic method calls
mcimadamore
parents: 41157
diff changeset
    57
    private List<Content> content = Collections.emptyList();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    58
    public static final Content EMPTY = new StringContent("");
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    61
     * Constructor to construct HtmlTree object.
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
     * @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
    64
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    65
    public HtmlTree(HtmlTag tag) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    66
        htmlTag = nullCheck(tag);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    67
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    68
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
     * Constructor to construct HtmlTree object.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    71
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    72
     * @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
    73
     * @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
    74
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    75
    public HtmlTree(HtmlTag tag, Content... contents) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    76
        this(tag);
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
    77
        for (Content c: contents)
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
    78
            addContent(c);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    79
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    80
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    81
    /**
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    82
     * Constructor to construct HtmlTree object.
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    83
     *
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    84
     * @param tag HTML tag for the HtmlTree object
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    85
     * @param contents contents to be added to the tree
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    86
     */
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    87
    public HtmlTree(HtmlTag tag, List<Content> contents) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    88
        this(tag);
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
    89
        for (Content c: contents)
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
    90
            addContent(c);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    91
    }
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    92
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    93
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    94
     * Adds an attribute for the HTML tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    95
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    96
     * @param attrName name of the attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    97
     * @param attrValue value of the attribute
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
    98
     * @return this object
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    99
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   100
    public HtmlTree addAttr(HtmlAttr attrName, String attrValue) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   101
        if (attrs.isEmpty())
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   102
            attrs = new LinkedHashMap<>(3);
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   103
        attrs.put(nullCheck(attrName), escapeHtmlChars(attrValue));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   104
        return this;
7614
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
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   107
    /**
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   108
     * Sets the "title" attribute for this tag.
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   109
     * Any HTML tags in the content will be removed.
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   110
     *
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   111
     * @param body the content for the title attribute
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   112
     * @return this object
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   113
     */
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   114
    public HtmlTree setTitle(Content body) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
   115
        addAttr(HtmlAttr.TITLE, stripHtml(body));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   116
        return this;
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   117
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   118
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   119
    /**
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   120
     * Sets the "role" attribute for this tag.
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   121
     *
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   122
     * @param role the role
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   123
     * @return this object
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   124
     */
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   125
    public HtmlTree setRole(Role role) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   126
        addAttr(HtmlAttr.ROLE, role.toString());
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   127
        return this;
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   128
    }
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   129
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   130
    /**
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   131
     * Sets the style for the HTML tag.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   132
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   133
     * @param style style to be added
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   134
     * @return this object
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   135
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   136
    public HtmlTree setStyle(HtmlStyle style) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   137
        addAttr(HtmlAttr.CLASS, style.toString());
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   138
        return this;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   139
    }
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   142
     * Adds content for the HTML tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   143
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   144
     * @param tagContent tag content to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   145
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   146
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   147
    public void addContent(Content tagContent) {
21023
1192bdc59d82 8026370: javadoc creates empty <span class="italic"></span>
bpatel
parents: 20613
diff changeset
   148
        if (tagContent instanceof ContentBuilder) {
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   149
            for (Content c: ((ContentBuilder)tagContent).contents) {
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   150
                addContent(c);
21023
1192bdc59d82 8026370: javadoc creates empty <span class="italic"></span>
bpatel
parents: 20613
diff changeset
   151
            }
1192bdc59d82 8026370: javadoc creates empty <span class="italic"></span>
bpatel
parents: 20613
diff changeset
   152
        }
1192bdc59d82 8026370: javadoc creates empty <span class="italic"></span>
bpatel
parents: 20613
diff changeset
   153
        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
   154
            if (content.isEmpty())
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   155
                content = new ArrayList<>();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   156
            content.add(tagContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   157
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   158
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   159
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   160
    /**
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   161
     * Adds String content to the HTML tree. If the last content member
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   162
     * added is a StringContent, append the string to that StringContent or else
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   163
     * create a new StringContent and add it to the HTML tree.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   164
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   165
     * @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
   166
     */
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 35426
diff changeset
   167
    @Override
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 35426
diff changeset
   168
    public void addContent(CharSequence stringContent) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   169
        if (!content.isEmpty()) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   170
            Content lastContent = content.get(content.size() - 1);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   171
            if (lastContent instanceof StringContent)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   172
                lastContent.addContent(stringContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   173
            else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   174
                addContent(new StringContent(stringContent));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   175
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   176
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   177
            addContent(new StringContent(stringContent));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   178
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   179
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   180
    /**
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   181
     * {@inheritDoc}
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   182
     */
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   183
    @Override
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   184
    public int charCount() {
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   185
        int n = 0;
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   186
        for (Content c : content)
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   187
            n += c.charCount();
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   188
        return n;
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   189
    }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   190
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   191
    /**
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   192
     * Given a string, escape all special HTML characters and
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   193
     * return the result.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   194
     *
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   195
     * @param s The string to check.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   196
     * @return the original string with all of the HTML characters escaped.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   197
     */
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   198
    private static String escapeHtmlChars(String s) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   199
        for (int i = 0; i < s.length(); i++) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   200
            char ch = s.charAt(i);
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   201
            switch (ch) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   202
                // only start building a new string if we need to
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   203
                case '<': case '>': case '&':
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   204
                    StringBuilder sb = new StringBuilder(s.substring(0, i));
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   205
                    for ( ; i < s.length(); i++) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   206
                        ch = s.charAt(i);
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   207
                        switch (ch) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   208
                            case '<': sb.append("&lt;");  break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   209
                            case '>': sb.append("&gt;");  break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   210
                            case '&': sb.append("&amp;"); break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   211
                            default:  sb.append(ch);      break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   212
                        }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   213
                    }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   214
                    return sb.toString();
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   215
            }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   216
        }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   217
        return s;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   218
    }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   219
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   220
    /*
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   221
     * The sets of ASCII URI characters to be left unencoded.
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   222
     * See "Uniform Resource Identifier (URI): Generic Syntax"
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   223
     * IETF RFC 3986. https://tools.ietf.org/html/rfc3986
20257
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   224
     */
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   225
    public static final BitSet MAIN_CHARS;
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   226
    public static final BitSet QUERY_FRAGMENT_CHARS;
20257
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   227
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   228
    static {
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   229
        BitSet alphaDigit = bitSet(bitSet('A', 'Z'), bitSet('a', 'z'), bitSet('0', '9'));
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   230
        BitSet unreserved = bitSet(alphaDigit, bitSet("-._~"));
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   231
        BitSet genDelims = bitSet(":/?#[]@");
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   232
        BitSet subDelims = bitSet("!$&'()*+,;=");
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   233
        MAIN_CHARS = bitSet(unreserved, genDelims, subDelims);
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   234
        BitSet pchar = bitSet(unreserved, subDelims, bitSet(":@"));
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   235
        QUERY_FRAGMENT_CHARS = bitSet(pchar, bitSet("/?"));
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   236
    }
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   237
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   238
    private static BitSet bitSet(String s) {
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   239
        BitSet result = new BitSet();
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   240
        for (int i = 0; i < s.length(); i++) {
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   241
           result.set(s.charAt(i));
20257
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   242
        }
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   243
        return result;
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   244
    }
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   245
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   246
    private static BitSet bitSet(char from, char to) {
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   247
        BitSet result = new BitSet();
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   248
        result.set(from, to + 1);
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   249
        return result;
20257
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   250
    }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   251
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   252
    private static BitSet bitSet(BitSet... sets) {
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   253
        BitSet result = new BitSet();
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   254
        for (BitSet set : sets) {
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   255
            result.or(set);
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   256
        }
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   257
        return result;
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   258
    }
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   259
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   260
    /**
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   261
     * Apply percent-encoding to a URL.
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   262
     * This is similar to {@link java.net.URLEncoder} but
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   263
     * is less aggressive about encoding some characters,
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   264
     * like '(', ')', ',' which are used in the anchor
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   265
     * names for Java methods in HTML5 mode.
49427
d2fd2581325b 8199278: Javadoc search results does not link to anchors on a page
bpatel
parents: 47847
diff changeset
   266
     *
d2fd2581325b 8199278: Javadoc search results does not link to anchors on a page
bpatel
parents: 47847
diff changeset
   267
     * @param url the url to be percent-encoded.
d2fd2581325b 8199278: Javadoc search results does not link to anchors on a page
bpatel
parents: 47847
diff changeset
   268
     * @return a percent-encoded string.
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   269
     */
49427
d2fd2581325b 8199278: Javadoc search results does not link to anchors on a page
bpatel
parents: 47847
diff changeset
   270
    public static String encodeURL(String url) {
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   271
        BitSet nonEncodingChars = MAIN_CHARS;
20257
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   272
        StringBuilder sb = new StringBuilder();
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 21023
diff changeset
   273
        for (byte c : url.getBytes(Charset.forName("UTF-8"))) {
47328
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   274
            if (c == '?' || c == '#') {
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   275
                sb.append((char) c);
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   276
                // switch to the more restrictive set inside
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   277
                // the query and/or fragment
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   278
                nonEncodingChars = QUERY_FRAGMENT_CHARS;
d18df41954ba 8187521: In some corner cases the javadoc tool can reuse id attribute
jjg
parents: 47216
diff changeset
   279
            } else if (nonEncodingChars.get(c & 0xFF)) {
20257
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   280
                sb.append((char) c);
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   281
            } else {
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   282
                sb.append(String.format("%%%02X", c & 0xFF));
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   283
            }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   284
        }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   285
        return sb.toString();
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   286
    }
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   287
9da4f6c30089 8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents: 19663
diff changeset
   288
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   289
     * Generates an HTML anchor tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   290
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   291
     * @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
   292
     * @param body content for the anchor tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   293
     * @return an HtmlTree object
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
    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
   296
        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
   297
        htmltree.addAttr(HtmlAttr.HREF, encodeURL(ref));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   298
        return htmltree;
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   301
    /**
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   302
     * Generates an HTML anchor tag with id attribute and a body.
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   303
     *
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   304
     * @param id id for the anchor tag
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   305
     * @param body body for the anchor tag
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   306
     * @return an HtmlTree object
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   307
     */
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   308
    public static HtmlTree A_ID(String id, Content body) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   309
        HtmlTree htmltree = new HtmlTree(HtmlTag.A);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   310
        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   311
        htmltree.addContent(nullCheck(body));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   312
        return htmltree;
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   313
    }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   314
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   315
    /**
44567
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   316
     * Generates an HTML anchor tag with a style class, id attribute and a body.
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   317
     *
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   318
     * @param styleClass stylesheet class for the tag
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   319
     * @param id id for the anchor tag
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   320
     * @param body body for the anchor tag
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   321
     * @return an HtmlTree object
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   322
     */
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   323
    public static HtmlTree A_ID(HtmlStyle styleClass, String id, Content body) {
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   324
        HtmlTree htmltree = A_ID(id, body);
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   325
        if (styleClass != null)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   326
            htmltree.setStyle(styleClass);
44567
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   327
        return htmltree;
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   328
    }
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   329
126285be00b9 8175218: The fix for JDK-8141492 broke formatting of some javadoc documentation.
bpatel
parents: 42828
diff changeset
   330
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   331
     * Generates a CAPTION 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 CAPTION 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 CAPTION(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.CAPTION, 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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   342
     * Generates a CODE tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   343
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   344
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   345
     * @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
   346
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   347
    public static HtmlTree CODE(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   348
        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
   349
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   350
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   351
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   352
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   353
     * Generates a DD tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   354
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   355
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   356
     * @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
   357
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   358
    public static HtmlTree DD(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   359
        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
   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 DL tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   365
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   366
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   367
     * @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
   368
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   369
    public static HtmlTree DL(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   370
        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
   371
        return htmltree;
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   374
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   375
     * 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
   376
     * a content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   377
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   378
     * @param styleClass stylesheet class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   379
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   380
     * @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
   381
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   382
    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
   383
        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
   384
        if (styleClass != null)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   385
            htmltree.setStyle(styleClass);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   386
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   387
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   388
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   389
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   390
     * Generates a DIV tag with some content.
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
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   393
     * @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
   394
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   395
    public static HtmlTree DIV(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   396
        return DIV(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   397
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   398
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
     * Generates a DT tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   401
     *
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 DT 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 DT(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   406
        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
   407
        return htmltree;
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
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   411
     * 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
   412
     *
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   413
     * @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
   414
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   415
    public static HtmlTree FOOTER() {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   416
        HtmlTree htmltree = new HtmlTree(HtmlTag.FOOTER);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   417
        htmltree.setRole(Role.CONTENTINFO);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   418
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   419
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   420
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   421
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   422
     * Generates a HEADER tag with role attribute.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   423
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   424
     * @return an HtmlTree object for the HEADER tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   425
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   426
    public static HtmlTree HEADER() {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   427
        HtmlTree htmltree = new HtmlTree(HtmlTag.HEADER);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   428
        htmltree.setRole(Role.BANNER);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   429
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   430
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   431
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   432
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   433
     * 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
   434
     * a content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   435
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   436
     * @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
   437
     * @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
   438
     * @param styleClass stylesheet class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   439
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   440
     * @return an HtmlTree object for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   441
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   442
    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
   443
            HtmlStyle styleClass, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   444
        HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   445
        if (printTitle)
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
   446
            htmltree.setTitle(body);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   447
        if (styleClass != null)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   448
            htmltree.setStyle(styleClass);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   449
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   450
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   451
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   452
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   453
     * 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
   454
     * a content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   455
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   456
     * @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
   457
     * @param styleClass stylesheet class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   458
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   459
     * @return an HtmlTree object for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   460
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   461
    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
   462
        return HEADING(headingTag, false, styleClass, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   463
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   464
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   465
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   466
     * 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
   467
     * a content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   468
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   469
     * @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
   470
     * @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
   471
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   472
     * @return an HtmlTree object for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   473
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   474
    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
   475
        return HEADING(headingTag, printTitle, null, body);
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   479
     * 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
   480
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   481
     * @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
   482
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   483
     * @return an HtmlTree object for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   484
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   485
    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
   486
        return HEADING(headingTag, false, null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   487
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   488
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
     * 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
   491
     * content to the HTML tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   492
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   493
     * @param lang language for the HTML document
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   494
     * @param head head for the HTML tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   495
     * @param body body for the HTML tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   496
     * @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
   497
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   498
    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
   499
        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
   500
        htmltree.addAttr(HtmlAttr.LANG, nullCheck(lang));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   501
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   502
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   503
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   504
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   505
     * Generates a IFRAME tag.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   506
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   507
     * @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
   508
     * @param name specifies the name of the frame
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   509
     * @param title the title for the frame
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   510
     * @return an HtmlTree object for the IFRAME tag
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
    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
   513
        HtmlTree htmltree = new HtmlTree(HtmlTag.IFRAME);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   514
        htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   515
        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   516
        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
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
    /**
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   521
     * Generates a INPUT tag with some id.
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   522
     *
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   523
     * @param type the type of input
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   524
     * @param id id for the tag
47047
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   525
     * @param value value for the tag
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   526
     * @return an HtmlTree object for the INPUT tag
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   527
     */
47047
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   528
    public static HtmlTree INPUT(String type, String id, String value) {
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   529
        HtmlTree htmltree = new HtmlTree(HtmlTag.INPUT);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   530
        htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   531
        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
47047
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   532
        htmltree.addAttr(HtmlAttr.VALUE, nullCheck(value));
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   533
        htmltree.addAttr(HtmlAttr.DISABLED, "disabled");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   534
        return htmltree;
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   535
    }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   536
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   537
    /**
47047
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   538
     * Generates a LABEL tag with some content.
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   539
     *
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   540
     * @param forLabel value of "for" attribute of the LABEL tag
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   541
     * @param body content for the tag
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   542
     * @return an HtmlTree object for the LABEL tag
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   543
     */
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   544
    public static HtmlTree LABEL(String forLabel, Content body) {
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   545
        HtmlTree htmltree = new HtmlTree(HtmlTag.LABEL, nullCheck(body));
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   546
        htmltree.addAttr(HtmlAttr.FOR, nullCheck(forLabel));
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   547
        return htmltree;
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   548
    }
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   549
91082c3c1d05 8182263: Search box and reset button needs to be a11y fixed.
bpatel
parents: 44567
diff changeset
   550
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   551
     * Generates a LI tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   552
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   553
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   554
     * @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
   555
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   556
    public static HtmlTree LI(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   557
        return LI(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   558
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   559
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   560
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   561
     * Generates a LI tag with some content.
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
     * @param styleClass style for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   564
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   565
     * @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
   566
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   567
    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
   568
        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
   569
        if (styleClass != null)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   570
            htmltree.setStyle(styleClass);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   571
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   572
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   573
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   574
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   575
     * 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
   576
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   577
     * @param rel relevance of the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   578
     * @param type type of link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   579
     * @param href the path for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   580
     * @param title title for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   581
     * @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
   582
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   583
    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
   584
        HtmlTree htmltree = new HtmlTree(HtmlTag.LINK);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   585
        htmltree.addAttr(HtmlAttr.REL, nullCheck(rel));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   586
        htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   587
        htmltree.addAttr(HtmlAttr.HREF, nullCheck(href));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   588
        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   589
        return htmltree;
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   592
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   593
     * Generates a MAIN tag with role attribute.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   594
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   595
     * @return an HtmlTree object for the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   596
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   597
    public static HtmlTree MAIN() {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   598
        HtmlTree htmltree = new HtmlTree(HtmlTag.MAIN);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   599
        htmltree.setRole(Role.MAIN);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   600
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   601
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   602
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   603
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   604
     * 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
   605
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   606
     * @param body content of the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   607
     * @return an HtmlTree object for the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   608
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   609
    public static HtmlTree MAIN(Content body) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   610
        HtmlTree htmltree = new HtmlTree(HtmlTag.MAIN, nullCheck(body));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   611
        htmltree.setRole(Role.MAIN);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   612
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   613
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   614
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   615
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   616
     * 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
   617
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   618
     * @param styleClass style of the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   619
     * @param body content of the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   620
     * @return an HtmlTree object for the MAIN tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   621
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   622
    public static HtmlTree MAIN(HtmlStyle styleClass, Content body) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   623
        HtmlTree htmltree = HtmlTree.MAIN(body);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   624
        if (styleClass != null) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   625
            htmltree.setStyle(styleClass);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   626
        }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   627
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   628
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   629
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   630
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   631
     * 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
   632
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 9087
diff changeset
   633
     * @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
   634
     * @param content type of content
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 9087
diff changeset
   635
     * @param charSet character set used
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   636
     * @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
   637
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   638
    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
   639
        HtmlTree htmltree = new HtmlTree(HtmlTag.META);
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents: 19254
diff changeset
   640
        String contentCharset = content + "; charset=" + charSet;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   641
        htmltree.addAttr(HtmlAttr.HTTP_EQUIV, nullCheck(httpEquiv));
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents: 19254
diff changeset
   642
        htmltree.addAttr(HtmlAttr.CONTENT, contentCharset);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   643
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   644
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   645
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   646
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   647
     * 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
   648
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   649
     * @param name name attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   650
     * @param content type of content
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   651
     * @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
   652
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   653
    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
   654
        HtmlTree htmltree = new HtmlTree(HtmlTag.META);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   655
        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   656
        htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   657
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   658
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   659
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   660
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   661
     * Generates a NAV tag with the role attribute.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   662
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   663
     * @return an HtmlTree object for the NAV tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   664
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   665
    public static HtmlTree NAV() {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   666
        HtmlTree htmltree = new HtmlTree(HtmlTag.NAV);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   667
        htmltree.setRole(Role.NAVIGATION);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   668
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   669
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   670
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   671
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   672
     * Generates a NOSCRIPT tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   673
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   674
     * @param body content of the noscript tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   675
     * @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
   676
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   677
    public static HtmlTree NOSCRIPT(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   678
        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
   679
        return htmltree;
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   683
     * Generates a P tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   684
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   685
     * @param body content of the Paragraph tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   686
     * @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
   687
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   688
    public static HtmlTree P(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   689
        return P(null, body);
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   693
     * Generates a P tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   694
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   695
     * @param styleClass style of the Paragraph tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   696
     * @param body content of the Paragraph tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   697
     * @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
   698
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   699
    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
   700
        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
   701
        if (styleClass != null)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   702
            htmltree.setStyle(styleClass);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   703
        return htmltree;
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   706
    /**
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   707
     * 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
   708
     *
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   709
     * @param src the path for the script
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   710
     * @return an HtmlTree object for the SCRIPT tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   711
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   712
    public static HtmlTree SCRIPT(String src) {
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   713
        HtmlTree htmltree = new HtmlTree(HtmlTag.SCRIPT);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   714
        htmltree.addAttr(HtmlAttr.TYPE, "text/javascript");
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   715
        htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   716
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   717
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   718
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   719
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   720
     * Generates a SECTION tag with role attribute.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   721
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   722
     * @return an HtmlTree object for the SECTION tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   723
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   724
    public static HtmlTree SECTION() {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   725
        HtmlTree htmltree = new HtmlTree(HtmlTag.SECTION);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   726
        htmltree.setRole(Role.REGION);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   727
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   728
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   729
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   730
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   731
     * 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
   732
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   733
     * @param body content of the section tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   734
     * @return an HtmlTree object for the SECTION tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   735
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   736
    public static HtmlTree SECTION(Content body) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   737
        HtmlTree htmltree = new HtmlTree(HtmlTag.SECTION, nullCheck(body));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   738
        htmltree.setRole(Role.REGION);
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   739
        return htmltree;
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   740
    }
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   741
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   742
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   743
     * Generates a SMALL tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   744
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   745
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   746
     * @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
   747
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   748
    public static HtmlTree SMALL(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   749
        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
   750
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   751
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   752
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   753
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   754
     * Generates a SPAN tag with 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 body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   757
     * @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
   758
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   759
    public static HtmlTree SPAN(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   760
        return SPAN(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   761
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   762
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   763
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   764
     * 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
   765
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   766
     * @param styleClass style class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   767
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   768
     * @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
   769
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   770
    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
   771
        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
   772
        if (styleClass != null)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   773
            htmltree.setStyle(styleClass);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   774
        return htmltree;
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
    /**
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   778
     * 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
   779
     * a content.
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   780
     *
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   781
     * @param id the id for the tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   782
     * @param styleClass stylesheet class for the tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   783
     * @param body content for the tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   784
     * @return an HtmlTree object for the SPAN tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   785
     */
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   786
    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
   787
        HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   788
        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   789
        if (styleClass != null)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   790
            htmltree.setStyle(styleClass);
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   791
        return htmltree;
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   792
    }
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   793
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   794
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   795
     * 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
   796
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   797
     * @param styleClass style of the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   798
     * @param summary summary for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   799
     * @param body content for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   800
     * @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
   801
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   802
    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
   803
        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
   804
        if (styleClass != null)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   805
            htmltree.setStyle(styleClass);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   806
        htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   807
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   808
    }
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
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   811
     * 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
   812
     *
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   813
     * @param styleClass style of the table
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   814
     * @param body content for the table
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   815
     * @return an HtmlTree object for the TABLE tag
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   816
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   817
    public static HtmlTree TABLE(HtmlStyle styleClass, Content body) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   818
        HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   819
        if (styleClass != null) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   820
            htmltree.setStyle(styleClass);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   821
        }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   822
        return htmltree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   823
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   824
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   825
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   826
     * 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
   827
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   828
     * @param styleClass style for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   829
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   830
     * @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
   831
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   832
    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
   833
        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
   834
        if (styleClass != null)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   835
            htmltree.setStyle(styleClass);
7614
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
     * 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
   841
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   842
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   843
     * @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
   844
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   845
    public static HtmlTree TD(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   846
        return TD(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   847
    }
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   850
     * 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
   851
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   852
     * @param styleClass style for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   853
     * @param scope scope of the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   854
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   855
     * @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
   856
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   857
    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
   858
        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
   859
        if (styleClass != null)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   860
            htmltree.setStyle(styleClass);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   861
        htmltree.addAttr(HtmlAttr.SCOPE, nullCheck(scope));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   862
        return htmltree;
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   866
     * 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
   867
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   868
     * @param scope scope of the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   869
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   870
     * @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
   871
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   872
    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
   873
        return TH(null, scope, body);
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   876
    /**
41157
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40500
diff changeset
   877
     * Generates a TH tag with style class, scope attribute and some content.
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40500
diff changeset
   878
     *
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40500
diff changeset
   879
     * @param styleClass style for the tag
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40500
diff changeset
   880
     * @param body content for the tag
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40500
diff changeset
   881
     * @return an HtmlTree object for the TH tag
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40500
diff changeset
   882
     */
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40500
diff changeset
   883
    public static HtmlTree TH_ROW_SCOPE(HtmlStyle styleClass, Content body) {
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40500
diff changeset
   884
        return TH(styleClass, "row", body);
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40500
diff changeset
   885
    }
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40500
diff changeset
   886
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40500
diff changeset
   887
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   888
     * Generates a TITLE tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   889
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   890
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   891
     * @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
   892
     */
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   893
    public static HtmlTree TITLE(String body) {
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   894
        HtmlTree htmltree = new HtmlTree(HtmlTag.TITLE, new StringContent(body));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   895
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   896
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   897
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   898
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   899
     * 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
   900
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   901
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   902
     * @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
   903
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   904
    public static HtmlTree TR(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   905
        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
   906
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   907
    }
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   910
     * 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
   911
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   912
     * @param styleClass style for the tag
40500
f293dbb81a53 8162353: javadoc should provide a way to disable use of frames
jjg
parents: 36500
diff changeset
   913
     * @param first initial content to be added
f293dbb81a53 8162353: javadoc should provide a way to disable use of frames
jjg
parents: 36500
diff changeset
   914
     * @param more a series of additional content nodes to be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   915
     * @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
   916
     */
40500
f293dbb81a53 8162353: javadoc should provide a way to disable use of frames
jjg
parents: 36500
diff changeset
   917
    public static HtmlTree UL(HtmlStyle styleClass, Content first, Content... more) {
f293dbb81a53 8162353: javadoc should provide a way to disable use of frames
jjg
parents: 36500
diff changeset
   918
        HtmlTree htmlTree = new HtmlTree(HtmlTag.UL);
f293dbb81a53 8162353: javadoc should provide a way to disable use of frames
jjg
parents: 36500
diff changeset
   919
        htmlTree.addContent(nullCheck(first));
f293dbb81a53 8162353: javadoc should provide a way to disable use of frames
jjg
parents: 36500
diff changeset
   920
        for (Content c : more) {
f293dbb81a53 8162353: javadoc should provide a way to disable use of frames
jjg
parents: 36500
diff changeset
   921
            htmlTree.addContent(nullCheck(c));
f293dbb81a53 8162353: javadoc should provide a way to disable use of frames
jjg
parents: 36500
diff changeset
   922
        }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47328
diff changeset
   923
        htmlTree.setStyle(nullCheck(styleClass));
40500
f293dbb81a53 8162353: javadoc should provide a way to disable use of frames
jjg
parents: 36500
diff changeset
   924
        return htmlTree;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   925
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   926
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   927
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   928
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   929
     */
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   930
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   931
    public boolean isEmpty() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   932
        return (!hasContent() && !hasAttrs());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   933
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   934
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   935
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   936
     * 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
   937
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   938
     * @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
   939
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   940
    public boolean hasContent() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   941
        return (!content.isEmpty());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   942
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   943
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   944
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   945
     * 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
   946
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   947
     * @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
   948
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   949
    public boolean hasAttrs() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   950
        return (!attrs.isEmpty());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   951
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   952
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   953
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   954
     * 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
   955
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   956
     * @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
   957
     * @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
   958
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   959
    public boolean hasAttr(HtmlAttr attrName) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   960
        return (attrs.containsKey(attrName));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   961
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   962
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   963
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   964
     * 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
   965
     * 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
   966
     * ensures HTML validation.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   967
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   968
     * @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
   969
     */
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   970
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   971
    public boolean isValid() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   972
        switch (htmlTag) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   973
            case A :
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   974
                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
   975
            case BR :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   976
                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
   977
            case IFRAME :
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   978
                return (hasAttr(HtmlAttr.SRC) && !hasContent());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   979
            case HR :
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31297
diff changeset
   980
            case INPUT:
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   981
                return (!hasContent());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   982
            case IMG :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   983
                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
   984
            case LINK :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   985
                return (hasAttr(HtmlAttr.HREF) && !hasContent());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   986
            case META :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   987
                return (hasAttr(HtmlAttr.CONTENT) && !hasContent());
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   988
            case SCRIPT :
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   989
                return ((hasAttr(HtmlAttr.TYPE) && hasAttr(HtmlAttr.SRC) && !hasContent()) ||
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   990
                        (hasAttr(HtmlAttr.TYPE) && hasContent()));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   991
            default :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   992
                return hasContent();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   993
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   994
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   995
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   996
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   997
     * 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
   998
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   999
     * @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
  1000
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1001
    public boolean isInline() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1002
        return (htmlTag.blockType == HtmlTag.BlockType.INLINE);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1003
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1004
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1005
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1006
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1007
     */
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1008
    @Override
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1009
    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
  1010
        if (!isInline() && !atNewline)
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1011
            out.write(DocletConstants.NL);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1012
        String tagString = htmlTag.toString();
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1013
        out.write("<");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1014
        out.write(tagString);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1015
        Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1016
        HtmlAttr key;
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1017
        String value;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1018
        while (iterator.hasNext()) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1019
            key = iterator.next();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1020
            value = attrs.get(key);
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1021
            out.write(" ");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1022
            out.write(key.toString());
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
  1023
            if (!value.isEmpty()) {
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1024
                out.write("=\"");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1025
                out.write(value);
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1026
                out.write("\"");
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
  1027
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1028
        }
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1029
        out.write(">");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1030
        boolean nl = false;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1031
        for (Content c : content)
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1032
            nl = c.write(out, nl);
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
  1033
        if (htmlTag.endTagRequired()) {
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1034
            out.write("</");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1035
            out.write(tagString);
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1036
            out.write(">");
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
  1037
        }
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1038
        if (!isInline()) {
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1039
            out.write(DocletConstants.NL);
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1040
            return true;
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1041
        } else {
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1042
            return false;
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
  1043
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1044
    }
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1045
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1046
    /**
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1047
     * Given a Content node, strips all html characters and
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1048
     * return the result.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1049
     *
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1050
     * @param body The content node to check.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1051
     * @return the plain text from the content node
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1052
     *
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1053
     */
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1054
    private static String stripHtml(Content body) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1055
        String rawString = body.toString();
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1056
        // remove HTML tags
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1057
        rawString = rawString.replaceAll("\\<.*?>", " ");
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1058
        // consolidate multiple spaces between a word to a single space
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1059
        rawString = rawString.replaceAll("\\b\\s{2,}\\b", " ");
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1060
        // remove extra whitespaces
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1061
        return rawString.trim();
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
  1062
    }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
  1063
}