langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
author jjg
Tue, 14 May 2013 10:14:55 -0700
changeset 17569 ef80738645e2
parent 17560 9f6771abbd1a
child 17570 78512b2899db
permissions -rw-r--r--
8012178: Cleanup use of Util.escapeHtmlChars Reviewed-by: darcy
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
/*
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 14549
diff changeset
     2
 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     4
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    10
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    15
 * accompanied this code).
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    16
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    20
 *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    23
 * questions.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    24
 */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    25
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    26
package com.sun.tools.doclets.formats.html.markup;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    27
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
    28
import java.io.IOException;
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
    29
import java.io.Writer;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    30
import java.util.*;
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
    31
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    32
import com.sun.tools.doclets.internal.toolkit.Content;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    33
import com.sun.tools.doclets.internal.toolkit.util.*;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    34
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    35
/**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    36
 * 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
    37
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    38
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    39
 *  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
    40
 *  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
    41
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    42
 *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    43
 * @author Bhavesh Patel
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    44
 */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    45
public class HtmlTree extends Content {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    46
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    47
    private HtmlTag htmlTag;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    48
    private Map<HtmlAttr,String> attrs = Collections.<HtmlAttr,String>emptyMap();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    49
    private List<Content> content = Collections.<Content>emptyList();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    50
    public static final Content EMPTY = new StringContent("");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    51
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
     * Constructor to construct HtmlTree object.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    54
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    55
     * @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
    56
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    57
    public HtmlTree(HtmlTag tag) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    58
        htmlTag = nullCheck(tag);
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    62
     * Constructor to construct HtmlTree object.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    63
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    64
     * @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
    65
     * @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
    66
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    67
    public HtmlTree(HtmlTag tag, Content... contents) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    68
        this(tag);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    69
        for (Content content: contents)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    70
            addContent(content);
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    73
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    74
     * Adds an attribute for the HTML tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    75
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    76
     * @param attrName name of the attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    77
     * @param attrValue value of the attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    78
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    79
    public void addAttr(HtmlAttr attrName, String attrValue) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    80
        if (attrs.isEmpty())
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
    81
            attrs = new LinkedHashMap<HtmlAttr,String>(3);
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
    82
        attrs.put(nullCheck(attrName), escapeHtmlChars(attrValue));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    83
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    84
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    85
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    86
     * Adds a style for the HTML tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    87
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    88
     * @param style style to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    89
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    90
    public void addStyle(HtmlStyle style) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    91
        addAttr(HtmlAttr.CLASS, style.toString());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    92
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    93
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    94
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    95
     * Adds content for the HTML tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    96
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    97
     * @param tagContent tag content to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    98
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
    99
    public void addContent(Content tagContent) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   100
        if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   101
            if (content.isEmpty())
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   102
                content = new ArrayList<Content>();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   103
            content.add(tagContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   104
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   105
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   106
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   107
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   108
     * This method adds a string content to the htmltree. If the last content member
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   109
     * added is a StringContent, append the string to that StringContent or else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   110
     * create a new StringContent and add it to the html tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   111
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   112
     * @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
   113
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   114
    public void addContent(String stringContent) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   115
        if (!content.isEmpty()) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   116
            Content lastContent = content.get(content.size() - 1);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   117
            if (lastContent instanceof StringContent)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   118
                lastContent.addContent(stringContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   119
            else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   120
                addContent(new StringContent(stringContent));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   121
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   122
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   123
            addContent(new StringContent(stringContent));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   124
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   125
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   126
    public int charCount() {
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   127
        int n = 0;
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   128
        for (Content c : content)
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   129
            n += c.charCount();
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   130
        return n;
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   131
    }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   132
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   133
    /**
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   134
     * Given a string, escape all special html characters and
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   135
     * return the result.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   136
     *
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   137
     * @param s The string to check.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   138
     * @return the original string with all of the HTML characters escaped.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   139
     */
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   140
    private static String escapeHtmlChars(String s) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   141
        for (int i = 0; i < s.length(); i++) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   142
            char ch = s.charAt(i);
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   143
            switch (ch) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   144
                // only start building a new string if we need to
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   145
                case '<': case '>': case '&':
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   146
                    StringBuilder sb = new StringBuilder(s.substring(0, i));
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   147
                    for ( ; i < s.length(); i++) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   148
                        ch = s.charAt(i);
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   149
                        switch (ch) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   150
                            case '<': sb.append("&lt;");  break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   151
                            case '>': sb.append("&gt;");  break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   152
                            case '&': sb.append("&amp;"); break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   153
                            default:  sb.append(ch);      break;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   154
                        }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   155
                    }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   156
                    return sb.toString();
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   157
            }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   158
        }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   159
        return s;
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   160
    }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   161
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   162
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   163
     * Generates an HTML anchor tag.
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 ref reference url for the anchor tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   166
     * @param body content for the anchor tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   167
     * @return an HtmlTree object
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   168
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   169
    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
   170
        HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body));
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   171
        htmltree.addAttr(HtmlAttr.HREF, ref);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   172
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   173
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   174
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
     * Generates an HTML anchor tag with name attribute and content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   177
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   178
     * @param name name for the anchor tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   179
     * @param body content for the anchor tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   180
     * @return an HtmlTree object
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   181
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   182
    public static HtmlTree A_NAME(String name, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   183
        HtmlTree htmltree = HtmlTree.A_NAME(name);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   184
        htmltree.addContent(nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   185
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   186
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   187
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   188
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   189
     * Generates an HTML anchor tag with name attribute.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   190
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   191
     * @param name name for the anchor tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   192
     * @return an HtmlTree object
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   193
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   194
    public static HtmlTree A_NAME(String name) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   195
        HtmlTree htmltree = new HtmlTree(HtmlTag.A);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   196
        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   197
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   198
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   199
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   200
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   201
     * Generates a CAPTION tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   202
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   203
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   204
     * @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
   205
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   206
    public static HtmlTree CAPTION(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   207
        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
   208
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   209
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   210
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   211
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   212
     * Generates a CODE tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   213
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   214
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   215
     * @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
   216
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   217
    public static HtmlTree CODE(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   218
        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
   219
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   220
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   221
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   222
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   223
     * Generates a DD tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   224
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   225
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   226
     * @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
   227
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   228
    public static HtmlTree DD(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   229
        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
   230
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   231
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   232
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   233
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   234
     * Generates a DL tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   235
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   236
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   237
     * @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
   238
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   239
    public static HtmlTree DL(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   240
        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
   241
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   242
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   243
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   244
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   245
     * 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
   246
     * a content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   247
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   248
     * @param styleClass stylesheet class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   249
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   250
     * @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
   251
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   252
    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
   253
        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
   254
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   255
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   256
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   257
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   258
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   259
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   260
     * Generates a DIV tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   261
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   262
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   263
     * @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
   264
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   265
    public static HtmlTree DIV(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   266
        return DIV(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   267
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   268
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   269
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   270
     * Generates a DT tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   271
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   272
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   273
     * @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
   274
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   275
    public static HtmlTree DT(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   276
        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
   277
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   278
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   279
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   280
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   281
     * Generates a EM tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   282
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   283
     * @param body content to be added to the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   284
     * @return an HtmlTree object for the EM tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   285
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   286
    public static HtmlTree EM(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   287
        HtmlTree htmltree = new HtmlTree(HtmlTag.EM, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   288
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   289
    }
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   292
     * Generates a FRAME tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   293
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   294
     * @param src the url of the document to be shown in the frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   295
     * @param name specifies the name of the frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   296
     * @param title the title for the frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   297
     * @param scrolling specifies whether to display scrollbars in the frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   298
     * @return an HtmlTree object for the FRAME tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   299
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   300
    public static HtmlTree FRAME(String src, String name, String title, String scrolling) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   301
        HtmlTree htmltree = new HtmlTree(HtmlTag.FRAME);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   302
        htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   303
        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   304
        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   305
        if (scrolling != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   306
            htmltree.addAttr(HtmlAttr.SCROLLING, scrolling);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   307
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   308
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   309
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   310
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   311
     * Generates a Frame tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   312
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   313
     * @param src the url of the document to be shown in the frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   314
     * @param name specifies the name of the frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   315
     * @param title the title for the frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   316
     * @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
   317
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   318
    public static HtmlTree FRAME(String src, String name, String title) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   319
        return FRAME(src, name, title, null);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   320
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   321
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   322
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   323
     * Generates a FRAMESET tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   324
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   325
     * @param cols the size of columns in the frameset
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   326
     * @param rows the size of rows in the frameset
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   327
     * @param title the title for the frameset
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   328
     * @param onload the script to run when the document loads
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   329
     * @return an HtmlTree object for the FRAMESET tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   330
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   331
    public static HtmlTree FRAMESET(String cols, String rows, String title, String onload) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   332
        HtmlTree htmltree = new HtmlTree(HtmlTag.FRAMESET);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   333
        if (cols != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   334
            htmltree.addAttr(HtmlAttr.COLS, cols);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   335
        if (rows != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   336
            htmltree.addAttr(HtmlAttr.ROWS, rows);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   337
        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   338
        htmltree.addAttr(HtmlAttr.ONLOAD, nullCheck(onload));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   339
        return htmltree;
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   343
     * 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
   344
     * a content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   345
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   346
     * @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
   347
     * @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
   348
     * @param styleClass stylesheet class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   349
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   350
     * @return an HtmlTree object for the tag
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
    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
   353
            HtmlStyle styleClass, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   354
        HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   355
        if (printTitle)
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   356
            htmltree.addAttr(HtmlAttr.TITLE, stripHtml(body));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   357
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   358
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   359
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   360
    }
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
     * 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
   364
     * a 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 headingTag the heading tag to be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   367
     * @param styleClass stylesheet class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   368
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   369
     * @return an HtmlTree object for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   370
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   371
    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
   372
        return HEADING(headingTag, false, styleClass, body);
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   376
     * 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
   377
     * a content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   378
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   379
     * @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
   380
     * @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
   381
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   382
     * @return an HtmlTree object for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   383
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   384
    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
   385
        return HEADING(headingTag, printTitle, null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   386
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   387
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
     * 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
   390
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   391
     * @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
   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 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 HEADING(HtmlTag headingTag, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   396
        return HEADING(headingTag, false, 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 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
   401
     * content to the HTML tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   402
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   403
     * @param lang language for the HTML document
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   404
     * @param head head for the HTML tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   405
     * @param body body for the HTML tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   406
     * @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
   407
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   408
    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
   409
        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
   410
        htmltree.addAttr(HtmlAttr.LANG, nullCheck(lang));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   411
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   412
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   413
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   414
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   415
     * Generates a I tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   416
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   417
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   418
     * @return an HtmlTree object for the I tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   419
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   420
    public static HtmlTree I(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   421
        HtmlTree htmltree = new HtmlTree(HtmlTag.I, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   422
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   423
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   424
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   425
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   426
     * Generates a LI tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   427
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   428
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   429
     * @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
   430
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   431
    public static HtmlTree LI(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   432
        return LI(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   433
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   434
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   435
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   436
     * Generates a LI tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   437
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   438
     * @param styleClass style 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 LI 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 LI(HtmlStyle styleClass, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   443
        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
   444
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   445
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   446
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   447
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   448
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   449
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   450
     * 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
   451
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   452
     * @param rel relevance of the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   453
     * @param type type of link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   454
     * @param href the path for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   455
     * @param title title for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   456
     * @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
   457
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   458
    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
   459
        HtmlTree htmltree = new HtmlTree(HtmlTag.LINK);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   460
        htmltree.addAttr(HtmlAttr.REL, nullCheck(rel));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   461
        htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   462
        htmltree.addAttr(HtmlAttr.HREF, nullCheck(href));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   463
        htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   464
        return htmltree;
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   467
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   468
     * 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
   469
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 9087
diff changeset
   470
     * @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
   471
     * @param content type of content
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 9087
diff changeset
   472
     * @param charSet character set used
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   473
     * @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
   474
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   475
    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
   476
        HtmlTree htmltree = new HtmlTree(HtmlTag.META);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   477
        htmltree.addAttr(HtmlAttr.HTTP_EQUIV, nullCheck(httpEquiv));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   478
        htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   479
        htmltree.addAttr(HtmlAttr.CHARSET, nullCheck(charSet));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   480
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   481
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   482
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   483
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   484
     * 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
   485
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   486
     * @param name name attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   487
     * @param content type of content
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   488
     * @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
   489
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   490
    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
   491
        HtmlTree htmltree = new HtmlTree(HtmlTag.META);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   492
        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   493
        htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   494
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   495
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   496
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
     * Generates a NOSCRIPT tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   499
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   500
     * @param body content of the noscript tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   501
     * @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
   502
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   503
    public static HtmlTree NOSCRIPT(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   504
        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
   505
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   506
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   507
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   508
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   509
     * Generates a P tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   510
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   511
     * @param body content of the Paragraph tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   512
     * @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
   513
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   514
    public static HtmlTree P(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   515
        return P(null, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   516
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   517
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   518
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   519
     * Generates a P tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   520
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   521
     * @param styleClass style of the Paragraph tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   522
     * @param body content of the Paragraph tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   523
     * @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
   524
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   525
    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
   526
        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
   527
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   528
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   529
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   530
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   531
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   532
    /**
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   533
     * 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
   534
     *
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   535
     * @param type type of link
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   536
     * @param src the path for the script
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   537
     * @return an HtmlTree object for the SCRIPT tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   538
     */
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   539
    public static HtmlTree SCRIPT(String type, String src) {
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   540
        HtmlTree htmltree = new HtmlTree(HtmlTag.SCRIPT);
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   541
        htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   542
        htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   543
        return htmltree;
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   544
    }
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   545
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   546
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   547
     * Generates a SMALL tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   548
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   549
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   550
     * @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
   551
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   552
    public static HtmlTree SMALL(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   553
        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
   554
        return htmltree;
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   557
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   558
     * Generates a STRONG tag with some content.
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
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   561
     * @return an HtmlTree object for the STRONG tag
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
    public static HtmlTree STRONG(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   564
        HtmlTree htmltree = new HtmlTree(HtmlTag.STRONG, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   565
        return htmltree;
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   568
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   569
     * Generates a SPAN tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   570
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   571
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   572
     * @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
   573
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   574
    public static HtmlTree SPAN(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   575
        return SPAN(null, body);
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   578
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   579
     * 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
   580
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   581
     * @param styleClass style class for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   582
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   583
     * @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
   584
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   585
    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
   586
        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
   587
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   588
            htmltree.addStyle(styleClass);
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
    /**
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   593
     * 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
   594
     * a content.
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   595
     *
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   596
     * @param id the id for the tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   597
     * @param styleClass stylesheet class for the tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   598
     * @param body content for the tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   599
     * @return an HtmlTree object for the SPAN tag
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   600
     */
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   601
    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
   602
        HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   603
        htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   604
        if (styleClass != null)
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   605
            htmltree.addStyle(styleClass);
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   606
        return htmltree;
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   607
    }
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   608
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   609
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   610
     * Generates a Table tag with border, width and summary attributes and
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   611
     * some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   612
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   613
     * @param border border for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   614
     * @param width width of the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   615
     * @param summary summary for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   616
     * @param body content for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   617
     * @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
   618
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   619
    public static HtmlTree TABLE(int border, int width, String summary,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   620
            Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   621
        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
   622
        htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   623
        htmltree.addAttr(HtmlAttr.WIDTH, Integer.toString(width));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   624
        htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   625
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   626
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   627
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   628
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   629
     * Generates a Table tag with style class, border, cell padding,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   630
     * cellspacing and summary attributes and some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   631
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   632
     * @param styleClass style of the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   633
     * @param border border for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   634
     * @param cellPadding cell padding for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   635
     * @param cellSpacing cell spacing for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   636
     * @param summary summary for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   637
     * @param body content for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   638
     * @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
   639
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   640
    public static HtmlTree TABLE(HtmlStyle styleClass, int border, int cellPadding,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   641
            int cellSpacing, String summary, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   642
        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
   643
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   644
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   645
        htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   646
        htmltree.addAttr(HtmlAttr.CELLPADDING, Integer.toString(cellPadding));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   647
        htmltree.addAttr(HtmlAttr.CELLSPACING, Integer.toString(cellSpacing));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   648
        htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   649
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   650
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   651
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
     * Generates a Table tag with border, cell padding,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   654
     * cellspacing and summary attributes and some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   655
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   656
     * @param border border for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   657
     * @param cellPadding cell padding for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   658
     * @param cellSpacing cell spacing for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   659
     * @param summary summary for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   660
     * @param body content for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   661
     * @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
   662
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   663
    public static HtmlTree TABLE(int border, int cellPadding,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   664
            int cellSpacing, String summary, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   665
        return TABLE(null, border, cellPadding, cellSpacing, summary, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   666
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   667
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   668
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   669
     * 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
   670
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   671
     * @param styleClass style for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   672
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   673
     * @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
   674
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   675
    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
   676
        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
   677
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   678
            htmltree.addStyle(styleClass);
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 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
   684
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   685
     * @param body content for the 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 TD 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 TD(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   689
        return TD(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 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
   694
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   695
     * @param styleClass style for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   696
     * @param scope scope of the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   697
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   698
     * @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
   699
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   700
    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
   701
        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
   702
        if (styleClass != null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   703
            htmltree.addStyle(styleClass);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   704
        htmltree.addAttr(HtmlAttr.SCOPE, nullCheck(scope));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   705
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   706
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   707
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   708
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   709
     * 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
   710
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   711
     * @param scope scope of the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   712
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   713
     * @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
   714
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   715
    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
   716
        return TH(null, scope, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   717
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   718
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   719
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   720
     * Generates a TITLE tag with some content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   721
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   722
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   723
     * @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
   724
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   725
    public static HtmlTree TITLE(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   726
        HtmlTree htmltree = new HtmlTree(HtmlTag.TITLE, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   727
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   728
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   729
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   730
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   731
     * 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
   732
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   733
     * @param body content for the tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   734
     * @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
   735
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   736
    public static HtmlTree TR(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   737
        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
   738
        return htmltree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   739
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   740
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   741
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   742
     * 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
   743
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   744
     * @param styleClass style for the tag
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 UL 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 UL(HtmlStyle styleClass, 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.UL, nullCheck(body));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   750
        htmltree.addStyle(nullCheck(styleClass));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   751
        return htmltree;
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   755
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   756
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   757
    public boolean isEmpty() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   758
        return (!hasContent() && !hasAttrs());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   759
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   760
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
     * 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
   763
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   764
     * @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
   765
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   766
    public boolean hasContent() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   767
        return (!content.isEmpty());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   768
    }
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   771
     * 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
   772
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   773
     * @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
   774
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   775
    public boolean hasAttrs() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   776
        return (!attrs.isEmpty());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   777
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   778
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   779
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   780
     * 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
   781
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   782
     * @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
   783
     * @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
   784
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   785
    public boolean hasAttr(HtmlAttr attrName) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   786
        return (attrs.containsKey(attrName));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   787
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   788
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   789
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   790
     * 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
   791
     * 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
   792
     * ensures HTML validation.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   793
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   794
     * @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
   795
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   796
    public boolean isValid() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   797
        switch (htmlTag) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   798
            case A :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   799
                return (hasAttr(HtmlAttr.NAME) || (hasAttr(HtmlAttr.HREF) && hasContent()));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   800
            case BR :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   801
                return (!hasContent() && (!hasAttrs() || hasAttr(HtmlAttr.CLEAR)));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   802
            case FRAME :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   803
                return (hasAttr(HtmlAttr.SRC) && !hasContent());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   804
            case HR :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   805
                return (!hasContent());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   806
            case IMG :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   807
                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
   808
            case LINK :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   809
                return (hasAttr(HtmlAttr.HREF) && !hasContent());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   810
            case META :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   811
                return (hasAttr(HtmlAttr.CONTENT) && !hasContent());
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   812
            case SCRIPT :
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   813
                return ((hasAttr(HtmlAttr.TYPE) && hasAttr(HtmlAttr.SRC) && !hasContent()) ||
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14265
diff changeset
   814
                        (hasAttr(HtmlAttr.TYPE) && hasContent()));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   815
            default :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   816
                return hasContent();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   817
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   818
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   819
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   820
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   821
     * 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
   822
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   823
     * @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
   824
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   825
    public boolean isInline() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   826
        return (htmlTag.blockType == HtmlTag.BlockType.INLINE);
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   829
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   830
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   831
     */
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   832
    @Override
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   833
    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
   834
        if (!isInline() && !atNewline)
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   835
            out.write(DocletConstants.NL);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   836
        String tagString = htmlTag.toString();
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   837
        out.write("<");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   838
        out.write(tagString);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   839
        Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   840
        HtmlAttr key;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   841
        String value = "";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   842
        while (iterator.hasNext()) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   843
            key = iterator.next();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   844
            value = attrs.get(key);
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   845
            out.write(" ");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   846
            out.write(key.toString());
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
   847
            if (!value.isEmpty()) {
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   848
                out.write("=\"");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   849
                out.write(value);
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   850
                out.write("\"");
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
   851
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   852
        }
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   853
        out.write(">");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   854
        boolean nl = false;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   855
        for (Content c : content)
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   856
            nl = c.write(out, nl);
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
   857
        if (htmlTag.endTagRequired()) {
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   858
            out.write("</");
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   859
            out.write(tagString);
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   860
            out.write(">");
8035
465338fc0c82 7010528: javadoc performance regression
bpatel
parents: 7641
diff changeset
   861
        }
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   862
        if (!isInline()) {
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   863
            out.write(DocletConstants.NL);
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   864
            return true;
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   865
        } else {
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   866
            return false;
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   867
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   868
    }
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   869
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   870
    /**
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   871
     * Given a Content node, strips all html characters and
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   872
     * return the result.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   873
     *
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   874
     * @param body The content node to check.
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   875
     * @return the plain text from the content node
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   876
     *
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   877
     */
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   878
    private static String stripHtml(Content body) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   879
        String rawString = body.toString();
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   880
        // remove HTML tags
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   881
        rawString = rawString.replaceAll("\\<.*?>", " ");
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   882
        // consolidate multiple spaces between a word to a single space
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   883
        rawString = rawString.replaceAll("\\b\\s{2,}\\b", " ");
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   884
        // remove extra whitespaces
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   885
        return rawString.trim();
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17560
diff changeset
   886
    }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
diff changeset
   887
}