langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
author bpatel
Thu, 08 Jan 2009 16:26:59 -0800
changeset 1787 1aa079321cd2
parent 10 06bc494ca11e
child 2216 b124d5c924eb
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 2003-2005 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;
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
import com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import com.sun.tools.doclets.internal.toolkit.taglets.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import com.sun.tools.doclets.internal.toolkit.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import com.sun.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * The taglet writer that writes HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * @since 1.5
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * @author Jamie Ho
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
public class TagletWriterImpl extends TagletWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
    private HtmlDocletWriter htmlWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
    public TagletWriterImpl(HtmlDocletWriter htmlWriter, boolean isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
        this.htmlWriter = htmlWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
        this.isFirstSentence = isFirstSentence;
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
    public TagletOutput getOutputInstance() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
        return new TagletOutputImpl("");
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
    public TagletOutput getDocRootOutput() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
        return new TagletOutputImpl(htmlWriter.relativepathNoSlash);
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
    public TagletOutput deprecatedTagOutput(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
        StringBuffer output = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
        Tag[] deprs = doc.tags("deprecated");
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
        if (doc instanceof ClassDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
            if (Util.isDeprecated((ProgramElementDoc) doc)) {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    72
                output.append("<STRONG>" +
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
                    ConfigurationImpl.getInstance().
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    74
                        getText("doclet.Deprecated") + "</STRONG>&nbsp;");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
                if (deprs.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
                    Tag[] commentTags = deprs[0].inlineTags();
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
                    if (commentTags.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
                        output.append(commentTagsToOutput(null, doc,
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
                            deprs[0].inlineTags(), false).toString()
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
                        );
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
                output.append("<p>");
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
            MemberDoc member = (MemberDoc) doc;
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
            if (Util.isDeprecated((ProgramElementDoc) doc)) {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    89
                output.append("<DD><STRONG>" +
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
                    ConfigurationImpl.getInstance().
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
    91
                            getText("doclet.Deprecated") + "</STRONG>&nbsp;");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
                if (deprs.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
                    output.append("<I>");
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
                    output.append(commentTagsToOutput(null, doc,
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
                        deprs[0].inlineTags(), false).toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
                    output.append("</I>");
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
                if (member instanceof ExecutableMemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
                    output.append(DocletConstants.NL + "<P>" +
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
                        DocletConstants.NL);
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
                if (Util.isDeprecated(member.containingClass())) {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   104
                    output.append("<DD><STRONG>" +
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
                    ConfigurationImpl.getInstance().
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   106
                            getText("doclet.Deprecated") + "</STRONG>&nbsp;");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
        return new TagletOutputImpl(output.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
    public MessageRetriever getMsgRetriever() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
        return htmlWriter.configuration.message;
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
    public TagletOutput getParamHeader(String header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
        StringBuffer result = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        result.append("<DT>");
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   126
        result.append("<STRONG>" +  header + "</STRONG>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
        return new TagletOutputImpl(result.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
    public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
        TagletOutput result = new TagletOutputImpl("<DD><CODE>" + paramName + "</CODE>"
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
         + " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false));
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
        return result;
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
    public TagletOutput returnTagOutput(Tag returnTag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
        TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<DT>" +
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   144
            "<STRONG>" + htmlWriter.configuration.getText("doclet.Returns") +
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   145
            "</STRONG>" + "<DD>" +
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
            htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(),
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
            false));
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
        return result;
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
    public TagletOutput seeTagOutput(Doc holder, SeeTag[] seeTags) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
        String result = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
        if (seeTags.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
            result = addSeeHeader(result);
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
            for (int i = 0; i < seeTags.length; ++i) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
                if (i > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
                    result += ", " + DocletConstants.NL;
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
                result += htmlWriter.seeTagToString(seeTags[i]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
        if (holder.isField() && ((FieldDoc)holder).constantValue() != null &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
                htmlWriter instanceof ClassWriterImpl) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
            //Automatically add link to constant values page for constant fields.
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
            result = addSeeHeader(result);
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
            result += htmlWriter.getHyperLink(htmlWriter.relativePath +
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
                ConfigurationImpl.CONSTANTS_FILE_NAME
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
                + "#" + ((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName()
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
                + "." + ((FieldDoc) holder).name(),
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
                htmlWriter.configuration.getText("doclet.Constants_Summary"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
        if (holder.isClass() && ((ClassDoc)holder).isSerializable()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
            //Automatically add link to serialized form page for serializable classes.
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
            if (!(SerializedFormBuilder.serialInclude(holder) &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
                      SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
                return result.equals("") ? null : new TagletOutputImpl(result);
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
            result = addSeeHeader(result);
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
            result += htmlWriter.getHyperLink(htmlWriter.relativePath + "serialized-form.html",
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
                ((ClassDoc)holder).qualifiedName(), htmlWriter.configuration.getText("doclet.Serialized_Form"), false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
        return result.equals("") ? null : new TagletOutputImpl(result);
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    private String addSeeHeader(String result) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
        if (result != null && result.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
            return result + ", " + DocletConstants.NL;
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
        } else {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   192
            return "<DT><STRONG>" + htmlWriter.configuration().getText("doclet.See_Also") + "</STRONG><DD>";
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
     }
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   200
        String result = "<DT><STRONG>" + header + "</STRONG></DT>" + DocletConstants.NL +
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
            "  <DD>";
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
        for (int i = 0; i < simpleTags.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
            if (i > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
                result += ", ";
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
            result += htmlWriter.commentTagsToString(simpleTags[i], null, simpleTags[i].inlineTags(), false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
         return new TagletOutputImpl(result + "</DD>" + DocletConstants.NL);
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
    public TagletOutput simpleTagOutput(Tag simpleTag, String header) {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   215
        return new TagletOutputImpl("<DT><STRONG>" + header + "</STRONG></DT>" + "  <DD>"
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
            + htmlWriter.commentTagsToString(simpleTag, null, simpleTag.inlineTags(), false)
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
            + "</DD>" + DocletConstants.NL);
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
    public TagletOutput getThrowsHeader() {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   224
        return new TagletOutputImpl(DocletConstants.NL + "<DT>" + "<STRONG>" +
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 10
diff changeset
   225
            htmlWriter.configuration().getText("doclet.Throws") + "</STRONG>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
    public TagletOutput throwsTagOutput(ThrowsTag throwsTag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
        String result = DocletConstants.NL + "<DD>";
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
        result += throwsTag.exceptionType() == null ?
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
            htmlWriter.codeText(throwsTag.exceptionName()) :
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
            htmlWriter.codeText(
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
                htmlWriter.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
                throwsTag.exceptionType())));
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
        TagletOutput text = new TagletOutputImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
            htmlWriter.commentTagsToString(throwsTag, null,
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
            throwsTag.inlineTags(), false));
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
        if (text != null && text.toString().length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
            result += " - " + text;
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
        return new TagletOutputImpl(result);
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
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
    public TagletOutput throwsTagOutput(Type throwsType) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
        return new TagletOutputImpl(DocletConstants.NL + "<DD>" +
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
            htmlWriter.codeText(htmlWriter.getLink(
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
                new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, throwsType))));
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
    public TagletOutput valueTagOutput(FieldDoc field, String constantVal,
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
            boolean includeLink) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
        return new TagletOutputImpl(includeLink ?
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
            htmlWriter.getDocLink(LinkInfoImpl.CONTEXT_VALUE_TAG, field,
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
                constantVal, false) : constantVal);
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
    public TagletOutput commentTagsToOutput(Tag holderTag, Tag[] tags) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
        return commentTagsToOutput(holderTag, null, tags, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
    public TagletOutput commentTagsToOutput(Doc holderDoc, Tag[] tags) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
        return commentTagsToOutput(null, holderDoc, tags, false);
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
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
    public TagletOutput commentTagsToOutput(Tag holderTag,
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
        Doc holderDoc, Tag[] tags, boolean isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
        return new TagletOutputImpl(htmlWriter.commentTagsToString(
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
            holderTag, holderDoc, tags, isFirstSentence));
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
    public Configuration configuration() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
        return htmlWriter.configuration();
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
     * Return an instance of a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
     * @return an instance of a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
    public TagletOutput getTagletOutputInstance() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
        return new TagletOutputImpl("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
}