langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
author bpatel
Mon, 13 Apr 2015 18:05:23 -0700
changeset 29957 7740f9657f56
parent 29429 964498d4dcec
child 38617 d93a7f64e231
permissions -rw-r--r--
8072945: Javadoc should generate valid and compliant HTML5 output Reviewed-by: jjg, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
     2
 * Copyright (c) 1997, 2015, 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: 2223
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: 2223
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: 2223
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2223
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2223
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.doclets.formats.html.markup;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
1869
0e193a8f3520 6794582: javadoc should read files using a FileManager
jjg
parents: 1787
diff changeset
    28
import java.io.*;
0e193a8f3520 6794582: javadoc should read files using a FileManager
jjg
parents: 1787
diff changeset
    29
import java.util.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import com.sun.javadoc.*;
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents: 14260
diff changeset
    32
import com.sun.tools.doclets.formats.html.ConfigurationImpl;
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
    33
import com.sun.tools.doclets.formats.html.SectionName;
1869
0e193a8f3520 6794582: javadoc should read files using a FileManager
jjg
parents: 1787
diff changeset
    34
import com.sun.tools.doclets.internal.toolkit.*;
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
    35
import com.sun.tools.doclets.internal.toolkit.util.DocFile;
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
    36
import com.sun.tools.doclets.internal.toolkit.util.DocLink;
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    37
import com.sun.tools.doclets.internal.toolkit.util.DocPath;
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
    38
import com.sun.tools.doclets.internal.toolkit.util.DocPaths;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
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 specific to JavaDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * This Class contains methods related to the Html Code Generation which
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * are used by the Sub-Classes in the package com.sun.tools.doclets.standard
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * and com.sun.tools.doclets.oneone.
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
    47
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
    48
 *  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: 7681
diff changeset
    49
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
    50
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
    51
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 * @since 1.2
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
 * @author Robert Field
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
public abstract class HtmlDocWriter extends HtmlWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
19663
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents: 17570
diff changeset
    58
    public static final String CONTENT_TYPE = "text/html";
