langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
changeset 39670 9d1eafbf29c6
parent 38911 48a00b5ee366
child 40303 96a1226aca18
equal deleted inserted replaced
39601:5b37e511ae4b 39670:9d1eafbf29c6
    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.*;
    28 import java.io.*;
       
    29 import java.util.ArrayList;
       
    30 import java.util.EnumMap;
    29 import java.util.List;
    31 import java.util.List;
    30 import java.util.Set;
    32 import java.util.Map;
    31 
    33 
    32 import javax.lang.model.element.ModuleElement;
    34 import javax.lang.model.element.ModuleElement;
       
    35 import javax.lang.model.element.ModuleElement.DirectiveKind;
    33 import javax.lang.model.element.PackageElement;
    36 import javax.lang.model.element.PackageElement;
       
    37 import javax.lang.model.element.TypeElement;
    34 
    38 
    35 import com.sun.source.doctree.DocTree;
    39 import com.sun.source.doctree.DocTree;
    36 
       
    37 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
    40 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
    38 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
    41 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
    39 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
    42 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
    40 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
    43 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
    41 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
    44 import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
       
    45 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
    42 import jdk.javadoc.internal.doclets.toolkit.Content;
    46 import jdk.javadoc.internal.doclets.toolkit.Content;
    43 import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
    47 import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
    44 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
    48 import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
    45 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
    49 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
       
    50 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
    46 
    51 
    47 /**
    52 /**
    48  * Class to generate file for each module contents in the right-hand
    53  * Class to generate file for each module contents in the right-hand
    49  * frame. This will list all the packages and Class Kinds in the module. A click on any
    54  * frame. This will list all the packages and Class Kinds in the module. A click on any
    50  * class-kind will update the frame with the clicked class-kind page. A click on any
    55  * class-kind will update the frame with the clicked class-kind page. A click on any
    72     /**
    77     /**
    73      * The module being documented.
    78      * The module being documented.
    74      */
    79      */
    75     protected ModuleElement mdle;
    80     protected ModuleElement mdle;
    76 
    81 
       
    82     private final Map<ModuleElement.DirectiveKind, List<ModuleElement.Directive>> directiveMap
       
    83             = new EnumMap<>(ModuleElement.DirectiveKind.class);
       
    84 
    77     /**
    85     /**
    78      * The HTML tree for main tag.
    86      * The HTML tree for main tag.
    79      */
    87      */
    80     protected HtmlTree mainTree = HtmlTree.MAIN();
    88     protected HtmlTree mainTree = HtmlTree.MAIN();
       
    89 
       
    90     /**
       
    91      * The HTML tree for section tag.
       
    92      */
       
    93     protected HtmlTree sectionTree = HtmlTree.SECTION();
    81 
    94 
    82     /**
    95     /**
    83      * Constructor to construct ModuleWriter object and to generate
    96      * Constructor to construct ModuleWriter object and to generate
    84      * "moduleName-summary.html" file.
    97      * "moduleName-summary.html" file.
    85      *
    98      *
    86      * @param configuration the configuration of the doclet.
    99      * @param configuration the configuration of the doclet.
    87      * @param module        Module under consideration.
   100      * @param mdle        Module under consideration.
    88      * @param prevModule   Previous module in the sorted array.
   101      * @param prevModule   Previous module in the sorted array.
    89      * @param nextModule   Next module in the sorted array.
   102      * @param nextModule   Next module in the sorted array.
    90      */
   103      */
    91     public ModuleWriterImpl(ConfigurationImpl configuration,
   104     public ModuleWriterImpl(ConfigurationImpl configuration,
    92             ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule)
   105             ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule)
    93             throws IOException {
   106             throws IOException {
    94         super(configuration, DocPaths.moduleSummary(mdle));
   107         super(configuration, DocPaths.moduleSummary(mdle));
    95         this.prevModule = prevModule;
   108         this.prevModule = prevModule;
    96         this.nextModule = nextModule;
   109         this.nextModule = nextModule;
    97         this.mdle = mdle;
   110         this.mdle = mdle;
    98     }
   111         generateDirectiveMap();
    99 
   112     }
   100     /**
   113 
   101      * {@inheritDoc}
   114     /**
       
   115      * Get the module header.
       
   116      *
       
   117      * @param heading the heading for the section
   102      */
   118      */
   103     public Content getModuleHeader(String heading) {
   119     public Content getModuleHeader(String heading) {
   104         HtmlTree bodyTree = getBody(true, getWindowTitle(mdle.getQualifiedName().toString()));
   120         HtmlTree bodyTree = getBody(true, getWindowTitle(mdle.getQualifiedName().toString()));
   105         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
   121         HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
   106                 ? HtmlTree.HEADER()
   122                 ? HtmlTree.HEADER()
   125         }
   141         }
   126         return bodyTree;
   142         return bodyTree;
   127     }
   143     }
   128 
   144 
   129     /**
   145     /**
   130      * {@inheritDoc}
   146      * Get the content header.
   131      */
   147      */
   132     public Content getContentHeader() {
   148     public Content getContentHeader() {
   133         HtmlTree div = new HtmlTree(HtmlTag.DIV);
   149         HtmlTree div = new HtmlTree(HtmlTag.DIV);
   134         div.addStyle(HtmlStyle.contentContainer);
   150         div.addStyle(HtmlStyle.contentContainer);
   135         return div;
   151         return div;
   136     }
   152     }
   137 
   153 
   138     /**
   154     /**
   139      * {@inheritDoc}
   155      * Get the summary section header.
   140      */
   156      */
   141     public Content getSummaryHeader() {
   157     public Content getSummaryHeader() {
   142         HtmlTree li = new HtmlTree(HtmlTag.LI);
   158         HtmlTree li = new HtmlTree(HtmlTag.LI);
   143         li.addStyle(HtmlStyle.blockList);
   159         li.addStyle(HtmlStyle.blockList);
   144         return li;
   160         return li;
   145     }
   161     }
   146 
   162 
   147     /**
   163     /**
   148      * {@inheritDoc}
   164      * Get the summary tree.
       
   165      *
       
   166      * @param summaryContentTree the content tree to be added to the summary tree.
   149      */
   167      */
   150     public Content getSummaryTree(Content summaryContentTree) {
   168     public Content getSummaryTree(Content summaryContentTree) {
   151         HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
   169         HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
   152         return ul;
   170         return ul;
   153     }
   171     }
   154 
   172 
   155     /**
   173     /**
   156      * {@inheritDoc}
   174      * Generate the directive map for the directives on the module.
   157      */
   175      */
   158     public void addPackagesSummary(Set<PackageElement> packages, String text,
   176     public void generateDirectiveMap() {
   159             String tableSummary, Content summaryContentTree) {
   177         for (ModuleElement.Directive d : mdle.getDirectives()) {
       
   178             if (directiveMap.containsKey(d.getKind())) {
       
   179                 List<ModuleElement.Directive> dir = directiveMap.get(d.getKind());
       
   180                 dir.add(d);
       
   181                 directiveMap.put(d.getKind(), dir);
       
   182             } else {
       
   183                 List<ModuleElement.Directive> dir = new ArrayList<>();
       
   184                 dir.add(d);
       
   185                 directiveMap.put(d.getKind(), dir);
       
   186             }
       
   187         }
       
   188     }
       
   189 
       
   190     /**
       
   191      * Add the summary header.
       
   192      *
       
   193      * @param startMarker the marker comment
       
   194      * @param markerAnchor the marker anchor for the section
       
   195      * @param heading the heading for the section
       
   196      * @param htmltree the content tree to which the information is added
       
   197      */
       
   198     public void addSummaryHeader(Content startMarker, SectionName markerAnchor, Content heading, Content htmltree) {
       
   199         htmltree.addContent(startMarker);
       
   200         htmltree.addContent(getMarkerAnchor(markerAnchor));
       
   201         htmltree.addContent(HtmlTree.HEADING(HtmlTag.H3, heading));
       
   202     }
       
   203 
       
   204     /**
       
   205      * Add the summary for the module.
       
   206      *
       
   207      * @param text the table caption
       
   208      * @param tableSummary the summary for the table
       
   209      * @param htmltree the content tree to which the table will be added
       
   210      * @param tableStyle the table style
       
   211      * @param tableHeader the table header
       
   212      * @param dirs the list of module directives
       
   213      */
       
   214     public void addSummary(String text, String tableSummary, Content htmltree, HtmlStyle tableStyle,
       
   215             List<String> tableHeader, List<ModuleElement.Directive> dirs) {
   160         Content table = (configuration.isOutputHtml5())
   216         Content table = (configuration.isOutputHtml5())
   161                 ? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text)))
   217                 ? HtmlTree.TABLE(tableStyle, getTableCaption(new RawHtml(text)))
   162                 : HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text)));
   218                 : HtmlTree.TABLE(tableStyle, tableSummary, getTableCaption(new RawHtml(text)));
   163         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
   219         table.addContent(getSummaryTableHeader(tableHeader, "col"));
   164         Content tbody = new HtmlTree(HtmlTag.TBODY);
   220         Content tbody = new HtmlTree(HtmlTag.TBODY);
   165         addPackagesList(packages, tbody);
   221         addList(dirs, tbody);
   166         table.addContent(tbody);
   222         table.addContent(tbody);
   167         summaryContentTree.addContent(table);
   223         htmltree.addContent(table);
       
   224     }
       
   225 
       
   226     /**
       
   227      * Add the list of directives for the module.
       
   228      *
       
   229      * @param dirs the list of module directives
       
   230      * @params tbody the content tree to which the list is added
       
   231      */
       
   232     public void addList(List<ModuleElement.Directive> dirs, Content tbody) {
       
   233         boolean altColor = true;
       
   234         for (ModuleElement.Directive direct : dirs) {
       
   235             DirectiveKind kind = direct.getKind();
       
   236             switch (kind) {
       
   237                 case REQUIRES:
       
   238                     addRequiresList((ModuleElement.RequiresDirective) direct, tbody, altColor);
       
   239                     break;
       
   240                 case EXPORTS:
       
   241                     addExportedPackagesList((ModuleElement.ExportsDirective) direct, tbody, altColor);
       
   242                     break;
       
   243                 case USES:
       
   244                     addUsesList((ModuleElement.UsesDirective) direct, tbody, altColor);
       
   245                     break;
       
   246                 case PROVIDES:
       
   247                     addProvidesList((ModuleElement.ProvidesDirective) direct, tbody, altColor);
       
   248                     break;
       
   249                 default:
       
   250                     throw new AssertionError("unknown directive kind: " + kind);
       
   251             }
       
   252             altColor = !altColor;
       
   253         }
       
   254     }
       
   255 
       
   256     /**
       
   257      * {@inheritDoc}
       
   258      */
       
   259     public void addModulesSummary(Content summaryContentTree) {
       
   260         List<ModuleElement.Directive> dirs = directiveMap.get(DirectiveKind.REQUIRES);
       
   261         if (dirs != null && !dirs.isEmpty()) {
       
   262             HtmlTree li = new HtmlTree(HtmlTag.LI);
       
   263             li.addStyle(HtmlStyle.blockList);
       
   264             addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES,
       
   265                     getResource("doclet.navModules"), li);
       
   266             String text = configuration.getText("doclet.Requires_Summary");
       
   267             String tableSummary = configuration.getText("doclet.Member_Table_Summary",
       
   268                     configuration.getText("doclet.Requires_Summary"),
       
   269                     configuration.getText("doclet.modules"));
       
   270             addRequiresSummary(text, tableSummary, dirs, li);
       
   271             HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
       
   272             summaryContentTree.addContent(ul);
       
   273         }
       
   274     }
       
   275 
       
   276     /**
       
   277      * Add the requires summary for the module.
       
   278      *
       
   279      * @param text the table caption
       
   280      * @param tableSummary the summary for the table
       
   281      * @param dirs the list of module directives
       
   282      * @param htmltree the content tree to which the table will be added
       
   283      */
       
   284     public void addRequiresSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
       
   285             Content htmltree) {
       
   286         addSummary(text, tableSummary, htmltree, HtmlStyle.requiresSummary, requiresTableHeader, dirs);
       
   287     }
       
   288 
       
   289     /**
       
   290      * Add the requires directive list for the module.
       
   291      *
       
   292      * @param direct the requires directive
       
   293      * @param tbody the content tree to which the directive will be added
       
   294      * @param altColor true if altColor style should be used or false if rowColor style should be used
       
   295      */
       
   296     public void addRequiresList(ModuleElement.RequiresDirective direct, Content tbody, boolean altColor) {
       
   297         ModuleElement m = direct.getDependency();
       
   298         Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName().toString()));
       
   299         Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, moduleLinkContent);
       
   300         HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
       
   301         tdSummary.addStyle(HtmlStyle.colLast);
       
   302         addSummaryComment(m, tdSummary);
       
   303         HtmlTree tr = HtmlTree.TR(tdPackage);
       
   304         tr.addContent(tdSummary);
       
   305         tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
       
   306         tbody.addContent(tr);
       
   307     }
       
   308 
       
   309     /**
       
   310      * {@inheritDoc}
       
   311      */
       
   312     public void addPackagesSummary(Content summaryContentTree) {
       
   313         List<ModuleElement.Directive> dirs = directiveMap.get(DirectiveKind.EXPORTS);
       
   314         if (dirs != null && !dirs.isEmpty()) {
       
   315             HtmlTree li = new HtmlTree(HtmlTag.LI);
       
   316             li.addStyle(HtmlStyle.blockList);
       
   317             addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
       
   318                     getResource("doclet.navPackages"), li);
       
   319             String text = configuration.getText("doclet.Exported_Packages_Summary");
       
   320             String tableSummary = configuration.getText("doclet.Member_Table_Summary",
       
   321                     configuration.getText("doclet.Exported_Packages_Summary"),
       
   322                     configuration.getText("doclet.packages"));
       
   323             addExportedPackagesSummary(text, tableSummary, dirs, li);
       
   324             HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
       
   325             summaryContentTree.addContent(ul);
       
   326         }
       
   327     }
       
   328 
       
   329     /**
       
   330      * Add the exported packages summary for the module.
       
   331      *
       
   332      * @param text the table caption
       
   333      * @param tableSummary the summary for the table
       
   334      * @param dirs the list of module directives
       
   335      * @param htmltree the content tree to which the table will be added
       
   336      */
       
   337     public void addExportedPackagesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
       
   338             Content htmltree) {
       
   339         addSummary(text, tableSummary, htmltree, HtmlStyle.packagesSummary, exportedPackagesTableHeader, dirs);
       
   340     }
       
   341 
       
   342     /**
       
   343      * Add the exported packages list for the module.
       
   344      *
       
   345      * @param direct the requires directive
       
   346      * @param tbody the content tree to which the directive will be added
       
   347      * @param altColor true if altColor style should be used or false if rowColor style should be used
       
   348      */
       
   349     public void addExportedPackagesList(ModuleElement.ExportsDirective direct, Content tbody, boolean altColor) {
       
   350         PackageElement pkg = direct.getPackage();
       
   351         Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
       
   352         Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, pkgLinkContent);
       
   353         HtmlTree tdModules = new HtmlTree(HtmlTag.TD);
       
   354         tdModules.addStyle(HtmlStyle.colSecond);
       
   355         List<? extends ModuleElement> targetModules = direct.getTargetModules();
       
   356         if (targetModules != null) {
       
   357             List<? extends ModuleElement> mElements = direct.getTargetModules();
       
   358             for (int i = 0; i < mElements.size(); i++) {
       
   359                 if (i > 0) {
       
   360                     tdModules.addContent(new HtmlTree(HtmlTag.BR));
       
   361                 }
       
   362                 ModuleElement m = mElements.get(i);
       
   363                 tdModules.addContent(new StringContent(m.getQualifiedName().toString()));
       
   364             }
       
   365         } else {
       
   366             tdModules.addContent(configuration.getText("doclet.All_Modules"));
       
   367         }
       
   368         HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
       
   369         tdSummary.addStyle(HtmlStyle.colLast);
       
   370         addSummaryComment(pkg, tdSummary);
       
   371         HtmlTree tr = HtmlTree.TR(tdPackage);
       
   372         tr.addContent(tdModules);
       
   373         tr.addContent(tdSummary);
       
   374         tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
       
   375         tbody.addContent(tr);
       
   376     }
       
   377 
       
   378     /**
       
   379      * {@inheritDoc}
       
   380      */
       
   381     public void addServicesSummary(Content summaryContentTree) {
       
   382         List<ModuleElement.Directive> usesDirs = directiveMap.get(DirectiveKind.USES);
       
   383         List<ModuleElement.Directive> providesDirs = directiveMap.get(DirectiveKind.PROVIDES);
       
   384         if ((usesDirs != null && !usesDirs.isEmpty()) || (providesDirs != null && !providesDirs.isEmpty())) {
       
   385             HtmlTree li = new HtmlTree(HtmlTag.LI);
       
   386             li.addStyle(HtmlStyle.blockList);
       
   387             addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES,
       
   388                     getResource("doclet.navServices"), li);
       
   389             String text;
       
   390             String tableSummary;
       
   391             if (usesDirs != null && !usesDirs.isEmpty()) {
       
   392                 text = configuration.getText("doclet.Uses_Summary");
       
   393                 tableSummary = configuration.getText("doclet.Member_Table_Summary",
       
   394                         configuration.getText("doclet.Uses_Summary"),
       
   395                         configuration.getText("doclet.types"));
       
   396                 addUsesSummary(text, tableSummary, usesDirs, li);
       
   397             }
       
   398             if (providesDirs != null && !providesDirs.isEmpty()) {
       
   399                 text = configuration.getText("doclet.Provides_Summary");
       
   400                 tableSummary = configuration.getText("doclet.Member_Table_Summary",
       
   401                         configuration.getText("doclet.Provides_Summary"),
       
   402                         configuration.getText("doclet.types"));
       
   403                 addProvidesSummary(text, tableSummary, providesDirs, li);
       
   404             }
       
   405             HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
       
   406             summaryContentTree.addContent(ul);
       
   407         }
       
   408     }
       
   409 
       
   410     /**
       
   411      * Add the uses summary for the module.
       
   412      *
       
   413      * @param text the table caption
       
   414      * @param tableSummary the summary for the table
       
   415      * @param dirs the list of module directives
       
   416      * @param htmltree the content tree to which the table will be added
       
   417      */
       
   418     public void addUsesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
       
   419             Content htmltree) {
       
   420         addSummary(text, tableSummary, htmltree, HtmlStyle.usesSummary, usesTableHeader, dirs);
       
   421     }
       
   422 
       
   423     /**
       
   424      * Add the uses list for the module.
       
   425      *
       
   426      * @param direct the requires directive
       
   427      * @param tbody the content tree to which the directive will be added
       
   428      * @param altColor true if altColor style should be used or false if rowColor style should be used
       
   429      */
       
   430     public void addUsesList(ModuleElement.UsesDirective direct, Content tbody, boolean altColor) {
       
   431         TypeElement type = direct.getService();
       
   432         Content typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, type));
       
   433         Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, typeLinkContent);
       
   434         HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
       
   435         tdSummary.addStyle(HtmlStyle.colLast);
       
   436         addSummaryComment(type, tdSummary);
       
   437         HtmlTree tr = HtmlTree.TR(tdPackage);
       
   438         tr.addContent(tdSummary);
       
   439         tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
       
   440         tbody.addContent(tr);
       
   441     }
       
   442 
       
   443     /**
       
   444      * Add the provides summary for the module.
       
   445      *
       
   446      * @param text the table caption
       
   447      * @param tableSummary the summary for the table
       
   448      * @param dirs the list of module directives
       
   449      * @param htmltree the content tree to which the table will be added
       
   450      */
       
   451     public void addProvidesSummary(String text, String tableSummary, List<ModuleElement.Directive> dirs,
       
   452             Content htmltree) {
       
   453         addSummary(text, tableSummary, htmltree, HtmlStyle.providesSummary, providesTableHeader, dirs);
       
   454     }
       
   455 
       
   456     /**
       
   457      * Add the exported packages list for the module.
       
   458      *
       
   459      * @param direct the requires directive
       
   460      * @param tbody the content tree to which the directive will be added
       
   461      * @param altColor true if altColor style should be used or false if rowColor style should be used
       
   462      */
       
   463     public void addProvidesList(ModuleElement.ProvidesDirective direct, Content tbody, boolean altColor) {
       
   464         TypeElement impl = direct.getImplementation();
       
   465         TypeElement srv = direct.getService();
       
   466         Content implLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl));
       
   467         Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv));
       
   468         HtmlTree tdType = HtmlTree.TD(HtmlStyle.colFirst, srvLinkContent);
       
   469         tdType.addContent(new HtmlTree(HtmlTag.BR));
       
   470         tdType.addContent("(");
       
   471         HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, getResource("doclet.Implementation"));
       
   472         tdType.addContent(implSpan);
       
   473         tdType.addContent(getSpace());
       
   474         tdType.addContent(implLinkContent);
       
   475         tdType.addContent(")");
       
   476         HtmlTree tdDesc = new HtmlTree(HtmlTag.TD);
       
   477         tdDesc.addStyle(HtmlStyle.colLast);
       
   478         addSummaryComment(srv, tdDesc);
       
   479         HtmlTree tr = HtmlTree.TR(tdType);
       
   480         tr.addContent(tdDesc);
       
   481         tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
       
   482         tbody.addContent(tr);
   168     }
   483     }
   169 
   484 
   170     /**
   485     /**
   171      * {@inheritDoc}
   486      * {@inheritDoc}
   172      */
   487      */
   194             moduleContentTree.addContent(tree);
   509             moduleContentTree.addContent(tree);
   195         }
   510         }
   196     }
   511     }
   197 
   512 
   198     /**
   513     /**
   199      * Adds list of packages in the package summary table. Generate link to each package.
   514      * Add summary details to the navigation bar.
   200      *
   515      *
   201      * @param packages Packages to which link is to be generated
   516      * @param subDiv the content tree to which the summary detail links will be added
   202      * @param tbody the documentation tree to which the list will be added
   517      */
   203      */
   518     protected void addSummaryDetailLinks(Content subDiv) {
   204     protected void addPackagesList(Set<PackageElement> packages, Content tbody) {
   519         try {
   205         boolean altColor = true;
   520             Content div = HtmlTree.DIV(getNavSummaryLinks());
   206         for (PackageElement pkg : packages) {
   521             subDiv.addContent(div);
   207             if (pkg != null && !pkg.isUnnamed()) {
   522         } catch (Exception e) {
   208                 if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
   523             throw new DocletAbortException(e);
   209                     Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
   524         }
   210                     Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
   525     }
   211                     HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
   526 
   212                     tdSummary.addStyle(HtmlStyle.colLast);
   527     /**
   213                     addSummaryComment(pkg, tdSummary);
   528      * Get summary links for navigation bar.
   214                     HtmlTree tr = HtmlTree.TR(tdPackage);
   529      *
   215                     tr.addContent(tdSummary);
   530      * @return the content tree for the navigation summary links
   216                     tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
   531      */
   217                     tbody.addContent(tr);
   532     protected Content getNavSummaryLinks() throws Exception {
   218                 }
   533         Content li = HtmlTree.LI(moduleSubNavLabel);
   219             }
   534         li.addContent(getSpace());
   220             altColor = !altColor;
   535         Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
   221         }
   536         Content liNav = new HtmlTree(HtmlTag.LI);
       
   537         liNav.addContent(!utils.getBody(mdle).isEmpty() && !configuration.nocomment
       
   538                 ? getHyperLink(SectionName.MODULE_DESCRIPTION, getResource("doclet.navModuleDescription"))
       
   539                 : getResource("doclet.navModuleDescription"));
       
   540         addNavGap(liNav);
       
   541         liNav.addContent(showDirectives(DirectiveKind.REQUIRES)
       
   542                 ? getHyperLink(SectionName.MODULES, getResource("doclet.navModules"))
       
   543                 : getResource("doclet.navModules"));
       
   544         addNavGap(liNav);
       
   545         liNav.addContent(showDirectives(DirectiveKind.EXPORTS)
       
   546                 ? getHyperLink(SectionName.PACKAGES, getResource("doclet.navPackages"))
       
   547                 : getResource("doclet.navPackages"));
       
   548         addNavGap(liNav);
       
   549         liNav.addContent((showDirectives(DirectiveKind.USES) || showDirectives(DirectiveKind.PROVIDES))
       
   550                 ? getHyperLink(SectionName.SERVICES, getResource("doclet.navServices"))
       
   551                 : getResource("doclet.navServices"));
       
   552         ulNav.addContent(liNav);
       
   553         return ulNav;
       
   554     }
       
   555 
       
   556     /**
       
   557      * Return true if the directive should be displayed.
       
   558      *
       
   559      * @param dirKind the kind of directive for the module
       
   560      * @return true if the directive should be displayed
       
   561      */
       
   562     private boolean showDirectives(DirectiveKind dirKind) {
       
   563         return directiveMap.get(dirKind) != null && !directiveMap.get(dirKind).isEmpty();
   222     }
   564     }
   223 
   565 
   224     /**
   566     /**
   225      * {@inheritDoc}
   567      * {@inheritDoc}
   226      */
   568      */