langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
author jjg
Wed, 10 Oct 2012 16:48:21 -0700
changeset 14260 727a84636f12
parent 14259 fb94a1df0d53
child 14262 058238ba531e
permissions -rw-r--r--
8000665: fix "internal API" comments on javadoc files Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
     2
 * Copyright (c) 1998, 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: 3891
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: 3891
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: 3891
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3891
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3891
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;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import java.io.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
import java.text.SimpleDateFormat;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import java.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    32
import com.sun.javadoc.*;
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    33
import com.sun.tools.doclets.formats.html.markup.*;
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    34
import com.sun.tools.doclets.internal.toolkit.*;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 13844
diff changeset
    35
import com.sun.tools.doclets.internal.toolkit.taglets.*;
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    36
import com.sun.tools.doclets.internal.toolkit.util.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * Class for the Html Format Code Generation specific to JavaDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * This Class contains methods related to the Html Code Generation which
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * are used extensively while generating the entire documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    43
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    44
 *  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
    45
 *  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
    46
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    47
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * @since 1.2
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * @author Robert Field
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    51
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
public class HtmlDocletWriter extends HtmlDocWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     * Relative path from the file getting generated to the destination
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     * directory. For example, if the file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     * "java/lang/Object.html", then the relative path string is "../../".
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     * This string can be empty if the file getting generated is in
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
     * the destination directory.
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    public String relativePath = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     * Same as relativepath, but normalized to never be empty or
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     * end with a slash.
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    public String relativepathNoSlash = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     * Platform-dependent directory path from the current or the
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     * destination directory to the file getting generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
     * Used when creating the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
     * For example, if the file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * "java/lang/Object.html", then the path string is "java/lang".
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    public String path = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     * Name of the file getting generated. If the file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     * "java/lang/Object.html", then the filename is "Object.html".
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    public String filename = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * The display length used for indentation while generating the class page.
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
    public int displayLength = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     * The global configuration information for this run.
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    public ConfigurationImpl configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    96
     * To check whether annotation heading is printed or not.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    97
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    98
    protected boolean printedAnnotationHeading = false;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    99
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   100
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
     * Constructor to construct the HtmlStandardWriter object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
     * @param filename File to be generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    public HtmlDocletWriter(ConfigurationImpl configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
                              String filename) throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
        super(configuration, filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
        this.configuration = configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
        this.filename = filename;
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     * Constructor to construct the HtmlStandardWriter object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     * @param path         Platform-dependent {@link #path} used when
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     *                     creating file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
     * @param filename     Name of file to be generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
     * @param relativePath Value for the variable {@link #relativePath}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
    public HtmlDocletWriter(ConfigurationImpl configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
                              String path, String filename,
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
                              String relativePath) throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
        super(configuration, path, filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
        this.configuration = configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        this.path = path;
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        this.relativePath = relativePath;
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
        this.relativepathNoSlash =
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
            DirectoryManager.getPathNoTrailingSlash(this.relativePath);
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
        this.filename = filename;
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     * Replace {&#064;docRoot} tag used in options that accept HTML text, such
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     * as -header, -footer, -top and -bottom, and when converting a relative
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     * HREF where commentTagsToString inserts a {&#064;docRoot} where one was
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * missing.  (Also see DocRootTaglet for {&#064;docRoot} tags in doc
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * comments.)
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * Replace {&#064;docRoot} tag in htmlstr with the relative path to the
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * destination directory from the directory where the file is being
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     * written, looping to handle all such tags in htmlstr.
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     * For example, for "-d docs" and -header containing {&#064;docRoot}, when
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     * the HTML page for source file p/C1.java is being generated, the
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     * {&#064;docRoot} tag would be inserted into the header as "../",
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     * the relative path from docs/p/ to docs/ (the document root).
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
     * Note: This doc comment was written with '&amp;#064;' representing '@'
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
     * to prevent the inline tag from being interpreted.
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    public String replaceDocRootDir(String htmlstr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
        // Return if no inline tags exist
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
        int index = htmlstr.indexOf("{@");
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
        if (index < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
            return htmlstr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
        String lowerHtml = htmlstr.toLowerCase();
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
        // Return index of first occurrence of {@docroot}
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
        // Note: {@docRoot} is not case sensitive when passed in w/command line option
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
        index = lowerHtml.indexOf("{@docroot}", index);
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        if (index < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
            return htmlstr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
        }
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
   164
        StringBuilder buf = new StringBuilder();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
        int previndex = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
        while (true) {
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   167
            if (configuration.docrootparent.length() > 0) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   168
                // Search for lowercase version of {@docRoot}/..
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   169
                index = lowerHtml.indexOf("{@docroot}/..", previndex);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   170
                // If next {@docRoot}/.. pattern not found, append rest of htmlstr and exit loop
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   171
                if (index < 0) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   172
                    buf.append(htmlstr.substring(previndex));
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   173
                    break;
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   174
                }
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   175
                // If next {@docroot}/.. pattern found, append htmlstr up to start of tag
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   176
                buf.append(htmlstr.substring(previndex, index));
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   177
                previndex = index + 13;  // length for {@docroot}/.. string
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   178
                // Insert docrootparent absolute path where {@docRoot}/.. was located
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   179
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   180
                buf.append(configuration.docrootparent);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   181
                // Append slash if next character is not a slash
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   182
                if (previndex < htmlstr.length() && htmlstr.charAt(previndex) != '/') {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   183
                    buf.append(DirectoryManager.URL_FILE_SEPARATOR);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   184
                }
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   185
            } else {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   186
                // Search for lowercase version of {@docRoot}
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   187
                index = lowerHtml.indexOf("{@docroot}", previndex);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   188
                // If next {@docRoot} tag not found, append rest of htmlstr and exit loop
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   189
                if (index < 0) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   190
                    buf.append(htmlstr.substring(previndex));
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   191
                    break;
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   192
                }
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   193
                // If next {@docroot} tag found, append htmlstr up to start of tag
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   194
                buf.append(htmlstr.substring(previndex, index));
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   195
                previndex = index + 10;  // length for {@docroot} string
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   196
                // Insert relative path where {@docRoot} was located
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   197
                buf.append(relativepathNoSlash);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   198
                // Append slash if next character is not a slash
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   199
                if (relativepathNoSlash.length() > 0 && previndex < htmlstr.length() &&
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   200
                        htmlstr.charAt(previndex) != '/') {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   201
                    buf.append(DirectoryManager.URL_FILE_SEPARATOR);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   202
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
        return buf.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
     * Print Html Hyper Link, with target frame.  This
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
     * link will only appear if page is not in a frame.
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     * @param link String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
     * @param where Position in the file
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
     * @param target Name of the target frame.
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
     * @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: 1264
diff changeset
   216
     * @param strong Whether the label should be strong or not?
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
    public void printNoFramesTargetHyperLink(String link, String where,
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
                                               String target, String label,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
   220
                                               boolean strong) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
        script();
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
        println("  <!--");
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
        println("  if(window==top) {");
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
        println("    document.writeln('"
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   225
            + getHyperLinkString(link, where, label, strong, "", "", target) + "');");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
        println("  }");
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
        println("  //-->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
        scriptEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
        noScript();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   230
        println("  " + getHyperLinkString(link, where, label, strong, "", "", target));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
        noScriptEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
        println(DocletConstants.NL);
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   235
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   236
     * Get the script to show or hide the All classes link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   237
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   238
     * @param id id of the element to show or hide
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   239
     * @return a content tree for the script
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   240
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   241
    public Content getAllClassesLinkScript(String id) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   242
        HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   243
        script.addAttr(HtmlAttr.TYPE, "text/javascript");
7641
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   244
        String scriptCode = "<!--" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   245
                "  allClassesLink = document.getElementById(\"" + id + "\");" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   246
                "  if(window==top) {" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   247
                "    allClassesLink.style.display = \"block\";" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   248
                "  }" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   249
                "  else {" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   250
                "    allClassesLink.style.display = \"none\";" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   251
                "  }" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   252
                "  //-->" + DocletConstants.NL;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   253
        Content scriptContent = new RawHtml(scriptCode);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   254
        script.addContent(scriptContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   255
        Content div = HtmlTree.DIV(script);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   256
        return div;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   257
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   258
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   259
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   260
     * Add method information.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   261
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   262
     * @param method the method to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   263
     * @param dl the content tree to which the method information will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   264
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   265
    private void addMethodInfo(MethodDoc method, Content dl) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
        ClassDoc[] intfacs = method.containingClass().interfaces();
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
        MethodDoc overriddenMethod = method.overriddenMethod();
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   268
        // Check whether there is any implementation or overridden info to be
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   269
        // printed. If no overridden or implementation info needs to be
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   270
        // printed, do not print this section.
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   271
        if ((intfacs.length > 0 &&
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   272
                new ImplementedMethods(method, this.configuration).build().length > 0) ||
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   273
                overriddenMethod != null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   274
            MethodWriterImpl.addImplementsInfo(this, method, dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
            if (overriddenMethod != null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   276
                MethodWriterImpl.addOverridden(this,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   277
                        method.overriddenType(), overriddenMethod, dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
7614
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
     * Adds the tags information.
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
     * @param doc the doc for which the tags will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   286
     * @param htmltree the documentation tree to which the tags will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   287
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   288
    protected void addTagsInfo(Doc doc, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   289
        if (configuration.nocomment) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   292
        Content dl = new HtmlTree(HtmlTag.DL);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
        if (doc instanceof MethodDoc) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   294
            addMethodInfo((MethodDoc) doc, dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
        TagletOutputImpl output = new TagletOutputImpl("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
        TagletWriter.genTagOuput(configuration.tagletManager, doc,
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
            configuration.tagletManager.getCustomTags(doc),
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
                getTagletWriterInstance(false), output);
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   300
        String outputString = output.toString().trim();
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   301
        if (!outputString.isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   302
            Content resultString = new RawHtml(outputString);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   303
            dl.addContent(resultString);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   305
        htmltree.addContent(dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
    /**
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   309
     * Check whether there are any tags for Serialization Overview
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   310
     * section to be printed.
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   311
     *
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   312
     * @param field the FieldDoc object to check for tags.
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   313
     * @return true if there are tags to be printed else return false.
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   314
     */
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   315
    protected boolean hasSerializationOverviewTags(FieldDoc field) {
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   316
        TagletOutputImpl output = new TagletOutputImpl("");
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   317
        TagletWriter.genTagOuput(configuration.tagletManager, field,
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   318
            configuration.tagletManager.getCustomTags(field),
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   319
                getTagletWriterInstance(false), output);
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   320
        return (!output.toString().trim().isEmpty());
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   321
    }
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   322
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   323
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
     * Returns a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
     * @return a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
    public TagletWriter getTagletWriterInstance(boolean isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
        return new TagletWriterImpl(this, isFirstSentence);
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
    protected void printTagsInfoHeader() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
        dl();
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
    protected void printTagsInfoFooter() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
        dlEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   341
     * Get Package link, with target frame.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   343
     * @param pd The link will be to the "package-summary.html" page for this package
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   344
     * @param target name of the target frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   345
     * @param label tag for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   346
     * @return a content for the target package link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   348
    public Content getTargetPackageLink(PackageDoc pd, String target,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   349
            Content label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   350
        return getHyperLink(pathString(pd, "package-summary.html"), "", label, "", target);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
     * Print the html file header. Also print Html page title and stylesheet
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
     * default properties.
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
     * @param title         String window title to go in the &lt;TITLE&gt; tag
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
     * @param metakeywords  Array of String keywords for META tag.  Each element
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
     *                      of the array is assigned to a separate META tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
     *                      Pass in null for no array.
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
     * @param includeScript boolean true if printing windowtitle script.
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
     *             False for files that appear in the left-hand frames.
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
    public void printHtmlHeader(String title, String[] metakeywords,
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
            boolean includeScript) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
        println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " +
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
                    "Transitional//EN\" " +
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
                    "\"http://www.w3.org/TR/html4/loose.dtd\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
        println("<!--NewPage-->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
        html();
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
        head();
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
        if (! configuration.notimestamp) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
            print("<!-- Generated by javadoc (build " + ConfigurationImpl.BUILD_DATE + ") on ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
            print(today());
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
            println(" -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
        if (configuration.charset.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
            println("<META http-equiv=\"Content-Type\" content=\"text/html; "
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
                        + "charset=" + configuration.charset + "\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
        if ( configuration.windowtitle.length() > 0 ) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
            title += " (" + configuration.windowtitle  + ")";
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
        title(title);
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
        println(title);
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
        titleEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
        if (! configuration.notimestamp) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
                println("<META NAME=\"date\" "
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
                                    + "CONTENT=\"" + dateFormat.format(new Date()) + "\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
        if ( metakeywords != null ) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
            for ( int i=0; i < metakeywords.length; i++ ) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
                println("<META NAME=\"keywords\" "
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
                            + "CONTENT=\"" + metakeywords[i] + "\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
        printStyleSheetProperties();
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
        // Don't print windowtitle script for overview-frame, allclasses-frame
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
        // and package-frame
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
        if (includeScript) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
            printWinTitleScript(title);
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
        headEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
        body("white", includeScript);
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   414
     * Generates the HTML document tree and prints it out.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   415
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   416
     * @param metakeywords Array of String keywords for META tag. Each element
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   417
     *                     of the array is assigned to a separate META tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   418
     *                     Pass in null for no array
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   419
     * @param includeScript true if printing windowtitle script
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   420
     *                      false for files that appear in the left-hand frames
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   421
     * @param body the body htmltree to be included in the document
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   422
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   423
    public void printHtmlDocument(String[] metakeywords, boolean includeScript,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   424
            Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   425
        Content htmlDocType = DocType.Transitional();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   426
        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
   427
        Content head = new HtmlTree(HtmlTag.HEAD);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   428
        if (!configuration.notimestamp) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   429
            Content headComment = new Comment("Generated by javadoc (version " +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   430
                    ConfigurationImpl.BUILD_DATE + ") on " + today());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   431
            head.addContent(headComment);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   432
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   433
        if (configuration.charset.length() > 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   434
            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
   435
                    configuration.charset);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   436
            head.addContent(meta);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   437
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   438
        head.addContent(getTitle());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   439
        if (!configuration.notimestamp) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   440
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   441
            Content meta = HtmlTree.META("date", dateFormat.format(new Date()));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   442
            head.addContent(meta);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   443
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   444
        if (metakeywords != null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   445
            for (int i=0; i < metakeywords.length; i++) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   446
                Content meta = HtmlTree.META("keywords", metakeywords[i]);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   447
                head.addContent(meta);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   448
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   449
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   450
        head.addContent(getStyleSheetProperties());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   451
        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
   452
                head, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   453
        Content htmlDocument = new HtmlDocument(htmlDocType,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   454
                htmlComment, htmlTree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   455
        print(htmlDocument.toString());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   456
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   457
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   458
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   459
     * Get the window title.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   460
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   461
     * @param title the title string to construct the complete window title
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   462
     * @return the window title string
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   463
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   464
    public String getWindowTitle(String title) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   465
        if (configuration.windowtitle.length() > 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   466
            title += " (" + configuration.windowtitle  + ")";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   467
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   468
        return title;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   469
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   470
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   471
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   472
     * Print user specified header and the footer.
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
     * @param header if true print the user provided header else print the
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
     * user provided footer.
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   477
    public void printUserHeaderFooter(boolean header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   478
        em();
06bc494ca11e Initial load
duke
parents:
diff changeset
   479
        if (header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   480
            print(replaceDocRootDir(configuration.header));
06bc494ca11e Initial load
duke
parents:
diff changeset
   481
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   482
            if (configuration.footer.length() != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   483
                print(replaceDocRootDir(configuration.footer));
06bc494ca11e Initial load
duke
parents:
diff changeset
   484
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   485
                print(replaceDocRootDir(configuration.header));
06bc494ca11e Initial load
duke
parents:
diff changeset
   486
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   487
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   488
        emEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   489
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   490
06bc494ca11e Initial load
duke
parents:
diff changeset
   491
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   492
     * Get user specified header and the footer.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   493
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   494
     * @param header if true print the user provided header else print the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   495
     * user provided footer.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   496
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   497
    public Content getUserHeaderFooter(boolean header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   498
        String content;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   499
        if (header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   500
            content = replaceDocRootDir(configuration.header);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   501
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   502
            if (configuration.footer.length() != 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   503
                content = replaceDocRootDir(configuration.footer);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   504
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   505
                content = replaceDocRootDir(configuration.header);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   506
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   507
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   508
        Content rawContent = new RawHtml(content);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   509
        Content em = HtmlTree.EM(rawContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   510
        return em;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   511
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   512
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   513
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   514
     * Print the user specified top.
06bc494ca11e Initial load
duke
parents:
diff changeset
   515
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   516
    public void printTop() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   517
        print(replaceDocRootDir(configuration.top));
06bc494ca11e Initial load
duke
parents:
diff changeset
   518
        hr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   519
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   520
06bc494ca11e Initial load
duke
parents:
diff changeset
   521
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   522
     * Adds the user specified top.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   523
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   524
     * @param body the content tree to which user specified top will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   525
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   526
    public void addTop(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   527
        Content top = new RawHtml(replaceDocRootDir(configuration.top));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   528
        body.addContent(top);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   529
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   530
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   531
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   532
     * Print the user specified bottom.
06bc494ca11e Initial load
duke
parents:
diff changeset
   533
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   534
    public void printBottom() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   535
        hr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   536
        print(replaceDocRootDir(configuration.bottom));
06bc494ca11e Initial load
duke
parents:
diff changeset
   537
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   538
06bc494ca11e Initial load
duke
parents:
diff changeset
   539
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   540
     * Adds the user specified bottom.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   541
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   542
     * @param body the content tree to which user specified bottom will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   543
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   544
    public void addBottom(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   545
        Content bottom = new RawHtml(replaceDocRootDir(configuration.bottom));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   546
        Content small = HtmlTree.SMALL(bottom);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   547
        Content p = HtmlTree.P(HtmlStyle.legalCopy, small);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   548
        body.addContent(p);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   549
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   550
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   551
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   552
     * Print the navigation bar for the Html page at the top and and the bottom.
06bc494ca11e Initial load
duke
parents:
diff changeset
   553
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   554
     * @param header If true print navigation bar at the top of the page else
06bc494ca11e Initial load
duke
parents:
diff changeset
   555
     * print the nevigation bar at the bottom.
06bc494ca11e Initial load
duke
parents:
diff changeset
   556
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   557
    protected void navLinks(boolean header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   558
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   559
        if (!configuration.nonavbar) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   560
            if (header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   561
                println(DocletConstants.NL + "<!-- ========= START OF TOP NAVBAR ======= -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   562
                anchor("navbar_top");
06bc494ca11e Initial load
duke
parents:
diff changeset
   563
                println();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   564
                print(getHyperLinkString("", "skip-navbar_top", "", false, "",
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   565
                    configuration.getText("doclet.Skip_navigation_links"), ""));
06bc494ca11e Initial load
duke
parents:
diff changeset
   566
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   567
                println(DocletConstants.NL + "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   568
                anchor("navbar_bottom");
06bc494ca11e Initial load
duke
parents:
diff changeset
   569
                println();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   570
                print(getHyperLinkString("", "skip-navbar_bottom", "", false, "",
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   571
                    configuration.getText("doclet.Skip_navigation_links"), ""));
06bc494ca11e Initial load
duke
parents:
diff changeset
   572
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   573
            table(0, "100%", 1, 0);
06bc494ca11e Initial load
duke
parents:
diff changeset
   574
            tr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   575
            tdColspanBgcolorStyle(2, "#EEEEFF", "NavBarCell1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   576
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   577
            if (header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   578
                anchor("navbar_top_firstrow");
06bc494ca11e Initial load
duke
parents:
diff changeset
   579
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   580
                anchor("navbar_bottom_firstrow");
06bc494ca11e Initial load
duke
parents:
diff changeset
   581
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   582
            table(0, 0, 3);
06bc494ca11e Initial load
duke
parents:
diff changeset
   583
            print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   584
            trAlignVAlign("center", "top");
06bc494ca11e Initial load
duke
parents:
diff changeset
   585
06bc494ca11e Initial load
duke
parents:
diff changeset
   586
            if (configuration.createoverview) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   587
                navLinkContents();
06bc494ca11e Initial load
duke
parents:
diff changeset
   588
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   589
06bc494ca11e Initial load
duke
parents:
diff changeset
   590
            if (configuration.packages.length == 1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   591
                navLinkPackage(configuration.packages[0]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   592
            } else if (configuration.packages.length > 1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   593
                navLinkPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
   594
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   595
06bc494ca11e Initial load
duke
parents:
diff changeset
   596
            navLinkClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
   597
06bc494ca11e Initial load
duke
parents:
diff changeset
   598
            if(configuration.classuse) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   599
                navLinkClassUse();
06bc494ca11e Initial load
duke
parents:
diff changeset
   600
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   601
            if(configuration.createtree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   602
                navLinkTree();
06bc494ca11e Initial load
duke
parents:
diff changeset
   603
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   604
            if(!(configuration.nodeprecated ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   605
                     configuration.nodeprecatedlist)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   606
                navLinkDeprecated();
06bc494ca11e Initial load
duke
parents:
diff changeset
   607
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   608
            if(configuration.createindex) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   609
                navLinkIndex();
06bc494ca11e Initial load
duke
parents:
diff changeset
   610
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   611
            if (!configuration.nohelp) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   612
                navLinkHelp();
06bc494ca11e Initial load
duke
parents:
diff changeset
   613
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   614
            print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   615
            trEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   616
            tableEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   617
            tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   618
06bc494ca11e Initial load
duke
parents:
diff changeset
   619
            tdAlignVAlignRowspan("right", "top", 3);
06bc494ca11e Initial load
duke
parents:
diff changeset
   620
06bc494ca11e Initial load
duke
parents:
diff changeset
   621
            printUserHeaderFooter(header);
06bc494ca11e Initial load
duke
parents:
diff changeset
   622
            tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   623
            trEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   624
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   625
06bc494ca11e Initial load
duke
parents:
diff changeset
   626
            tr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   627
            tdBgcolorStyle("white", "NavBarCell2");
06bc494ca11e Initial load
duke
parents:
diff changeset
   628
            font("-2");
06bc494ca11e Initial load
duke
parents:
diff changeset
   629
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   630
            navLinkPrevious();
06bc494ca11e Initial load
duke
parents:
diff changeset
   631
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   632
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   633
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   634
            navLinkNext();
06bc494ca11e Initial load
duke
parents:
diff changeset
   635
            fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   636
            tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   637
06bc494ca11e Initial load
duke
parents:
diff changeset
   638
            tdBgcolorStyle("white", "NavBarCell2");
06bc494ca11e Initial load
duke
parents:
diff changeset
   639
            font("-2");
06bc494ca11e Initial load
duke
parents:
diff changeset
   640
            print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   641
            navShowLists();
06bc494ca11e Initial load
duke
parents:
diff changeset
   642
            print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   643
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   644
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   645
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   646
            navHideLists(filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
   647
            print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   648
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   649
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   650
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   651
            navLinkClassIndex();
06bc494ca11e Initial load
duke
parents:
diff changeset
   652
            fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   653
            tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   654
06bc494ca11e Initial load
duke
parents:
diff changeset
   655
            trEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   656
06bc494ca11e Initial load
duke
parents:
diff changeset
   657
            printSummaryDetailLinks();
06bc494ca11e Initial load
duke
parents:
diff changeset
   658
06bc494ca11e Initial load
duke
parents:
diff changeset
   659
            tableEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   660
            if (header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   661
                aName("skip-navbar_top");
06bc494ca11e Initial load
duke
parents:
diff changeset
   662
                aEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   663
                println(DocletConstants.NL + "<!-- ========= END OF TOP NAVBAR ========= -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   664
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   665
                aName("skip-navbar_bottom");
06bc494ca11e Initial load
duke
parents:
diff changeset
   666
                aEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   667
                println(DocletConstants.NL + "<!-- ======== END OF BOTTOM NAVBAR ======= -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   668
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   669
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   670
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   671
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   672
06bc494ca11e Initial load
duke
parents:
diff changeset
   673
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   674
     * Adds the navigation bar for the Html page at the top and and the bottom.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   675
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   676
     * @param header If true print navigation bar at the top of the page else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   677
     * @param body the HtmlTree to which the nav links will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   678
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   679
    protected void addNavLinks(boolean header, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   680
        if (!configuration.nonavbar) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   681
            String allClassesId = "allclasses_";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   682
            HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   683
            if (header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   684
                body.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   685
                navDiv.addStyle(HtmlStyle.topNav);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   686
                allClassesId += "navbar_top";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   687
                Content a = getMarkerAnchor("navbar_top");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   688
                navDiv.addContent(a);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   689
                Content skipLinkContent = getHyperLink("",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   690
                        "skip-navbar_top", HtmlTree.EMPTY, configuration.getText(
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   691
                        "doclet.Skip_navigation_links"), "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   692
                navDiv.addContent(skipLinkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   693
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   694
                body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   695
                navDiv.addStyle(HtmlStyle.bottomNav);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   696
                allClassesId += "navbar_bottom";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   697
                Content a = getMarkerAnchor("navbar_bottom");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   698
                navDiv.addContent(a);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   699
                Content skipLinkContent = getHyperLink("",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   700
                        "skip-navbar_bottom", HtmlTree.EMPTY, configuration.getText(
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   701
                        "doclet.Skip_navigation_links"), "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   702
                navDiv.addContent(skipLinkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   703
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   704
            if (header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   705
                navDiv.addContent(getMarkerAnchor("navbar_top_firstrow"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   706
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   707
                navDiv.addContent(getMarkerAnchor("navbar_bottom_firstrow"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   708
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   709
            HtmlTree navList = new HtmlTree(HtmlTag.UL);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   710
            navList.addStyle(HtmlStyle.navList);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   711
            navList.addAttr(HtmlAttr.TITLE, "Navigation");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   712
            if (configuration.createoverview) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   713
                navList.addContent(getNavLinkContents());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   714
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   715
            if (configuration.packages.length == 1) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   716
                navList.addContent(getNavLinkPackage(configuration.packages[0]));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   717
            } else if (configuration.packages.length > 1) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   718
                navList.addContent(getNavLinkPackage());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   719
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   720
            navList.addContent(getNavLinkClass());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   721
            if(configuration.classuse) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   722
                navList.addContent(getNavLinkClassUse());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   723
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   724
            if(configuration.createtree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   725
                navList.addContent(getNavLinkTree());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   726
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   727
            if(!(configuration.nodeprecated ||
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   728
                     configuration.nodeprecatedlist)) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   729
                navList.addContent(getNavLinkDeprecated());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   730
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   731
            if(configuration.createindex) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   732
                navList.addContent(getNavLinkIndex());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   733
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   734
            if (!configuration.nohelp) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   735
                navList.addContent(getNavLinkHelp());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   736
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   737
            navDiv.addContent(navList);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   738
            Content aboutDiv = HtmlTree.DIV(HtmlStyle.aboutLanguage, getUserHeaderFooter(header));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   739
            navDiv.addContent(aboutDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   740
            body.addContent(navDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   741
            Content ulNav = HtmlTree.UL(HtmlStyle.navList, getNavLinkPrevious());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   742
            ulNav.addContent(getNavLinkNext());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   743
            Content subDiv = HtmlTree.DIV(HtmlStyle.subNav, ulNav);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   744
            Content ulFrames = HtmlTree.UL(HtmlStyle.navList, getNavShowLists());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   745
            ulFrames.addContent(getNavHideLists(filename));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   746
            subDiv.addContent(ulFrames);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   747
            HtmlTree ulAllClasses = HtmlTree.UL(HtmlStyle.navList, getNavLinkClassIndex());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   748
            ulAllClasses.addAttr(HtmlAttr.ID, allClassesId.toString());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   749
            subDiv.addContent(ulAllClasses);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   750
            subDiv.addContent(getAllClassesLinkScript(allClassesId.toString()));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   751
            addSummaryDetailLinks(subDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   752
            if (header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   753
                subDiv.addContent(getMarkerAnchor("skip-navbar_top"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   754
                body.addContent(subDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   755
                body.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   756
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   757
                subDiv.addContent(getMarkerAnchor("skip-navbar_bottom"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   758
                body.addContent(subDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   759
                body.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   760
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   761
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   762
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   763
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   764
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   765
     * Print the word "NEXT" to indicate that no link is available.  Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   766
     * this method to customize next link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   767
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   768
    protected void navLinkNext() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   769
        navLinkNext(null);
06bc494ca11e Initial load
duke
parents:
diff changeset
   770
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   771
06bc494ca11e Initial load
duke
parents:
diff changeset
   772
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   773
     * Get the word "NEXT" to indicate that no link is available.  Override
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   774
     * this method to customize next link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   775
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   776
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   777
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   778
    protected Content getNavLinkNext() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   779
        return getNavLinkNext(null);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   780
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   781
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   782
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   783
     * Print the word "PREV" to indicate that no link is available.  Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   784
     * this method to customize prev link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   785
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   786
    protected void navLinkPrevious() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   787
        navLinkPrevious(null);
06bc494ca11e Initial load
duke
parents:
diff changeset
   788
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   789
06bc494ca11e Initial load
duke
parents:
diff changeset
   790
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   791
     * Get the word "PREV" to indicate that no link is available.  Override
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   792
     * this method to customize prev link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   793
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   794
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   795
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   796
    protected Content getNavLinkPrevious() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   797
        return getNavLinkPrevious(null);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   798
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   799
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   800
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   801
     * Do nothing. This is the default method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   802
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   803
    protected void printSummaryDetailLinks() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   804
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   805
06bc494ca11e Initial load
duke
parents:
diff changeset
   806
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   807
     * Do nothing. This is the default method.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   808
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   809
    protected void addSummaryDetailLinks(Content navDiv) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   810
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   811
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   812
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   813
     * Print link to the "overview-summary.html" page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   814
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   815
    protected void navLinkContents() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   816
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   817
        printHyperLink(relativePath + "overview-summary.html", "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   818
                       configuration.getText("doclet.Overview"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   819
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   820
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   821
06bc494ca11e Initial load
duke
parents:
diff changeset
   822
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   823
     * Get link to the "overview-summary.html" page.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   824
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   825
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   826
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   827
    protected Content getNavLinkContents() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   828
        Content linkContent = getHyperLink(relativePath +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   829
                "overview-summary.html", "", overviewLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   830
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   831
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   832
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   833
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   834
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   835
     * Description for a cell in the navigation bar.
06bc494ca11e Initial load
duke
parents:
diff changeset
   836
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   837
    protected void navCellStart() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   838
        print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   839
        tdBgcolorStyle("#EEEEFF", "NavBarCell1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   840
        print("    ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   841
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   842
06bc494ca11e Initial load
duke
parents:
diff changeset
   843
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   844
     * Description for a cell in the navigation bar, but with reverse
06bc494ca11e Initial load
duke
parents:
diff changeset
   845
     * high-light effect.
06bc494ca11e Initial load
duke
parents:
diff changeset
   846
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   847
    protected void navCellRevStart() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   848
        print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   849
        tdBgcolorStyle("#FFFFFF", "NavBarCell1Rev");
06bc494ca11e Initial load
duke
parents:
diff changeset
   850
        print(" ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   851
        space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   852
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   853
06bc494ca11e Initial load
duke
parents:
diff changeset
   854
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   855
     * Closing tag for navigation bar cell.
06bc494ca11e Initial load
duke
parents:
diff changeset
   856
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   857
    protected void navCellEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   858
        space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   859
        tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   860
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   861
06bc494ca11e Initial load
duke
parents:
diff changeset
   862
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   863
     * Print link to the "package-summary.html" page for the package passed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   864
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   865
     * @param pkg Package to which link will be generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   866
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   867
    protected void navLinkPackage(PackageDoc pkg) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   868
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   869
        printPackageLink(pkg, configuration.getText("doclet.Package"), true,
06bc494ca11e Initial load
duke
parents:
diff changeset
   870
            "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   871
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   872
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   873
06bc494ca11e Initial load
duke
parents:
diff changeset
   874
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   875
     * Get link to the "package-summary.html" page for the package passed.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   876
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   877
     * @param pkg Package to which link will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   878
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   879
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   880
    protected Content getNavLinkPackage(PackageDoc pkg) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   881
        Content linkContent = getPackageLink(pkg,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   882
                packageLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   883
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   884
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   885
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   886
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   887
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   888
     * Print the word "Package" in the navigation bar cell, to indicate that
06bc494ca11e Initial load
duke
parents:
diff changeset
   889
     * link is not available here.
06bc494ca11e Initial load
duke
parents:
diff changeset
   890
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   891
    protected void navLinkPackage() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   892
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   893
        fontStyle("NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   894
        printText("doclet.Package");
06bc494ca11e Initial load
duke
parents:
diff changeset
   895
        fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   896
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   897
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   898
06bc494ca11e Initial load
duke
parents:
diff changeset
   899
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   900
     * Get the word "Package" , to indicate that link is not available here.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   901
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   902
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   903
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   904
    protected Content getNavLinkPackage() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   905
        Content li = HtmlTree.LI(packageLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   906
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   907
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   908
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   909
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   910
     * Print the word "Use" in the navigation bar cell, to indicate that link
06bc494ca11e Initial load
duke
parents:
diff changeset
   911
     * is not available.
06bc494ca11e Initial load
duke
parents:
diff changeset
   912
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   913
    protected void navLinkClassUse() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   914
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   915
        fontStyle("NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   916
        printText("doclet.navClassUse");
06bc494ca11e Initial load
duke
parents:
diff changeset
   917
        fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   918
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   919
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   920
06bc494ca11e Initial load
duke
parents:
diff changeset
   921
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   922
     * Get the word "Use", to indicate that link is not available.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   923
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   924
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   925
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   926
    protected Content getNavLinkClassUse() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   927
        Content li = HtmlTree.LI(useLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   928
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   929
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   930
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   931
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   932
     * Print link for previous file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   933
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   934
     * @param prev File name for the prev link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   935
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   936
    public void navLinkPrevious(String prev) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   937
        String tag = configuration.getText("doclet.Prev");
06bc494ca11e Initial load
duke
parents:
diff changeset
   938
        if (prev != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   939
            printHyperLink(prev, "", tag, true) ;
06bc494ca11e Initial load
duke
parents:
diff changeset
   940
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   941
            print(tag);
06bc494ca11e Initial load
duke
parents:
diff changeset
   942
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   943
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   944
06bc494ca11e Initial load
duke
parents:
diff changeset
   945
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   946
     * Get link for previous file.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   947
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   948
     * @param prev File name for the prev link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   949
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   950
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   951
    public Content getNavLinkPrevious(String prev) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   952
        Content li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   953
        if (prev != null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   954
            li = HtmlTree.LI(getHyperLink(prev, "", prevLabel, "", ""));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   955
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   956
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   957
            li = HtmlTree.LI(prevLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   958
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   959
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   960
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   961
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   962
     * Print link for next file.  If next is null, just print the label
06bc494ca11e Initial load
duke
parents:
diff changeset
   963
     * without linking it anywhere.
06bc494ca11e Initial load
duke
parents:
diff changeset
   964
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   965
     * @param next File name for the next link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   966
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   967
    public void navLinkNext(String next) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   968
        String tag = configuration.getText("doclet.Next");
06bc494ca11e Initial load
duke
parents:
diff changeset
   969
        if (next != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   970
            printHyperLink(next, "", tag, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
   971
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   972
            print(tag);
06bc494ca11e Initial load
duke
parents:
diff changeset
   973
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   974
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   975
06bc494ca11e Initial load
duke
parents:
diff changeset
   976
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   977
     * Get link for next file.  If next is null, just print the label
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   978
     * without linking it anywhere.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   979
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   980
     * @param next File name for the next link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   981
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   982
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   983
    public Content getNavLinkNext(String next) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   984
        Content li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   985
        if (next != null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   986
            li = HtmlTree.LI(getHyperLink(next, "", nextLabel, "", ""));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   987
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   988
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   989
            li = HtmlTree.LI(nextLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   990
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   991
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   992
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   993
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   994
     * Print "FRAMES" link, to switch to the frame version of the output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   995
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   996
     * @param link File to be linked, "index.html".
06bc494ca11e Initial load
duke
parents:
diff changeset
   997
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   998
    protected void navShowLists(String link) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   999
        print(getHyperLinkString(link + "?" + path + filename, "",
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1000
            configuration.getText("doclet.FRAMES"), true, "", "", "_top"));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1001
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1002
06bc494ca11e Initial load
duke
parents:
diff changeset
  1003
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1004
     * Get "FRAMES" link, to switch to the frame version of the output.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1005
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1006
     * @param link File to be linked, "index.html"
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1007
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1008
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1009
    protected Content getNavShowLists(String link) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1010
        Content framesContent = getHyperLink(link + "?" + path +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1011
                filename, "", framesLabel, "", "_top");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1012
        Content li = HtmlTree.LI(framesContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1013
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1014
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1015
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1016
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1017
     * Print "FRAMES" link, to switch to the frame version of the output.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1018
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1019
    protected void navShowLists() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1020
        navShowLists(relativePath + "index.html");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1021
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1022
06bc494ca11e Initial load
duke
parents:
diff changeset
  1023
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1024
     * Get "FRAMES" link, to switch to the frame version of the output.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1025
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1026
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1027
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1028
    protected Content getNavShowLists() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1029
        return getNavShowLists(relativePath + "index.html");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1030
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1031
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1032
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1033
     * Print "NO FRAMES" link, to switch to the non-frame version of the output.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1034
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1035
     * @param link File to be linked.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1036
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1037
    protected void navHideLists(String link) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1038
        print(getHyperLinkString(link, "", configuration.getText("doclet.NO_FRAMES"),
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1039
            true, "", "", "_top"));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1040
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1041
06bc494ca11e Initial load
duke
parents:
diff changeset
  1042
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1043
     * Get "NO FRAMES" link, to switch to the non-frame version of the output.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1044
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1045
     * @param link File to be linked
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1046
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1047
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1048
    protected Content getNavHideLists(String link) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1049
        Content noFramesContent = getHyperLink(link, "", noframesLabel, "", "_top");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1050
        Content li = HtmlTree.LI(noFramesContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1051
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1052
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1053
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1054
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1055
     * Print "Tree" link in the navigation bar. If there is only one package
06bc494ca11e Initial load
duke
parents:
diff changeset
  1056
     * specified on the command line, then the "Tree" link will be to the
06bc494ca11e Initial load
duke
parents:
diff changeset
  1057
     * only "package-tree.html" file otherwise it will be to the
06bc494ca11e Initial load
duke
parents:
diff changeset
  1058
     * "overview-tree.html" file.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1059
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1060
    protected void navLinkTree() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1061
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1062
        PackageDoc[] packages = configuration.root.specifiedPackages();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1063
        if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1064
            printHyperLink(pathString(packages[0], "package-tree.html"), "",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1065
                           configuration.getText("doclet.Tree"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1066
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1067
            printHyperLink(relativePath + "overview-tree.html", "",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1068
                           configuration.getText("doclet.Tree"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1069
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1070
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1071
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1072
06bc494ca11e Initial load
duke
parents:
diff changeset
  1073
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1074
     * Get "Tree" link in the navigation bar. If there is only one package
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1075
     * specified on the command line, then the "Tree" link will be to the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1076
     * only "package-tree.html" file otherwise it will be to the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1077
     * "overview-tree.html" file.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1078
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1079
     * @return a content tree for the link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1080
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1081
    protected Content getNavLinkTree() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1082
        Content treeLinkContent;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1083
        PackageDoc[] packages = configuration.root.specifiedPackages();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1084
        if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1085
            treeLinkContent = getHyperLink(pathString(packages[0],
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1086
                    "package-tree.html"), "", treeLabel,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1087
                    "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1088
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1089
            treeLinkContent = getHyperLink(relativePath + "overview-tree.html",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1090
                    "", treeLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1091
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1092
        Content li = HtmlTree.LI(treeLinkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1093
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1094
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1095
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1096
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1097
     * Get the overview tree link for the main tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1098
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1099
     * @param label the label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1100
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1101
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1102
    protected Content getNavLinkMainTree(String label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1103
        Content mainTreeContent = getHyperLink(relativePath + "overview-tree.html",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1104
                new StringContent(label));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1105
        Content li = HtmlTree.LI(mainTreeContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1106
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1107
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1108
06bc494ca11e Initial load
duke
parents:
diff changeset
  1109
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1110
     * Print the word "Class" in the navigation bar cell, to indicate that
06bc494ca11e Initial load
duke
parents:
diff changeset
  1111
     * class link is not available.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1112
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1113
    protected void navLinkClass() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1114
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1115
        fontStyle("NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1116
        printText("doclet.Class");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1117
        fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1118
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1119
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1120
06bc494ca11e Initial load
duke
parents:
diff changeset
  1121
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1122
     * Get the word "Class", to indicate that class link is not available.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1123
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1124
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1125
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1126
    protected Content getNavLinkClass() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1127
        Content li = HtmlTree.LI(classLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1128
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1129
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1130
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1131
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1132
     * Print "Deprecated" API link in the navigation bar.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1133
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1134
    protected void navLinkDeprecated() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1135
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1136
        printHyperLink(relativePath + "deprecated-list.html", "",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1137
                       configuration.getText("doclet.navDeprecated"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1138
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1139
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1140
06bc494ca11e Initial load
duke
parents:
diff changeset
  1141
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1142
     * Get "Deprecated" API link in the navigation bar.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1143
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1144
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1145
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1146
    protected Content getNavLinkDeprecated() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1147
        Content linkContent = getHyperLink(relativePath +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1148
                "deprecated-list.html", "", deprecatedLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1149
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1150
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1151
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1152
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1153
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1154
     * Print link for generated index. If the user has used "-splitindex"
06bc494ca11e Initial load
duke
parents:
diff changeset
  1155
     * command line option, then link to file "index-files/index-1.html" is
06bc494ca11e Initial load
duke
parents:
diff changeset
  1156
     * generated otherwise link to file "index-all.html" is generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1157
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1158
    protected void navLinkClassIndex() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1159
        printNoFramesTargetHyperLink(relativePath +
06bc494ca11e Initial load
duke
parents:
diff changeset
  1160
                AllClassesFrameWriter.OUTPUT_FILE_NAME_NOFRAMES,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1161
            "", "", configuration.getText("doclet.All_Classes"), true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1162
    }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1163
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1164
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1165
     * Get link for generated index. If the user has used "-splitindex"
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1166
     * command line option, then link to file "index-files/index-1.html" is
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1167
     * generated otherwise link to file "index-all.html" is generated.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1168
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1169
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1170
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1171
    protected Content getNavLinkClassIndex() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1172
        Content allClassesContent = getHyperLink(relativePath +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1173
                AllClassesFrameWriter.OUTPUT_FILE_NAME_NOFRAMES, "",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1174
                allclassesLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1175
        Content li = HtmlTree.LI(allClassesContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1176
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1177
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1178
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1179
     * Print link for generated class index.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1180
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1181
    protected void navLinkIndex() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1182
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1183
        printHyperLink(relativePath +
06bc494ca11e Initial load
duke
parents:
diff changeset
  1184
                           (configuration.splitindex?
06bc494ca11e Initial load
duke
parents:
diff changeset
  1185
                                DirectoryManager.getPath("index-files") +
06bc494ca11e Initial load
duke
parents:
diff changeset
  1186
                                fileseparator: "") +
06bc494ca11e Initial load
duke
parents:
diff changeset
  1187
                           (configuration.splitindex?
06bc494ca11e Initial load
duke
parents:
diff changeset
  1188
                                "index-1.html" : "index-all.html"), "",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1189
                       configuration.getText("doclet.Index"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1190
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1191
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1192
06bc494ca11e Initial load
duke
parents:
diff changeset
  1193
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1194
     * Get link for generated class index.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1195
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1196
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1197
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1198
    protected Content getNavLinkIndex() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1199
        Content linkContent = getHyperLink(relativePath +(configuration.splitindex?
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1200
            DirectoryManager.getPath("index-files") + fileseparator: "") +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1201
            (configuration.splitindex?"index-1.html" : "index-all.html"), "",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1202
            indexLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1203
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1204
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1205
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1206
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1207
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1208
     * Print help file link. If user has provided a help file, then generate a
06bc494ca11e Initial load
duke
parents:
diff changeset
  1209
     * link to the user given file, which is already copied to current or
06bc494ca11e Initial load
duke
parents:
diff changeset
  1210
     * destination directory.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1211
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1212
    protected void navLinkHelp() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1213
        String helpfilenm = configuration.helpfile;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1214
        if (helpfilenm.equals("")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1215
            helpfilenm = "help-doc.html";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1216
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1217
            int lastsep;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1218
            if ((lastsep = helpfilenm.lastIndexOf(File.separatorChar)) != -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1219
                helpfilenm = helpfilenm.substring(lastsep + 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1220
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1221
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1222
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1223
        printHyperLink(relativePath + helpfilenm, "",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1224
                       configuration.getText("doclet.Help"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1225
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1226
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1227
06bc494ca11e Initial load
duke
parents:
diff changeset
  1228
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1229
     * Get help file link. If user has provided a help file, then generate a
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1230
     * link to the user given file, which is already copied to current or
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1231
     * destination directory.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1232
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1233
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1234
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1235
    protected Content getNavLinkHelp() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1236
        String helpfilenm = configuration.helpfile;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1237
        if (helpfilenm.equals("")) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1238
            helpfilenm = "help-doc.html";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1239
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1240
            int lastsep;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1241
            if ((lastsep = helpfilenm.lastIndexOf(File.separatorChar)) != -1) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1242
                helpfilenm = helpfilenm.substring(lastsep + 1);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1243
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1244
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1245
        Content linkContent = getHyperLink(relativePath + helpfilenm, "",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1246
                helpLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1247
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1248
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1249
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1250
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1251
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1252
     * Print the word "Detail" in the navigation bar. No link is available.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1253
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1254
    protected void navDetail() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1255
        printText("doclet.Detail");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1256
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1257
06bc494ca11e Initial load
duke
parents:
diff changeset
  1258
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1259
     * Print the word "Summary" in the navigation bar. No link is available.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1260
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1261
    protected void navSummary() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1262
        printText("doclet.Summary");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1263
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1264
06bc494ca11e Initial load
duke
parents:
diff changeset
  1265
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1266
     * Print the Html table tag for the index summary tables. The table tag
06bc494ca11e Initial load
duke
parents:
diff changeset
  1267
     * printed is
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  1268
     * {@code <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1269
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1270
    public void tableIndexSummary() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1271
        table(1, "100%", 3, 0);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1272
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1273
06bc494ca11e Initial load
duke
parents:
diff changeset
  1274
    /**
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1275
     * Print the Html table tag for the index summary tables.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1276
     *
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1277
     * @param summary the summary for the table tag summary attribute.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1278
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1279
    public void tableIndexSummary(String summary) {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1280
        table(1, "100%", 3, 0, summary);
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1281
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1282
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1283
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1284
     * Same as {@link #tableIndexSummary()}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1285
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1286
    public void tableIndexDetail() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1287
        table(1, "100%", 3, 0);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1288
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1289
06bc494ca11e Initial load
duke
parents:
diff changeset
  1290
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1291
     * Print Html tag for table elements. The tag printed is
06bc494ca11e Initial load
duke
parents:
diff changeset
  1292
     * &lt;TD ALIGN="right" VALIGN="top" WIDTH="1%"&gt;.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1293
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1294
    public void tdIndex() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1295
        print("<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1296
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1297
06bc494ca11e Initial load
duke
parents:
diff changeset
  1298
    /**
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1299
     * Print table caption.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1300
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1301
    public void tableCaptionStart() {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1302
        captionStyle("TableCaption");
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1303
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1304
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1305
    /**
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1306
     * Print table sub-caption.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1307
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1308
    public void tableSubCaptionStart() {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1309
        captionStyle("TableSubCaption");
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1310
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1311
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1312
    /**
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1313
     * Print table caption end tags.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1314
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1315
    public void tableCaptionEnd() {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1316
        captionEnd();
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1317
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1318
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1319
    /**
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1320
     * Print summary table header.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1321
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1322
    public void summaryTableHeader(String[] header, String scope) {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1323
        tr();
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1324
        for ( int i=0; i < header.length; i++ ) {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1325
            thScopeNoWrap("TableHeader", scope);
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1326
            print(header[i]);
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1327
            thEnd();
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1328
        }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1329
        trEnd();
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1330
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1331
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
  1332
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1333
     * Get summary table header.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1334
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1335
     * @param header the header for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1336
     * @param scope the scope of the headers
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1337
     * @return a content tree for the header
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1338
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1339
    public Content getSummaryTableHeader(String[] header, String scope) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1340
        Content tr = new HtmlTree(HtmlTag.TR);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1341
        int size = header.length;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1342
        Content tableHeader;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1343
        if (size == 1) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1344
            tableHeader = new StringContent(header[0]);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1345
            tr.addContent(HtmlTree.TH(HtmlStyle.colOne, scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1346
            return tr;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1347
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1348
        for (int i = 0; i < size; i++) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1349
            tableHeader = new StringContent(header[i]);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1350
            if(i == 0)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1351
                tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1352
            else if(i == (size - 1))
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1353
                tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1354
            else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1355
                tr.addContent(HtmlTree.TH(scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1356
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1357
        return tr;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1358
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1359
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1360
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1361
     * Get table caption.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1362
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1363
     * @param rawText the caption for the table which could be raw Html
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1364
     * @return a content tree for the caption
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1365
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1366
    public Content getTableCaption(String rawText) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1367
        Content title = new RawHtml(rawText);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1368
        Content captionSpan = HtmlTree.SPAN(title);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1369
        Content space = getSpace();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1370
        Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1371
        Content caption = HtmlTree.CAPTION(captionSpan);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1372
        caption.addContent(tabSpan);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1373
        return caption;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1374
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1375
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1376
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1377
     * Get the marker anchor which will be added to the documentation tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1378
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1379
     * @param anchorName the anchor name attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1380
     * @return a content tree for the marker anchor
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1381
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1382
    public Content getMarkerAnchor(String anchorName) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1383
        return getMarkerAnchor(anchorName, null);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1384
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1385
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1386
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1387
     * Get the marker anchor which will be added to the documentation tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1388
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1389
     * @param anchorName the anchor name attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1390
     * @param anchorContent the content that should be added to the anchor
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1391
     * @return a content tree for the marker anchor
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1392
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1393
    public Content getMarkerAnchor(String anchorName, Content anchorContent) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1394
        if (anchorContent == null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1395
            anchorContent = new Comment(" ");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1396
        Content markerAnchor = HtmlTree.A_NAME(anchorName, anchorContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1397
        return markerAnchor;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1398
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1399
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1400
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1401
     * Returns a packagename content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1402
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1403
     * @param packageDoc the package to check
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1404
     * @return package name content
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1405
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1406
    public Content getPackageName(PackageDoc packageDoc) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1407
        return packageDoc == null || packageDoc.name().length() == 0 ?
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1408
            defaultPackageLabel :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1409
            getPackageLabel(packageDoc.name());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1410
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1411
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1412
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1413
     * Returns a package name label.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1414
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
  1415
     * @param packageName the package name
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1416
     * @return the package name content
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1417
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1418
    public Content getPackageLabel(String packageName) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1419
        return new StringContent(packageName);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1420
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1421
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1422
    /**
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1423
     * Add package deprecation information to the documentation tree
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1424
     *
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1425
     * @param deprPkgs list of deprecated packages
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1426
     * @param headingKey the caption for the deprecated package table
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1427
     * @param tableSummary the summary for the deprecated package table
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1428
     * @param tableHeader table headers for the deprecated package table
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1429
     * @param contentTree the content tree to which the deprecated package table will be added
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1430
     */
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1431
    protected void addPackageDeprecatedAPI(List<Doc> deprPkgs, String headingKey,
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1432
            String tableSummary, String[] tableHeader, Content contentTree) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1433
        if (deprPkgs.size() > 0) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1434
            Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1435
                    getTableCaption(configuration().getText(headingKey)));
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1436
            table.addContent(getSummaryTableHeader(tableHeader, "col"));
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1437
            Content tbody = new HtmlTree(HtmlTag.TBODY);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1438
            for (int i = 0; i < deprPkgs.size(); i++) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1439
                PackageDoc pkg = (PackageDoc) deprPkgs.get(i);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1440
                HtmlTree td = HtmlTree.TD(HtmlStyle.colOne,
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1441
                        getPackageLink(pkg, getPackageName(pkg)));
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1442
                if (pkg.tags("deprecated").length > 0) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1443
                    addInlineDeprecatedComment(pkg, pkg.tags("deprecated")[0], td);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1444
                }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1445
                HtmlTree tr = HtmlTree.TR(td);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1446
                if (i % 2 == 0) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1447
                    tr.addStyle(HtmlStyle.altColor);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1448
                } else {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1449
                    tr.addStyle(HtmlStyle.rowColor);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1450
                }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1451
                tbody.addContent(tr);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1452
            }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1453
            table.addContent(tbody);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1454
            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1455
            Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1456
            contentTree.addContent(ul);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1457
        }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1458
    }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1459
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
  1460
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1461
     * Prine table header information about color, column span and the font.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1462
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1463
     * @param color Background color.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1464
     * @param span  Column span.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1465
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1466
    public void tableHeaderStart(String color, int span) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1467
        trBgcolorStyle(color, "TableHeadingColor");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1468
        thAlignColspan("left", span);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1469
        font("+2");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1470
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1471
06bc494ca11e Initial load
duke
parents:
diff changeset
  1472
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1473
     * Print table header for the inherited members summary tables. Print the
06bc494ca11e Initial load
duke
parents:
diff changeset
  1474
     * background color information.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1475
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1476
     * @param color Background color.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1477
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1478
    public void tableInheritedHeaderStart(String color) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1479
        trBgcolorStyle(color, "TableSubHeadingColor");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1480
        thAlign("left");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1481
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1482
06bc494ca11e Initial load
duke
parents:
diff changeset
  1483
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1484
     * Print "Use" table header. Print the background color and the column span.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1485
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1486
     * @param color Background color.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1487
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1488
    public void tableUseInfoHeaderStart(String color) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1489
        trBgcolorStyle(color, "TableSubHeadingColor");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1490
        thAlignColspan("left", 2);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1491
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1492
06bc494ca11e Initial load
duke
parents:
diff changeset
  1493
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1494
     * Print table header with the background color with default column span 2.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1495
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1496
     * @param color Background color.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1497
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1498
    public void tableHeaderStart(String color) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1499
        tableHeaderStart(color, 2);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1500
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1501
06bc494ca11e Initial load
duke
parents:
diff changeset
  1502
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1503
     * Print table header with the column span, with the default color #CCCCFF.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1504
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1505
     * @param span Column span.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1506
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1507
    public void tableHeaderStart(int span) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1508
        tableHeaderStart("#CCCCFF", span);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1509
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1510
06bc494ca11e Initial load
duke
parents:
diff changeset
  1511
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1512
     * Print table header with default column span 2 and default color #CCCCFF.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1513
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1514
    public void tableHeaderStart() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1515
        tableHeaderStart(2);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1516
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1517
06bc494ca11e Initial load
duke
parents:
diff changeset
  1518
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1519
     * Print table header end tags for font, column and row.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1520
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1521
    public void tableHeaderEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1522
        fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1523
        thEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1524
        trEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1525
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1526
06bc494ca11e Initial load
duke
parents:
diff changeset
  1527
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1528
     * Print table header end tags in inherited tables for column and row.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1529
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1530
    public void tableInheritedHeaderEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1531
        thEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1532
        trEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1533
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1534
06bc494ca11e Initial load
duke
parents:
diff changeset
  1535
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1536
     * Print the summary table row cell attribute width.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1537
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1538
     * @param width Width of the table cell.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1539
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1540
    public void summaryRow(int width) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1541
        if (width != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1542
            tdWidth(width + "%");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1543
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1544
            td();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1545
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1546
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1547
06bc494ca11e Initial load
duke
parents:
diff changeset
  1548
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1549
     * Print the summary table row cell end tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1550
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1551
    public void summaryRowEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1552
        tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1553
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1554
06bc494ca11e Initial load
duke
parents:
diff changeset
  1555
    /**
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  1556
     * Print the heading in Html {@literal <H2>} format.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1557
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1558
     * @param str The Header string.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1559
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1560
    public void printIndexHeading(String str) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1561
        h2();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1562
        print(str);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1563
        h2End();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1564
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1565
06bc494ca11e Initial load
duke
parents:
diff changeset
  1566
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1567
     * Print Html tag &lt;FRAMESET=arg&gt;.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1568
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1569
     * @param arg Argument for the tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1570
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1571
    public void frameSet(String arg) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1572
        println("<FRAMESET " + arg + ">");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1573
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1574
06bc494ca11e Initial load
duke
parents:
diff changeset
  1575
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1576
     * Print Html closing tag &lt;/FRAMESET&gt;.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1577
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1578
    public void frameSetEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1579
        println("</FRAMESET>");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1580
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1581
06bc494ca11e Initial load
duke
parents:
diff changeset
  1582
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1583
     * Print Html tag &lt;FRAME=arg&gt;.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1584
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1585
     * @param arg Argument for the tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1586
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1587
    public void frame(String arg) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1588
        println("<FRAME " + arg + ">");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1589
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1590
06bc494ca11e Initial load
duke
parents:
diff changeset
  1591
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1592
     * Print Html closing tag &lt;/FRAME&gt;.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1593
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1594
    public void frameEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1595
        println("</FRAME>");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1596
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1597
06bc494ca11e Initial load
duke
parents:
diff changeset
  1598
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1599
     * Return path to the class page for a classdoc. For example, the class
06bc494ca11e Initial load
duke
parents:
diff changeset
  1600
     * name is "java.lang.Object" and if the current file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
  1601
     * "java/io/File.html", then the path string to the class, returned is
06bc494ca11e Initial load
duke
parents:
diff changeset
  1602
     * "../../java/lang.Object.html".
06bc494ca11e Initial load
duke
parents:
diff changeset
  1603
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1604
     * @param cd Class to which the path is requested.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1605
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1606
    protected String pathToClass(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1607
        return pathString(cd.containingPackage(), cd.name() + ".html");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1608
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1609
06bc494ca11e Initial load
duke
parents:
diff changeset
  1610
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1611
     * Return the path to the class page for a classdoc. Works same as
06bc494ca11e Initial load
duke
parents:
diff changeset
  1612
     * {@link #pathToClass(ClassDoc)}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1613
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1614
     * @param cd   Class to which the path is requested.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1615
     * @param name Name of the file(doesn't include path).
06bc494ca11e Initial load
duke
parents:
diff changeset
  1616
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1617
    protected String pathString(ClassDoc cd, String name) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1618
        return pathString(cd.containingPackage(), name);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1619
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1620
06bc494ca11e Initial load
duke
parents:
diff changeset
  1621
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1622
     * Return path to the given file name in the given package. So if the name
06bc494ca11e Initial load
duke
parents:
diff changeset
  1623
     * passed is "Object.html" and the name of the package is "java.lang", and
06bc494ca11e Initial load
duke
parents:
diff changeset
  1624
     * if the relative path is "../.." then returned string will be
06bc494ca11e Initial load
duke
parents:
diff changeset
  1625
     * "../../java/lang/Object.html"
06bc494ca11e Initial load
duke
parents:
diff changeset
  1626
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1627
     * @param pd Package in which the file name is assumed to be.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1628
     * @param name File name, to which path string is.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1629
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1630
    protected String pathString(PackageDoc pd, String name) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1631
        StringBuffer buf = new StringBuffer(relativePath);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1632
        buf.append(DirectoryManager.getPathToPackage(pd, name));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1633
        return buf.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1634
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1635
06bc494ca11e Initial load
duke
parents:
diff changeset
  1636
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1637
     * Print the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1638
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1639
     * @param pkg the package to link to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1640
     * @param label the label for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1641
     * @param isStrong true if the label should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1642
     */
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1643
    public void printPackageLink(PackageDoc pkg, String label, boolean isStrong) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1644
        print(getPackageLinkString(pkg, label, isStrong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1645
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1646
06bc494ca11e Initial load
duke
parents:
diff changeset
  1647
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1648
     * Print the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1649
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1650
     * @param pkg the package to link to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1651
     * @param label the label for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1652
     * @param isStrong true if the label should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1653
     * @param style  the font of the package link label.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1654
     */
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1655
    public void printPackageLink(PackageDoc pkg, String label, boolean isStrong,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1656
            String style) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1657
        print(getPackageLinkString(pkg, label, isStrong, style));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1658
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1659
06bc494ca11e Initial load
duke
parents:
diff changeset
  1660
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1661
     * Return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1662
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1663
     * @param pkg the package to link to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1664
     * @param label the label for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1665
     * @param isStrong true if the label should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1666
     * @return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1667
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1668
    public String getPackageLinkString(PackageDoc pkg, String label,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1669
                                 boolean isStrong) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1670
        return getPackageLinkString(pkg, label, isStrong, "");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1671
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1672
06bc494ca11e Initial load
duke
parents:
diff changeset
  1673
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1674
     * Return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1675
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1676
     * @param pkg the package to link to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1677
     * @param label the label for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1678
     * @param isStrong true if the label should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1679
     * @param style  the font of the package link label.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1680
     * @return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1681
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1682
    public String getPackageLinkString(PackageDoc pkg, String label, boolean isStrong,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1683
            String style) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1684
        boolean included = pkg != null && pkg.isIncluded();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1685
        if (! included) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1686
            PackageDoc[] packages = configuration.packages;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1687
            for (int i = 0; i < packages.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1688
                if (packages[i].equals(pkg)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1689
                    included = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1690
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1691
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1692
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1693
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1694
        if (included || pkg == null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1695
            return getHyperLinkString(pathString(pkg, "package-summary.html"),
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1696
                                "", label, isStrong, style);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1697
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1698
            String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1699
            if (crossPkgLink != null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1700
                return getHyperLinkString(crossPkgLink, "", label, isStrong, style);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1701
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1702
                return label;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1703
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1704
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1705
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1706
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1707
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1708
     * Return the link to the given package.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1709
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1710
     * @param pkg the package to link to.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1711
     * @param label the label for the link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1712
     * @return a content tree for the package link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1713
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1714
    public Content getPackageLink(PackageDoc pkg, Content label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1715
        boolean included = pkg != null && pkg.isIncluded();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1716
        if (! included) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1717
            PackageDoc[] packages = configuration.packages;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1718
            for (int i = 0; i < packages.length; i++) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1719
                if (packages[i].equals(pkg)) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1720
                    included = true;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1721
                    break;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1722
                }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1723
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1724
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1725
        if (included || pkg == null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1726
            return getHyperLink(pathString(pkg, "package-summary.html"),
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1727
                                "", label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1728
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1729
            String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1730
            if (crossPkgLink != null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1731
                return getHyperLink(crossPkgLink, "", label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1732
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1733
                return label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1734
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1735
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1736
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1737
06bc494ca11e Initial load
duke
parents:
diff changeset
  1738
    public String italicsClassName(ClassDoc cd, boolean qual) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1739
        String name = (qual)? cd.qualifiedName(): cd.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1740
        return (cd.isInterface())?  italicsText(name): name;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1741
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1742
06bc494ca11e Initial load
duke
parents:
diff changeset
  1743
    public void printSrcLink(ProgramElementDoc d, String label) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1744
        if (d == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1745
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1746
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1747
        ClassDoc cd = d.containingClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1748
        if (cd == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1749
            //d must be a class doc since in has no containing class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1750
            cd = (ClassDoc) d;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1751
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1752
        String href = relativePath + DocletConstants.SOURCE_OUTPUT_DIR_NAME
06bc494ca11e Initial load
duke
parents:
diff changeset
  1753
            + DirectoryManager.getDirectoryPath(cd.containingPackage())
06bc494ca11e Initial load
duke
parents:
diff changeset
  1754
            + cd.name() + ".html#" + SourceToHTMLConverter.getAnchorName(d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1755
        printHyperLink(href, "", label, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1756
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1757
06bc494ca11e Initial load
duke
parents:
diff changeset
  1758
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1759
     * Add the link to the content tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1760
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1761
     * @param doc program element doc for which the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1762
     * @param label label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1763
     * @param htmltree the content tree to which the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1764
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1765
    public void addSrcLink(ProgramElementDoc doc, Content label, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1766
        if (doc == null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1767
            return;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1768
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1769
        ClassDoc cd = doc.containingClass();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1770
        if (cd == null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1771
            //d must be a class doc since in has no containing class.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1772
            cd = (ClassDoc) doc;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1773
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1774
        String href = relativePath + DocletConstants.SOURCE_OUTPUT_DIR_NAME
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1775
                + DirectoryManager.getDirectoryPath(cd.containingPackage())
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1776
                + cd.name() + ".html#" + SourceToHTMLConverter.getAnchorName(doc);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1777
        Content linkContent = getHyperLink(href, "", label, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1778
        htmltree.addContent(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1779
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1780
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1781
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1782
     * Return the link to the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1783
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1784
     * @param linkInfo the information about the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1785
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1786
     * @return the link for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1787
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1788
    public String getLink(LinkInfoImpl linkInfo) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1789
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1790
        String link = ((LinkOutputImpl) factory.getLinkOutput(linkInfo)).toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1791
        displayLength += linkInfo.displayLength;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1792
        return link;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1793
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1794
06bc494ca11e Initial load
duke
parents:
diff changeset
  1795
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1796
     * Return the type parameters for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1797
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1798
     * @param linkInfo the information about the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1799
     * @return the type for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1800
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1801
    public String getTypeParameterLinks(LinkInfoImpl linkInfo) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1802
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1803
        return ((LinkOutputImpl)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1804
            factory.getTypeParameterLinks(linkInfo, false)).toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1805
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1806
06bc494ca11e Initial load
duke
parents:
diff changeset
  1807
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1808
     * Print the link to the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1809
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1810
    public void printLink(LinkInfoImpl linkInfo) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1811
        print(getLink(linkInfo));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1812
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1813
06bc494ca11e Initial load
duke
parents:
diff changeset
  1814
    /*************************************************************
06bc494ca11e Initial load
duke
parents:
diff changeset
  1815
     * Return a class cross link to external class documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1816
     * The name must be fully qualified to determine which package
06bc494ca11e Initial load
duke
parents:
diff changeset
  1817
     * the class is in.  The -link option does not allow users to
06bc494ca11e Initial load
duke
parents:
diff changeset
  1818
     * link to external classes in the "default" package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1819
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1820
     * @param qualifiedClassName the qualified name of the external class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1821
     * @param refMemName the name of the member being referenced.  This should
06bc494ca11e Initial load
duke
parents:
diff changeset
  1822
     * be null or empty string if no member is being referenced.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1823
     * @param label the label for the external link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1824
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1825
     * @param style the style of the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1826
     * @param code true if the label should be code font.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1827
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1828
    public String getCrossClassLink(String qualifiedClassName, String refMemName,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1829
                                    String label, boolean strong, String style,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1830
                                    boolean code) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1831
        String className = "",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1832
            packageName = qualifiedClassName == null ? "" : qualifiedClassName;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1833
        int periodIndex;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1834
        while((periodIndex = packageName.lastIndexOf('.')) != -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1835
            className = packageName.substring(periodIndex + 1, packageName.length()) +
06bc494ca11e Initial load
duke
parents:
diff changeset
  1836
                (className.length() > 0 ? "." + className : "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1837
            String defaultLabel = code ? getCode() + className + getCodeEnd() : className;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1838
            packageName = packageName.substring(0, periodIndex);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1839
            if (getCrossPackageLink(packageName) != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1840
                //The package exists in external documentation, so link to the external
06bc494ca11e Initial load
duke
parents:
diff changeset
  1841
                //class (assuming that it exists).  This is definitely a limitation of
06bc494ca11e Initial load
duke
parents:
diff changeset
  1842
                //the -link option.  There are ways to determine if an external package
06bc494ca11e Initial load
duke
parents:
diff changeset
  1843
                //exists, but no way to determine if the external class exists.  We just
06bc494ca11e Initial load
duke
parents:
diff changeset
  1844
                //have to assume that it does.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1845
                return getHyperLinkString(
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1846
                    configuration.extern.getExternalLink(packageName, relativePath,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1847
                                className + ".html?is-external=true"),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1848
                    refMemName == null ? "" : refMemName,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1849
                    label == null || label.length() == 0 ? defaultLabel : label,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1850
                    strong, style,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1851
                    configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1852
                    "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1853
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1854
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1855
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1856
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1857
06bc494ca11e Initial load
duke
parents:
diff changeset
  1858
    public boolean isClassLinkable(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1859
        if (cd.isIncluded()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1860
            return configuration.isGeneratedDoc(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1861
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1862
        return configuration.extern.isExternal(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1863
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1864
06bc494ca11e Initial load
duke
parents:
diff changeset
  1865
    public String getCrossPackageLink(String pkgName) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1866
        return configuration.extern.getExternalLink(pkgName, relativePath,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1867
            "package-summary.html?is-external=true");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1868
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1869
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1870
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1871
     * Get the class link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1872
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1873
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1874
     * @param cd the class doc to link to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1875
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1876
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1877
    public Content getQualifiedClassLink(int context, ClassDoc cd) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1878
        return new RawHtml(getLink(new LinkInfoImpl(context, cd,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1879
                configuration.getClassName(cd), "")));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1880
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1881
06bc494ca11e Initial load
duke
parents:
diff changeset
  1882
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1883
     * Add the class link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1884
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1885
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1886
     * @param cd the class doc to link to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1887
     * @param contentTree the content tree to which the link will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1888
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1889
    public void addPreQualifiedClassLink(int context, ClassDoc cd, Content contentTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1890
        addPreQualifiedClassLink(context, cd, false, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1891
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1892
06bc494ca11e Initial load
duke
parents:
diff changeset
  1893
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1894
     * Retrieve the class link with the package portion of the label in
06bc494ca11e Initial load
duke
parents:
diff changeset
  1895
     * plain text.  If the qualifier is excluded, it willnot be included in the
06bc494ca11e Initial load
duke
parents:
diff changeset
  1896
     * link label.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1897
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1898
     * @param cd the class to link to.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1899
     * @param isStrong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1900
     * @return the link with the package portion of the label in plain text.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1901
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1902
    public String getPreQualifiedClassLink(int context,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1903
            ClassDoc cd, boolean isStrong) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1904
        String classlink = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1905
        PackageDoc pd = cd.containingPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1906
        if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1907
            classlink = getPkgName(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1908
        }
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1909
        classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isStrong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1910
        return classlink;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1911
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1912
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1913
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1914
     * Add the class link with the package portion of the label in
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1915
     * plain text. If the qualifier is excluded, it will not be included in the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1916
     * link label.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1917
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1918
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1919
     * @param cd the class to link to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1920
     * @param isStrong true if the link should be strong
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1921
     * @param contentTree the content tree to which the link with be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1922
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1923
    public void addPreQualifiedClassLink(int context,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1924
            ClassDoc cd, boolean isStrong, Content contentTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1925
        PackageDoc pd = cd.containingPackage();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1926
        if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1927
            contentTree.addContent(getPkgName(cd));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1928
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1929
        contentTree.addContent(new RawHtml(getLink(new LinkInfoImpl(
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1930
                context, cd, cd.name(), isStrong))));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1931
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1932
06bc494ca11e Initial load
duke
parents:
diff changeset
  1933
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1934
     * Add the class link, with only class name as the strong link and prefixing
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1935
     * plain package name.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1936
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1937
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1938
     * @param cd the class to link to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1939
     * @param contentTree the content tree to which the link with be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1940
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1941
    public void addPreQualifiedStrongClassLink(int context, ClassDoc cd, Content contentTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1942
        addPreQualifiedClassLink(context, cd, true, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1943
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1944
06bc494ca11e Initial load
duke
parents:
diff changeset
  1945
    public void printText(String key) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1946
        print(configuration.getText(key));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1947
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1948
06bc494ca11e Initial load
duke
parents:
diff changeset
  1949
    public void printText(String key, String a1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1950
        print(configuration.getText(key, a1));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1951
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1952
06bc494ca11e Initial load
duke
parents:
diff changeset
  1953
    public void printText(String key, String a1, String a2) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1954
        print(configuration.getText(key, a1, a2));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1955
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1956
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1957
    public void strongText(String key) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1958
        strong(configuration.getText(key));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1959
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1960
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1961
    public void strongText(String key, String a1) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1962
        strong(configuration.getText(key, a1));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1963
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1964
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1965
    public void strongText(String key, String a1, String a2) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1966
        strong(configuration.getText(key, a1, a2));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1967
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1968
06bc494ca11e Initial load
duke
parents:
diff changeset
  1969
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1970
     * Get the link for the given member.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1971
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1972
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1973
     * @param doc the member being linked to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1974
     * @param label the label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1975
     * @return a content tree for the doc link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1976
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1977
    public Content getDocLink(int context, MemberDoc doc, String label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1978
        return getDocLink(context, doc.containingClass(), doc, label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1979
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1980
06bc494ca11e Initial load
duke
parents:
diff changeset
  1981
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1982
     * Print the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1983
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1984
     * @param context the id of the context where the link will be printed.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1985
     * @param classDoc the classDoc that we should link to.  This is not
06bc494ca11e Initial load
duke
parents:
diff changeset
  1986
     *                 necessarily equal to doc.containingClass().  We may be
06bc494ca11e Initial load
duke
parents:
diff changeset
  1987
     *                 inheriting comments.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1988
     * @param doc the member being linked to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1989
     * @param label the label for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1990
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1991
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1992
    public void printDocLink(int context, ClassDoc classDoc, MemberDoc doc,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1993
            String label, boolean strong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1994
        print(getDocLink(context, classDoc, doc, label, strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1995
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1996
06bc494ca11e Initial load
duke
parents:
diff changeset
  1997
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1998
     * Return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1999
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2000
     * @param context the id of the context where the link will be printed.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2001
     * @param doc the member being linked to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2002
     * @param label the label for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  2003
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2004
     * @return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2005
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2006
    public String getDocLink(int context, MemberDoc doc, String label,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  2007
                boolean strong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  2008
        return getDocLink(context, doc.containingClass(), doc, label, strong);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2009
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2010
06bc494ca11e Initial load
duke
parents:
diff changeset
  2011
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  2012
     * Return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2013
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2014
     * @param context the id of the context where the link will be printed.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2015
     * @param classDoc the classDoc that we should link to.  This is not
06bc494ca11e Initial load
duke
parents:
diff changeset
  2016
     *                 necessarily equal to doc.containingClass().  We may be
06bc494ca11e Initial load
duke
parents:
diff changeset
  2017
     *                 inheriting comments.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2018
     * @param doc the member being linked to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2019
     * @param label the label for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  2020
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2021
     * @return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2022
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2023
    public String getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  2024
        String label, boolean strong) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2025
        if (! (doc.isIncluded() ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  2026
            Util.isLinkable(classDoc, configuration()))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2027
            return label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2028
        } else if (doc instanceof ExecutableMemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2029
            ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2030
            return getLink(new LinkInfoImpl(context, classDoc,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  2031
                getAnchor(emd), label, strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2032
        } else if (doc instanceof MemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2033
            return getLink(new LinkInfoImpl(context, classDoc,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  2034
                doc.name(), label, strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2035
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2036
            return label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2037
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2038
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2039
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2040
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2041
     * Return the link for the given member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2042
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2043
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2044
     * @param classDoc the classDoc that we should link to.  This is not
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2045
     *                 necessarily equal to doc.containingClass().  We may be
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2046
     *                 inheriting comments
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2047
     * @param doc the member being linked to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2048
     * @param label the label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2049
     * @return the link for the given member
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2050
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2051
    public Content getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2052
        String label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2053
        if (! (doc.isIncluded() ||
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2054
            Util.isLinkable(classDoc, configuration()))) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2055
            return new StringContent(label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2056
        } else if (doc instanceof ExecutableMemberDoc) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2057
            ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2058
            return new RawHtml(getLink(new LinkInfoImpl(context, classDoc,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2059
                getAnchor(emd), label, false)));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2060
        } else if (doc instanceof MemberDoc) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2061
            return new RawHtml(getLink(new LinkInfoImpl(context, classDoc,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2062
                doc.name(), label, false)));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2063
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2064
            return new StringContent(label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2065
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2066
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2067
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2068
    public void anchor(ExecutableMemberDoc emd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2069
        anchor(getAnchor(emd));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2070
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2071
06bc494ca11e Initial load
duke
parents:
diff changeset
  2072
    public String getAnchor(ExecutableMemberDoc emd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2073
        StringBuilder signature = new StringBuilder(emd.signature());
06bc494ca11e Initial load
duke
parents:
diff changeset
  2074
        StringBuilder signatureParsed = new StringBuilder();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2075
        int counter = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2076
        for (int i = 0; i < signature.length(); i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2077
            char c = signature.charAt(i);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2078
            if (c == '<') {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2079
                counter++;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2080
            } else if (c == '>') {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2081
                counter--;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2082
            } else if (counter == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2083
                signatureParsed.append(c);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2084
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2085
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2086
        return emd.name() + signatureParsed.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2087
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2088
06bc494ca11e Initial load
duke
parents:
diff changeset
  2089
    public String seeTagToString(SeeTag see) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2090
        String tagName = see.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2091
        if (! (tagName.startsWith("@link") || tagName.equals("@see"))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2092
            return "";
06bc494ca11e Initial load
duke
parents:
diff changeset
  2093
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2094
        StringBuffer result = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2095
        boolean isplaintext = tagName.toLowerCase().equals("@linkplain");
06bc494ca11e Initial load
duke
parents:
diff changeset
  2096
        String label = see.label();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2097
        label = (label.length() > 0)?
06bc494ca11e Initial load
duke
parents:
diff changeset
  2098
            ((isplaintext) ? label :
06bc494ca11e Initial load
duke
parents:
diff changeset
  2099
                 getCode() + label + getCodeEnd()):"";
06bc494ca11e Initial load
duke
parents:
diff changeset
  2100
        String seetext = replaceDocRootDir(see.text());
06bc494ca11e Initial load
duke
parents:
diff changeset
  2101
06bc494ca11e Initial load
duke
parents:
diff changeset
  2102
        //Check if @see is an href or "string"
06bc494ca11e Initial load
duke
parents:
diff changeset
  2103
        if (seetext.startsWith("<") || seetext.startsWith("\"")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2104
            result.append(seetext);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2105
            return result.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2106
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2107
06bc494ca11e Initial load
duke
parents:
diff changeset
  2108
        //The text from the @see tag.  We will output this text when a label is not specified.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2109
        String text = (isplaintext) ? seetext : getCode() + seetext + getCodeEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2110
06bc494ca11e Initial load
duke
parents:
diff changeset
  2111
        ClassDoc refClass = see.referencedClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2112
        String refClassName = see.referencedClassName();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2113
        MemberDoc refMem = see.referencedMember();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2114
        String refMemName = see.referencedMemberName();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2115
        if (refClass == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2116
            //@see is not referencing an included class
06bc494ca11e Initial load
duke
parents:
diff changeset
  2117
            PackageDoc refPackage = see.referencedPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2118
            if (refPackage != null && refPackage.isIncluded()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2119
                //@see is referencing an included package
06bc494ca11e Initial load
duke
parents:
diff changeset
  2120
                String packageName = isplaintext ? refPackage.name() :
06bc494ca11e Initial load
duke
parents:
diff changeset
  2121
                    getCode() + refPackage.name() + getCodeEnd();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2122
                result.append(getPackageLinkString(refPackage,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2123
                    label.length() == 0 ? packageName : label, false));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2124
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2125
                //@see is not referencing an included class or package.  Check for cross links.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2126
                String classCrossLink, packageCrossLink = getCrossPackageLink(refClassName);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2127
                if (packageCrossLink != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2128
                    //Package cross link found
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2129
                    result.append(getHyperLinkString(packageCrossLink, "",
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2130
                        (label.length() == 0)? text : label, false));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2131
                } else if ((classCrossLink = getCrossClassLink(refClassName,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2132
                        refMemName, label, false, "", ! isplaintext)) != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2133
                    //Class cross link found (possiblly to a member in the class)
06bc494ca11e Initial load
duke
parents:
diff changeset
  2134
                    result.append(classCrossLink);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2135
                } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2136
                    //No cross link found so print warning
06bc494ca11e Initial load
duke
parents:
diff changeset
  2137
                    configuration.getDocletSpecificMsg().warning(see.position(), "doclet.see.class_or_package_not_found",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2138
                            tagName, seetext);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2139
                    result.append((label.length() == 0)? text: label);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2140
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2141
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2142
        } else if (refMemName == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2143
            // Must be a class reference since refClass is not null and refMemName is null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2144
            if (label.length() == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2145
                label = (isplaintext) ? refClass.name() : getCode() + refClass.name() + getCodeEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2146
                result.append(getLink(new LinkInfoImpl(refClass, label)));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2147
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2148
                result.append(getLink(new LinkInfoImpl(refClass, label)));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2149
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2150
        } else if (refMem == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2151
            // Must be a member reference since refClass is not null and refMemName is not null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2152
            // However, refMem is null, so this referenced member does not exist.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2153
            result.append((label.length() == 0)? text: label);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2154
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2155
            // Must be a member reference since refClass is not null and refMemName is not null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2156
            // refMem is not null, so this @see tag must be referencing a valid member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2157
            ClassDoc containing = refMem.containingClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2158
            if (see.text().trim().startsWith("#") &&
06bc494ca11e Initial load
duke
parents:
diff changeset
  2159
                ! (containing.isPublic() ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  2160
                Util.isLinkable(containing, configuration()))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2161
                // Since the link is relative and the holder is not even being
06bc494ca11e Initial load
duke
parents:
diff changeset
  2162
                // documented, this must be an inherited link.  Redirect it.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2163
                // The current class either overrides the referenced member or
06bc494ca11e Initial load
duke
parents:
diff changeset
  2164
                // inherits it automatically.
3891
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  2165
                if (this instanceof ClassWriterImpl) {
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  2166
                    containing = ((ClassWriterImpl) this).getClassDoc();
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  2167
                } else if (!containing.isPublic()){
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  2168
                    configuration.getDocletSpecificMsg().warning(
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  2169
                        see.position(), "doclet.see.class_or_package_not_accessible",
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  2170
                        tagName, containing.qualifiedName());
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  2171
                } else {
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  2172
                    configuration.getDocletSpecificMsg().warning(
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  2173
                        see.position(), "doclet.see.class_or_package_not_found",
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  2174
                        tagName, seetext);
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  2175
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2176
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2177
            if (configuration.currentcd != containing) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2178
                refMemName = containing.name() + "." + refMemName;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2179
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2180
            if (refMem instanceof ExecutableMemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2181
                if (refMemName.indexOf('(') < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2182
                    refMemName += ((ExecutableMemberDoc)refMem).signature();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2183
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2184
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2185
            text = (isplaintext) ?
9592
82e14c156b3b 6758050: javadoc handles nested generic types incorrectly
bpatel
parents: 9303
diff changeset
  2186
                refMemName : getCode() + Util.escapeHtmlChars(refMemName) + getCodeEnd();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2187
06bc494ca11e Initial load
duke
parents:
diff changeset
  2188
            result.append(getDocLink(LinkInfoImpl.CONTEXT_SEE_TAG, containing,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2189
                refMem, (label.length() == 0)? text: label, false));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2190
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2191
        return result.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2192
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2193
06bc494ca11e Initial load
duke
parents:
diff changeset
  2194
    public void printInlineComment(Doc doc, Tag tag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2195
        printCommentTags(doc, tag.inlineTags(), false, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2196
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2197
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2198
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2199
     * Add the inline comment.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2200
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2201
     * @param doc the doc for which the inline comment will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2202
     * @param tag the inline tag to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2203
     * @param htmltree the content tree to which the comment will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2204
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2205
    public void addInlineComment(Doc doc, Tag tag, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2206
        addCommentTags(doc, tag.inlineTags(), false, false, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2207
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2208
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2209
    public void printInlineDeprecatedComment(Doc doc, Tag tag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2210
        printCommentTags(doc, tag.inlineTags(), true, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2211
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2212
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2213
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2214
     * Add the inline deprecated comment.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2215
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2216
     * @param doc the doc for which the inline deprecated comment will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2217
     * @param tag the inline tag to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2218
     * @param htmltree the content tree to which the comment will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2219
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2220
    public void addInlineDeprecatedComment(Doc doc, Tag tag, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2221
        addCommentTags(doc, tag.inlineTags(), true, false, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2222
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2223
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2224
    public void printSummaryComment(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2225
        printSummaryComment(doc, doc.firstSentenceTags());
06bc494ca11e Initial load
duke
parents:
diff changeset
  2226
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2227
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2228
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2229
     * Adds the summary content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2230
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2231
     * @param doc the doc for which the summary will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2232
     * @param htmltree the documentation tree to which the summary will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2233
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2234
    public void addSummaryComment(Doc doc, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2235
        addSummaryComment(doc, doc.firstSentenceTags(), htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2236
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2237
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2238
    public void printSummaryComment(Doc doc, Tag[] firstSentenceTags) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2239
        printCommentTags(doc, firstSentenceTags, false, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2240
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2241
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2242
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2243
     * Adds the summary content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2244
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2245
     * @param doc the doc for which the summary will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2246
     * @param firstSentenceTags the first sentence tags for the doc
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2247
     * @param htmltree the documentation tree to which the summary will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2248
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2249
    public void addSummaryComment(Doc doc, Tag[] firstSentenceTags, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2250
        addCommentTags(doc, firstSentenceTags, false, true, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2251
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2252
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2253
    public void printSummaryDeprecatedComment(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2254
        printCommentTags(doc, doc.firstSentenceTags(), true, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2255
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2256
06bc494ca11e Initial load
duke
parents:
diff changeset
  2257
    public void printSummaryDeprecatedComment(Doc doc, Tag tag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2258
        printCommentTags(doc, tag.firstSentenceTags(), true, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2259
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2260
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2261
    public void addSummaryDeprecatedComment(Doc doc, Tag tag, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2262
        addCommentTags(doc, tag.firstSentenceTags(), true, true, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2263
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2264
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2265
    public void printInlineComment(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2266
        printCommentTags(doc, doc.inlineTags(), false, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2267
        p();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2268
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2269
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2270
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2271
     * Adds the inline comment.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2272
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2273
     * @param doc the doc for which the inline comments will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2274
     * @param htmltree the documentation tree to which the inline comments will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2275
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2276
    public void addInlineComment(Doc doc, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2277
        addCommentTags(doc, doc.inlineTags(), false, false, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2278
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2279
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2280
    public void printInlineDeprecatedComment(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2281
        printCommentTags(doc, doc.inlineTags(), true, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2282
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2283
06bc494ca11e Initial load
duke
parents:
diff changeset
  2284
    private void printCommentTags(Doc doc, Tag[] tags, boolean depr, boolean first) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2285
        if(configuration.nocomment){
06bc494ca11e Initial load
duke
parents:
diff changeset
  2286
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2287
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2288
        if (depr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2289
            italic();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2290
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2291
        String result = commentTagsToString(null, doc, tags, first);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2292
        print(result);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2293
        if (depr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2294
            italicEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2295
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2296
        if (tags.length == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2297
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2298
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2299
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2300
06bc494ca11e Initial load
duke
parents:
diff changeset
  2301
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2302
     * Adds the comment tags.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2303
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2304
     * @param doc the doc for which the comment tags will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2305
     * @param tags the first sentence tags for the doc
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2306
     * @param depr true if it is deprecated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2307
     * @param first true if the first sentenge tags should be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2308
     * @param htmltree the documentation tree to which the comment tags will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2309
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2310
    private void addCommentTags(Doc doc, Tag[] tags, boolean depr,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2311
            boolean first, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2312
        if(configuration.nocomment){
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2313
            return;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2314
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2315
        Content div;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2316
        Content result = new RawHtml(commentTagsToString(null, doc, tags, first));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2317
        if (depr) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2318
            Content italic = HtmlTree.I(result);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2319
            div = HtmlTree.DIV(HtmlStyle.block, italic);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2320
            htmltree.addContent(div);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2321
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2322
        else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2323
            div = HtmlTree.DIV(HtmlStyle.block, result);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2324
            htmltree.addContent(div);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2325
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2326
        if (tags.length == 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2327
            htmltree.addContent(getSpace());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2328
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2329
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2330
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2331
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2332
     * Converts inline tags and text to text strings, expanding the
06bc494ca11e Initial load
duke
parents:
diff changeset
  2333
     * inline tags along the way.  Called wherever text can contain
06bc494ca11e Initial load
duke
parents:
diff changeset
  2334
     * an inline tag, such as in comments or in free-form text arguments
06bc494ca11e Initial load
duke
parents:
diff changeset
  2335
     * to non-inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2336
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2337
     * @param holderTag    specific tag where comment resides
06bc494ca11e Initial load
duke
parents:
diff changeset
  2338
     * @param doc    specific doc where comment resides
06bc494ca11e Initial load
duke
parents:
diff changeset
  2339
     * @param tags   array of text tags and inline tags (often alternating)
06bc494ca11e Initial load
duke
parents:
diff changeset
  2340
     *               present in the text of interest for this doc
06bc494ca11e Initial load
duke
parents:
diff changeset
  2341
     * @param isFirstSentence  true if text is first sentence
06bc494ca11e Initial load
duke
parents:
diff changeset
  2342
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2343
    public String commentTagsToString(Tag holderTag, Doc doc, Tag[] tags,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2344
            boolean isFirstSentence) {
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
  2345
        StringBuilder result = new StringBuilder();
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2346
        boolean textTagChange = false;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2347
        // Array of all possible inline tags for this javadoc run
06bc494ca11e Initial load
duke
parents:
diff changeset
  2348
        configuration.tagletManager.checkTags(doc, tags, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2349
        for (int i = 0; i < tags.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2350
            Tag tagelem = tags[i];
06bc494ca11e Initial load
duke
parents:
diff changeset
  2351
            String tagName = tagelem.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2352
            if (tagelem instanceof SeeTag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2353
                result.append(seeTagToString((SeeTag)tagelem));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2354
            } else if (! tagName.equals("Text")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2355
                int originalLength = result.length();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2356
                TagletOutput output = TagletWriter.getInlineTagOuput(
06bc494ca11e Initial load
duke
parents:
diff changeset
  2357
                    configuration.tagletManager, holderTag,
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  2358
                    tagelem, getTagletWriterInstance(isFirstSentence));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2359
                result.append(output == null ? "" : output.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
  2360
                if (originalLength == 0 && isFirstSentence && tagelem.name().equals("@inheritDoc") && result.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2361
                    break;
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2362
                } else if (configuration.docrootparent.length() > 0 &&
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2363
                        tagelem.name().equals("@docRoot") &&
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2364
                        ((tags[i + 1]).text()).startsWith("/..")) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2365
                    //If Xdocrootparent switch ON, set the flag to remove the /.. occurance after
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2366
                    //{@docRoot} tag in the very next Text tag.
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2367
                    textTagChange = true;
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2368
                    continue;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2369
                } else {
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2370
                    continue;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2371
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2372
            } else {
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2373
                String text = tagelem.text();
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2374
                //If Xdocrootparent switch ON, remove the /.. occurance after {@docRoot} tag.
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2375
                if (textTagChange) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2376
                    text = text.replaceFirst("/..", "");
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2377
                    textTagChange = false;
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2378
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2379
                //This is just a regular text tag.  The text may contain html links (<a>)
06bc494ca11e Initial load
duke
parents:
diff changeset
  2380
                //or inline tag {@docRoot}, which will be handled as special cases.
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  2381
                text = redirectRelativeLinks(tagelem.holder(), text);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2382
06bc494ca11e Initial load
duke
parents:
diff changeset
  2383
                // Replace @docRoot only if not represented by an instance of DocRootTaglet,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2384
                // that is, only if it was not present in a source file doc comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2385
                // This happens when inserted by the doclet (a few lines
06bc494ca11e Initial load
duke
parents:
diff changeset
  2386
                // above in this method).  [It might also happen when passed in on the command
06bc494ca11e Initial load
duke
parents:
diff changeset
  2387
                // line as a text argument to an option (like -header).]
06bc494ca11e Initial load
duke
parents:
diff changeset
  2388
                text = replaceDocRootDir(text);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2389
                if (isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2390
                    text = removeNonInlineHtmlTags(text);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2391
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2392
                StringTokenizer lines = new StringTokenizer(text, "\r\n", true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2393
                StringBuffer textBuff = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2394
                while (lines.hasMoreTokens()) {
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
  2395
                    StringBuilder line = new StringBuilder(lines.nextToken());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2396
                    Util.replaceTabs(configuration.sourcetab, line);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2397
                    textBuff.append(line.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
  2398
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2399
                result.append(textBuff);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2400
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2401
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2402
        return result.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2403
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2404
06bc494ca11e Initial load
duke
parents:
diff changeset
  2405
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  2406
     * Return true if relative links should not be redirected.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2407
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2408
     * @return Return true if a relative link should not be redirected.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2409
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2410
    private boolean shouldNotRedirectRelativeLinks() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2411
        return  this instanceof AnnotationTypeWriter ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  2412
                this instanceof ClassWriter ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  2413
                this instanceof PackageSummaryWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2414
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2415
06bc494ca11e Initial load
duke
parents:
diff changeset
  2416
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  2417
     * Suppose a piece of documentation has a relative link.  When you copy
06bc494ca11e Initial load
duke
parents:
diff changeset
  2418
     * that documetation to another place such as the index or class-use page,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2419
     * that relative link will no longer work.  We should redirect those links
06bc494ca11e Initial load
duke
parents:
diff changeset
  2420
     * so that they will work again.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2421
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  2422
     * Here is the algorithm used to fix the link:
06bc494ca11e Initial load
duke
parents:
diff changeset
  2423
     * <p>
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  2424
     * {@literal <relative link> => docRoot + <relative path to file> + <relative link> }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2425
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  2426
     * For example, suppose com.sun.javadoc.RootDoc has this link:
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  2427
     * {@literal <a href="package-summary.html">The package Page</a> }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2428
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  2429
     * If this link appeared in the index, we would redirect
06bc494ca11e Initial load
duke
parents:
diff changeset
  2430
     * the link like this:
06bc494ca11e Initial load
duke
parents:
diff changeset
  2431
     *
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  2432
     * {@literal <a href="./com/sun/javadoc/package-summary.html">The package Page</a>}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2433
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2434
     * @param doc the Doc object whose documentation is being written.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2435
     * @param text the text being written.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2436
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2437
     * @return the text, with all the relative links redirected to work.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2438
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2439
    private String redirectRelativeLinks(Doc doc, String text) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2440
        if (doc == null || shouldNotRedirectRelativeLinks()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2441
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2442
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2443
06bc494ca11e Initial load
duke
parents:
diff changeset
  2444
        String redirectPathFromRoot;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2445
        if (doc instanceof ClassDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2446
            redirectPathFromRoot = DirectoryManager.getDirectoryPath(((ClassDoc) doc).containingPackage());
06bc494ca11e Initial load
duke
parents:
diff changeset
  2447
        } else if (doc instanceof MemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2448
            redirectPathFromRoot = DirectoryManager.getDirectoryPath(((MemberDoc) doc).containingPackage());
06bc494ca11e Initial load
duke
parents:
diff changeset
  2449
        } else if (doc instanceof PackageDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2450
            redirectPathFromRoot = DirectoryManager.getDirectoryPath((PackageDoc) doc);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2451
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2452
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2453
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2454
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2455
        if (! redirectPathFromRoot.endsWith(DirectoryManager.URL_FILE_SEPARATOR)) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2456
            redirectPathFromRoot += DirectoryManager.URL_FILE_SEPARATOR;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2457
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2458
06bc494ca11e Initial load
duke
parents:
diff changeset
  2459
        //Redirect all relative links.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2460
        int end, begin = text.toLowerCase().indexOf("<a");
06bc494ca11e Initial load
duke
parents:
diff changeset
  2461
        if(begin >= 0){
06bc494ca11e Initial load
duke
parents:
diff changeset
  2462
            StringBuffer textBuff = new StringBuffer(text);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2463
06bc494ca11e Initial load
duke
parents:
diff changeset
  2464
            while(begin >=0){
06bc494ca11e Initial load
duke
parents:
diff changeset
  2465
                if (textBuff.length() > begin + 2 && ! Character.isWhitespace(textBuff.charAt(begin+2))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2466
                    begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2467
                    continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2468
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2469
06bc494ca11e Initial load
duke
parents:
diff changeset
  2470
                begin = textBuff.indexOf("=", begin) + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2471
                end = textBuff.indexOf(">", begin +1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2472
                if(begin == 0){
06bc494ca11e Initial load
duke
parents:
diff changeset
  2473
                    //Link has no equal symbol.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2474
                    configuration.root.printWarning(
06bc494ca11e Initial load
duke
parents:
diff changeset
  2475
                        doc.position(),
06bc494ca11e Initial load
duke
parents:
diff changeset
  2476
                        configuration.getText("doclet.malformed_html_link_tag", text));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2477
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2478
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2479
                if (end == -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2480
                    //Break without warning.  This <a> tag is not necessarily malformed.  The text
06bc494ca11e Initial load
duke
parents:
diff changeset
  2481
                    //might be missing '>' character because the href has an inline tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2482
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2483
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2484
                if(textBuff.substring(begin, end).indexOf("\"") != -1){
06bc494ca11e Initial load
duke
parents:
diff changeset
  2485
                    begin = textBuff.indexOf("\"", begin) + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2486
                    end = textBuff.indexOf("\"", begin +1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2487
                    if(begin == 0 || end == -1){
06bc494ca11e Initial load
duke
parents:
diff changeset
  2488
                        //Link is missing a quote.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2489
                        break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2490
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2491
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2492
                String relativeLink = textBuff.substring(begin, end);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2493
                if(!(relativeLink.toLowerCase().startsWith("mailto:") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  2494
                     relativeLink.toLowerCase().startsWith("http:") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  2495
                     relativeLink.toLowerCase().startsWith("https:") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  2496
                     relativeLink.toLowerCase().startsWith("file:"))){
06bc494ca11e Initial load
duke
parents:
diff changeset
  2497
                     relativeLink = "{@"+(new DocRootTaglet()).getName() + "}"
06bc494ca11e Initial load
duke
parents:
diff changeset
  2498
                        + redirectPathFromRoot
06bc494ca11e Initial load
duke
parents:
diff changeset
  2499
                        + relativeLink;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2500
                    textBuff.replace(begin, end, relativeLink);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2501
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2502
                begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2503
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2504
            return textBuff.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2505
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2506
        return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2507
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2508
06bc494ca11e Initial load
duke
parents:
diff changeset
  2509
    public String removeNonInlineHtmlTags(String text) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2510
        if (text.indexOf('<') < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2511
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2512
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2513
        String noninlinetags[] = { "<ul>", "</ul>", "<ol>", "</ol>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2514
                "<dl>", "</dl>", "<table>", "</table>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2515
                "<tr>", "</tr>", "<td>", "</td>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2516
                "<th>", "</th>", "<p>", "</p>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2517
                "<li>", "</li>", "<dd>", "</dd>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2518
                "<dir>", "</dir>", "<dt>", "</dt>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2519
                "<h1>", "</h1>", "<h2>", "</h2>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2520
                "<h3>", "</h3>", "<h4>", "</h4>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2521
                "<h5>", "</h5>", "<h6>", "</h6>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2522
                "<pre>", "</pre>", "<menu>", "</menu>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2523
                "<listing>", "</listing>", "<hr>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2524
                "<blockquote>", "</blockquote>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2525
                "<center>", "</center>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2526
                "<UL>", "</UL>", "<OL>", "</OL>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2527
                "<DL>", "</DL>", "<TABLE>", "</TABLE>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2528
                "<TR>", "</TR>", "<TD>", "</TD>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2529
                "<TH>", "</TH>", "<P>", "</P>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2530
                "<LI>", "</LI>", "<DD>", "</DD>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2531
                "<DIR>", "</DIR>", "<DT>", "</DT>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2532
                "<H1>", "</H1>", "<H2>", "</H2>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2533
                "<H3>", "</H3>", "<H4>", "</H4>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2534
                "<H5>", "</H5>", "<H6>", "</H6>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2535
                "<PRE>", "</PRE>", "<MENU>", "</MENU>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2536
                "<LISTING>", "</LISTING>", "<HR>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2537
                "<BLOCKQUOTE>", "</BLOCKQUOTE>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  2538
                "<CENTER>", "</CENTER>"
06bc494ca11e Initial load
duke
parents:
diff changeset
  2539
        };
06bc494ca11e Initial load
duke
parents:
diff changeset
  2540
        for (int i = 0; i < noninlinetags.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2541
            text = replace(text, noninlinetags[i], "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  2542
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2543
        return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2544
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2545
06bc494ca11e Initial load
duke
parents:
diff changeset
  2546
    public String replace(String text, String tobe, String by) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2547
        while (true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2548
            int startindex = text.indexOf(tobe);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2549
            if (startindex < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2550
                return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2551
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2552
            int endindex = startindex + tobe.length();
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
  2553
            StringBuilder replaced = new StringBuilder();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2554
            if (startindex > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2555
                replaced.append(text.substring(0, startindex));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2556
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2557
            replaced.append(by);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2558
            if (text.length() > endindex) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2559
                replaced.append(text.substring(endindex));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2560
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2561
            text = replaced.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2562
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2563
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2564
06bc494ca11e Initial load
duke
parents:
diff changeset
  2565
    public void printStyleSheetProperties() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2566
        String filename = configuration.stylesheetfile;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2567
        if (filename.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2568
            File stylefile = new File(filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2569
            String parent = stylefile.getParent();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2570
            filename = (parent == null)?
06bc494ca11e Initial load
duke
parents:
diff changeset
  2571
                filename:
06bc494ca11e Initial load
duke
parents:
diff changeset
  2572
                filename.substring(parent.length() + 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2573
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2574
            filename = "stylesheet.css";
06bc494ca11e Initial load
duke
parents:
diff changeset
  2575
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2576
        filename = relativePath + filename;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2577
        link("REL =\"stylesheet\" TYPE=\"text/css\" HREF=\"" +
06bc494ca11e Initial load
duke
parents:
diff changeset
  2578
                 filename + "\" " + "TITLE=\"Style\"");
06bc494ca11e Initial load
duke
parents:
diff changeset
  2579
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2580
06bc494ca11e Initial load
duke
parents:
diff changeset
  2581
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2582
     * Returns a link to the stylesheet file.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2583
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2584
     * @return an HtmlTree for the lINK tag which provides the stylesheet location
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2585
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2586
    public HtmlTree getStyleSheetProperties() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2587
        String filename = configuration.stylesheetfile;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2588
        if (filename.length() > 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2589
            File stylefile = new File(filename);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2590
            String parent = stylefile.getParent();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2591
            filename = (parent == null)?
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2592
                filename:
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2593
                filename.substring(parent.length() + 1);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2594
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2595
            filename = "stylesheet.css";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2596
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2597
        filename = relativePath + filename;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2598
        HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", filename, "Style");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2599
        return link;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2600
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2601
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2602
    /**
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 8631
diff changeset
  2603
     * According to
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 8631
diff changeset
  2604
     * <cite>The Java&trade; Language Specification</cite>,
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 8631
diff changeset
  2605
     * all the outer classes and static nested classes are core classes.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2606
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2607
    public boolean isCoreClass(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2608
        return cd.containingClass() == null || cd.isStatic();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2609
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2610
06bc494ca11e Initial load
duke
parents:
diff changeset
  2611
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  2612
     * Write the annotatation types for the given packageDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2613
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2614
     * @param packageDoc the package to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2615
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2616
    public void writeAnnotationInfo(PackageDoc packageDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2617
        writeAnnotationInfo(packageDoc, packageDoc.annotations());
06bc494ca11e Initial load
duke
parents:
diff changeset
  2618
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2619
06bc494ca11e Initial load
duke
parents:
diff changeset
  2620
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2621
     * Adds the annotatation types for the given packageDoc.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2622
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2623
     * @param packageDoc the package to write annotations for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2624
     * @param htmltree the documentation tree to which the annotation info will be
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2625
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2626
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2627
    public void addAnnotationInfo(PackageDoc packageDoc, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2628
        addAnnotationInfo(packageDoc, packageDoc.annotations(), htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2629
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2630
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2631
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2632
     * Write the annotatation types for the given doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2633
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2634
     * @param doc the doc to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2635
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2636
    public void writeAnnotationInfo(ProgramElementDoc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2637
        writeAnnotationInfo(doc, doc.annotations());
06bc494ca11e Initial load
duke
parents:
diff changeset
  2638
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2639
06bc494ca11e Initial load
duke
parents:
diff changeset
  2640
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2641
     * Adds the annotatation types for the given doc.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2642
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
  2643
     * @param doc the package to write annotations for
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2644
     * @param htmltree the content tree to which the annotation types will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2645
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2646
    public void addAnnotationInfo(ProgramElementDoc doc, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2647
        addAnnotationInfo(doc, doc.annotations(), htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2648
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2649
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2650
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2651
     * Write the annotatation types for the given doc and parameter.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2652
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2653
     * @param indent the number of spaced to indent the parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2654
     * @param doc the doc to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2655
     * @param param the parameter to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2656
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2657
    public boolean writeAnnotationInfo(int indent, Doc doc, Parameter param) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2658
        return writeAnnotationInfo(indent, doc, param.annotations(), false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2659
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2660
06bc494ca11e Initial load
duke
parents:
diff changeset
  2661
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2662
     * Add the annotatation types for the given doc and parameter.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2663
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2664
     * @param indent the number of spaces to indent the parameters.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2665
     * @param doc the doc to write annotations for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2666
     * @param param the parameter to write annotations for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2667
     * @param tree the content tree to which the annotation types will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2668
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2669
    public boolean addAnnotationInfo(int indent, Doc doc, Parameter param,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2670
            Content tree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2671
        return addAnnotationInfo(indent, doc, param.annotations(), false, tree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2672
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2673
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2674
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2675
     * Write the annotatation types for the given doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2676
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2677
     * @param doc the doc to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2678
     * @param descList the array of {@link AnnotationDesc}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2679
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2680
    private void writeAnnotationInfo(Doc doc, AnnotationDesc[] descList) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2681
        writeAnnotationInfo(0, doc, descList, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2682
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2683
06bc494ca11e Initial load
duke
parents:
diff changeset
  2684
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2685
     * Adds the annotatation types for the given doc.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2686
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2687
     * @param doc the doc to write annotations for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2688
     * @param descList the array of {@link AnnotationDesc}.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2689
     * @param htmltree the documentation tree to which the annotation info will be
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2690
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2691
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2692
    private void addAnnotationInfo(Doc doc, AnnotationDesc[] descList,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2693
            Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2694
        addAnnotationInfo(0, doc, descList, true, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2695
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2696
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2697
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2698
     * Write the annotatation types for the given doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2699
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2700
     * @param indent the number of extra spaces to indent the annotations.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2701
     * @param doc the doc to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2702
     * @param descList the array of {@link AnnotationDesc}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2703
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2704
    private boolean writeAnnotationInfo(int indent, Doc doc, AnnotationDesc[] descList, boolean lineBreak) {
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  2705
        List<String> annotations = getAnnotations(indent, descList, lineBreak);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2706
        if (annotations.size() == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2707
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2708
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2709
        fontNoNewLine("-1");
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  2710
        for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) {
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  2711
            print(iter.next());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2712
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2713
        fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2714
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2715
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2716
06bc494ca11e Initial load
duke
parents:
diff changeset
  2717
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2718
     * Adds the annotatation types for the given doc.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2719
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2720
     * @param indent the number of extra spaces to indent the annotations.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2721
     * @param doc the doc to write annotations for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2722
     * @param descList the array of {@link AnnotationDesc}.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2723
     * @param htmltree the documentation tree to which the annotation info will be
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2724
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2725
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2726
    private boolean addAnnotationInfo(int indent, Doc doc,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2727
            AnnotationDesc[] descList, boolean lineBreak, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2728
        List<String> annotations = getAnnotations(indent, descList, lineBreak);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2729
        if (annotations.size() == 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2730
            return false;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2731
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2732
        Content annotationContent;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2733
        for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2734
            annotationContent = new RawHtml(iter.next());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2735
            htmltree.addContent(annotationContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2736
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2737
        return true;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2738
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2739
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  2740
   /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2741
     * Return the string representations of the annotation types for
06bc494ca11e Initial load
duke
parents:
diff changeset
  2742
     * the given doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2743
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2744
     * @param indent the number of extra spaces to indent the annotations.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2745
     * @param descList the array of {@link AnnotationDesc}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2746
     * @param linkBreak if true, add new line between each member value.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2747
     * @return an array of strings representing the annotations being
06bc494ca11e Initial load
duke
parents:
diff changeset
  2748
     *         documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2749
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  2750
    private List<String> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  2751
        List<String> results = new ArrayList<String>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2752
        StringBuffer annotation;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2753
        for (int i = 0; i < descList.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2754
            AnnotationTypeDoc annotationDoc = descList[i].annotationType();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2755
            if (! Util.isDocumentedAnnotation(annotationDoc)){
06bc494ca11e Initial load
duke
parents:
diff changeset
  2756
                continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2757
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2758
            annotation = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2759
            LinkInfoImpl linkInfo = new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
  2760
                LinkInfoImpl.CONTEXT_ANNOTATION, annotationDoc);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2761
            linkInfo.label = "@" + annotationDoc.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2762
            annotation.append(getLink(linkInfo));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2763
            AnnotationDesc.ElementValuePair[] pairs = descList[i].elementValues();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2764
            if (pairs.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2765
                annotation.append('(');
06bc494ca11e Initial load
duke
parents:
diff changeset
  2766
                for (int j = 0; j < pairs.length; j++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2767
                    if (j > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2768
                        annotation.append(",");
06bc494ca11e Initial load
duke
parents:
diff changeset
  2769
                        if (linkBreak) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2770
                            annotation.append(DocletConstants.NL);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2771
                            int spaces = annotationDoc.name().length() + 2;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2772
                            for (int k = 0; k < (spaces + indent); k++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2773
                                annotation.append(' ');
06bc494ca11e Initial load
duke
parents:
diff changeset
  2774
                            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2775
                        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2776
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2777
                    annotation.append(getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2778
                        pairs[j].element(), pairs[j].element().name(), false));
06bc494ca11e Initial load
duke
parents:
diff changeset
  2779
                    annotation.append('=');
06bc494ca11e Initial load
duke
parents:
diff changeset
  2780
                    AnnotationValue annotationValue = pairs[j].value();
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  2781
                    List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2782
                    if (annotationValue.value() instanceof AnnotationValue[]) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2783
                        AnnotationValue[] annotationArray =
06bc494ca11e Initial load
duke
parents:
diff changeset
  2784
                            (AnnotationValue[]) annotationValue.value();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2785
                        for (int k = 0; k < annotationArray.length; k++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2786
                            annotationTypeValues.add(annotationArray[k]);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2787
                        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2788
                    } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2789
                        annotationTypeValues.add(annotationValue);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2790
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2791
                    annotation.append(annotationTypeValues.size() == 1 ? "" : "{");
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  2792
                    for (Iterator<AnnotationValue> iter = annotationTypeValues.iterator(); iter.hasNext(); ) {
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  2793
                        annotation.append(annotationValueToString(iter.next()));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2794
                        annotation.append(iter.hasNext() ? "," : "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  2795
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2796
                    annotation.append(annotationTypeValues.size() == 1 ? "" : "}");
06bc494ca11e Initial load
duke
parents:
diff changeset
  2797
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2798
                annotation.append(")");
06bc494ca11e Initial load
duke
parents:
diff changeset
  2799
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2800
            annotation.append(linkBreak ? DocletConstants.NL : "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  2801
            results.add(annotation.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
  2802
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2803
        return results;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2804
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2805
06bc494ca11e Initial load
duke
parents:
diff changeset
  2806
    private String annotationValueToString(AnnotationValue annotationValue) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2807
        if (annotationValue.value() instanceof Type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2808
            Type type = (Type) annotationValue.value();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2809
            if (type.asClassDoc() != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2810
                LinkInfoImpl linkInfo = new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
  2811
                    LinkInfoImpl.CONTEXT_ANNOTATION, type);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2812
                    linkInfo.label = (type.asClassDoc().isIncluded() ?
06bc494ca11e Initial load
duke
parents:
diff changeset
  2813
                        type.typeName() :
06bc494ca11e Initial load
duke
parents:
diff changeset
  2814
                        type.qualifiedTypeName()) + type.dimension() + ".class";
06bc494ca11e Initial load
duke
parents:
diff changeset
  2815
                return getLink(linkInfo);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2816
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2817
                return type.typeName() + type.dimension() + ".class";
06bc494ca11e Initial load
duke
parents:
diff changeset
  2818
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2819
        } else if (annotationValue.value() instanceof AnnotationDesc) {
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  2820
            List<String> list = getAnnotations(0,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2821
                new AnnotationDesc[]{(AnnotationDesc) annotationValue.value()},
06bc494ca11e Initial load
duke
parents:
diff changeset
  2822
                    false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2823
            StringBuffer buf = new StringBuffer();
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  2824
            for (Iterator<String> iter = list.iterator(); iter.hasNext(); ) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2825
                buf.append(iter.next());
06bc494ca11e Initial load
duke
parents:
diff changeset
  2826
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2827
            return buf.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2828
        } else if (annotationValue.value() instanceof MemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2829
            return getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2830
                (MemberDoc) annotationValue.value(),
06bc494ca11e Initial load
duke
parents:
diff changeset
  2831
                ((MemberDoc) annotationValue.value()).name(), false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2832
         } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2833
            return annotationValue.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2834
         }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2835
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2836
06bc494ca11e Initial load
duke
parents:
diff changeset
  2837
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  2838
     * Return the configuation for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2839
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2840
     * @return the configuration for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2841
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2842
    public Configuration configuration() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2843
        return configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2844
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2845
}