langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
author jjg
Tue, 16 Oct 2012 21:03:36 -0700
changeset 14266 69453558960d
parent 14265 4e8e488eeae0
child 14357 faf9cde2817b
permissions -rw-r--r--
8000673: remove dead code from HtmlWriter and subtypes Reviewed-by: bpatel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
     2
 * Copyright (c) 1997, 2012, 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;
1869
0e193a8f3520 6794582: javadoc should read files using a FileManager
jjg
parents: 1787
diff changeset
    33
import com.sun.tools.doclets.internal.toolkit.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * Class for the Html Format Code Generation specific to JavaDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * This Class contains methods related to the Html Code Generation which
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * are used by the Sub-Classes in the package com.sun.tools.doclets.standard
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * and com.sun.tools.doclets.oneone.
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
    42
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
    43
 *  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
    44
 *  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
    45
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 7681
diff changeset
    46
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 * @since 1.2
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 * @author Robert Field
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
public abstract class HtmlDocWriter extends HtmlWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
     * Constructor. Initializes the destination file name through the super
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
     * class HtmlWriter.
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     * @param filename String file name.
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    public HtmlDocWriter(Configuration configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
                         String filename) throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
        super(configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
              null, configuration.destDirName + filename,
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
              configuration.docencoding);
1869
0e193a8f3520 6794582: javadoc should read files using a FileManager
jjg
parents: 1787
diff changeset
    64
        // use File to normalize file separators
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
        configuration.message.notice("doclet.Generating_0",
1869
0e193a8f3520 6794582: javadoc should read files using a FileManager
jjg
parents: 1787
diff changeset
    66
            new File(configuration.destDirName, filename));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
    public HtmlDocWriter(Configuration configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
                         String path, String filename) throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
        super(configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
              configuration.destDirName + path, filename,
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
              configuration.docencoding);
