langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
author bpatel
Thu, 28 Apr 2016 05:10:11 +0000
changeset 37747 878801512393
parent 36526 3b41f1c69604
child 37943 2efb75c09230
permissions -rw-r--r--
8154119: Module summary page should display module description Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     2
 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
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
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    28
import java.io.*;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    29
import java.util.List;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    30
import java.util.Set;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    31
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    32
import javax.lang.model.element.ModuleElement;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    33
import javax.lang.model.element.PackageElement;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    34
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    35
import com.sun.source.doctree.DocTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    36
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    37
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    38
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    39
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    40
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    41
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    42
import jdk.javadoc.internal.doclets.toolkit.Content;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    43
import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    44
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    45
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    46
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    47
/**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    48
 * Class to generate file for each module contents in the right-hand
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    49
 * frame. This will list all the packages and Class Kinds in the module. A click on any
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    50
 * class-kind will update the frame with the clicked class-kind page. A click on any
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    51
 * package will update the frame with the clicked module package page.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    52
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    53
 *  <p><b>This is NOT part of any supported API.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    54
 *  If you write code that depends on this, you do so at your own risk.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    55
 *  This code and its internal interfaces are subject to change or
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    56
 *  deletion without notice.</b>
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    57
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    58
 * @author Bhavesh Patel
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    59
 */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    60
