langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java
author jjg
Mon, 22 Aug 2016 16:32:40 -0700
changeset 40587 1c355ea550ed
parent 40303 96a1226aca18
child 41630 9cc5bcc88057
permissions -rw-r--r--
8164130: Simplify doclet IOException handling Reviewed-by: bpatel, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
     2
 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html.markup;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1863
diff changeset
    28
import java.io.*;
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
    29
import java.util.*;
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1863
diff changeset
    30
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    31
import jdk.javadoc.internal.doclets.toolkit.Configuration;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    32
import jdk.javadoc.internal.doclets.toolkit.Content;
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
    33
import jdk.javadoc.internal.doclets.toolkit.Resources;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    34
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
    35
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    36
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    37
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    38
import jdk.javadoc.internal.doclets.toolkit.util.MethodTypes;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    39
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * Class for the Html format code generation.
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
    43
 * Initializes PrintWriter with FileWriter, to enable print
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * related methods to generate the code to the named File through FileWriter.
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    46
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    47
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    48
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    49
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    50
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 * @author Atul M Dambalkar
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
    52
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 */
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
    54
public class HtmlWriter {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     * The window title of this file
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    protected String winTitle;
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
     * The configuration
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    protected Configuration configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    /**
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
    67
     * Header for table displaying modules and description..
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
    68
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
    69
    protected final List<String> moduleTableHeader;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
    70
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
    71
    /**
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
    72
     * Header for tables displaying packages and description..
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
    73
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
    74
    protected final List<String> packageTableHeader;
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
    75
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
    76
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    77
     * Header for tables displaying modules and description..
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    78
     */
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    79
    protected final List<String> requiresTableHeader;
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    80
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    81
    /**
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    82
     * Header for tables displaying packages and description..
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    83
     */
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    84
    protected final List<String> exportedPackagesTableHeader;
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    85
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    86
    /**
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    87
     * Header for tables displaying types and description..
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    88
     */
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    89
    protected final List<String> usesTableHeader;
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    90
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    91
    /**
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    92
     * Header for tables displaying types and description..
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    93
     */
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    94
    protected final List<String> providesTableHeader;
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    95
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
    96
    /**
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
    97
     * Summary for use tables displaying class and package use.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
    98
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
    99
    protected final String useTableSummary;
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   100
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   101
    /**
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   102
     * Column header for class docs displaying Modifier and Type header.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   103
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   104
    protected final String modifierTypeHeader;
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   105
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   106
    private final DocFile docFile;
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
   107
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 30528
diff changeset
   108
    protected Content script;
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   109
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   110
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   111
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     * Constructor.
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     * @param path The directory path to be created for this file
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     *             or null if none to be created.
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     */
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   117
    public HtmlWriter(Configuration configuration, DocPath path) {
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   118
        docFile = DocFile.createFileForOutput(configuration, path);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
        this.configuration = configuration;
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   120
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   121
        // The following should be converted to shared Content objects
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   122
        // and moved to Contents, but that will require additional
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   123
        // changes at the use sites.
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   124
        Resources resources = configuration.getResources();
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   125
        moduleTableHeader = Arrays.asList(
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   126
            resources.getText("doclet.Module"),
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   127
            resources.getText("doclet.Description"));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 33920
diff changeset
   128
        packageTableHeader = new ArrayList<>();
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   129
        packageTableHeader.add(resources.getText("doclet.Package"));
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   130
        packageTableHeader.add(resources.getText("doclet.Description"));
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
   131
        requiresTableHeader = new ArrayList<>();
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   132
        requiresTableHeader.add(resources.getText("doclet.Module"));
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   133
        requiresTableHeader.add(resources.getText("doclet.Description"));
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
   134
        exportedPackagesTableHeader = new ArrayList<>();
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   135
        exportedPackagesTableHeader.add(resources.getText("doclet.Package"));
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   136
        exportedPackagesTableHeader.add(resources.getText("doclet.Module"));
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   137
        exportedPackagesTableHeader.add(resources.getText("doclet.Description"));
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
   138
        usesTableHeader = new ArrayList<>();
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   139
        usesTableHeader.add(resources.getText("doclet.Type"));
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   140
        usesTableHeader.add(resources.getText("doclet.Description"));
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 36526
diff changeset
   141
        providesTableHeader = new ArrayList<>();
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   142
        providesTableHeader.add(resources.getText("doclet.Type"));
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   143
        providesTableHeader.add(resources.getText("doclet.Description"));
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   144
        useTableSummary = resources.getText("doclet.Use_Table_Summary",
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   145
                resources.getText("doclet.packages"));
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   146
        modifierTypeHeader = resources.getText("doclet.0_and_1",
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   147
                resources.getText("doclet.Modifier"),
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   148
                resources.getText("doclet.Type"));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   149
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   150
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
   151
    public void write(Content c) throws DocFileIOException {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   152
        try (Writer writer = docFile.openWriter()) {
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   153
            c.write(writer, true);
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
   154
        } catch (IOException e) {
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
   155
            throw new DocFileIOException(docFile, DocFileIOException.Mode.WRITE, e);
19907
41ae54351dea 8023700: Use non breaking space in various labels
jjg
parents: 18404
diff changeset
   156
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   160
     * Returns an HtmlTree for the SCRIPT tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   161
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   162
     * @return an HtmlTree for the SCRIPT tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   163
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   164
    protected HtmlTree getWinTitleScript(){
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   165
        HtmlTree scriptTree = HtmlTree.SCRIPT();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   166
        if(winTitle != null && winTitle.length() > 0) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   167
            String scriptCode = "<!--\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   168
                    "    try {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   169
                    "        if (location.href.indexOf('is-external=true') == -1) {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   170
                    "            parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   171
                    "        }\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   172
                    "    }\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   173
                    "    catch(err) {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   174
                    "    }\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   175
                    "//-->\n";
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   176
            RawHtml scriptContent = new RawHtml(scriptCode.replace("\n", DocletConstants.NL));
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   177
            scriptTree.addContent(scriptContent);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   178
        }
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   179
        return scriptTree;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   180
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   181
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   182
    /**
21026
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   183
     * Returns a String with escaped special JavaScript characters.
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   184
     *
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   185
     * @param s String that needs to be escaped
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   186
     * @return a valid escaped JavaScript string
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   187
     */
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   188
    private static String escapeJavaScriptChars(String s) {
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   189
        StringBuilder sb = new StringBuilder();
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   190
        for (int i = 0; i < s.length(); i++) {
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   191
            char ch = s.charAt(i);
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   192
            switch (ch) {
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   193
                case '\b':
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   194
                    sb.append("\\b");
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   195
                    break;
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   196
                case '\t':
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   197
                    sb.append("\\t");
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   198
                    break;
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   199
                case '\n':
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   200
                    sb.append("\\n");
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   201
                    break;
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   202
                case '\f':
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   203
                    sb.append("\\f");
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   204
                    break;
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   205
                case '\r':
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   206
                    sb.append("\\r");
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   207
                    break;
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   208
                case '"':
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   209
                    sb.append("\\\"");
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   210
                    break;
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   211
                case '\'':
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   212
                    sb.append("\\\'");
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   213
                    break;
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   214
                case '\\':
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   215
                    sb.append("\\\\");
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   216
                    break;
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   217
                default:
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   218
                    if (ch < 32 || ch >= 127) {
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   219
                        sb.append(String.format("\\u%04X", (int)ch));
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   220
                    } else {
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   221
                        sb.append(ch);
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   222
                    }
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   223
                    break;
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   224
            }
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   225
        }
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   226
        return sb.toString();
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   227
    }
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   228
b35314edf87a 8016675: Make Javadoc pages more robust
bpatel
parents: 18404
diff changeset
   229
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   230
     * Returns a content tree for the SCRIPT tag for the main page(index.html).
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   231
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   232
     * @return a content for the SCRIPT tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   233
     */
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 25874
diff changeset
   234
    protected Content getFramesJavaScript() {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   235
        HtmlTree scriptTree = HtmlTree.SCRIPT();
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   236
        String scriptCode = "\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   237
                "    targetPage = \"\" + window.location.search;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   238
                "    if (targetPage != \"\" && targetPage != \"undefined\")\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   239
                "        targetPage = targetPage.substring(1);\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   240
                "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   241
                "        targetPage = \"undefined\";\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   242
                "    function validURL(url) {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   243
                "        try {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   244
                "            url = decodeURIComponent(url);\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   245
                "        }\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   246
                "        catch (error) {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   247
                "            return false;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   248
                "        }\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   249
                "        var pos = url.indexOf(\".html\");\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   250
                "        if (pos == -1 || pos != url.length - 5)\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   251
                "            return false;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   252
                "        var allowNumber = false;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   253
                "        var allowSep = false;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   254
                "        var seenDot = false;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   255
                "        for (var i = 0; i < url.length - 5; i++) {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   256
                "            var ch = url.charAt(i);\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   257
                "            if ('a' <= ch && ch <= 'z' ||\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   258
                "                    'A' <= ch && ch <= 'Z' ||\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   259
                "                    ch == '$' ||\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   260
                "                    ch == '_' ||\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   261
                "                    ch.charCodeAt(0) > 127) {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   262
                "                allowNumber = true;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   263
                "                allowSep = true;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   264
                "            } else if ('0' <= ch && ch <= '9'\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   265
                "                    || ch == '-') {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   266
                "                if (!allowNumber)\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   267
                "                     return false;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   268
                "            } else if (ch == '/' || ch == '.') {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   269
                "                if (!allowSep)\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   270
                "                    return false;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   271
                "                allowNumber = false;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   272
                "                allowSep = false;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   273
                "                if (ch == '.')\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   274
                "                     seenDot = true;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   275
                "                if (ch == '/' && seenDot)\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   276
                "                     return false;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   277
                "            } else {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   278
                "                return false;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   279
                "            }\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   280
                "        }\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   281
                "        return true;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   282
                "    }\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   283
                "    function loadFrames() {\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   284
                "        if (targetPage != \"\" && targetPage != \"undefined\")\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   285
                "             top.classFrame.location = top.targetPage;\n" +
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   286
                "    }\n";
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   287
        RawHtml scriptContent = new RawHtml(scriptCode.replace("\n", DocletConstants.NL));
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   288
        scriptTree.addContent(scriptContent);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   289
        return scriptTree;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   290
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   291
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   292
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   293
     * Returns an HtmlTree for the BODY tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   294
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   295
     * @param includeScript  set true if printing windowtitle script
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   296
     * @param title title for the window
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   297
     * @return an HtmlTree for the BODY tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   298
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   299
    public HtmlTree getBody(boolean includeScript, String title) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   300
        HtmlTree body = new HtmlTree(HtmlTag.BODY);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   301
        // Set window title string which is later printed
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   302
        this.winTitle = title;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   303
        // Don't print windowtitle script for overview-frame, allclasses-frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   304
        // and package-frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   305
        if (includeScript) {
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   306
            this.script = getWinTitleScript();
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   307
            body.addContent(script);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   308
            Content noScript = HtmlTree.NOSCRIPT(
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   309
                    HtmlTree.DIV(configuration.getContent("doclet.No_Script_Message")));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   310
            body.addContent(noScript);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   311
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   312
        return body;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   313
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   314
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   315
    /**
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   316
     * Generated javascript variables for the document.
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   317
     *
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   318
     * @param typeMap map comprising of method and type relationship
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   319
     * @param methodTypes set comprising of all methods types for this class
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   320
     */
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   321
    public void generateMethodTypesScript(Map<String,Integer> typeMap,
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   322
            Set<MethodTypes> methodTypes) {
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   323
        String sep = "";
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   324
        StringBuilder vars = new StringBuilder("var methods = {");
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   325
        for (Map.Entry<String,Integer> entry : typeMap.entrySet()) {
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   326
            vars.append(sep);
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   327
            sep = ",";
30528
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   328
            vars.append("\"")
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   329
                    .append(entry.getKey())
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   330
                    .append("\":")
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   331
                    .append(entry.getValue());
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   332
        }
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   333
        vars.append("};").append(DocletConstants.NL);
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   334
        sep = "";
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   335
        vars.append("var tabs = {");
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   336
        for (MethodTypes entry : methodTypes) {
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   337
            vars.append(sep);
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   338
            sep = ",";
30528
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   339
            vars.append(entry.value())
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   340
                    .append(":")
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   341
                    .append("[")
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   342
                    .append("\"")
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   343
                    .append(entry.tabId())
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   344
                    .append("\"")
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   345
                    .append(sep)
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   346
                    .append("\"")
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   347
                    .append(configuration.getText(entry.resourceKey()))
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   348
                    .append("\"]");
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   349
        }
30528
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   350
        vars.append("};")
dadaac1f5cc2 8065077: MethodTypes are not localized
bpatel
parents: 29957
diff changeset
   351
                .append(DocletConstants.NL);
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   352
        addStyles(HtmlStyle.altColor, vars);
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   353
        addStyles(HtmlStyle.rowColor, vars);
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   354
        addStyles(HtmlStyle.tableTab, vars);
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   355
        addStyles(HtmlStyle.activeTableTab, vars);
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36270
diff changeset
   356
        script.addContent(new RawHtml(vars));
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   357
    }
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   358
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   359
    /**
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   360
     * Adds javascript style variables to the document.
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   361
     *
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   362
     * @param style style to be added as a javascript variable
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   363
     * @param vars variable string to which the style variable will be added
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   364
     */
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   365
    public void addStyles(HtmlStyle style, StringBuilder vars) {
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   366
        vars.append("var ").append(style).append(" = \"").append(style)
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   367
                .append("\";").append(DocletConstants.NL);
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   368
    }
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   369
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14368
diff changeset
   370
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   371
     * Returns an HtmlTree for the TITLE tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   372
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   373
     * @return an HtmlTree for the TITLE tag
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   374
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   375
    public HtmlTree getTitle() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   376
        HtmlTree title = HtmlTree.TITLE(new StringContent(winTitle));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   377
        return title;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   378
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   380
    /*
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   381
     * Returns a header for Modifier and Type column of a table.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   382
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   383
    public String getModifierTypeHeader() {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   384
        return modifierTypeHeader;
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   385
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
}