langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
author jjg
Tue, 09 Oct 2012 19:10:00 -0700
changeset 14258 8d2148961366
parent 9606 e5a619cb5dd3
child 14259 fb94a1df0d53
permissions -rw-r--r--
8000663: clean up langtools imports Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9606
diff changeset
     2
 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
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: 2320
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: 2320
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
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
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    28
import java.io.*;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9606
diff changeset
    29
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9606
diff changeset
    30
import com.sun.tools.doclets.formats.html.markup.*;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    31
import com.sun.tools.doclets.internal.toolkit.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import com.sun.tools.doclets.internal.toolkit.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * Generate File to list all the deprecated classes and class members with the
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * appropriate links.
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * @see java.util.List
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * @author Atul M Dambalkar
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    40
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
public class DeprecatedListWriter extends SubWriterHolderWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
    private static final String[] ANCHORS = new String[] {
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
    45
        "package", "interface", "class", "enum", "exception", "error",
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
    46
        "annotation_type", "field", "method", "constructor", "enum_constant",
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
        "annotation_type_member"
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
    };
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
    private static final String[] HEADING_KEYS = new String[] {
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
    51
        "doclet.Deprecated_Packages", "doclet.Deprecated_Interfaces",
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
    52
        "doclet.Deprecated_Classes", "doclet.Deprecated_Enums",
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
    53
        "doclet.Deprecated_Exceptions", "doclet.Deprecated_Errors",
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
        "doclet.Deprecated_Annotation_Types",
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
        "doclet.Deprecated_Fields",
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
        "doclet.Deprecated_Methods", "doclet.Deprecated_Constructors",
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
        "doclet.Deprecated_Enum_Constants",
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
        "doclet.Deprecated_Annotation_Type_Members"
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    };
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    61
    private static final String[] SUMMARY_KEYS = new String[] {
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
    62
        "doclet.deprecated_packages", "doclet.deprecated_interfaces",
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
    63
        "doclet.deprecated_classes", "doclet.deprecated_enums",
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
    64
        "doclet.deprecated_exceptions", "doclet.deprecated_errors",
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    65
        "doclet.deprecated_annotation_types",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    66
        "doclet.deprecated_fields",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    67
        "doclet.deprecated_methods", "doclet.deprecated_constructors",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    68
        "doclet.deprecated_enum_constants",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    69
        "doclet.deprecated_annotation_type_members"
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    70
    };
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    71
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    72
    private static final String[] HEADER_KEYS = new String[] {
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
    73
        "doclet.Package", "doclet.Interface", "doclet.Class",
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    74
        "doclet.Enum", "doclet.Exceptions",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    75
        "doclet.Errors",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    76
        "doclet.AnnotationType",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    77
        "doclet.Field",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    78
        "doclet.Method", "doclet.Constructor",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    79
        "doclet.Enum_Constant",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    80
        "doclet.Annotation_Type_Member"
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    81
    };
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
    82
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    private AbstractMemberWriter[] writers;
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    private ConfigurationImpl configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     * Constructor.
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
     * @param filename the file to be generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
    public DeprecatedListWriter(ConfigurationImpl configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
                                String filename) throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
        super(configuration, filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
        this.configuration = configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
        NestedClassWriterImpl classW = new NestedClassWriterImpl(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
        writers = new AbstractMemberWriter[]
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
            {classW, classW, classW, classW, classW, classW,
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
            new FieldWriterImpl(this),
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
            new MethodWriterImpl(this),
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
            new ConstructorWriterImpl(this),
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
            new EnumConstantWriterImpl(this),
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
            new AnnotationTypeOptionalMemberWriterImpl(this, null)};
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
     * Get list of all the deprecated classes and members in all the Packages
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     * specified on the Command Line.
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * Then instantiate DeprecatedListWriter and generate File.
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     * @param configuration the current configuration of the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    public static void generate(ConfigurationImpl configuration) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
        String filename = "deprecated-list.html";
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
            DeprecatedListWriter depr =
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
                   new DeprecatedListWriter(configuration, filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
            depr.generateDeprecatedListFile(
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   119
                   new DeprecatedAPIListBuilder(configuration));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
            depr.close();
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        } catch (IOException exc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
            configuration.standardmessage.error(
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
                        "doclet.exception_encountered",
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
                        exc.toString(), filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
            throw new DocletAbortException();
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   130
     * Generate the deprecated API list.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     * @param deprapi list of deprecated API built already.
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
    protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi)
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   135
            throws IOException {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   136
        Content body = getHeader();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   137
        body.addContent(getContentsList(deprapi));
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
   138
        String memberTableSummary;
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
   139
        String[] memberTableHeader = new String[1];
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   140
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   141
        div.addStyle(HtmlStyle.contentContainer);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
        for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
            if (deprapi.hasDocumentation(i)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   144
                addAnchor(deprapi, i, div);
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
   145
                memberTableSummary =
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
   146
                        configuration.getText("doclet.Member_Table_Summary",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
   147
                        configuration.getText(HEADING_KEYS[i]),
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
   148
                        configuration.getText(SUMMARY_KEYS[i]));
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
   149
                memberTableHeader[0] = configuration.getText("doclet.0_and_1",
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
   150
                        configuration.getText(HEADER_KEYS[i]),
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1787
diff changeset
   151
                        configuration.getText("doclet.Description"));
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   152
                // DeprecatedAPIListBuilder.PACKAGE == 0, so if i == 0, it is
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   153
                // a PackageDoc.
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   154
                if (i == DeprecatedAPIListBuilder.PACKAGE)
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   155
                    addPackageDeprecatedAPI(deprapi.getList(i),
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   156
                            HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   157
                else
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   158
                    writers[i - 1].addDeprecatedAPI(deprapi.getList(i),
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   159
                            HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   162
        body.addContent(div);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   163
        addNavLinks(false, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   164
        addBottom(body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   165
        printHtmlDocument(null, true, body);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   168
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   169
     * Add the index link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   170
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   171
     * @param builder the deprecated list builder
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   172
     * @param type the type of list being documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   173
     * @param contentTree the content tree to which the index link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   174
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   175
    private void addIndexLink(DeprecatedAPIListBuilder builder,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   176
            int type, Content contentTree) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
        if (builder.hasDocumentation(type)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   178
            Content li = HtmlTree.LI(getHyperLink("#" + ANCHORS[type],
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   179
                    getResource(HEADING_KEYS[type])));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   180
            contentTree.addContent(li);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   185
     * Get the contents list.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   186
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   187
     * @param deprapi the deprecated list builder
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   188
     * @return a content tree for the contents list
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   190
    public Content getContentsList(DeprecatedAPIListBuilder deprapi) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   191
        Content headContent = getResource("doclet.Deprecated_API");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   192
        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   193
                HtmlStyle.title, headContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   194
        Content div = HtmlTree.DIV(HtmlStyle.header, heading);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   195
        Content headingContent = getResource("doclet.Contents");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   196
        div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   197
                headingContent));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   198
        Content ul = new HtmlTree(HtmlTag.UL);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   199
        for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   200
            addIndexLink(deprapi, i, ul);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   201
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   202
        div.addContent(ul);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   203
        return div;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   207
     * Add the anchor.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   208
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   209
     * @param builder the deprecated list builder
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   210
     * @param type the type of list being documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   211
     * @param contentTree the content tree to which the anchor will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   213
    private void addAnchor(DeprecatedAPIListBuilder builder, int type, Content htmlTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   214
        if (builder.hasDocumentation(type)) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   215
            htmlTree.addContent(getMarkerAnchor(ANCHORS[type]));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   216
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   220
     * Get the header for the deprecated API Listing.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   221
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   222
     * @return a content tree for the header
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   224
    public Content getHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   225
        String title = configuration.getText("doclet.Window_Deprecated_List");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   226
        Content bodyTree = getBody(true, getWindowTitle(title));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   227
        addTop(bodyTree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   228
        addNavLinks(true, bodyTree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   229
        return bodyTree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   230
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   231
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   232
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   233
     * Get the deprecated label.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   234
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   235
     * @return a content tree for the deprecated label
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   236
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   237
    protected Content getNavLinkDeprecated() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   238
        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, deprecatedLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   239
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
}