langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
author bpatel
Thu, 08 Jan 2009 16:26:59 -0800
changeset 1787 1aa079321cd2
parent 10 06bc494ca11e
child 1869 0e193a8f3520
permissions -rw-r--r--
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
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
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
 * have any questions.
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.doclets.formats.html.markup;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import com.sun.tools.doclets.internal.toolkit.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import com.sun.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import java.io.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import java.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
import com.sun.tools.doclets.internal.toolkit.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * Class for the Html Format Code Generation specific to JavaDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * This Class contains methods related to the Html Code Generation which
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * are used by the Sub-Classes in the package com.sun.tools.doclets.standard
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * and com.sun.tools.doclets.oneone.
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * @since 1.2
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * @author Robert Field
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
public abstract class HtmlDocWriter extends HtmlWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
     * Constructor. Initializes the destination file name through the super
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
     * class HtmlWriter.
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
     * @param filename String file name.
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
    public HtmlDocWriter(Configuration configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
                         String filename) throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
        super(configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
              null, configuration.destDirName + filename,
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
              configuration.docencoding);
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
        configuration.message.notice("doclet.Generating_0",
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
                                     configuration.destDirName + filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
    public HtmlDocWriter(Configuration configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
                         String path, String filename) throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
        super(configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
              configuration.destDirName + path, filename,
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
              configuration.docencoding);
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
        configuration.message.notice("doclet.Generating_0",
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
                                     configuration.destDirName +
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
                                         ((path.length() > 0)?
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
                                              path + File.separator: "") + filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * Accessor for configuration.
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    public abstract Configuration configuration();
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     * Print Html Hyper Link.
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     * @param link String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     * @param where Position of the link in the file. Character '#' is not
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     * needed.
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * @param label Tag for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    86
     * @param strong  Boolean that sets label to strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
    public void printHyperLink(String link, String where,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    89
                               String label, boolean strong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    90
        print(getHyperLink(link, where, label, strong, "", "", ""));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     * Print Html Hyper Link.
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     * @param link String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     * @param where Position of the link in the file. Character '#' is not
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     * needed.
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     * @param label Tag for the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
    public void printHyperLink(String link, String where, String label) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
        printHyperLink(link, where, label, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     * Print Html Hyper Link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     * @param link       String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * @param where      Position of the link in the file. Character '#' is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * needed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     * @param label      Tag for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   112
     * @param strong       Boolean that sets label to strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     * @param stylename  String style of text defined in style sheet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    public void printHyperLink(String link, String where,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   116
                               String label, boolean strong,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
                               String stylename) {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   118
        print(getHyperLink(link, where, label, strong, stylename, "", ""));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
     * Return Html Hyper Link string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
     * @param link       String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     * @param where      Position of the link in the file. Character '#' is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     * needed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
     * @param label      Tag for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   128
     * @param strong       Boolean that sets label to strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
     * @return String    Hyper Link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
    public String getHyperLink(String link, String where,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   132
                               String label, boolean strong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   133
        return getHyperLink(link, where, label, strong, "", "", "");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * Get Html Hyper Link string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * @param link       String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * @param where      Position of the link in the file. Character '#' is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     *                   needed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     * @param label      Tag for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   143
     * @param strong       Boolean that sets label to strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     * @param stylename  String style of text defined in style sheet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     * @return String    Hyper Link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
    public String getHyperLink(String link, String where,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   148
                               String label, boolean strong,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
                               String stylename) {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   150
        return getHyperLink(link, where, label, strong, stylename, "", "");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     * Get Html Hyper Link string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
     * @param link       String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
     * @param where      Position of the link in the file. Character '#' is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
     *                   needed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
     * @param label      Tag for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   160
     * @param strong       Boolean that sets label to strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     * @param stylename  String style of text defined in style sheet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
     * @param title      String that describes the link's content for accessibility.
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
     * @param target     Target frame.
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
     * @return String    Hyper Link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
    public String getHyperLink(String link, String where,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   167
                               String label, boolean strong,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
                               String stylename, String title, String target) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
        StringBuffer retlink = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
        retlink.append("<A HREF=\"");
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
        retlink.append(link);
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
        if (where != null && where.length() != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
            retlink.append("#");
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
            retlink.append(where);
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
        retlink.append("\"");
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
        if (title != null && title.length() != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
            retlink.append(" title=\"" + title + "\"");
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
        if (target != null && target.length() != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
            retlink.append(" target=\"" + target + "\"");
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
        retlink.append(">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
        if (stylename != null && stylename.length() != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
            retlink.append("<FONT CLASS=\"");
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
            retlink.append(stylename);
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
            retlink.append("\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
        }
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   189
        if (strong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   190
            retlink.append("<STRONG>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
        retlink.append(label);
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   193
        if (strong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   194
            retlink.append("</STRONG>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
        if (stylename != null && stylename.length() != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
            retlink.append("</FONT>");
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
        retlink.append("</A>");
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
        return retlink.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     * Print link without positioning in the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
     * @param link       String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
     * @param label      Tag for the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
    public void printHyperLink(String link, String label) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
        print(getHyperLink(link, "", label, false));
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
     * Get link string without positioning in the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
     * @param link       String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
     * @param label      Tag for the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
     * @return Strign    Hyper link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
    public String getHyperLink(String link, String label) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
        return getHyperLink(link, "", label, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
     * Print the name of the package, this class is in.
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
     * @param cd    ClassDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    public void printPkgName(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
        print(getPkgName(cd));
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
     * Get the name of the package, this class is in.
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
     * @param cd    ClassDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
    public String getPkgName(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
        String pkgName = cd.containingPackage().name();
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
        if (pkgName.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
            pkgName += ".";
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
            return pkgName;
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
        return "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
     * Print the frameset version of the Html file header.
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
     * Called only when generating an HTML frameset file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
     * @param title    Title of this HTML document.
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
    public void printFramesetHeader(String title) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
        printFramesetHeader(title, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
     * Print the frameset version of the Html file header.
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
     * Called only when generating an HTML frameset file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
     * @param title        Title of this HTML document.
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
     * @param noTimeStamp  If true, don't print time stamp in header.
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
    public void printFramesetHeader(String title, boolean noTimeStamp) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
        println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " +
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
                    "Frameset//EN\" " +
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
                    "\"http://www.w3.org/TR/html4/frameset.dtd\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
        println("<!--NewPage-->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
        html();
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
        head();
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
        if (! noTimeStamp) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
            print("<!-- Generated by javadoc on ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
            print(today());
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
            println("-->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
        if (configuration.charset.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
            println("<META http-equiv=\"Content-Type\" content=\"text/html; "
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
                        + "charset=" + configuration.charset + "\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
        title();
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
        println(title);
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
        titleEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
        //Script to set the classFrame if necessary.
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
        script();
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
        println("    targetPage = \"\" + window.location.search;");
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
        println("    if (targetPage != \"\" && targetPage != \"undefined\")");
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
        println("        targetPage = targetPage.substring(1);");
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
        println("    if (targetPage.indexOf(\":\") != -1)");
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
        println("        targetPage = \"undefined\";");
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
        println("    function loadFrames() {");
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
        println("        if (targetPage != \"\" && targetPage != \"undefined\")");
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
        println("             top.classFrame.location = top.targetPage;");
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
        println("    }");
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
        scriptEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
        noScript();
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
        noScriptEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
        headEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
     * Print the appropriate spaces to format the class tree in the class page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
     * @param len   Number of spaces.
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
    public String spaces(int len) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
        String space = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
        for (int i = 0; i < len; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
            space += " ";
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
        return space;
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
     * Print the closing &lt;/body&gt; and &lt;/html&gt; tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
    public void printBodyHtmlEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
        println();
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
        bodyEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
        htmlEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
     * Calls {@link #printBodyHtmlEnd()} method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
    public void printFooter() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
        printBodyHtmlEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
     * Print closing &lt;/html&gt; tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
    public void printFrameFooter() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
        htmlEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
     * Print ten non-breaking spaces("&#38;nbsp;").
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
    public void printNbsps() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
        print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
     * Get the day and date information for today, depending upon user option.
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
     * @return String Today.
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
     * @see java.util.Calendar
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
     * @see java.util.GregorianCalendar
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
     * @see java.util.TimeZone
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
    public String today() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
        Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
        return calendar.getTime().toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
}