src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
author jjg
Thu, 16 Nov 2017 15:01:45 -0800
changeset 47846 4e78aba768f0
parent 47427 251676148c62
child 47847 7640bc1eb94f
permissions -rw-r--r--
8190295: Introduce a new Table builder class Reviewed-by: bpatel, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
44293
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 42831
diff changeset
     2
 * Copyright (c) 2016, 2017, 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.HtmlConstants;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    50
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    51
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    52
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    53
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
    54
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    55
import jdk.javadoc.internal.doclets.toolkit.Content;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    56
import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    57
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
    58
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    59
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
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 prev module name in the alpha-order list.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    77
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    78
    protected ModuleElement prevModule;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    79
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    80
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    81
     * The next module name in the alpha-order list.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    82
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    83
    protected ModuleElement nextModule;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    84
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    85
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    86
     * The module being documented.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    87
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    88
    protected ModuleElement mdle;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    89
42831
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
     * 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
    92
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    93
    private final ModuleMode moduleMode;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    94
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    95
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    96
     * 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
    97
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
    98
    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
    99
            = new TreeMap<>(utils.makeModuleComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   100
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   101
    /**
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   102
     * 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
   103
     */
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   104
    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
   105
            = new TreeMap<>(utils.makeModuleComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   106
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   107
    /**
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   108
     * Map of packages exported by this module and the modules it has been exported to.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   109
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   110
    private final Map<PackageElement, SortedSet<ModuleElement>> exportedPackages
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   111
            = new TreeMap<>(utils.makePackageComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   112
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   113
    /**
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   114
     * Map of opened packages by this module and the modules it has been opened to.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   115
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   116
    private final Map<PackageElement, SortedSet<ModuleElement>> openedPackages
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   117
            = new TreeMap<>(utils.makePackageComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   118
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   119
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   120
     * Set of concealed packages of this module.
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
    private final SortedSet<PackageElement> concealedPackages = new TreeSet<>(utils.makePackageComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   123
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   124
    /**
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   125
     * 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
   126
     */
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   127
    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
   128
            = new TreeMap<>(utils.makeModuleComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   129
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   130
    /**
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   131
     * 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
   132
     */
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   133
    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
   134
            = new TreeMap<>(utils.makeModuleComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   135
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   136
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   137
     * 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
   138
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   139
    private final SortedSet<TypeElement> uses
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   140
            = new TreeSet<>(utils.makeAllClassesComparator());
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
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   143
     * 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
   144
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   145
    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
   146
            = new TreeMap<>(utils.makeAllClassesComparator());
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
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   149
     * 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
   150
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   151
    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
   152
            = new TreeMap<>(utils.makeAllClassesComparator());
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
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   155
     * 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
   156
     * description.
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
    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
   159
            = new TreeMap<>(utils.makeAllClassesComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   160
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   161
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   162
     * The HTML tree for main tag.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   163
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   164
    protected HtmlTree mainTree = HtmlTree.MAIN();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   165
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   166
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   167
     * The HTML tree for section tag.
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   168
     */
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   169
    protected HtmlTree sectionTree = HtmlTree.SECTION();
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   170
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
     * @param prevModule   Previous module in the sorted array.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   177
     * @param nextModule   Next module in the sorted array.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   178
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 44807
diff changeset
   179
    public ModuleWriterImpl(HtmlConfiguration configuration,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   180
            ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   181
        super(configuration, DocPaths.moduleSummary(mdle));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   182
        this.prevModule = prevModule;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   183
        this.nextModule = nextModule;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   184
        this.mdle = mdle;
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   185
        this.moduleMode = configuration.docEnv.getModuleMode();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   186
        computeModulesData();
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   187
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   188
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   189
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   190
     * Get the module header.
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   191
     *
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   192
     * @param heading the heading for the section
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   193
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   194
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   195
    public Content getModuleHeader(String heading) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   196
        HtmlTree bodyTree = getBody(true, getWindowTitle(mdle.getQualifiedName().toString()));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   197
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   198
                ? HtmlTree.HEADER()
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   199
                : bodyTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   200
        addTop(htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   201
        addNavLinks(true, htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   202
        if (configuration.allowTag(HtmlTag.HEADER)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   203
            bodyTree.addContent(htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   204
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   205
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   206
        div.setStyle(HtmlStyle.header);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   207
        Content annotationContent = new HtmlTree(HtmlTag.P);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   208
        addAnnotationInfo(mdle, annotationContent);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   209
        div.addContent(annotationContent);
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   210
        Content label = mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL)
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   211
                ? contents.openModuleLabel : contents.moduleLabel;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   212
        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   213
                HtmlStyle.title, label);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   214
        tHeading.addContent(Contents.SPACE);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   215
        Content moduleHead = new RawHtml(heading);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   216
        tHeading.addContent(moduleHead);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   217
        div.addContent(tHeading);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   218
        if (configuration.allowTag(HtmlTag.MAIN)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   219
            mainTree.addContent(div);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   220
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   221
            bodyTree.addContent(div);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   222
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   223
        return bodyTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   224
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   225
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   226
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   227
     * Get the content header.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   228
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   229
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   230
    public Content getContentHeader() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   231
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   232
        div.setStyle(HtmlStyle.contentContainer);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   233
        return div;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   234
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   235
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   236
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   237
     * Get the summary section header.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   238
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   239
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   240
    public Content getSummaryHeader() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   241
        HtmlTree li = new HtmlTree(HtmlTag.LI);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   242
        li.setStyle(HtmlStyle.blockList);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   243
        return li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   244
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   245
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   246
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   247
     * Get the summary tree.
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   248
     *
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   249
     * @param summaryContentTree the content tree to be added to the summary tree.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   250
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   251
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   252
    public Content getSummaryTree(Content summaryContentTree) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   253
        HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   254
        return ul;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   255
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   256
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   257
    /**
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   258
     * 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
   259
     */
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   260
    public void computeModulesData() {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   261
        CommentHelper ch = utils.getCommentHelper(mdle);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   262
        // 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
   263
        Map<ModuleElement, String> dependentModules = utils.getDependentModules(mdle);
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   264
        // 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
   265
        // 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
   266
        // required modules.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   267
        dependentModules.forEach((module, mod) -> {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   268
            if (shouldDocument(module)) {
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   269
                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
   270
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   271
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   272
        (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
   273
            ModuleElement m = directive.getDependency();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   274
            if (shouldDocument(m)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   275
                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
   276
                    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
   277
            } else {
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   278
                    // 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
   279
                    // 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
   280
                    dependentModules.remove(m);
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   281
                }
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   282
                indirectModules.remove(m);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   283
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   284
        });
44293
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 42831
diff changeset
   285
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   286
        // Get all packages for the module and put it in the concealed packages set.
44293
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 42831
diff changeset
   287
        utils.getModulePackageMap().getOrDefault(mdle, Collections.emptySet()).forEach((pkg) -> {
44689
53c703004306 8175823: doclet crashes when documenting a single class in a module.
bpatel
parents: 44684
diff changeset
   288
            if (shouldDocument(pkg) && moduleMode == ModuleMode.ALL) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   289
                concealedPackages.add(pkg);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   290
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   291
        });
44293
2f47b2c16612 8176778: javadoc does not produce summary pages for aggregated modules
ksrini
parents: 42831
diff changeset
   292
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   293
        // Get all exported packages for the module using the exports directive for the module.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   294
        (ElementFilter.exportsIn(mdle.getDirectives())).forEach((directive) -> {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   295
            PackageElement p = directive.getPackage();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   296
            if (shouldDocument(p)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   297
                SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   298
                List<? extends ModuleElement> targetMdles = directive.getTargetModules();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   299
                if (targetMdles != null) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   300
                    mdleList.addAll(targetMdles);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   301
                }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   302
                // Qualified exports should not be displayed in the api mode. So if mdleList is empty,
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   303
                // its exported to all modules and hence can be added.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   304
                if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   305
                    exportedPackages.put(p, mdleList);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   306
                }
44689
53c703004306 8175823: doclet crashes when documenting a single class in a module.
bpatel
parents: 44684
diff changeset
   307
                if (moduleMode == ModuleMode.ALL) {
53c703004306 8175823: doclet crashes when documenting a single class in a module.
bpatel
parents: 44684
diff changeset
   308
                    concealedPackages.remove(p);
53c703004306 8175823: doclet crashes when documenting a single class in a module.
bpatel
parents: 44684
diff changeset
   309
                }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   310
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   311
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   312
        // Get all opened packages for the module using the opens directive for the module.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   313
        (ElementFilter.opensIn(mdle.getDirectives())).forEach((directive) -> {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   314
            PackageElement p = directive.getPackage();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   315
            if (shouldDocument(p)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   316
                SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   317
                List<? extends ModuleElement> targetMdles = directive.getTargetModules();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   318
                if (targetMdles != null) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   319
                    mdleList.addAll(targetMdles);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   320
                }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   321
                // Qualified opens should not be displayed in the api mode. So if mdleList is empty,
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   322
                // it is opened to all modules and hence can be added.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   323
                if (moduleMode == ModuleMode.ALL || mdleList.isEmpty()) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   324
                    openedPackages.put(p, mdleList);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   325
                }
44689
53c703004306 8175823: doclet crashes when documenting a single class in a module.
bpatel
parents: 44684
diff changeset
   326
                if (moduleMode == ModuleMode.ALL) {
53c703004306 8175823: doclet crashes when documenting a single class in a module.
bpatel
parents: 44684
diff changeset
   327
                    concealedPackages.remove(p);
53c703004306 8175823: doclet crashes when documenting a single class in a module.
bpatel
parents: 44684
diff changeset
   328
                }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   329
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   330
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   331
        // 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
   332
        // the indirect packages tables.
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   333
        dependentModules.forEach((module, mod) -> {
44807
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   334
            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
   335
            (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
   336
                PackageElement pkg = directive.getPackage();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   337
                if (shouldDocument(pkg)) {
44807
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   338
                    // Qualified exports are not displayed in API mode
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   339
                    if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) {
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   340
                        exportPkgList.add(pkg);
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   341
                    }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   342
                }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   343
            });
44807
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   344
            // 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
   345
            // 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
   346
            if (!exportPkgList.isEmpty()) {
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   347
                indirectPackages.put(module, exportPkgList);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   348
            }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   349
            SortedSet<PackageElement> openPkgList = new TreeSet<>(utils.makePackageComparator());
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   350
            (ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   351
                PackageElement pkg = directive.getPackage();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   352
                if (shouldDocument(pkg)) {
44807
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   353
                    // Qualified opens are not displayed in API mode
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   354
                    if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) {
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   355
                        openPkgList.add(pkg);
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   356
                    }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   357
                }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   358
            });
44807
47e09e3f1829 8178339: javadoc includes qualified opens in "Additional Opened Packages" section
ksrini
parents: 44689
diff changeset
   359
            // 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
   360
            // 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
   361
            if (!openPkgList.isEmpty()) {
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   362
                indirectOpenPackages.put(module, openPkgList);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   363
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   364
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   365
        // 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
   366
        (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
   367
            TypeElement u = directive.getService();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   368
            if (shouldDocument(u)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   369
                uses.add(u);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   370
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   371
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   372
        // 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
   373
        (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
   374
            TypeElement u = directive.getService();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   375
            if (shouldDocument(u)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   376
                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
   377
                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
   378
                implSet.addAll(implList);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   379
                provides.put(u, implSet);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   380
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   381
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   382
        // 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
   383
        (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
   384
            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
   385
            if (t != null) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   386
                providesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false));
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   387
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   388
        });
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   389
        // 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
   390
        (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
   391
            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
   392
            if (t != null) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   393
                usesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false));
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
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
     * 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
   400
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   401
     * @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
   402
     * @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
   403
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   404
    public boolean shouldDocument(Element element) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   405
        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
   406
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   407
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
     * 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
   410
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   411
     * @param section set of elements
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   412
     * @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
   413
     */
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   414
    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
   415
        return section != null && !section.isEmpty();
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
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
     * 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
   420
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   421
     * @param section map of elements.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   422
     * @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
   423
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   424
    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
   425
        return section != null && !section.isEmpty();
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   426
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   427
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   428
    /*
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   429
     * 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
   430
     * 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
   431
     */
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   432
    private boolean displayServices(Set<TypeElement> typeElements,
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   433
                                    Map<TypeElement, Content> tagsMap) {
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   434
        return typeElements != null &&
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   435
                typeElements.stream().anyMatch((v) -> displayServiceDirective(v, tagsMap));
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
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   438
    /*
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   439
     * 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
   440
     * from a javadoc tag in tagsMap.
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   441
     */
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   442
    private boolean displayServiceDirective(TypeElement typeElement,
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   443
                                            Map<TypeElement, Content> tagsMap) {
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   444
        return moduleMode == ModuleMode.ALL || tagsMap.containsKey(typeElement);
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   445
    }
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   446
39670
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
     * Add the summary header.
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   449
     *
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   450
     * @param startMarker the marker comment
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   451
     * @param markerAnchor the marker anchor for the section
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   452
     * @param heading the heading for the section
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   453
     * @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
   454
     */
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   455
    public void addSummaryHeader(Content startMarker, SectionName markerAnchor, Content heading,
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   456
            Content htmltree) {
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   457
        htmltree.addContent(startMarker);
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   458
        htmltree.addContent(getMarkerAnchor(markerAnchor));
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   459
        htmltree.addContent(HtmlTree.HEADING(HtmlTag.H3, heading));
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   460
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   461
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   462
    /**
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   463
     * 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
   464
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   465
     * @param caption the table caption
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   466
     * @param tableSummary the summary for the table
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   467
     * @param tableStyle the table style
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   468
     * @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
   469
     * @return a content object
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   470
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   471
    private Table getTable2(Content caption, String tableSummary, HtmlStyle tableStyle,
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   472
            TableHeader tableHeader) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   473
        return new Table(configuration.htmlVersion, tableStyle)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   474
                .setSummary(tableSummary)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   475
                .setCaption(caption)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   476
                .setHeader(tableHeader)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   477
                .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast);
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
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   480
    /**
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   481
     * 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
   482
     *
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   483
     * @param caption the table caption
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   484
     * @param tableSummary the summary for the table
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   485
     * @param tableStyle the table style
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   486
     * @param tableHeader the table header
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   487
     * @return a content object
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   488
     */
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   489
    private Table getTable3(Content caption, String tableSummary, HtmlStyle tableStyle,
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   490
            TableHeader tableHeader) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   491
        return new Table(configuration.htmlVersion, tableStyle)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   492
                .setSummary(tableSummary)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   493
                .setCaption(caption)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   494
                .setHeader(tableHeader)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   495
                .setRowScopeColumn(1)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   496
                .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
   497
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   498
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   499
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   500
     * {@inheritDoc}
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   501
     */
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   502
    @Override
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   503
    public void addModulesSummary(Content summaryContentTree) {
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   504
        if (display(requires) || display(indirectModules)) {
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   505
            TableHeader requiresTableHeader =
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   506
                    new TableHeader(contents.modifierLabel, contents.moduleLabel,
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   507
                            contents.descriptionLabel);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   508
            HtmlTree li = new HtmlTree(HtmlTag.LI);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   509
            li.setStyle(HtmlStyle.blockList);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   510
            addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES,
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   511
                    contents.navModules, li);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   512
            if (display(requires)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   513
                String text = resources.getText("doclet.Requires_Summary");
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   514
                String tableSummary = resources.getText("doclet.Member_Table_Summary",
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   515
                        text,
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   516
                        resources.getText("doclet.modules"));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   517
                Content caption = getTableCaption(new StringContent(text));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   518
                Table table = getTable3(caption, tableSummary, HtmlStyle.requiresSummary,
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   519
                            requiresTableHeader);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   520
                addModulesList(requires, table);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   521
                li.addContent(table.toContent());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   522
            }
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   523
            // Display indirect modules table in both "api" and "all" mode.
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   524
            if (display(indirectModules)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   525
                String amrText = resources.getText("doclet.Indirect_Requires_Summary");
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   526
                String amrTableSummary = resources.getText("doclet.Member_Table_Summary",
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   527
                        amrText,
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   528
                        configuration.getText("doclet.modules"));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   529
                Content amrCaption = getTableCaption(new StringContent(amrText));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   530
                Table amrTable = getTable3(amrCaption, amrTableSummary, HtmlStyle.requiresSummary,
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   531
                            requiresTableHeader);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   532
                addModulesList(indirectModules, amrTable);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   533
                li.addContent(amrTable.toContent());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   534
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   535
            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   536
            summaryContentTree.addContent(ul);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   537
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   538
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   539
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   540
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   541
     * Add the list of modules.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   542
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   543
     * @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
   544
     * @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
   545
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   546
    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
   547
        for (ModuleElement m : mdleMap.keySet()) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   548
            Content modifiers = mdleMap.get(m);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   549
            Content moduleLink = getModuleLink(m, new StringContent(m.getQualifiedName()));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   550
            Content moduleSummary = new ContentBuilder();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   551
            addSummaryComment(m, moduleSummary);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   552
            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
   553
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   554
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   555
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   556
    @Override
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   557
    public void addPackagesSummary(Content summaryContentTree) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   558
        if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   559
                || display(indirectPackages) || display(indirectOpenPackages)) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   560
            HtmlTree li = new HtmlTree(HtmlTag.LI);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   561
            li.setStyle(HtmlStyle.blockList);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   562
            addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   563
                    contents.navPackages, li);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   564
            if (display(exportedPackages) || display(openedPackages) || display(concealedPackages)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   565
                String tableSummary = resources.getText("doclet.Member_Table_Summary",
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   566
                        resources.getText("doclet.Packages_Summary"),
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   567
                        resources.getText("doclet.packages"));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   568
                addPackageSummary(tableSummary, li);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   569
            }
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   570
            TableHeader indirectPackagesHeader =
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   571
                    new TableHeader(contents.fromLabel, contents.packagesLabel);
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   572
            if (display(indirectPackages)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   573
                String aepText = resources.getText("doclet.Indirect_Exports_Summary");
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   574
                String aepTableSummary = resources.getText("doclet.Indirect_Packages_Table_Summary",
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   575
                        aepText,
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   576
                        resources.getText("doclet.modules"),
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   577
                        resources.getText("doclet.packages"));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   578
                Table aepTable = getTable2(new StringContent(aepText), aepTableSummary,
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   579
                        HtmlStyle.packagesSummary, indirectPackagesHeader);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   580
                addIndirectPackages(aepTable, indirectPackages);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   581
                li.addContent(aepTable.toContent());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   582
            }
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   583
            if (display(indirectOpenPackages)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   584
                String aopText = resources.getText("doclet.Indirect_Opens_Summary");
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   585
                String aopTableSummary = resources.getText("doclet.Indirect_Packages_Table_Summary",
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   586
                        aopText,
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   587
                        resources.getText("doclet.modules"),
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   588
                        resources.getText("doclet.packages"));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   589
                Table aopTable = getTable2(new StringContent(aopText), aopTableSummary,
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   590
                        HtmlStyle.packagesSummary, indirectPackagesHeader);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   591
                addIndirectPackages(aopTable, indirectOpenPackages);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   592
                li.addContent(aopTable.toContent());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   593
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   594
            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   595
            summaryContentTree.addContent(ul);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   596
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   597
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   598
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   599
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   600
     * 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
   601
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   602
     * @param tableSummary
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   603
     * @param li
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   604
     */
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   605
    public void addPackageSummary(String tableSummary, HtmlTree li) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   606
        Table table = new Table(configuration.htmlVersion, HtmlStyle.packagesSummary)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   607
                .setSummary(tableSummary)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   608
                .setDefaultTab(resources.getText("doclet.All_Packages"))
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   609
                .addTab(resources.getText("doclet.Exported_Packages_Summary"),
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   610
                        e -> exportedPackages.containsKey((PackageElement) e))
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   611
                .addTab(resources.getText("doclet.Opened_Packages_Summary"),
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   612
                        e -> openedPackages.containsKey((PackageElement) e))
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   613
                .addTab(resources.getText("doclet.Concealed_Packages_Summary"),
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   614
                        e -> concealedPackages.contains((PackageElement) e))
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   615
                .setTabScript(i -> String.format("showPkgs(%d);", i))
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   616
                .setTabScriptVariable("packages");
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   617
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   618
        if (configuration.docEnv.getModuleMode() == ModuleMode.API) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   619
            table.setHeader(new TableHeader(contents.packageLabel, contents.descriptionLabel))
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   620
                    .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   621
        } else {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   622
            table.setHeader(new TableHeader(contents.packageLabel, contents.moduleLabel, contents.descriptionLabel))
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   623
                    .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
   624
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   625
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   626
        addPackageTableRows(table);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   627
        li.addContent(table.toContent());
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   628
        if (table.needsScript()) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   629
            script.addContent(new RawHtml(table.getScript()));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   630
        }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   631
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   632
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   633
    /**
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   634
     * Get the package table rows.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   635
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   636
     * @return a content object
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   637
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   638
    private void addPackageTableRows(Table table) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   639
        addPackageTableRows(table, exportedPackages);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   640
        addPackageTableRows(table, openedPackages);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   641
        // Show concealed packages only in "all" mode.
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   642
        if (moduleMode == ModuleMode.ALL) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   643
            for (PackageElement pkg : concealedPackages) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   644
                Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   645
                Content noModules = new StringContent(resources.getText("doclet.None"));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   646
                Content summary = new ContentBuilder();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   647
                addSummaryComment(pkg, summary);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   648
                table.addRow(pkg, pkgLinkContent, noModules, summary);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   649
            }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   650
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   651
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   652
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   653
    private void addPackageTableRows(Table table, Map<PackageElement,SortedSet<ModuleElement>> ap) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   654
        for (Map.Entry<PackageElement, SortedSet<ModuleElement>> entry : ap.entrySet()) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   655
            List<Content> row = new ArrayList<>();
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   656
            PackageElement pkg = entry.getKey();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   657
            SortedSet<ModuleElement> mdleList = entry.getValue();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   658
            Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   659
            row.add(pkgLinkContent);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   660
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   661
            if (moduleMode == ModuleMode.ALL) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   662
                Content modules = new ContentBuilder();
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   663
                if (!mdleList.isEmpty()) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   664
                    for (ModuleElement m : mdleList) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   665
                        if (!modules.isEmpty()) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   666
                            modules.addContent(new HtmlTree(HtmlTag.BR));
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   667
                        }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   668
                        modules.addContent(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
   669
                    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   670
                } else {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   671
                    Content allModules = new StringContent(resources.getText("doclet.All_Modules"));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   672
                    modules.addContent(allModules);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   673
                }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   674
                row.add(modules);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   675
            }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   676
            Content summary = new ContentBuilder();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   677
            addSummaryComment(pkg, summary);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   678
            row.add(summary);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   679
            table.addRow(pkg, row);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   680
        }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   681
    }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   682
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   683
    /**
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   684
     * 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
   685
     *
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   686
     * @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
   687
     * @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
   688
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   689
    public void addIndirectPackages(Table table, Map<ModuleElement, SortedSet<PackageElement>> ip) {
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   690
        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
   691
            ModuleElement m = entry.getKey();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   692
            SortedSet<PackageElement> pkgList = entry.getValue();
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   693
            Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName()));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   694
            Content packages = new ContentBuilder();
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   695
            String sep = "";
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   696
            for (PackageElement pkg : pkgList) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   697
                packages.addContent(sep);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   698
                packages.addContent(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
   699
                sep = " ";
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
            table.addRow(moduleLinkContent, packages);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   702
        }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   703
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   704
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   705
    /**
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   706
     * {@inheritDoc}
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   707
     */
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   708
    @Override
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   709
    public void addServicesSummary(Content summaryContentTree) {
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   710
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   711
        boolean haveUses = displayServices(uses, usesTrees);
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   712
        boolean haveProvides = displayServices(provides.keySet(), providesTrees);
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   713
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   714
        if (haveProvides || haveUses) {
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   715
            HtmlTree li = new HtmlTree(HtmlTag.LI);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   716
            li.setStyle(HtmlStyle.blockList);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   717
            addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   718
                    contents.navServices, li);
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   719
            TableHeader usesProvidesTableHeader =
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   720
                    new TableHeader(contents.typeLabel, contents.descriptionLabel);
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   721
            if (haveProvides) {
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   722
                String label = resources.getText("doclet.Provides_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   723
                String tableSummary = resources.getText("doclet.Member_Table_Summary",
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   724
                        label,
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   725
                        resources.getText("doclet.types"));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   726
                Table table = getTable2(new StringContent(label), tableSummary, HtmlStyle.providesSummary,
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   727
                        usesProvidesTableHeader);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   728
                addProvidesList(table);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   729
                if (!table.isEmpty()) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   730
                    li.addContent(table.toContent());
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   731
                }
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   732
            }
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   733
            if (haveUses){
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   734
                String label = resources.getText("doclet.Uses_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   735
                String tableSummary = resources.getText("doclet.Member_Table_Summary",
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   736
                        label,
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   737
                        resources.getText("doclet.types"));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   738
                Table table = getTable2(new StringContent(label), tableSummary, HtmlStyle.usesSummary,
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   739
                        usesProvidesTableHeader);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   740
                addUsesList(table);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   741
                if (!table.isEmpty()) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   742
                    li.addContent(table.toContent());
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   743
                }
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   744
            }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   745
            HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   746
            summaryContentTree.addContent(ul);
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   747
        }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   748
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   749
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   750
    /**
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   751
     * Add the uses list for the module.
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   752
     *
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   753
     * @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
   754
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   755
    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
   756
        Content typeLinkContent;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   757
        Content description;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   758
        for (TypeElement t : uses) {
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   759
            if (!displayServiceDirective(t, usesTrees)) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   760
                continue;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   761
            }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   762
            typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, t));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   763
            Content summary = new ContentBuilder();
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   764
            if (display(usesTrees)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   765
                description = usesTrees.get(t);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   766
                if (description != null) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   767
                    summary.addContent(description);
42831
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
            }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   770
            addSummaryComment(t, summary);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   771
            table.addRow(typeLinkContent, summary);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   772
        }
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   773
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   774
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   775
    /**
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   776
     * Add the provides list for the module.
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   777
     *
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   778
     * @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
   779
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   780
    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
   781
        SortedSet<TypeElement> implSet;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   782
        Content description;
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   783
        for (Map.Entry<TypeElement, SortedSet<TypeElement>> entry : provides.entrySet()) {
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   784
            TypeElement srv = entry.getKey();
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   785
            if (!displayServiceDirective(srv, providesTrees)) {
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   786
                continue;
44684
6ce4d52084e8 8178067: support for @uses/@provides tags is broken
ksrini
parents: 44564
diff changeset
   787
            }
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   788
            implSet = entry.getValue();
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   789
            Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   790
            Content desc = new ContentBuilder();
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   791
            if (display(providesTrees)) {
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   792
                description = providesTrees.get(srv);
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   793
                if (description != null) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   794
                    desc.addContent(description);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   795
                }
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   796
            }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   797
            addSummaryComment(srv, desc);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   798
            // 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
   799
            if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   800
                desc.addContent(new HtmlTree(HtmlTag.BR));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   801
                desc.addContent("(");
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   802
                HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   803
                desc.addContent(implSpan);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   804
                desc.addContent(Contents.SPACE);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   805
                String sep = "";
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   806
                for (TypeElement impl : implSet) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   807
                    desc.addContent(sep);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   808
                    desc.addContent(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
   809
                    sep = ", ";
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   810
                }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   811
                desc.addContent(")");
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   812
            }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   813
            table.addRow(srvLinkContent, desc);
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   814
        }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   815
    }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   816
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   817
    /**
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   818
     * Add the module deprecation information to the documentation tree.
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   819
     *
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   820
     * @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
   821
     */
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   822
    public void addDeprecationInfo(Content div) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   823
        List<? extends DocTree> deprs = utils.getBlockTags(mdle, DocTree.Kind.DEPRECATED);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   824
        if (utils.isDeprecated(mdle)) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   825
            CommentHelper ch = utils.getCommentHelper(mdle);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   826
            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   827
            deprDiv.setStyle(HtmlStyle.deprecationBlock);
42816
3638773ff1b0 8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents: 42407
diff changeset
   828
            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle));
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   829
            deprDiv.addContent(deprPhrase);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   830
            if (!deprs.isEmpty()) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   831
                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   832
                if (!commentTags.isEmpty()) {
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   833
                    addInlineDeprecatedComment(mdle, deprs.get(0), deprDiv);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   834
                }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   835
            }
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   836
            div.addContent(deprDiv);
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   837
        }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   838
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   839
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   840
    /**
37747
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   841
     * {@inheritDoc}
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   842
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   843
    @Override
37747
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   844
    public void addModuleDescription(Content moduleContentTree) {
41452
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 41157
diff changeset
   845
        if (!utils.getFullBody(mdle).isEmpty()) {
37747
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   846
            Content tree = configuration.allowTag(HtmlTag.SECTION) ? HtmlTree.SECTION() : moduleContentTree;
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   847
            addDeprecationInfo(tree);
37747
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   848
            tree.addContent(HtmlConstants.START_OF_MODULE_DESCRIPTION);
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   849
            tree.addContent(getMarkerAnchor(SectionName.MODULE_DESCRIPTION));
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   850
            addInlineComment(mdle, tree);
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   851
            if (configuration.allowTag(HtmlTag.SECTION)) {
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   852
                moduleContentTree.addContent(tree);
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   853
            }
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   854
        }
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   855
    }
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   856
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   857
    /**
38911
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   858
     * {@inheritDoc}
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   859
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   860
    @Override
38911
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   861
    public void addModuleTags(Content moduleContentTree) {
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   862
        Content tree = (configuration.allowTag(HtmlTag.SECTION))
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   863
                ? HtmlTree.SECTION()
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   864
                : moduleContentTree;
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   865
        addTagsInfo(mdle, tree);
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   866
        if (configuration.allowTag(HtmlTag.SECTION)) {
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   867
            moduleContentTree.addContent(tree);
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   868
        }
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   869
    }
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   870
48a00b5ee366 8156077: Support javadoc tags in module documentation
bpatel
parents: 37943
diff changeset
   871
    /**
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   872
     * Add summary details to the navigation bar.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   873
     *
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   874
     * @param subDiv the content tree to which the summary detail links will be added
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   875
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   876
    @Override
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   877
    protected void addSummaryDetailLinks(Content subDiv) {
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
   878
        Content div = HtmlTree.DIV(getNavSummaryLinks());
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
   879
        subDiv.addContent(div);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   880
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   881
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   882
    /**
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   883
     * Get summary links for navigation bar.
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   884
     *
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   885
     * @return the content tree for the navigation summary links
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   886
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
   887
    protected Content getNavSummaryLinks() {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   888
        Content li = HtmlTree.LI(contents.moduleSubNavLabel);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   889
        li.addContent(Contents.SPACE);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   890
        Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   891
        Content liNav = new HtmlTree(HtmlTag.LI);
41452
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 41157
diff changeset
   892
        liNav.addContent(!utils.getFullBody(mdle).isEmpty() && !configuration.nocomment
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   893
                ? getHyperLink(SectionName.MODULE_DESCRIPTION, contents.navModuleDescription)
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   894
                : contents.navModuleDescription);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   895
        addNavGap(liNav);
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   896
        liNav.addContent((display(requires) || display(indirectModules))
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   897
                ? getHyperLink(SectionName.MODULES, contents.navModules)
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   898
                : contents.navModules);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   899
        addNavGap(liNav);
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   900
        liNav.addContent((display(exportedPackages) || display(openedPackages) || display(concealedPackages)
44564
4e1df2513486 8177562: Small updates to module summary page
jjg
parents: 44293
diff changeset
   901
                || display(indirectPackages) || display(indirectOpenPackages))
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   902
                ? getHyperLink(SectionName.PACKAGES, contents.navPackages)
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   903
                : contents.navPackages);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   904
        addNavGap(liNav);
46082
c65be9fae87b 8185151: doclet may create a link to a missing anchor/id
pmuthuswamy
parents: 45417
diff changeset
   905
        liNav.addContent((displayServices(uses, usesTrees) || displayServices(provides.keySet(), providesTrees))
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   906
                ? getHyperLink(SectionName.SERVICES, contents.navServices)
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   907
                : contents.navServices);
39670
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   908
        ulNav.addContent(liNav);
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   909
        return ulNav;
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   910
    }
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   911
9d1eafbf29c6 8154261: Module summary page should display directives for the module
bpatel
parents: 38911
diff changeset
   912
    /**
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   913
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   914
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   915
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   916
    public void addModuleContent(Content contentTree, Content moduleContentTree) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   917
        if (configuration.allowTag(HtmlTag.MAIN)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   918
            mainTree.addContent(moduleContentTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   919
            contentTree.addContent(mainTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   920
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   921
            contentTree.addContent(moduleContentTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   922
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   923
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   924
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   925
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   926
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   927
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   928
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   929
    public void addModuleFooter(Content contentTree) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   930
        Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   931
                ? HtmlTree.FOOTER()
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   932
                : contentTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   933
        addNavLinks(false, htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   934
        addBottom(htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   935
        if (configuration.allowTag(HtmlTag.FOOTER)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   936
            contentTree.addContent(htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   937
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   938
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   939
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   940
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   941
     * {@inheritDoc}
42831
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   942
     *
feff6f296019 8160196: Module summary page should display information based on "api" or "detail" mode.
bpatel
parents: 42816
diff changeset
   943
     * @throws jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   944
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
   945
    @Override
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
   946
    public void printDocument(Content contentTree) throws DocFileIOException {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   947
        printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle),
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   948
                true, contentTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   949
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   950
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   951
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   952
     * Add the module package deprecation information to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   953
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   954
     * @param li the content tree to which the deprecation information will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   955
     * @param pkg the PackageDoc that is added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   956
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   957
    public void addPackageDeprecationInfo(Content li, PackageElement pkg) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   958
        List<? extends DocTree> deprs;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   959
        if (utils.isDeprecated(pkg)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   960
            deprs = utils.getDeprecatedTrees(pkg);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   961
            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47427
diff changeset
   962
            deprDiv.setStyle(HtmlStyle.deprecationBlock);
42816
3638773ff1b0 8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents: 42407
diff changeset
   963
            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg));
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   964
            deprDiv.addContent(deprPhrase);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   965
            if (!deprs.isEmpty()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   966
                CommentHelper ch = utils.getCommentHelper(pkg);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   967
                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   968
                if (!commentTags.isEmpty()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   969
                    addInlineDeprecatedComment(pkg, deprs.get(0), deprDiv);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   970
                }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   971
            }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   972
            li.addContent(deprDiv);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   973
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   974
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   975
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   976
    /**
37943
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 37747
diff changeset
   977
     * Get this module link.
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 37747
diff changeset
   978
     *
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 37747
diff changeset
   979
     * @return a content tree for the module link
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 37747
diff changeset
   980
     */
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 37747
diff changeset
   981
    @Override
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 37747
diff changeset
   982
    protected Content getNavLinkModule() {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   983
        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.moduleLabel);
37943
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 37747
diff changeset
   984
        return li;
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 37747
diff changeset
   985
    }
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 37747
diff changeset
   986
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 37747
diff changeset
   987
    /**
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   988
     * Get "PREV MODULE" link in the navigation bar.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   989
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   990
     * @return a content tree for the previous link
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   991
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
   992
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   993
    public Content getNavLinkPrevious() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   994
        Content li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   995
        if (prevModule == null) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   996
            li = HtmlTree.LI(contents.prevModuleLabel);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   997
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   998
            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   999
                    prevModule)), contents.prevModuleLabel, "", ""));
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1000
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1001
        return li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1002
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1003
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1004
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1005
     * Get "NEXT MODULE" link in the navigation bar.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1006
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1007
     * @return a content tree for the next link
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1008
     */
42407
f3702cff2933 8169069: Module system implementation refresh (11/2016)
alanb
parents: 41452
diff changeset
  1009
    @Override
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1010
    public Content getNavLinkNext() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1011
        Content li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1012
        if (nextModule == null) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
  1013
            li = HtmlTree.LI(contents.nextModuleLabel);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1014
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1015
            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
  1016
                    nextModule)), contents.nextModuleLabel, "", ""));
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1017
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1018
        return li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1019
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
  1020
}