src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
author pmuthuswamy
Tue, 23 Apr 2019 18:28:48 +0530
changeset 54596 86c1da00dd6a
parent 54350 4f9772f4403d
child 54610 a9ab154b1384
permissions -rw-r--r--
8219998: Eliminate inherently singleton lists Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
53863
d001808c57e8 8218998: Add metadata to generated API documentation files
jjg
parents: 53562
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     4
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    10
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    15
 * accompanied this code).
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    16
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    20
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    23
 * questions.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    24
 */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    25
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    27
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
    28
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
    29
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
    30
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
    31
import java.util.ArrayList;
44293
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 42831
diff changeset
    32
import java.util.Collections;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    33
import java.util.List;
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
    34
import java.util.Map;
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    35
import java.util.Set;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    36
import java.util.SortedSet;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    37
import java.util.TreeMap;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    38
import java.util.TreeSet;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    39
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    40
import javax.lang.model.element.Element;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    41
import javax.lang.model.element.ModuleElement;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    42
import javax.lang.model.element.PackageElement;
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
    43
import javax.lang.model.element.TypeElement;
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    44
import javax.lang.model.util.ElementFilter;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    45
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    46
import com.sun.source.doctree.DocTree;
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    47
import jdk.javadoc.doclet.DocletEnvironment.ModuleMode;
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
    48
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    49
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    50
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    51
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    52
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    53
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    54
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
    55
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    56
import jdk.javadoc.internal.doclets.toolkit.Content;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    57
import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    58
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
    59
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    60
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    61
/**
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    62
 * Class to generate file for each module contents in the right-hand frame. This will list all the
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    63
 * required modules, packages and service types for the module. A click on any of the links will update
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    64
 * the frame with the clicked element page.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    65
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    66
 *  <p><b>This is NOT part of any supported API.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    67
 *  If you write code that depends on this, you do so at your own risk.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    68
 *  This code and its internal interfaces are subject to change or
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    69
 *  deletion without notice.</b>
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    70
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    71
 * @author Bhavesh Patel
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    72
 */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    73
