langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
author alanb
Thu, 17 Mar 2016 19:04:28 +0000
changeset 36526 3b41f1c69604
child 37747 878801512393
permissions -rw-r--r--
8142968: Module System implementation Summary: Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282 Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, jan.lahoda@oracle.com, vicente.romero@oracle.com, andreas.lundblad@oracle.com, andrey.x.nazarov@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, kumar.x.srinivasan@oracle.com, sundararajan.athijegannathan@oracle.com
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
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   171
     * Adds list of packages in the package summary table. Generate link to each package.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   172
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   173
     * @param packages Packages to which link is to be generated
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   174
     * @param tbody the documentation tree to which the list will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   175
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   176
    protected void addPackagesList(Set<PackageElement> packages, Content tbody) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   177
        boolean altColor = true;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   178
        for (PackageElement pkg : packages) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   179
            if (pkg != null && !pkg.isUnnamed()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   180
                if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   181
                    Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   182
                    Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   183
                    HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   184
                    tdSummary.addStyle(HtmlStyle.colLast);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   185
                    addSummaryComment(pkg, tdSummary);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   186
                    HtmlTree tr = HtmlTree.TR(tdPackage);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   187
                    tr.addContent(tdSummary);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   188
                    tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   189
                    tbody.addContent(tr);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   190
                }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   191
            }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   192
            altColor = !altColor;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   193
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   194
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   195
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   196
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   197
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   198
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   199
    public void addModuleContent(Content contentTree, Content moduleContentTree) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   200
        if (configuration.allowTag(HtmlTag.MAIN)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   201
            mainTree.addContent(moduleContentTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   202
            contentTree.addContent(mainTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   203
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   204
            contentTree.addContent(moduleContentTree);
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
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   208
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   209
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   210
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   211
    public void addModuleFooter(Content contentTree) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   212
        Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   213
                ? HtmlTree.FOOTER()
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   214
                : contentTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   215
        addNavLinks(false, htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   216
        addBottom(htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   217
        if (configuration.allowTag(HtmlTag.FOOTER)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   218
            contentTree.addContent(htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   219
        }
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
     * {@inheritDoc}
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   224
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   225
    public void printDocument(Content contentTree) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   226
        printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle),
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   227
                true, contentTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   228
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   229
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   230
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   231
     * Add the module package deprecation information to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   232
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   233
     * @param li the content tree to which the deprecation information will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   234
     * @param pkg the PackageDoc that is added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   235
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   236
    public void addPackageDeprecationInfo(Content li, PackageElement pkg) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   237
        List<? extends DocTree> deprs;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   238
        if (utils.isDeprecated(pkg)) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   239
            deprs = utils.getDeprecatedTrees(pkg);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   240
            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   241
            deprDiv.addStyle(HtmlStyle.deprecatedContent);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   242
            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   243
            deprDiv.addContent(deprPhrase);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   244
            if (!deprs.isEmpty()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   245
                CommentHelper ch = utils.getCommentHelper(pkg);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   246
                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   247
                if (!commentTags.isEmpty()) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   248
                    addInlineDeprecatedComment(pkg, deprs.get(0), deprDiv);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   249
                }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   250
            }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   251
            li.addContent(deprDiv);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   252
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   253
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   254
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   255
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   256
     * Get "PREV MODULE" link in the navigation bar.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   257
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   258
     * @return a content tree for the previous link
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   259
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   260
    public Content getNavLinkPrevious() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   261
        Content li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   262
        if (prevModule == null) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   263
            li = HtmlTree.LI(prevmoduleLabel);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   264
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   265
            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   266
                    prevModule)), prevmoduleLabel, "", ""));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   267
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   268
        return li;
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
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   272
     * Get "NEXT MODULE" link in the navigation bar.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   273
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   274
     * @return a content tree for the next link
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   275
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   276
    public Content getNavLinkNext() {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   277
        Content li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   278
        if (nextModule == null) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   279
            li = HtmlTree.LI(nextmoduleLabel);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   280
        } else {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   281
            li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.moduleSummary(
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   282
                    nextModule)), nextmoduleLabel, "", ""));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   283
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   284
        return li;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   285
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   286
}