src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java
changeset 53883 f41793b5b83f
parent 53879 e7cb0348fa1c
child 53991 786825220790
equal deleted inserted replaced
53882:ca682d9d8db5 53883:f41793b5b83f
    31 import java.util.Set;
    31 import java.util.Set;
    32 
    32 
    33 import javax.lang.model.element.ModuleElement;
    33 import javax.lang.model.element.ModuleElement;
    34 import javax.lang.model.element.PackageElement;
    34 import javax.lang.model.element.PackageElement;
    35 
    35 
       
    36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
    36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
    37 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
    37 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
    38 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
    38 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
    39 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
    39 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
    40 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
    40 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
    41 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
    54  *  deletion without notice.</b>
    55  *  deletion without notice.</b>
    55  *
    56  *
    56  * @author Bhavesh Patel
    57  * @author Bhavesh Patel
    57  */
    58  */
    58 public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
    59 public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
    59     /**
       
    60      * The heading (h1 or h2) to use for the module packages list,
       
    61      * set by addNavigationBarHeader depending on whether or not there
       
    62      * is an additional initial heading.
       
    63      */
       
    64     private HtmlTag modulePackagesListHeading;
       
    65 
    60 
    66     /**
    61     /**
    67      * Construct the ModulePackageIndexFrameWriter object.
    62      * Construct the ModulePackageIndexFrameWriter object.
    68      *
    63      *
    69      * @param configuration the configuration object
    64      * @param configuration the configuration object
    92      * {@inheritDoc}
    87      * {@inheritDoc}
    93      */
    88      */
    94     protected void addModulePackagesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
    89     protected void addModulePackagesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
    95             String tableSummary, Content main, ModuleElement mdle) {
    90             String tableSummary, Content main, ModuleElement mdle) {
    96         Content profNameContent = new StringContent(mdle.getQualifiedName().toString());
    91         Content profNameContent = new StringContent(mdle.getQualifiedName().toString());
    97         Content heading = HtmlTree.HEADING(modulePackagesListHeading, true,
    92         Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
    98                 getTargetModuleLink("classFrame", profNameContent, mdle));
    93                 getTargetModuleLink("classFrame", profNameContent, mdle));
    99         heading.addContent(Contents.SPACE);
    94         heading.addContent(Contents.SPACE);
   100         heading.addContent(contents.packagesLabel);
    95         heading.addContent(contents.packagesLabel);
   101         HtmlTree htmlTree = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
    96         HtmlTree htmlTree = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
   102         HtmlTree ul = new HtmlTree(HtmlTag.UL);
    97         HtmlTree ul = new HtmlTree(HtmlTag.UL);
   115      * {@inheritDoc}
   110      * {@inheritDoc}
   116      */
   111      */
   117     protected void addModulePackagesList(Set<ModuleElement> modules, String text,
   112     protected void addModulePackagesList(Set<ModuleElement> modules, String text,
   118             String tableSummary, Content body, ModuleElement mdle) {
   113             String tableSummary, Content body, ModuleElement mdle) {
   119         Content moduleNameContent = new StringContent(mdle.getQualifiedName().toString());
   114         Content moduleNameContent = new StringContent(mdle.getQualifiedName().toString());
   120         Content heading = HtmlTree.HEADING(modulePackagesListHeading, true,
   115         Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
   121                 getTargetModuleLink("classFrame", moduleNameContent, mdle));
   116                 getTargetModuleLink("classFrame", moduleNameContent, mdle));
   122         heading.addContent(Contents.SPACE);
   117         heading.addContent(Contents.SPACE);
   123         heading.addContent(contents.packagesLabel);
   118         heading.addContent(contents.packagesLabel);
   124         HtmlTree htmlTree = HtmlTree.MAIN(HtmlStyle.indexContainer, heading);
   119         HtmlTree htmlTree = HtmlTree.MAIN(HtmlStyle.indexContainer, heading);
   125         HtmlTree ul = new HtmlTree(HtmlTag.UL);
   120         HtmlTree ul = new HtmlTree(HtmlTag.UL);
   160 
   155 
   161     /**
   156     /**
   162      * {@inheritDoc}
   157      * {@inheritDoc}
   163      */
   158      */
   164     protected void addNavigationBarHeader(Content header) {
   159     protected void addNavigationBarHeader(Content header) {
   165         String headerContent = !configuration.packagesheader.isEmpty() ? configuration.packagesheader
   160         Content headerContent;
   166                 : configuration.header;
   161         if (configuration.packagesheader.length() > 0) {
   167         if (!headerContent.isEmpty()) {
   162             headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
   168             Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true,
       
   169                     HtmlStyle.bar, new RawHtml(replaceDocRootDir(headerContent)));
       
   170             header.addContent(heading);
       
   171             modulePackagesListHeading = Headings.IndexFrames.PACKAGE_HEADING;
       
   172         } else {
   163         } else {
   173             modulePackagesListHeading = Headings.PAGE_TITLE_HEADING;
   164             headerContent = new RawHtml(replaceDocRootDir(configuration.header));
   174         }
   165         }
       
   166         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
       
   167                 HtmlStyle.bar, headerContent);
       
   168         header.addContent(heading);
   175     }
   169     }
   176 
   170 
   177     /**
   171     /**
   178      * Do nothing as there is no overview information in this page.
   172      * Do nothing as there is no overview information in this page.
   179      */
   173      */
   181     }
   175     }
   182 
   176 
   183     /**
   177     /**
   184      * Do nothing as there is no modules list on this page.
   178      * Do nothing as there is no modules list on this page.
   185      */
   179      */
   186     @Override
       
   187     protected void addModulesList(Content body) {
   180     protected void addModulesList(Content body) {
   188     }
   181     }
   189 
   182 
   190     /**
   183     /**
   191      * Adds "All Classes" link for the top of the left-hand frame page to the
   184      * Adds "All Classes" link for the top of the left-hand frame page to the