1869
0e193a8f3520 6794582: javadoc should read files using a FileManager
jjg
parents: 1787
diff changeset
    74
        // use File to normalize file separators
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
        configuration.message.notice("doclet.Generating_0",
1869
0e193a8f3520 6794582: javadoc should read files using a FileManager
jjg
parents: 1787
diff changeset
    76
            new File(configuration.destDirName,
0e193a8f3520 6794582: javadoc should read files using a FileManager
jjg
parents: 1787
diff changeset
    77
                    ((path.length() > 0)? path + File.separator: "") + filename));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     * Accessor for configuration.
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    public abstract Configuration configuration();
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * Return Html Hyper Link string.
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     * @param link       String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
     * @param where      Position of the link in the file. Character '#' is not
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
     * needed.
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     * @param label      Tag for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    92
     * @param strong       Boolean that sets label to strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
     * @return String    Hyper Link.
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    95
    public String getHyperLinkString(String link, String where,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    96
                               String label, boolean strong) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    97
        return getHyperLinkString(link, where, label, strong, "", "", "");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
     * Get Html Hyper Link string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
     * @param link       String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     * @param where      Position of the link in the file. Character '#' is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
     *                   needed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     * @param label      Tag for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   107
     * @param strong       Boolean that sets label to strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     * @param stylename  String style of text defined in style sheet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * @return String    Hyper Link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   111
    public String getHyperLinkString(String link, String where,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   112
                               String label, boolean strong,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
                               String stylename) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   114
        return getHyperLinkString(link, where, label, strong, stylename, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   115
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   116
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   117
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   118
     * Get Html Hyper Link string.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   119
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   120
     * @param link       String name of the file.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   121
     * @param where      Position of the link in the file. Character '#' is not
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   122
     *                   needed.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   123
     * @param label      Tag for the link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   124
     * @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
   125
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   126
    public Content getHyperLink(String link, String where,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   127
                               Content label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   128
        return getHyperLink(link, where, label, "", "");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     * Get Html Hyper Link string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     * @param link       String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     * @param where      Position of the link in the file. Character '#' is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     *                   needed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * @param label      Tag for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   138
     * @param strong       Boolean that sets label to strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * @param stylename  String style of text defined in style sheet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * @param title      String that describes the link's content for accessibility.
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     * @param target     Target frame.
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     * @return String    Hyper Link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   144
    public String getHyperLinkString(String link, String where,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   145
                               String label, boolean strong,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
                               String stylename, String title, String target) {
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
   147
        StringBuilder retlink = new StringBuilder();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   148
        retlink.append("<a href=\"");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
        retlink.append(link);
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
        if (where != null && where.length() != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
            retlink.append("#");
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
            retlink.append(where);
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
        retlink.append("\"");
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
        if (title != null && title.length() != 0) {
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
   156
            retlink.append(" title=\"").append(title).append("\"");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
        if (target != null && target.length() != 0) {
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
   159
            retlink.append(" target=\"").append(target).append("\"");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        retlink.append(">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
        if (stylename != null && stylename.length() != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
            retlink.append("<FONT CLASS=\"");
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
            retlink.append(stylename);
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
            retlink.append("\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
        }
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   167
        if (strong) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   168
            retlink.append("<span class=\"strong\">");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
        retlink.append(label);
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   171
        if (strong) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   172
            retlink.append("</span>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
        if (stylename != null && stylename.length() != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
            retlink.append("</FONT>");
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   177
        retlink.append("</a>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
        return retlink.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   182
     * Get Html Hyper Link.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     * @param link       String name of the file.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   185
     * @param where      Position of the link in the file. Character '#' is not
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   186
     *                   needed.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     * @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
   188
     * @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
   189
     * @param target     Target frame.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   190
     * @return a content tree for the hyper link.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   192
    public Content getHyperLink(String link, String where,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   193
            Content label, String title, String target) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   194
        if (where != null && where.length() != 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   195
            link += "#" + where;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   196
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   197
        HtmlTree anchor = HtmlTree.A(link, label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   198
        if (title != null && title.length() != 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   199
            anchor.addAttr(HtmlAttr.TITLE, title);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   200
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   201
        if (target != null && target.length() != 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   202
            anchor.addAttr(HtmlAttr.TARGET, target);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   203
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   204
        return anchor;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   205
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   206
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   207
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   208
     * Get a hyperlink to a file.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   209
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   210
     * @param link String name of the file
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   211
     * @param label Label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   212
     * @return a content for the hyperlink to the file
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   213
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   214
    public Content getHyperLink(String link, Content label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   215
        return getHyperLink(link, "", label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
     * Get link string without positioning in the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
     * @param link       String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
     * @param label      Tag for the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
     * @return Strign    Hyper link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   225
    public String getHyperLinkString(String link, String label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   226
        return getHyperLinkString(link, "", label, false);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
     * Get the name of the package, this class is in.
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
     * @param cd    ClassDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
    public String getPkgName(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
        String pkgName = cd.containingPackage().name();
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
        if (pkgName.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
            pkgName += ".";
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
            return pkgName;
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
        return "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1869
diff changeset
   243
    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
   244
        return memberDetailsListPrinted;
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1869
diff changeset
   245
    }
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1869
diff changeset
   246
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1869
diff changeset
   247
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
     * Print the frameset version of the Html file header.
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
     * Called only when generating an HTML frameset file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   251
     * @param title Title of this HTML document
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   252
     * @param noTimeStamp If true, don't print time stamp in header
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   253
     * @param frameset the frameset to be added to the HTML document
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   255
    public void printFramesetDocument(String title, boolean noTimeStamp,
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14263
diff changeset
   256
            Content frameset) throws IOException {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   257
        Content htmlDocType = DocType.Frameset();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   258
        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
   259
        Content head = new HtmlTree(HtmlTag.HEAD);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
        if (! noTimeStamp) {
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents: 14260
diff changeset
   261
            Content headComment = new Comment(getGeneratedByString());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   262
            head.addContent(headComment);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
        if (configuration.charset.length() > 0) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   265
            Content meta = HtmlTree.META("Content-Type", "text/html",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   266
                    configuration.charset);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   267
            head.addContent(meta);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   269
        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
   270
        head.addContent(windowTitle);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   271
        head.addContent(getFramesetJavaScript());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   272
        Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   273
                head, frameset);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   274
        Content htmlDocument = new HtmlDocument(htmlDocType,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   275
                htmlComment, htmlTree);
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
   276
        write(htmlDocument);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
     * Print the appropriate spaces to format the class tree in the class page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
     * @param len   Number of spaces.
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
    public String spaces(int len) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
        String space = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
        for (int i = 0; i < len; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
            space += " ";
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
        return space;
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents: 14260
diff changeset
   293
    protected String getGeneratedByString() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
        Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents: 14260
diff changeset
   295
        Date today = calendar.getTime();
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents: 14260
diff changeset
   296
        return "Generated by javadoc ("+ ConfigurationImpl.BUILD_DATE + ") on " + today;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
}