9a3447cabe1a 7052170: javadoc -charset option generates wrong meta tag
bpatel
parents: 17570
diff changeset
    59
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
    60
    DocPath pathToRoot;
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
    61
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
     * Constructor. Initializes the destination file name through the super
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
     * class HtmlWriter.
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     * @param filename String file name.
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    68
    public HtmlDocWriter(Configuration configuration, DocPath filename)
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    69
            throws IOException {
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    70
        super(configuration, filename);
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
    71
        this.pathToRoot = filename.parent().invert();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
        configuration.message.notice("doclet.Generating_0",
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
    73
            DocFile.createFileForOutput(configuration, filename).getPath());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     * Accessor for configuration.
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    public abstract Configuration configuration();
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17560
diff changeset
    81
    public Content getHyperLink(DocPath link, String label) {
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17560
diff changeset
    82
        return getHyperLink(link, new StringContent(label), false, "", "", "");
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17560
diff changeset
    83
    }
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17560
diff changeset
    84
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    /**
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
    86
     * Get Html Hyper Link Content.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     *
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    88
     * @param where      Position of the link in the file. Character '#' is not
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    89
     *                   needed.
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    90
     * @param label      Tag for the link.
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    91
     * @return a content tree for the hyper link
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    92
     */
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    93
    public Content getHyperLink(String where,
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    94
                               Content label) {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
    95
        return getHyperLink(getDocLink(where), label, "", "");
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
    96
    }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
    97
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
    98
    /**
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
    99
     * Get Html Hyper Link Content.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   100
     *
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   101
     * @param sectionName      The section name to which the link will be created.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   102
     * @param label            Tag for the link.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   103
     * @return a content tree for the hyper link
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   104
     */
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   105
    public Content getHyperLink(SectionName sectionName,
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   106
                               Content label) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   107
        return getHyperLink(getDocLink(sectionName), label, "", "");
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   108
    }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   109
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   110
    /**
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   111
     * Get Html Hyper Link Content.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   112
     *
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   113
     * @param sectionName      The section name combined with where to which the link
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   114
     *                         will be created.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   115
     * @param where            The fragment combined with sectionName to which the link
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   116
     *                         will be created.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   117
     * @param label            Tag for the link.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   118
     * @return a content tree for the hyper link
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   119
     */
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   120
    public Content getHyperLink(SectionName sectionName, String where,
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   121
                               Content label) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   122
        return getHyperLink(getDocLink(sectionName, where), label, "", "");
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   123
    }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   124
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   125
    /**
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   126
     * Get the link.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   127
     *
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   128
     * @param where      Position of the link in the file.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   129
     * @return a DocLink object for the hyper link
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   130
     */
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   131
    public DocLink getDocLink(String where) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   132
        return DocLink.fragment(getName(where));
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   133
    }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   134
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   135
    /**
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   136
     * Get the link.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   137
     *
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   138
     * @param sectionName      The section name to which the link will be created.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   139
     * @return a DocLink object for the hyper link
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   140
     */
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   141
    public DocLink getDocLink(SectionName sectionName) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   142
        return DocLink.fragment(sectionName.getName());
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   143
    }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   144
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   145
    /**
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   146
     * Get the link.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   147
     *
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   148
     * @param sectionName      The section name combined with where to which the link
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   149
     *                         will be created.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   150
     * @param where            The fragment combined with sectionName to which the link
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   151
     *                         will be created.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   152
     * @return a DocLink object for the hyper link
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   153
     */
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   154
    public DocLink getDocLink(SectionName sectionName, String where) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   155
        return DocLink.fragment(sectionName.getName() + getName(where));
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   156
    }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   157
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   158
    /**
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   159
     * Convert the name to a valid HTML name.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   160
     *
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   161
     * @param name the name that needs to be converted to valid HTML name.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   162
     * @return a valid HTML name string.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   163
     */
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   164
    public String getName(String name) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   165
        StringBuilder sb = new StringBuilder();
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   166
        char ch;
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   167
        /* The HTML 4 spec at http://www.w3.org/TR/html4/types.html#h-6.2 mentions
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   168
         * that the name/id should begin with a letter followed by other valid characters.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   169
         * The HTML 5 spec (draft) is more permissive on names/ids where the only restriction
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   170
         * is that it should be at least one character long and should not contain spaces.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   171
         * The spec draft is @ http://www.w3.org/html/wg/drafts/html/master/dom.html#the-id-attribute.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   172
         *
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   173
         * For HTML 4, we need to check for non-characters at the beginning of the name and
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   174
         * substitute it accordingly, "_" and "$" can appear at the beginning of a member name.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   175
         * The method substitutes "$" with "Z:Z:D" and will prefix "_" with "Z:Z".
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   176
         */
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   177
        for (int i = 0; i < name.length(); i++) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   178
            ch = name.charAt(i);
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   179
            switch (ch) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   180
                case '(':
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   181
                case ')':
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   182
                case '<':
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   183
                case '>':
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   184
                case ',':
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   185
                    sb.append('-');
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   186
                    break;
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   187
                case ' ':
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   188
                case '[':
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   189
                    break;
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   190
                case ']':
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   191
                    sb.append(":A");
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   192
                    break;
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   193
                // Any appearance of $ needs to be substituted with ":D" and not with hyphen
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   194
                // since a field name "P$$ and a method P(), both valid member names, can end
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   195
                // up as "P--". A member name beginning with $ needs to be substituted with
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   196
                // "Z:Z:D".
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   197
                case '$':
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   198
                    if (i == 0)
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   199
                        sb.append("Z:Z");
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   200
                    sb.append(":D");
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   201
                    break;
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   202
                // A member name beginning with _ needs to be prefixed with "Z:Z" since valid anchor
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   203
                // names can only begin with a letter.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   204
                case '_':
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   205
                    if (i == 0)
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   206
                        sb.append("Z:Z");
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   207
                    sb.append(ch);
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   208
                    break;
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   209
                default:
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   210
                    sb.append(ch);
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   211
            }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   212
        }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 19920
diff changeset
   213
        return sb.toString();
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   214
    }
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   215
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   216
    /**
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   217
     * Get Html hyperlink.
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   218
     *
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   219
     * @param link       path of the file.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   220
     * @param label      Tag for the link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   221
     * @return a content tree for the hyper link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   222
     */
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   223
    public Content getHyperLink(DocPath link, Content label) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   224
        return getHyperLink(link, label, "", "");
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   225
    }
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   226
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   227
    public Content getHyperLink(DocLink link, Content label) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   228
        return getHyperLink(link, label, "", "");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17560
diff changeset
   231
    public Content getHyperLink(DocPath link,
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17560
diff changeset
   232
                               Content label, boolean strong,
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17560
diff changeset
   233
                               String stylename, String title, String target) {
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17560
diff changeset
   234
        return getHyperLink(new DocLink(link), label, strong,
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17560
diff changeset
   235
                stylename, title, target);
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17560
diff changeset
   236
    }
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17560
diff changeset
   237
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   238
    public Content getHyperLink(DocLink link,
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   239
                               Content label, boolean strong,
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   240
                               String stylename, String title, String target) {
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   241
        Content body = label;
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   242
        if (strong) {
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 21008
diff changeset
   243
            body = HtmlTree.SPAN(HtmlStyle.typeNameLink, body);
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   244
        }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   245
        if (stylename != null && stylename.length() != 0) {
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   246
            HtmlTree t = new HtmlTree(HtmlTag.FONT, body);
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   247
            t.addAttr(HtmlAttr.CLASS, stylename);
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   248
            body = t;
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   249
        }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   250
        HtmlTree l = HtmlTree.A(link.toString(), body);
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   251
        if (title != null && title.length() != 0) {
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   252
            l.addAttr(HtmlAttr.TITLE, title);
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   253
        }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   254
        if (target != null && target.length() != 0) {
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   255
            l.addAttr(HtmlAttr.TARGET, target);
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   256
        }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   257
        return l;
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   258
    }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 14544