public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryWriter {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    61
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    62
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    63
     * The prev module name in the alpha-order list.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    64
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    65
    protected ModuleElement prevModule;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    66
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    67
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    68
     * The next module name in the alpha-order list.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    69
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    70
    protected ModuleElement nextModule;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    71
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    72
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    73
     * The module being documented.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    74
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    75
    protected ModuleElement mdle;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    76
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    77
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    78
     * The HTML tree for main tag.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    79
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    80
    protected HtmlTree mainTree = HtmlTree.MAIN();
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    81
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    82
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    83
     * Constructor to construct ModuleWriter object and to generate
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    84
     * "moduleName-summary.html" file.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    85
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    86
     * @param configuration the configuration of the doclet.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    87
     * @param module        Module under consideration.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    88
     * @param prevModule   Previous module in the sorted array.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    89
     * @param nextModule   Next module in the sorted array.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    90
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    91
    public ModuleWriterImpl(ConfigurationImpl configuration,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    92
            ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule)
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    93
            throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    94
        super(configuration, DocPaths.moduleSummary(mdle));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    95
        this.prevModule = prevModule;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    96
        this.nextModule = nextModule;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    97
        this.mdle = mdle;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    98
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    99
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   100
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   101
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   102
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   103
    public Content getModuleHeader(String heading) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   104
        HtmlTree bodyTree = getBody(true, getWindowTitle(mdle.getQualifiedName().toString()));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   105
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   106
                ? HtmlTree.HEADER()
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   107
                : bodyTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   108
        addTop(htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   109
        addNavLinks(true, htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   110
        if (configuration.allowTag(HtmlTag.HEADER)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   111
            bodyTree.addContent(htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   112
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   113
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   114
        div.addStyle(HtmlStyle.header);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   115
        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   116
                HtmlStyle.title, moduleLabel);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   117
        tHeading.addContent(getSpace());
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   118
        Content moduleHead = new RawHtml(heading);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   119
        tHeading.addContent(moduleHead);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   120
        div.addContent(tHeading);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   121
        if (configuration.allowTag(HtmlTag.MAIN)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   122
            mainTree.addContent(div);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   123
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   124
            bodyTree.addContent(div);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   125
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   126
        return bodyTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   127
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   128
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   129
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   130
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   131
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   132
    public Content getContentHeader() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   133
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   134
        div.addStyle(HtmlStyle.contentContainer);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   135
        return div;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   136
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   137
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   138
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   139
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   140
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   141
    public Content getSummaryHeader() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   142
        HtmlTree li = new HtmlTree(HtmlTag.LI);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   143
        li.addStyle(HtmlStyle.blockList);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   144
        return li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   145
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   146
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   147
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   148
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   149
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   150
    public Content getSummaryTree(Content summaryContentTree) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   151
        HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   152
        return ul;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   153
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   154
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   155
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   156
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   157
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   158
    public void addPackagesSummary(Set<PackageElement> packages, String text,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   159
            String tableSummary, Content summaryContentTree) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   160
        Content table = (configuration.isOutputHtml5())
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   161
                ? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text)))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   162
                : HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text)));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   163
        table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   164
        Content tbody = new HtmlTree(HtmlTag.TBODY);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   165
        addPackagesList(packages, tbody);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   166
        table.addContent(tbody);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   167
        summaryContentTree.addContent(table);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   168
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   169
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   170
    /**
37747
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   171
     * {@inheritDoc}
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   172
     */
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   173
    public void addModuleDescription(Content moduleContentTree) {
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   174
        if (!utils.getBody(mdle).isEmpty()) {
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   175
            Content tree = configuration.allowTag(HtmlTag.SECTION) ? HtmlTree.SECTION() : moduleContentTree;
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   176
            tree.addContent(HtmlConstants.START_OF_MODULE_DESCRIPTION);
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   177
            tree.addContent(getMarkerAnchor(SectionName.MODULE_DESCRIPTION));
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   178
            addInlineComment(mdle, tree);
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   179
            if (configuration.allowTag(HtmlTag.SECTION)) {
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   180
                moduleContentTree.addContent(tree);
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   181
            }
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   182
        }
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   183
    }
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   184
878801512393 8154119: Module summary page should display module description
bpatel
parents: 36526
diff changeset
   185
    /**
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   186
     * Adds list of packages in the package summary table. Generate link to each package.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   187
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   188
     * @param packages Packages to which link is to be generated
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   189
     * @param tbody the documentation tree to which the list will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   190
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   191
    protected void addPackagesList(Set<PackageElement> packages, Content tbody) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   192
        boolean altColor = true;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   193
        for (PackageElement pkg : packages) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   194
            if (pkg != null && !pkg.isUnnamed()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   195
                if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   196
                    Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   197
                    Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   198
                    HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   199
                    tdSummary.addStyle(HtmlStyle.colLast);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   200
                    addSummaryComment(pkg, tdSummary);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   201
                    HtmlTree tr = HtmlTree.TR(tdPackage);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   202
                    tr.addContent(tdSummary);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   203
                    tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   204
                    tbody.addContent(tr);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   205
                }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   206
            }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   207
            altColor = !altColor;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   208
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   209
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   210
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   211
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   212
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   213
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   214
    public void addModuleContent(Content contentTree, Content moduleContentTree) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   215
        if (configuration.allowTag(HtmlTag.MAIN)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   216
            mainTree.addContent(moduleContentTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   217
            contentTree.addContent(mainTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   218
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   219
            contentTree.addContent(moduleContentTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   220
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   221
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   222
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   223
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   224
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   225
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   226
    public void addModuleFooter(Content contentTree) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   227
        Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   228
                ? HtmlTree.FOOTER()
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   229
                : contentTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   230
        addNavLinks(false, htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   231
        addBottom(htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   232
        if (configuration.allowTag(HtmlTag.FOOTER)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   233
            contentTree.addContent(htmlTree);
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
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   237
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   238
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   239
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   240
    public void printDocument(Content contentTree) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   241
        printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle),
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   242
                true, contentTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   243
    }
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
     * Add the module package deprecation information to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   247
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   248
     * @param li the content tree to which the deprecation information will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   249
     * @param pkg the PackageDoc that is added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   250
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   251
    public void addPackageDeprecationInfo(Content li, PackageElement pkg) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   252
        List<? extends DocTree> deprs;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   253
        if (utils.isDeprecated(pkg)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   254
            deprs = utils.getDeprecatedTrees(pkg);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   255
            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   256
            deprDiv.addStyle(HtmlStyle.deprecatedContent);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   257
            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   258
            deprDiv.addContent(deprPhrase);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   259
            if (!deprs.isEmpty()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   260
                CommentHelper ch = utils.getCommentHelper(pkg);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   261
                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   262
                if (!commentTags.isEmpty()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   263
                    addInlineDeprecatedComment(pkg, deprs.get(0), deprDiv);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   264
                }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   265
            }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   266
            li.addContent(deprDiv);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   267
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   268
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   269
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   270
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   271
     * Get "PREV MODULE" link in the navigation bar.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   272
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   273
     * @return a content tree for the previous link
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   274
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   275
    public Content getNavLinkPrevious() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   276
        Content li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   277
        if (prevModule == null) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   278
            li = HtmlTree.LI(prevmoduleLabel);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   279
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   280
            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   281
                    prevModule)), prevmoduleLabel, "", ""));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   282
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   283
        return li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   284
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   285
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   286
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   287
     * Get "NEXT MODULE" link in the navigation bar.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   288
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   289
     * @return a content tree for the next link
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   290
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   291
    public Content getNavLinkNext() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   292
        Content li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   293
        if (nextModule == null) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   294
            li = HtmlTree.LI(nextmoduleLabel);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   295
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   296
            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   297
                    nextModule)), nextmoduleLabel, "", ""));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   298
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   299
        return li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   300
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   301
}