public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryWriter {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    74
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    75
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    76
     * The module being documented.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    77
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    78
    protected ModuleElement mdle;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    79
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    80
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    81
     * The module mode for this javadoc run. It can be set to "api" or "all".
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    82
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    83
    private final ModuleMode moduleMode;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    84
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    85
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    86
     * Map of module elements and modifiers required by this module.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    87
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    88
    private final Map<ModuleElement, Content> requires
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    89
            = new TreeMap<>(utils.makeModuleComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    90
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    91
    /**
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
    92
     * Map of indirect modules and modifiers, transitive closure, required by this module.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    93
     */
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
    94
    private final Map<ModuleElement, Content> indirectModules
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    95
            = new TreeMap<>(utils.makeModuleComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    96
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    97
    /**
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
    98
     * Details about a package in a module.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
    99
     * A package may be not exported, or exported to some modules, or exported to all modules.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   100
     * A package may be not opened, or opened to some modules, or opened to all modules.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   101
     * A package that is neither exported or opened to any modules is a concealed package.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   102
     * An open module opens all its packages to all modules.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   103
     */
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   104
    class PackageEntry {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   105
        /**
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   106
         * Summary of package exports:
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   107
         * If null, the package is not exported to any modules;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   108
         * if empty, the package is exported to all modules;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   109
         * otherwise, the package is exported to these modules.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   110
         */
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   111
        Set<ModuleElement> exportedTo;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   112
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   113
        /**
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   114
         * Summary of package opens:
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   115
         * If null, the package is not opened to any modules;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   116
         * if empty, the package is opened to all modules;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   117
         * otherwise, the package is opened to these modules.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   118
         */
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   119
        Set<ModuleElement> openedTo;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   120
    }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   121
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   122
    /**
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   123
     * Map of packages of this module, and details of whether they are exported or opened.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   124
     */
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   125
    private final Map<PackageElement, PackageEntry> packages = new TreeMap<>(utils.makePackageComparator());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   126
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   127
    /**
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   128
     * Map of indirect modules (transitive closure) and their exported packages.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   129
     */
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   130
    private final Map<ModuleElement, SortedSet<PackageElement>> indirectPackages
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   131
            = new TreeMap<>(utils.makeModuleComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   132
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   133
    /**
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   134
     * Map of indirect modules (transitive closure) and their open packages.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   135
     */
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   136
    private final Map<ModuleElement, SortedSet<PackageElement>> indirectOpenPackages
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   137
            = new TreeMap<>(utils.makeModuleComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   138
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   139
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   140
     * Set of services used by the module.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   141
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   142
    private final SortedSet<TypeElement> uses
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   143
            = new TreeSet<>(utils.makeAllClassesComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   144
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   145
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   146
     * Map of services used by the module and specified using @uses javadoc tag, and description.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   147
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   148
    private final Map<TypeElement, Content> usesTrees
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   149
            = new TreeMap<>(utils.makeAllClassesComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   150
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   151
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   152
     * Map of services provided by this module, and set of its implementations.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   153
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   154
    private final Map<TypeElement, SortedSet<TypeElement>> provides
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   155
            = new TreeMap<>(utils.makeAllClassesComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   156
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   157
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   158
     * Map of services provided by the module and specified using @provides javadoc tag, and
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   159
     * description.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   160
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   161
    private final Map<TypeElement, Content> providesTrees
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   162
            = new TreeMap<>(utils.makeAllClassesComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   163
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   164
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   165
     * The HTML tree for main tag.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   166
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   167
    protected HtmlTree mainTree = HtmlTree.MAIN();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   168
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   169
    private final Navigation navBar;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   170
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   171
    /**
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   172
     * Constructor to construct ModuleWriter object and to generate "moduleName-summary.html" file.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   173
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   174
     * @param configuration the configuration of the doclet.
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   175
     * @param mdle        Module under consideration.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   176
     */
48756
ce608a09a666 8196027: Remove "Prev" and "Next" links from the javadoc navigation
bpatel
parents: 48654
diff changeset
   177
    public ModuleWriterImpl(HtmlConfiguration configuration, ModuleElement mdle) {
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48756
diff changeset
   178
        super(configuration, configuration.docPaths.moduleSummary(mdle));
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   179
        this.mdle = mdle;
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   180
        this.moduleMode = configuration.docEnv.getModuleMode();
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   181
        this.navBar = new Navigation(mdle, configuration, fixedNavDiv, PageMode.MODULE, path);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   182
        computeModulesData();
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   183
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   184
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   185
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   186
     * Get the module header.
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   187
     *
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   188
     * @param heading the heading for the section
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   189
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   190
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   191
    public Content getModuleHeader(String heading) {
54350
4f9772f4403d 8215599: Remove support for javadoc "frames" mode
pmuthuswamy
parents: 54060
diff changeset
   192
        HtmlTree bodyTree = getBody(getWindowTitle(mdle.getQualifiedName().toString()));
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   193
        HtmlTree htmlTree = HtmlTree.HEADER();
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   194
        addTop(htmlTree);
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   195
        navBar.setDisplaySummaryModuleDescLink(!utils.getFullBody(mdle).isEmpty() && !configuration.nocomment);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   196
        navBar.setDisplaySummaryModulesLink(display(requires) || display(indirectModules));
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   197
        navBar.setDisplaySummaryPackagesLink(display(packages) || display(indirectPackages)
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   198
                || display(indirectOpenPackages));
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   199
        navBar.setDisplaySummaryServicesLink(displayServices(uses, usesTrees) || displayServices(provides.keySet(), providesTrees));
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   200
        navBar.setUserHeader(getUserHeaderFooter(true));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   201
        htmlTree.add(navBar.getContent(true));
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   202
        bodyTree.add(htmlTree);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   203
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   204
        div.setStyle(HtmlStyle.header);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   205
        Content annotationContent = new HtmlTree(HtmlTag.P);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   206
        addAnnotationInfo(mdle, annotationContent);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   207
        div.add(annotationContent);
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   208
        Content label = mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL)
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   209
                ? contents.openModuleLabel : contents.moduleLabel;
53991
786825220790 8219801: Pages do not have <h1>
jjg
parents: 53883
diff changeset
   210
        Content tHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true,
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   211
                HtmlStyle.title, label);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   212
        tHeading.add(Contents.SPACE);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   213
        Content moduleHead = new RawHtml(heading);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   214
        tHeading.add(moduleHead);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   215
        div.add(tHeading);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   216
        mainTree.add(div);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   217
        return bodyTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   218
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   219
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   220
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   221
     * Get the content header.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   222
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   223
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   224
    public Content getContentHeader() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   225
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   226
        div.setStyle(HtmlStyle.contentContainer);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   227
        return div;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   228
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   229
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   230
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   231
     * Get the summary section header.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   232
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   233
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   234
    public Content getSummaryHeader() {
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   235
        HtmlTree ul = new HtmlTree(HtmlTag.UL);
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   236
        ul.setStyle(HtmlStyle.blockList);
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   237
        return ul;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   238
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   239
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   240
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   241
     * Get the summary tree.
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   242
     *
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   243
     * @param summaryContentTree the content tree to be added to the summary tree.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   244
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   245
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   246
    public Content getSummaryTree(Content summaryContentTree) {
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   247
        return HtmlTree.SECTION(HtmlStyle.summary, summaryContentTree);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   248
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   249
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   250
    /**
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   251
     * Compute the modules data that will be displayed in various tables on the module summary page.
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   252
     */
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   253
    public void computeModulesData() {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   254
        CommentHelper ch = utils.getCommentHelper(mdle);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   255
        // Get module dependencies using the module's transitive closure.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   256
        Map<ModuleElement, String> dependentModules = utils.getDependentModules(mdle);
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   257
        // Add all dependent modules to indirect modules set. We will remove the modules,
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   258
        // listed using the requires directive, from this set to come up with the table of indirect
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   259
        // required modules.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   260
        dependentModules.forEach((module, mod) -> {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   261
            if (shouldDocument(module)) {
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   262
                indirectModules.put(module, new StringContent(mod));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   263
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   264
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   265
        (ElementFilter.requiresIn(mdle.getDirectives())).forEach((directive) -> {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   266
            ModuleElement m = directive.getDependency();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   267
            if (shouldDocument(m)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   268
                if (moduleMode == ModuleMode.ALL || directive.isTransitive()) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   269
                    requires.put(m, new StringContent(utils.getModifiers(directive)));
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   270
            } else {
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   271
                    // For api mode, just keep the public requires in dependentModules for display of
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   272
                    // indirect packages in the "Packages" section.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   273
                    dependentModules.remove(m);
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   274
                }
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   275
                indirectModules.remove(m);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   276
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   277
        });
44293
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 42831
diff changeset
   278
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   279
        // Get all packages if module is open or if displaying concealed modules
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   280
        for (PackageElement pkg : utils.getModulePackageMap().getOrDefault(mdle, Collections.emptySet())) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   281
            if (shouldDocument(pkg) && (mdle.isOpen() || moduleMode == ModuleMode.ALL)) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   282
                PackageEntry e = new PackageEntry();
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   283
                if (mdle.isOpen()) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   284
                    e.openedTo = Collections.emptySet();
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   285
                }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   286
                packages.put(pkg, e);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   287
            }
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   288
        };
44293
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 42831
diff changeset
   289
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   290
        // Get all exported packages for the module, using the exports directive for the module.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   291
        for (ModuleElement.ExportsDirective directive : ElementFilter.exportsIn(mdle.getDirectives())) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   292
            PackageElement p = directive.getPackage();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   293
            if (shouldDocument(p)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   294
                List<? extends ModuleElement> targetMdles = directive.getTargetModules();
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   295
                // Include package if in details mode, or exported to all (i.e. targetModules == null)
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   296
                if (moduleMode == ModuleMode.ALL || targetMdles == null) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   297
                    PackageEntry packageEntry = packages.computeIfAbsent(p, pkg -> new PackageEntry());
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   298
                    SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   299
                    if (targetMdles != null) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   300
                        mdleList.addAll(targetMdles);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   301
                    }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   302
                    packageEntry.exportedTo = mdleList;
44689
53c703004306 8175823: doclet crashes when documenting a single class in a module.
bpatel
parents: 44684
diff changeset
   303
                }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   304
            }
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   305
        }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   306
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   307
        // Get all opened packages for the module, using the opens directive for the module.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   308
        // If it is an open module, there will be no separate opens directives.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   309
        for (ModuleElement.OpensDirective directive : ElementFilter.opensIn(mdle.getDirectives())) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   310
            PackageElement p = directive.getPackage();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   311
            if (shouldDocument(p)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   312
                List<? extends ModuleElement> targetMdles = directive.getTargetModules();
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   313
                // Include package if in details mode, or opened to all (i.e. targetModules == null)
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   314
                if (moduleMode == ModuleMode.ALL || targetMdles == null) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   315
                    PackageEntry packageEntry = packages.computeIfAbsent(p, pkg -> new PackageEntry());
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   316
                    SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   317
                    if (targetMdles != null) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   318
                        mdleList.addAll(targetMdles);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   319
                    }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   320
                    packageEntry.openedTo = mdleList;
44689
53c703004306 8175823: doclet crashes when documenting a single class in a module.
bpatel
parents: 44684
diff changeset
   321
                }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   322
            }
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   323
        }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   324
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   325
        // Get all the exported and opened packages, for the transitive closure of the module, to be displayed in
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   326
        // the indirect packages tables.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   327
        dependentModules.forEach((module, mod) -> {
44807
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   328
            SortedSet<PackageElement> exportPkgList = new TreeSet<>(utils.makePackageComparator());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   329
            (ElementFilter.exportsIn(module.getDirectives())).forEach((directive) -> {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   330
                PackageElement pkg = directive.getPackage();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   331
                if (shouldDocument(pkg)) {
44807
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   332
                    // Qualified exports are not displayed in API mode
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   333
                    if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) {
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   334
                        exportPkgList.add(pkg);
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   335
                    }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   336
                }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   337
            });
44807
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   338
            // If none of the indirect modules have exported packages to be displayed, we should not be
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   339
            // displaying the table and so it should not be added to the map.
44807
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   340
            if (!exportPkgList.isEmpty()) {
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   341
                indirectPackages.put(module, exportPkgList);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   342
            }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   343
            SortedSet<PackageElement> openPkgList = new TreeSet<>(utils.makePackageComparator());
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   344
            if (module.isOpen()) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   345
                openPkgList.addAll(utils.getModulePackageMap().getOrDefault(module, Collections.emptySet()));
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   346
            } else {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   347
                (ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   348
                    PackageElement pkg = directive.getPackage();
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   349
                    if (shouldDocument(pkg)) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   350
                        // Qualified opens are not displayed in API mode
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   351
                        if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   352
                            openPkgList.add(pkg);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   353
                        }
44807
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   354
                    }
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   355
                });
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   356
            }
44807
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   357
            // If none of the indirect modules have opened packages to be displayed, we should not be
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   358
            // displaying the table and so it should not be added to the map.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   359
            if (!openPkgList.isEmpty()) {
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   360
                indirectOpenPackages.put(module, openPkgList);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   361
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   362
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   363
        // Get all the services listed as uses directive.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   364
        (ElementFilter.usesIn(mdle.getDirectives())).forEach((directive) -> {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   365
            TypeElement u = directive.getService();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   366
            if (shouldDocument(u)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   367
                uses.add(u);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   368
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   369
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   370
        // Get all the services and implementations listed as provides directive.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   371
        (ElementFilter.providesIn(mdle.getDirectives())).forEach((directive) -> {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   372
            TypeElement u = directive.getService();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   373
            if (shouldDocument(u)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   374
                List<? extends TypeElement> implList = directive.getImplementations();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   375
                SortedSet<TypeElement> implSet = new TreeSet<>(utils.makeAllClassesComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   376
                implSet.addAll(implList);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   377
                provides.put(u, implSet);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   378
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   379
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   380
        // Generate the map of all services listed using @provides, and the description.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   381
        (utils.getBlockTags(mdle, DocTree.Kind.PROVIDES)).forEach((tree) -> {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   382
            TypeElement t = ch.getServiceType(configuration, tree);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   383
            if (t != null) {
51862
c319db69099c 8202462: {@index} may cause duplicate labels
pmuthuswamy
parents: 50167
diff changeset
   384
                providesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false, true));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   385
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   386
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   387
        // Generate the map of all services listed using @uses, and the description.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   388
        (utils.getBlockTags(mdle, DocTree.Kind.USES)).forEach((tree) -> {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   389
            TypeElement t = ch.getServiceType(configuration, tree);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   390
            if (t != null) {
51862
c319db69099c 8202462: {@index} may cause duplicate labels
pmuthuswamy
parents: 50167
diff changeset
   391
                usesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false, true));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   392
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   393
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   394
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   395
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   396
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   397
     * Returns true if the element should be documented on the module summary page.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   398
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   399
     * @param element the element to be checked
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   400
     * @return true if the element should be documented
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   401
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   402
    public boolean shouldDocument(Element element) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   403
        return (moduleMode == ModuleMode.ALL || utils.isIncluded(element));
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   404
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   405
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   406
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   407
     * Returns true if there are elements to be displayed.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   408
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   409
     * @param section set of elements
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   410
     * @return true if there are elements to be displayed
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   411
     */
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   412
    public boolean display(Set<? extends Element> section) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   413
        return section != null && !section.isEmpty();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   414
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   415
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   416
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   417
     * Returns true if there are elements to be displayed.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   418
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   419
     * @param section map of elements.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   420
     * @return true if there are elements to be displayed
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   421
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   422
    public boolean display(Map<? extends Element, ?> section) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   423
        return section != null && !section.isEmpty();
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   424
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   425
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   426
    /*
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   427
     * Returns true, in API mode, if at least one type element in
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   428
     * the typeElements set is referenced by a javadoc tag in tagsMap.
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   429
     */
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   430
    private boolean displayServices(Set<TypeElement> typeElements,
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   431
                                    Map<TypeElement, Content> tagsMap) {
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   432
        return typeElements != null &&
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   433
                typeElements.stream().anyMatch((v) -> displayServiceDirective(v, tagsMap));
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   434
    }
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   435
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   436
    /*
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   437
     * Returns true, in API mode, if the type element is referenced
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   438
     * from a javadoc tag in tagsMap.
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   439
     */
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   440
    private boolean displayServiceDirective(TypeElement typeElement,
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   441
                                            Map<TypeElement, Content> tagsMap) {
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   442
        return moduleMode == ModuleMode.ALL || tagsMap.containsKey(typeElement);
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   443
    }
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   444
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   445
    /**
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   446
     * Add the summary header.
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   447
     *
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   448
     * @param startMarker the marker comment
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   449
     * @param markerAnchor the marker anchor for the section
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   450
     * @param heading the heading for the section
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   451
     * @param htmltree the content tree to which the information is added
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   452
     */
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   453
    public void addSummaryHeader(Content startMarker, SectionName markerAnchor, Content heading,
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   454
            Content htmltree) {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   455
        htmltree.add(startMarker);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   456
        htmltree.add(links.createAnchor(markerAnchor));
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   457
        htmltree.add(HtmlTree.HEADING(Headings.ModuleDeclaration.SUMMARY_HEADING, heading));
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   458
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   459
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   460
    /**
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   461
     * Get a table, with two columns.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   462
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   463
     * @param caption the table caption
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   464
     * @param tableStyle the table style
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   465
     * @param tableHeader the table header
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   466
     * @return a content object
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   467
     */
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   468
    private Table getTable2(Content caption, HtmlStyle tableStyle,
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   469
            TableHeader tableHeader) {
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   470
        return new Table(tableStyle)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   471
                .setCaption(caption)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   472
                .setHeader(tableHeader)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   473
                .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   474
    }
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   475
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   476
    /**
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   477
     * Get a table, with three columns, with the second column being the defining column.
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   478
     *
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   479
     * @param caption the table caption
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   480
     * @param tableSummary the summary for the table
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   481
     * @param tableStyle the table style
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   482
     * @param tableHeader the table header
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   483
     * @return a content object
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   484
     */
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   485
    private Table getTable3(Content caption, String tableSummary, HtmlStyle tableStyle,
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   486
            TableHeader tableHeader) {
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   487
        return new Table(tableStyle)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   488
                .setCaption(caption)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   489
                .setHeader(tableHeader)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   490
                .setRowScopeColumn(1)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   491
                .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   492
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   493
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   494
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   495
     * {@inheritDoc}
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   496
     */
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   497
    @Override
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   498
    public void addModulesSummary(Content summaryContentTree) {
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   499
        if (display(requires) || display(indirectModules)) {
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   500
            TableHeader requiresTableHeader =
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   501
                    new TableHeader(contents.modifierLabel, contents.moduleLabel,
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   502
                            contents.descriptionLabel);
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   503
            HtmlTree section = HtmlTree.SECTION(HtmlStyle.modulesSummary);
53991
786825220790 8219801: Pages do not have <h1>
jjg
parents: 53883
diff changeset
   504
            addSummaryHeader(MarkerComments.START_OF_MODULES_SUMMARY, SectionName.MODULES,
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   505
                    contents.navModules, section);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   506
            if (display(requires)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   507
                String text = resources.getText("doclet.Requires_Summary");
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   508
                String tableSummary = resources.getText("doclet.Member_Table_Summary",
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   509
                        text,
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   510
                        resources.getText("doclet.modules"));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   511
                Content caption = getTableCaption(new StringContent(text));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   512
                Table table = getTable3(caption, tableSummary, HtmlStyle.requiresSummary,
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   513
                            requiresTableHeader);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   514
                addModulesList(requires, table);
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   515
                section.add(table.toContent());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   516
            }
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   517
            // Display indirect modules table in both "api" and "all" mode.
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   518
            if (display(indirectModules)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   519
                String amrText = resources.getText("doclet.Indirect_Requires_Summary");
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   520
                String amrTableSummary = resources.getText("doclet.Member_Table_Summary",
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   521
                        amrText,
52644
43efb4ca6d6c 8214139: Remove wrapper methods from {Base,Html}Configuration
jjg
parents: 51862
diff changeset
   522
                        resources.getText("doclet.modules"));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   523
                Content amrCaption = getTableCaption(new StringContent(amrText));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   524
                Table amrTable = getTable3(amrCaption, amrTableSummary, HtmlStyle.requiresSummary,
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   525
                            requiresTableHeader);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   526
                addModulesList(indirectModules, amrTable);
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   527
                section.add(amrTable.toContent());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   528
            }
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   529
            summaryContentTree.add(HtmlTree.LI(HtmlStyle.blockList, section));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   530
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   531
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   532
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   533
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   534
     * Add the list of modules.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   535
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   536
     * @param mdleMap map of modules and modifiers
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   537
     * @param tbody the content tree to which the list will be added
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   538
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   539
    private void addModulesList(Map<ModuleElement, Content> mdleMap, Table table) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   540
        for (ModuleElement m : mdleMap.keySet()) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   541
            Content modifiers = mdleMap.get(m);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   542
            Content moduleLink = getModuleLink(m, new StringContent(m.getQualifiedName()));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   543
            Content moduleSummary = new ContentBuilder();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   544
            addSummaryComment(m, moduleSummary);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   545
            table.addRow(modifiers, moduleLink, moduleSummary);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   546
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   547
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   548
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   549
    @Override
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   550
    public void addPackagesSummary(Content summaryContentTree) {
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   551
        if (display(packages)
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   552
                || display(indirectPackages) || display(indirectOpenPackages)) {
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   553
            HtmlTree section = HtmlTree.SECTION(HtmlStyle.packagesSummary);
53991
786825220790 8219801: Pages do not have <h1>
jjg
parents: 53883
diff changeset
   554
            addSummaryHeader(MarkerComments.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   555
                    contents.navPackages, section);
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   556
            if (display(packages)) {
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   557
                addPackageSummary(section);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   558
            }
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   559
            TableHeader indirectPackagesHeader =
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   560
                    new TableHeader(contents.fromLabel, contents.packagesLabel);
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   561
            if (display(indirectPackages)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   562
                String aepText = resources.getText("doclet.Indirect_Exports_Summary");
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   563
                Table aepTable = getTable2(new StringContent(aepText),
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   564
                        HtmlStyle.packagesSummary, indirectPackagesHeader);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   565
                addIndirectPackages(aepTable, indirectPackages);
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   566
                section.add(aepTable.toContent());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   567
            }
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   568
            if (display(indirectOpenPackages)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   569
                String aopText = resources.getText("doclet.Indirect_Opens_Summary");
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   570
                Table aopTable = getTable2(new StringContent(aopText), HtmlStyle.packagesSummary,
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   571
                        indirectPackagesHeader);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   572
                addIndirectPackages(aopTable, indirectOpenPackages);
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   573
                section.add(aopTable.toContent());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   574
            }
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   575
            summaryContentTree.add(HtmlTree.LI(HtmlStyle.blockList, section));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   576
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   577
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   578
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   579
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   580
     * Add the package summary for the module.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   581
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   582
     * @param li
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   583
     */
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   584
    public void addPackageSummary(HtmlTree li) {
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   585
        Table table = new Table(HtmlStyle.packagesSummary)
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   586
                .setDefaultTab(resources.getText("doclet.All_Packages"))
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   587
                .addTab(resources.getText("doclet.Exported_Packages_Summary"), this::isExported)
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   588
                .addTab(resources.getText("doclet.Opened_Packages_Summary"), this::isOpened)
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   589
                .addTab(resources.getText("doclet.Concealed_Packages_Summary"), this::isConcealed)
50167
cc705c956798 8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents: 49551
diff changeset
   590
                .setTabScript(i -> String.format("show(%d);", i));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   591
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   592
        // Determine whether to show the "Exported To" and "Opened To" columns,
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   593
        // based on whether such columns would provide "useful" info.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   594
        int numExports = 0;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   595
        int numUnqualifiedExports = 0;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   596
        int numOpens = 0;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   597
        int numUnqualifiedOpens = 0;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   598
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   599
        for (PackageEntry e : packages.values()) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   600
            if (e.exportedTo != null) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   601
                numExports++;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   602
                if (e.exportedTo.isEmpty()) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   603
                    numUnqualifiedExports++;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   604
                }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   605
            }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   606
            if (e.openedTo != null) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   607
                numOpens++;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   608
                if (e.openedTo.isEmpty()) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   609
                    numUnqualifiedOpens++;
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   610
                }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   611
            }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   612
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   613
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   614
        boolean showExportedTo = numExports > 0 && (numOpens > 0   || numUnqualifiedExports < packages.size());
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   615
        boolean showOpenedTo   = numOpens > 0   && (numExports > 0 || numUnqualifiedOpens < packages.size());
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   616
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   617
        // Create the table header and column styles.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   618
        List<Content> colHeaders = new ArrayList<>();
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   619
        List<HtmlStyle> colStyles = new ArrayList<>();
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   620
        colHeaders.add(contents.packageLabel);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   621
        colStyles.add(HtmlStyle.colFirst);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   622
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   623
        if (showExportedTo) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   624
            colHeaders.add(contents.exportedTo);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   625
            colStyles.add(HtmlStyle.colSecond);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   626
        }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   627
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   628
        if (showOpenedTo) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   629
            colHeaders.add(contents.openedTo);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   630
            colStyles.add(HtmlStyle.colSecond);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   631
        }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   632
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   633
        colHeaders.add(contents.descriptionLabel);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   634
        colStyles.add(HtmlStyle.colLast);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   635
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   636
        table.setHeader(new TableHeader(colHeaders).styles(colStyles))
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   637
                .setColumnStyles(colStyles);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   638
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   639
        // Add the table rows, based on the "packages" map.
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   640
        for (Map.Entry<PackageElement, PackageEntry> e : packages.entrySet()) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   641
            PackageElement pkg = e.getKey();
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   642
            PackageEntry entry = e.getValue();
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   643
            List<Content> row = new ArrayList<>();
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   644
            Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   645
            row.add(pkgLinkContent);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   646
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   647
            if (showExportedTo) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   648
                row.add(getPackageExportOpensTo(entry.exportedTo));
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   649
            }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   650
            if (showOpenedTo) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   651
                row.add(getPackageExportOpensTo(entry.openedTo));
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   652
            }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   653
            Content summary = new ContentBuilder();
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   654
            addSummaryComment(pkg, summary);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   655
            row.add(summary);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   656
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   657
            table.addRow(pkg, row);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   658
        }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   659
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   660
        li.add(table.toContent());
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   661
        if (table.needsScript()) {
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   662
            mainBodyScript.append(table.getScript());
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   663
        }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   664
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   665
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   666
    private boolean isExported(Element e) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   667
        PackageEntry entry = packages.get((PackageElement) e);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   668
        return (entry != null) && (entry.exportedTo != null);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   669
    }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   670
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   671
    private boolean isOpened(Element e) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   672
        PackageEntry entry = packages.get((PackageElement) e);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   673
        return (entry != null) && (entry.openedTo != null);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   674
    }
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   675
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   676
    private boolean isConcealed(Element e) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   677
        PackageEntry entry = packages.get((PackageElement) e);
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   678
        return (entry != null) && (entry.exportedTo == null) && (entry.openedTo == null);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   679
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   680
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   681
    private Content getPackageExportOpensTo(Set<ModuleElement> modules) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   682
        if (modules == null) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   683
            return new StringContent(resources.getText("doclet.None"));
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   684
        } else if (modules.isEmpty()) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   685
            return new StringContent(resources.getText("doclet.All_Modules"));
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   686
        } else {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   687
            Content list = new ContentBuilder();
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   688
            for (ModuleElement m : modules) {
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   689
                if (!list.isEmpty()) {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   690
                    list.add(new StringContent(", "));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   691
                }
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   692
                list.add(getModuleLink(m, new StringContent(m.getQualifiedName())));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   693
            }
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   694
            return list;
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   695
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   696
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   697
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   698
    /**
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   699
     * Add the indirect packages for the module being documented.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   700
     *
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   701
     * @param table the table to which the content rows will be added
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   702
     * @param ip indirect packages to be added
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   703
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   704
    public void addIndirectPackages(Table table, Map<ModuleElement, SortedSet<PackageElement>> ip) {
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   705
        for (Map.Entry<ModuleElement, SortedSet<PackageElement>> entry : ip.entrySet()) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   706
            ModuleElement m = entry.getKey();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   707
            SortedSet<PackageElement> pkgList = entry.getValue();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   708
            Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName()));
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   709
            Content list = new ContentBuilder();
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   710
            String sep = "";
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   711
            for (PackageElement pkg : pkgList) {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   712
                list.add(sep);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   713
                list.add(getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   714
                sep = " ";
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   715
            }
48325
e5cdedd37b78 8178070: duplicate entries in package table
jjg
parents: 47850
diff changeset
   716
            table.addRow(moduleLinkContent, list);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   717
        }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   718
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   719
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   720
    /**
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   721
     * {@inheritDoc}
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   722
     */
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   723
    @Override
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   724
    public void addServicesSummary(Content summaryContentTree) {
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   725
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   726
        boolean haveUses = displayServices(uses, usesTrees);
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   727
        boolean haveProvides = displayServices(provides.keySet(), providesTrees);
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   728
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   729
        if (haveProvides || haveUses) {
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   730
            HtmlTree section = HtmlTree.SECTION(HtmlStyle.servicesSummary);
53991
786825220790 8219801: Pages do not have <h1>
jjg
parents: 53883
diff changeset
   731
            addSummaryHeader(MarkerComments.START_OF_SERVICES_SUMMARY, SectionName.SERVICES,
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   732
                    contents.navServices, section);
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   733
            TableHeader usesProvidesTableHeader =
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   734
                    new TableHeader(contents.typeLabel, contents.descriptionLabel);
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   735
            if (haveProvides) {
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   736
                String label = resources.getText("doclet.Provides_Summary");
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   737
                Table table = getTable2(new StringContent(label), HtmlStyle.providesSummary,
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   738
                        usesProvidesTableHeader);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   739
                addProvidesList(table);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   740
                if (!table.isEmpty()) {
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   741
                    section.add(table.toContent());
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   742
                }
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   743
            }
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   744
            if (haveUses){
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   745
                String label = resources.getText("doclet.Uses_Summary");
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   746
                Table table = getTable2(new StringContent(label), HtmlStyle.usesSummary,
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   747
                        usesProvidesTableHeader);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   748
                addUsesList(table);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   749
                if (!table.isEmpty()) {
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   750
                    section.add(table.toContent());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   751
                }
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   752
            }
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   753
            summaryContentTree.add(HtmlTree.LI(HtmlStyle.blockList, section));
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   754
        }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   755
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   756
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   757
    /**
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   758
     * Add the uses list for the module.
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   759
     *
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   760
     * @param table the table to which the services used will be added
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   761
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   762
    public void addUsesList(Table table) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   763
        Content typeLinkContent;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   764
        Content description;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   765
        for (TypeElement t : uses) {
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   766
            if (!displayServiceDirective(t, usesTrees)) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   767
                continue;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   768
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   769
            typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, t));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   770
            Content summary = new ContentBuilder();
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   771
            if (display(usesTrees)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   772
                description = usesTrees.get(t);
48437
dd3b97564ed7 8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents: 48325
diff changeset
   773
                if (description != null && !description.isEmpty()) {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   774
                    summary.add(HtmlTree.DIV(HtmlStyle.block, description));
48437
dd3b97564ed7 8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents: 48325
diff changeset
   775
                } else {
dd3b97564ed7 8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents: 48325
diff changeset
   776
                    addSummaryComment(t, summary);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   777
                }
48437
dd3b97564ed7 8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents: 48325
diff changeset
   778
            } else {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   779
                summary.add(Contents.SPACE);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   780
            }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   781
            table.addRow(typeLinkContent, summary);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   782
        }
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   783
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   784
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   785
    /**
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   786
     * Add the provides list for the module.
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   787
     *
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   788
     * @param table the table to which the services provided will be added
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   789
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   790
    public void addProvidesList(Table table) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   791
        SortedSet<TypeElement> implSet;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   792
        Content description;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   793
        for (Map.Entry<TypeElement, SortedSet<TypeElement>> entry : provides.entrySet()) {
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   794
            TypeElement srv = entry.getKey();
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   795
            if (!displayServiceDirective(srv, providesTrees)) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   796
                continue;
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   797
            }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   798
            implSet = entry.getValue();
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   799
            Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   800
            Content desc = new ContentBuilder();
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   801
            if (display(providesTrees)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   802
                description = providesTrees.get(srv);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   803
                desc.add((description != null && !description.isEmpty())
48437
dd3b97564ed7 8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents: 48325
diff changeset
   804
                        ? HtmlTree.DIV(HtmlStyle.block, description)
dd3b97564ed7 8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents: 48325
diff changeset
   805
                        : Contents.SPACE);
dd3b97564ed7 8192007: javadoc @uses and @provides tags in the modules documentation appears before the first-sentence summary of the service type.
bpatel
parents: 48325
diff changeset
   806
            } else {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   807
                desc.add(Contents.SPACE);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   808
                }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   809
            // Only display the implementation details in the "all" mode.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   810
            if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   811
                desc.add(new HtmlTree(HtmlTag.BR));
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   812
                desc.add("(");
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   813
                HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   814
                desc.add(implSpan);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   815
                desc.add(Contents.SPACE);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   816
                String sep = "";
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   817
                for (TypeElement impl : implSet) {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   818
                    desc.add(sep);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   819
                    desc.add(getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl)));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   820
                    sep = ", ";
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   821
                }
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   822
                desc.add(")");
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   823
            }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   824
            table.addRow(srvLinkContent, desc);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   825
        }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   826
    }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   827
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   828
    /**
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   829
     * Add the module deprecation information to the documentation tree.
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   830
     *
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   831
     * @param div the content tree to which the deprecation information will be added
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   832
     */
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   833
    public void addDeprecationInfo(Content div) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   834
        List<? extends DocTree> deprs = utils.getBlockTags(mdle, DocTree.Kind.DEPRECATED);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   835
        if (utils.isDeprecated(mdle)) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   836
            CommentHelper ch = utils.getCommentHelper(mdle);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   837
            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   838
            deprDiv.setStyle(HtmlStyle.deprecationBlock);
42816
3638773ff1b0 8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents: 42407
diff changeset
   839
            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   840
            deprDiv.add(deprPhrase);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   841
            if (!deprs.isEmpty()) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   842
                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   843
                if (!commentTags.isEmpty()) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   844
                    addInlineDeprecatedComment(mdle, deprs.get(0), deprDiv);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   845
                }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   846
            }
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   847
            div.add(deprDiv);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   848
        }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   849
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   850
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   851
    /**
37747
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   852
     * {@inheritDoc}
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   853
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   854
    @Override
37747
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   855
    public void addModuleDescription(Content moduleContentTree) {
41452
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 41157
diff changeset
   856
        if (!utils.getFullBody(mdle).isEmpty()) {
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   857
            Content tree = HtmlTree.SECTION(HtmlStyle.moduleDescription);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   858
            addDeprecationInfo(tree);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   859
            tree.add(MarkerComments.START_OF_MODULE_DESCRIPTION);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   860
            tree.add(links.createAnchor(SectionName.MODULE_DESCRIPTION));
37747
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   861
            addInlineComment(mdle, tree);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   862
            moduleContentTree.add(tree);
37747
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   863
        }
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   864
    }
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   865
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   866
    /**
38911
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   867
     * {@inheritDoc}
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   868
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   869
    @Override
38911
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   870
    public void addModuleTags(Content moduleContentTree) {
54596
86c1da00dd6a 8219998: Eliminate inherently singleton lists
pmuthuswamy
parents: 54350
diff changeset
   871
        Content tree = HtmlTree.SECTION(HtmlStyle.moduleTags);
38911
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   872
        addTagsInfo(mdle, tree);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   873
        moduleContentTree.add(tree);
38911
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   874
    }
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   875
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   876
    /**
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   877
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   878
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   879
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   880
    public void addModuleContent(Content contentTree, Content moduleContentTree) {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   881
        mainTree.add(moduleContentTree);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   882
        contentTree.add(mainTree);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   883
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   884
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   885
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   886
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   887
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   888
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   889
    public void addModuleFooter(Content contentTree) {
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52644
diff changeset
   890
        Content htmlTree = HtmlTree.FOOTER();
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   891
        navBar.setUserFooter(getUserHeaderFooter(false));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   892
        htmlTree.add(navBar.getContent(false));
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   893
        addBottom(htmlTree);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   894
        contentTree.add(htmlTree);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   895
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   896
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   897
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   898
     * {@inheritDoc}
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   899
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   900
     * @throws jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   901
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
   902
    @Override
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
   903
    public void printDocument(Content contentTree) throws DocFileIOException {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   904
        printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle),
53863
d001808c57e8 8218998: Add metadata to generated API documentation files
jjg
parents: 53562
diff changeset
   905
                getDescription("declaration", mdle),
53880
3f1e9372557f 8219497: Unused parameter in HtmlDocletWriter::printHtmlDocument
jjg
parents: 53879
diff changeset
   906
                contentTree);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   907
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   908
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   909
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   910
     * Add the module package deprecation information to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   911
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   912
     * @param li the content tree to which the deprecation information will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   913
     * @param pkg the PackageDoc that is added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   914
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   915
    public void addPackageDeprecationInfo(Content li, PackageElement pkg) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   916
        List<? extends DocTree> deprs;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   917
        if (utils.isDeprecated(pkg)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   918
            deprs = utils.getDeprecatedTrees(pkg);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   919
            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   920
            deprDiv.setStyle(HtmlStyle.deprecationBlock);
42816
3638773ff1b0 8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents: 42407
diff changeset
   921
            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   922
            deprDiv.add(deprPhrase);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   923
            if (!deprs.isEmpty()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   924
                CommentHelper ch = utils.getCommentHelper(pkg);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   925
                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   926
                if (!commentTags.isEmpty()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   927
                    addInlineDeprecatedComment(pkg, deprs.get(0), deprDiv);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   928
                }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   929
            }
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   930
            li.add(deprDiv);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   931
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   932
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   933
}