diff changeset
   259
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   261
     * Get Html Hyper Link.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
     * @param link       String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
     * @param label      Tag for the link.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   265
     * @param title      String that describes the link's content for accessibility.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   266
     * @param target     Target frame.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   267
     * @return a content tree for the hyper link.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
     */
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   269
    public Content getHyperLink(DocPath link,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   270
            Content label, String title, String target) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   271
        return getHyperLink(new DocLink(link), label, title, target);
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   272
    }
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   273
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   274
    public Content getHyperLink(DocLink link,
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   275
            Content label, String title, String target) {
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   276
        HtmlTree anchor = HtmlTree.A(link.toString(), label);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   277
        if (title != null && title.length() != 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   278
            anchor.addAttr(HtmlAttr.TITLE, title);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   279
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   280
        if (target != null && target.length() != 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   281
            anchor.addAttr(HtmlAttr.TARGET, target);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   282
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   283
        return anchor;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   284
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   285
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   286
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
     * Get the name of the package, this class is in.
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
     * @param cd    ClassDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
    public String getPkgName(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
        String pkgName = cd.containingPackage().name();
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
        if (pkgName.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
            pkgName += ".";
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
            return pkgName;
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
        return "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1869
diff changeset
   300
    public boolean getMemberDetailsListPrinted() {
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1869
diff changeset
   301
        return memberDetailsListPrinted;
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1869
diff changeset
   302
    }
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1869
diff changeset
   303
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1869
diff changeset
   304
    /**
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   305
     * Print the frames version of the Html file header.
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   306
     * Called only when generating an HTML frames file.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   308
     * @param title Title of this HTML document
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   309
     * @param configuration the configuration object
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   310
     * @param body the body content tree to be added to the HTML document
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
     */
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   312
    public void printFramesDocument(String title, ConfigurationImpl configuration,
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   313
            HtmlTree body) throws IOException {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   314
        Content htmlDocType = configuration.isOutputHtml5()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   315
                ? DocType.HTML5
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 29429
diff changeset
   316
                : DocType.TRANSITIONAL;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   317
        Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   318
        Content head = new HtmlTree(HtmlTag.HEAD);
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   319
        head.addContent(getGeneratedBy(!configuration.notimestamp));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   320
        Content windowTitle = HtmlTree.TITLE(new StringContent(title));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   321
        head.addContent(windowTitle);
26665
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   322
        Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   323
                (configuration.charset.length() > 0) ?
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   324
                        configuration.charset : HtmlConstants.HTML_DEFAULT_CHARSET);
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   325
        head.addContent(meta);
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   326
        head.addContent(getStyleSheetProperties(configuration));
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   327
        head.addContent(getFramesJavaScript());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   328
        Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   329
                head, body);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   330
        Content htmlDocument = new HtmlDocument(htmlDocType,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   331
                htmlComment, htmlTree);
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
   332
        write(htmlDocument);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
29429
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   335
    /**
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   336
     * Returns a link to the stylesheet file.
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   337
     *
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   338
     * @return an HtmlTree for the lINK tag which provides the stylesheet location
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   339
     */
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   340
    public HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   341
        String stylesheetfile = configuration.stylesheetfile;
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   342
        DocPath stylesheet;
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   343
        if (stylesheetfile.isEmpty()) {
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   344
            stylesheet = DocPaths.STYLESHEET;
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   345
        } else {
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   346
            DocFile file = DocFile.createFileForInput(configuration, stylesheetfile);
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   347
            stylesheet = DocPath.create(file.getName());
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   348
        }
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   349
        HtmlTree link = HtmlTree.LINK("stylesheet", "text/css",
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   350
                pathToRoot.resolve(stylesheet).getPath(),
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   351
                "Style");
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   352
        return link;
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   353
    }
964498d4dcec 8074521: Generate iframe instead of frame and frameset for index.html page
bpatel
parents: 26665
diff changeset
   354
19920
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 19663
diff changeset
   355
    protected Comment getGeneratedBy(boolean timestamp) {
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 19663
diff changeset
   356
        String text = "Generated by javadoc"; // marker string, deliberately not localized
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 19663
diff changeset
   357
        if (timestamp) {
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 19663
diff changeset
   358
            Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 19663
diff changeset
   359
            Date today = calendar.getTime();
21888
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21478
diff changeset
   360
            text += " ("+ configuration.getDocletSpecificBuildDate() + ") on " + today;
19920
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 19663
diff changeset
   361
        }
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 19663
diff changeset
   362
        return new Comment(text);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
}