langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
changeset 40587 1c355ea550ed
parent 40508 74ef30d16fb9
child 45157 f5f796453339
equal deleted inserted replaced
40519:e17429a7e843 40587:1c355ea550ed
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package jdk.javadoc.internal.doclets.formats.html;
    26 package jdk.javadoc.internal.doclets.formats.html;
    27 
    27 
    28 import java.io.*;
       
    29 import java.util.Map;
    28 import java.util.Map;
    30 import java.util.Set;
    29 import java.util.Set;
    31 import java.util.SortedMap;
    30 import java.util.SortedMap;
    32 
    31 
    33 import javax.lang.model.element.ModuleElement;
    32 import javax.lang.model.element.ModuleElement;
    37 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
    36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
    38 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
    37 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
    39 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
    38 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
    40 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
    39 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
    41 import jdk.javadoc.internal.doclets.toolkit.Content;
    40 import jdk.javadoc.internal.doclets.toolkit.Content;
       
    41 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
    42 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
    42 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
    43 
    43 
    44 /**
    44 /**
    45  * Abstract class to generate the module overview files in
    45  * Abstract class to generate the module overview files in
    46  * Frame and Non-Frame format. This will be sub-classed to
    46  * Frame and Non-Frame format. This will be sub-classed to
   121      * methods from the sub-class in order to generate Frame or Non
   121      * methods from the sub-class in order to generate Frame or Non
   122      * Frame format.
   122      * Frame format.
   123      *
   123      *
   124      * @param title the title of the window.
   124      * @param title the title of the window.
   125      * @param includeScript boolean set true if windowtitle script is to be included
   125      * @param includeScript boolean set true if windowtitle script is to be included
   126      */
   126      * @throws DocFileIOException if there is a problem building the module index file
   127     protected void buildModuleIndexFile(String title, boolean includeScript) throws IOException {
   127      */
       
   128     protected void buildModuleIndexFile(String title, boolean includeScript) throws DocFileIOException {
   128         String windowOverview = configuration.getText(title);
   129         String windowOverview = configuration.getText(title);
   129         Content body = getBody(includeScript, getWindowTitle(windowOverview));
   130         Content body = getBody(includeScript, getWindowTitle(windowOverview));
   130         addNavigationBarHeader(body);
   131         addNavigationBarHeader(body);
   131         addOverviewHeader(body);
   132         addOverviewHeader(body);
   132         addIndex(body);
   133         addIndex(body);
   142      * Frame format.
   143      * Frame format.
   143      *
   144      *
   144      * @param title the title of the window.
   145      * @param title the title of the window.
   145      * @param includeScript boolean set true if windowtitle script is to be included
   146      * @param includeScript boolean set true if windowtitle script is to be included
   146      * @param mdle the name of the module being documented
   147      * @param mdle the name of the module being documented
       
   148      * @throws DocFileIOException if there is an exception building the module packages index file
   147      */
   149      */
   148     protected void buildModulePackagesIndexFile(String title,
   150     protected void buildModulePackagesIndexFile(String title,
   149             boolean includeScript, ModuleElement mdle) throws IOException {
   151             boolean includeScript, ModuleElement mdle) throws DocFileIOException {
   150         String windowOverview = configuration.getText(title);
   152         String windowOverview = configuration.getText(title);
   151         Content body = getBody(includeScript, getWindowTitle(windowOverview));
   153         Content body = getBody(includeScript, getWindowTitle(windowOverview));
   152         addNavigationBarHeader(body);
   154         addNavigationBarHeader(body);
   153         addOverviewHeader(body);
   155         addOverviewHeader(body);
   154         addModulePackagesIndex(body, mdle);
   156         addModulePackagesIndex(body, mdle);
   161     /**
   163     /**
   162      * Default to no overview, override to add overview.
   164      * Default to no overview, override to add overview.
   163      *
   165      *
   164      * @param body the document tree to which the overview will be added
   166      * @param body the document tree to which the overview will be added
   165      */
   167      */
   166     protected void addOverview(Content body) throws IOException {
   168     protected void addOverview(Content body) { }
   167     }
       
   168 
   169 
   169     /**
   170     /**
   170      * Adds the frame or non-frame module index to the documentation tree.
   171      * Adds the frame or non-frame module index to the documentation tree.
   171      *
   172      *
   172      * @param body the document tree to which the index will be added
   173      * @param body the document tree to which the index will be added
   257      * Returns highlighted "Overview", in the navigation bar as this is the
   258      * Returns highlighted "Overview", in the navigation bar as this is the
   258      * overview page.
   259      * overview page.
   259      *
   260      *
   260      * @return a Content object to be added to the documentation tree
   261      * @return a Content object to be added to the documentation tree
   261      */
   262      */
       
   263     @Override
   262     protected Content getNavLinkContents() {
   264     protected Content getNavLinkContents() {
   263         Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.overviewLabel);
   265         Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.overviewLabel);
   264         return li;
   266         return li;
   265     }
   267     }
   266 
   268 
   267     /**
   269     /**
   268      * Do nothing. This will be overridden in ModuleIndexFrameWriter.
   270      * Do nothing. This will be overridden in ModuleIndexFrameWriter.
   269      *
   271      *
   270      * @param div the document tree to which the all classes link will be added
   272      * @param div the document tree to which the all classes link will be added
   271      */
   273      */
   272     protected void addAllClassesLink(Content div) {
   274     protected void addAllClassesLink(Content div) { }
   273     }
       
   274 
   275 
   275     /**
   276     /**
   276      * Do nothing. This will be overridden in ModuleIndexFrameWriter.
   277      * Do nothing. This will be overridden in ModuleIndexFrameWriter.
   277      *
   278      *
   278      * @param div the document tree to which the all packages link will be added
   279      * @param div the document tree to which the all packages link will be added
   279      */
   280      */
   280     protected void addAllPackagesLink(Content div) {
   281     protected void addAllPackagesLink(Content div) { }
   281     }
       
   282 
   282 
   283     /**
   283     /**
   284      * Do nothing. This will be overridden in ModulePackageIndexFrameWriter.
   284      * Do nothing. This will be overridden in ModulePackageIndexFrameWriter.
   285      *
   285      *
   286      * @param div the document tree to which the all modules link will be added
   286      * @param div the document tree to which the all modules link will be added
   287      */
   287      */
   288     protected void addAllModulesLink(Content div) {
   288     protected void addAllModulesLink(Content div) { }
   289     }
       
   290 }
   289 }