langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java
author jjg
Mon, 22 Aug 2016 16:32:40 -0700
changeset 40587 1c355ea550ed
parent 40508 74ef30d16fb9
child 42277 2668b0bc7ad7
permissions -rw-r--r--
8164130: Simplify doclet IOException handling Reviewed-by: bpatel, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40229
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
     1
/*
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
     4
 *
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    10
 *
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    15
 * accompanied this code).
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    16
 *
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    20
 *
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    23
 * questions.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    24
 */
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    25
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    27
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    28
import java.util.*;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    29
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    30
import javax.lang.model.element.ModuleElement;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    31
import javax.lang.model.element.PackageElement;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    32
import javax.lang.model.element.TypeElement;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    33
import javax.lang.model.util.ElementFilter;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    34
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    35
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    36
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    37
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    38
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    39
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    40
import jdk.javadoc.internal.doclets.toolkit.Content;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    41
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
40229
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    42
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    43
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    44
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    45
/**
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    46
 * Class to generate file for each module contents in the left-hand bottom
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    47
 * frame. This will list all the Class Kinds in the module. A click on any
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    48
 * class-kind will update the right-hand frame with the clicked class-kind page.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    49
 *
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    50
 *  <p><b>This is NOT part of any supported API.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    51
 *  If you write code that depends on this, you do so at your own risk.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    52
 *  This code and its internal interfaces are subject to change or
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    53
 *  deletion without notice.</b>
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    54
 *
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    55
 * @author Bhavesh Patel
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    56
 */
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    57
public class ModuleFrameWriter extends HtmlDocletWriter {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    58
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    59
    /**
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    60
     * The module being documented.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    61
     */
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 40229
diff changeset
    62
    private final ModuleElement mdle;
40229
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    63
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    64
    /**
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    65
     * The classes to be documented.  Use this to filter out classes
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    66
     * that will not be documented.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    67
     */
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    68
    private SortedSet<TypeElement> documentedClasses;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    69
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    70
    /**
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    71
     * Constructor to construct ModuleFrameWriter object and to generate
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    72
     * "module_name-type-frame.html" file. For example for module "java.base" this will generate file
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    73
     * "java.base-type-frame.html" file.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    74
     *
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    75
     * @param configuration the configuration of the doclet.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    76
     * @param moduleElement moduleElement under consideration.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    77
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    78
    public ModuleFrameWriter(ConfigurationImpl configuration, ModuleElement moduleElement) {
40229
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    79
        super(configuration, DocPaths.moduleTypeFrame(moduleElement));
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    80
        this.mdle = moduleElement;
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40303
diff changeset
    81
        if (configuration.getSpecifiedPackages().isEmpty()) {
40229
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    82
            documentedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator());
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40303
diff changeset
    83
            documentedClasses.addAll(configuration.docEnv.getIncludedTypeElements());
40229
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    84
        }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    85
    }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    86
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    87
    /**
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    88
     * Generate a module type summary page for the left-hand bottom frame.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    89
     *
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    90
     * @param configuration the current configuration of the doclet.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    91
     * @param moduleElement The package for which "module_name-type-frame.html" is to be generated.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    92
     * @throws DocFileIOException if there is a problem generating the module summary file
40229
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
    93
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    94
    public static void generate(ConfigurationImpl configuration, ModuleElement moduleElement)
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    95
            throws DocFileIOException {
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    96
        ModuleFrameWriter mdlgen = new ModuleFrameWriter(configuration, moduleElement);
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    97
        String mdlName = moduleElement.getQualifiedName().toString();
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    98
        Content mdlLabel = new StringContent(mdlName);
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    99
        HtmlTree body = mdlgen.getBody(false, mdlgen.getWindowTitle(mdlName));
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   100
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   101
                ? HtmlTree.MAIN()
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   102
                : body;
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   103
        Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   104
                mdlgen.getHyperLink(DocPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame"));
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   105
        htmlTree.addContent(heading);
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   106
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   107
        div.addStyle(HtmlStyle.indexContainer);
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   108
        mdlgen.addClassListing(div);
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   109
        htmlTree.addContent(div);
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   110
        if (configuration.allowTag(HtmlTag.MAIN)) {
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   111
            body.addContent(htmlTree);
40229
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   112
        }
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   113
        mdlgen.printHtmlDocument(
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   114
                configuration.metakeywords.getMetaKeywordsForModule(moduleElement), false, body);
40229
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   115
    }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   116
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   117
    /**
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   118
     * Add class listing for all the classes in this module. Divide class
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   119
     * listing as per the class kind and generate separate listing for
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   120
     * Classes, Interfaces, Exceptions and Errors.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   121
     *
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   122
     * @param contentTree the content tree to which the listing will be added
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   123
     */
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   124
    protected void addClassListing(HtmlTree contentTree) {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   125
        List<PackageElement> packagesIn = ElementFilter.packagesIn(mdle.getEnclosedElements());
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   126
        SortedSet<TypeElement> interfaces = new TreeSet<>(utils.makeGeneralPurposeComparator());
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   127
        SortedSet<TypeElement> classes = new TreeSet<>(utils.makeGeneralPurposeComparator());
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   128
        SortedSet<TypeElement> enums = new TreeSet<>(utils.makeGeneralPurposeComparator());
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   129
        SortedSet<TypeElement> exceptions = new TreeSet<>(utils.makeGeneralPurposeComparator());
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   130
        SortedSet<TypeElement> errors = new TreeSet<>(utils.makeGeneralPurposeComparator());
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   131
        SortedSet<TypeElement> annotationTypes = new TreeSet<>(utils.makeGeneralPurposeComparator());
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   132
        for (PackageElement pkg : packagesIn) {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   133
            if (utils.isIncluded(pkg)) {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   134
                interfaces.addAll(utils.getInterfaces(pkg));
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   135
                classes.addAll(utils.getOrdinaryClasses(pkg));
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   136
                enums.addAll(utils.getEnums(pkg));
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   137
                exceptions.addAll(utils.getExceptions(pkg));
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   138
                errors.addAll(utils.getErrors(pkg));
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   139
                annotationTypes.addAll(utils.getAnnotationTypes(pkg));
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   140
            }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   141
        }
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 40229
diff changeset
   142
        addClassKindListing(interfaces, contents.interfaces, contentTree);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 40229
diff changeset
   143
        addClassKindListing(classes, contents.classes, contentTree);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 40229
diff changeset
   144
        addClassKindListing(enums, contents.enums, contentTree);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 40229
diff changeset
   145
        addClassKindListing(exceptions, contents.exceptions, contentTree);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 40229
diff changeset
   146
        addClassKindListing(errors, contents.errors, contentTree);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 40229
diff changeset
   147
        addClassKindListing(annotationTypes, contents.annotationTypes, contentTree);
40229
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   148
    }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   149
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   150
    /**
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   151
     * Add specific class kind listing. Also add label to the listing.
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   152
     *
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   153
     * @param list Iterable list of TypeElements
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   154
     * @param labelContent content tree of the label to be added
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   155
     * @param contentTree the content tree to which the class kind listing will be added
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   156
     */
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   157
    protected void addClassKindListing(Iterable<TypeElement> list, Content labelContent,
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   158
            HtmlTree contentTree) {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   159
        SortedSet<TypeElement> tset = utils.filterOutPrivateClasses(list, configuration.javafx);
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   160
        if (!tset.isEmpty()) {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   161
            boolean printedHeader = false;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   162
            HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   163
                    ? HtmlTree.SECTION()
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   164
                    : contentTree;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   165
            HtmlTree ul = new HtmlTree(HtmlTag.UL);
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   166
            ul.setTitle(labelContent);
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   167
            for (TypeElement typeElement : tset) {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   168
                if (documentedClasses != null && !documentedClasses.contains(typeElement)) {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   169
                    continue;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   170
                }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   171
                if (!utils.isCoreClass(typeElement) || !configuration.isGeneratedDoc(typeElement)) {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   172
                    continue;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   173
                }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   174
                if (!printedHeader) {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   175
                    Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   176
                            true, labelContent);
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   177
                    htmlTree.addContent(heading);
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   178
                    printedHeader = true;
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   179
                }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   180
                Content arr_i_name = new StringContent(utils.getSimpleName(typeElement));
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   181
                if (utils.isInterface(typeElement)) {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   182
                    arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   183
                }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   184
                Content link = getLink(new LinkInfoImpl(configuration,
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   185
                        LinkInfoImpl.Kind.ALL_CLASSES_FRAME, typeElement).label(arr_i_name).target("classFrame"));
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   186
                Content li = HtmlTree.LI(link);
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   187
                ul.addContent(li);
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   188
            }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   189
            htmlTree.addContent(ul);
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   190
            if (configuration.allowTag(HtmlTag.SECTION)) {
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   191
                contentTree.addContent(htmlTree);
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   192
            }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   193
        }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   194
    }
09f4478d07e5 8154817: Fix the click-through navigation for modules
bpatel
parents:
diff changeset
   195
}