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