langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
author jjg
Tue, 09 Aug 2016 13:22:57 -0700
changeset 40303 96a1226aca18
parent 36526 3b41f1c69604
child 40508 74ef30d16fb9
permissions -rw-r--r--
8160697: HTMLWriter needs perf cleanup Reviewed-by: ksrini, bpatel
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.Map;
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 jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    36
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    37
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    38
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    39
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    40
import jdk.javadoc.internal.doclets.toolkit.Content;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    41
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    42
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    43
/**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    44
 * Abstract class to generate the module overview files in
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    45
 * Frame and Non-Frame format. This will be sub-classed to
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    46
 * generate module-overview-frame.html as well as module-overview-summary.html.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    47
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    48
 *  <p><b>This is NOT part of any supported API.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    49
 *  If you write code that depends on this, you do so at your own risk.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    50
 *  This code and its internal interfaces are subject to change or
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    51
 *  deletion without notice.</b>
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    52
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    53
 * @author Bhavesh Patel
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    54
 */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    55
public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    56
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    57
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    58
     * Modules to be documented.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    59
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    60
    protected Map<ModuleElement, Set<PackageElement>> modules;
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
     * Constructor. Also initializes the modules variable.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    64
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    65
     * @param configuration  The current configuration
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    66
     * @param filename Name of the module index file to be generated.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    67
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    68
    public AbstractModuleIndexWriter(ConfigurationImpl configuration,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36526
diff changeset
    69
                                      DocPath filename) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    70
        super(configuration, filename);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    71
        modules = configuration.modulePackages;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    72
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    73
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    74
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    75
     * Adds the navigation bar header to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    76
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    77
     * @param body the document tree to which the navigation bar header will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    78
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    79
    protected abstract void addNavigationBarHeader(Content body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    80
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    81
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    82
     * Adds the navigation bar footer to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    83
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    84
     * @param body the document tree to which the navigation bar footer will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    85
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    86
    protected abstract void addNavigationBarFooter(Content body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    87
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    88
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    89
     * Adds the overview header to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    90
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    91
     * @param body the document tree to which the overview header will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    92
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    93
    protected abstract void addOverviewHeader(Content body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    94
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    95
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    96
     * Adds the modules list to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    97
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    98
     * @param modules the set of modules
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    99
     * @param text caption for the table
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   100
     * @param tableSummary summary for the table
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   101
     * @param body the document tree to which the modules list will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   102
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   103
    protected abstract void addModulesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   104
            String tableSummary, Content body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   105
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   106
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   107
     * Adds the module packages list to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   108
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   109
     * @param modules the set of modules
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   110
     * @param text caption for the table
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   111
     * @param tableSummary summary for the table
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   112
     * @param body the document tree to which the modules list will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   113
     * @param mdle the module being documented
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   114
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   115
    protected abstract void addModulePackagesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   116
            String tableSummary, Content body, ModuleElement mdle);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   117
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   118
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   119
     * Generate and prints the contents in the module index file. Call appropriate
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   120
     * methods from the sub-class in order to generate Frame or Non
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   121
     * Frame format.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   122
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   123
     * @param title the title of the window.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   124
     * @param includeScript boolean set true if windowtitle script is to be included
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   125
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   126
    protected void buildModuleIndexFile(String title, boolean includeScript) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   127
        String windowOverview = configuration.getText(title);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   128
        Content body = getBody(includeScript, getWindowTitle(windowOverview));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   129
        addNavigationBarHeader(body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   130
        addOverviewHeader(body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   131
        addIndex(body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   132
        addOverview(body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   133
        addNavigationBarFooter(body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   134
        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   135
                configuration.doctitle), includeScript, body);
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
     * Generate and prints the contents in the module packages index file. Call appropriate
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   140
     * methods from the sub-class in order to generate Frame or Non
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   141
     * Frame format.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   142
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   143
     * @param title the title of the window.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   144
     * @param includeScript boolean set true if windowtitle script is to be included
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   145
     * @param moduleName the name of the module being documented
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   146
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   147
    protected void buildModulePackagesIndexFile(String title,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   148
            boolean includeScript, ModuleElement mdle) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   149
        String windowOverview = configuration.getText(title);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   150
        Content body = getBody(includeScript, getWindowTitle(windowOverview));
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   151
        addNavigationBarHeader(body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   152
        addOverviewHeader(body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   153
        addModulePackagesIndex(body, mdle);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   154
        addOverview(body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   155
        addNavigationBarFooter(body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   156
        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   157
                configuration.doctitle), includeScript, body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   158
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   159
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   160
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   161
     * Default to no overview, override to add overview.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   162
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   163
     * @param body the document tree to which the overview will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   164
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   165
    protected void addOverview(Content body) throws IOException {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   166
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   167
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   168
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   169
     * Adds the frame or non-frame module index to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   170
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   171
     * @param body the document tree to which the index will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   172
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   173
    protected void addIndex(Content body) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   174
        addIndexContents(modules, "doclet.Module_Summary",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   175
                configuration.getText("doclet.Member_Table_Summary",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   176
                configuration.getText("doclet.Module_Summary"),
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   177
                configuration.getText("doclet.modules")), body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   178
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   179
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   180
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   181
     * Adds the frame or non-frame module packages index to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   182
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   183
     * @param body the document tree to which the index will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   184
     * @param mdle the module being documented
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   185
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   186
    protected void addModulePackagesIndex(Content body, ModuleElement mdle) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   187
        addModulePackagesIndexContents("doclet.Module_Summary",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   188
                configuration.getText("doclet.Member_Table_Summary",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   189
                configuration.getText("doclet.Module_Summary"),
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   190
                configuration.getText("doclet.modules")), body, mdle);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   191
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   192
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   193
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   194
     * Adds module index contents. Call appropriate methods from
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   195
     * the sub-classes. Adds it to the body HtmlTree
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   196
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   197
     * @param modules the modules to be documented
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   198
     * @param text string which will be used as the heading
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   199
     * @param tableSummary summary for the table
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   200
     * @param body the document tree to which the index contents will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   201
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   202
    protected void addIndexContents(Map<ModuleElement, Set<PackageElement>> modules, String text,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   203
            String tableSummary, Content body) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   204
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   205
                ? HtmlTree.NAV()
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   206
                : new HtmlTree(HtmlTag.DIV);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   207
        htmlTree.addStyle(HtmlStyle.indexNav);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   208
        HtmlTree ul = new HtmlTree(HtmlTag.UL);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   209
        addAllClassesLink(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   210
        addAllPackagesLink(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   211
        htmlTree.addContent(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   212
        body.addContent(htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   213
        addModulesList(modules, text, tableSummary, body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   214
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   215
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   216
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   217
     * Adds module packages index contents. Call appropriate methods from
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   218
     * the sub-classes. Adds it to the body HtmlTree
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   219
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   220
     * @param text string which will be used as the heading
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   221
     * @param tableSummary summary for the table
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   222
     * @param body the document tree to which the index contents will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   223
     * @param mdle the module being documented
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   224
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   225
    protected void addModulePackagesIndexContents(String text,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   226
            String tableSummary, Content body, ModuleElement mdle) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   227
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   228
                ? HtmlTree.NAV()
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   229
                : new HtmlTree(HtmlTag.DIV);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   230
        htmlTree.addStyle(HtmlStyle.indexNav);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   231
        HtmlTree ul = new HtmlTree(HtmlTag.UL);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   232
        addAllClassesLink(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   233
        addAllPackagesLink(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   234
        addAllModulesLink(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   235
        htmlTree.addContent(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   236
        body.addContent(htmlTree);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   237
        addModulePackagesList(modules, text, tableSummary, body, mdle);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   238
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   239
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   240
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   241
     * Adds the doctitle to the documentation tree, if it is specified on the command line.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   242
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   243
     * @param body the document tree to which the title will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   244
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   245
    protected void addConfigurationTitle(Content body) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   246
        if (configuration.doctitle.length() > 0) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   247
            Content title = new RawHtml(configuration.doctitle);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   248
            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   249
                    HtmlStyle.title, title);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   250
            Content div = HtmlTree.DIV(HtmlStyle.header, heading);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   251
            body.addContent(div);
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
     * Returns highlighted "Overview", in the navigation bar as this is the
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   257
     * overview page.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   258
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   259
     * @return a Content object to be added to the documentation tree
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   260
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   261
    protected Content getNavLinkContents() {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36526
diff changeset
   262
        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.overviewLabel);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   263
        return li;
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
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   267
     * Do nothing. This will be overridden in ModuleIndexFrameWriter.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   268
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   269
     * @param div the document tree to which the all classes link will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   270
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   271
    protected void addAllClassesLink(Content div) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   272
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   273
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   274
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   275
     * Do nothing. This will be overridden in ModuleIndexFrameWriter.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   276
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   277
     * @param div the document tree to which the all packages link will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   278
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   279
    protected void addAllPackagesLink(Content div) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   280
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   281
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   282
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   283
     * Do nothing. This will be overridden in ModulePackageIndexFrameWriter.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   284
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   285
     * @param div the document tree to which the all modules link will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   286
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   287
    protected void addAllModulesLink(Content div) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   288
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   289
}