Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8240697: convert builders to high-level Content blocks
Reviewed-by: prappo
  • Loading branch information
jonathan-gibbons committed Mar 10, 2020
1 parent 39ab073 commit 0fd2ac701f3393f1dd8ab390edc5c1b86651fc0a
Showing with 297 additions and 216 deletions.
  1. +1 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
  2. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
  3. +4 −7 ....javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractOverviewIndexWriter.java
  4. +6 −9 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java
  5. +6 −9 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java
  6. +4 −5 ...jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java
  7. +6 −7 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java
  8. +4 −5 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java
  9. +6 −7 ...k.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java
  10. +5 −6 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
  11. +5 −8 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java
  12. +4 −6 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java
  13. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
  14. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java
  15. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java
  16. +11 −12 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java
  17. +79 −56 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/{markup → }/Navigation.java
  18. +1 −1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java
  19. +4 −5 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java
  20. +6 −7 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java
  21. +5 −6 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
  22. +5 −6 ...jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriterImpl.java
  23. +3 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SingleIndexWriter.java
  24. +1 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java
  25. +3 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java
  26. +5 −7 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SystemPropertiesWriter.java
  27. +4 −6 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java
  28. +38 −13 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/BodyContents.java
  29. +22 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java
  30. +21 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
  31. +11 −5 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Table.java
  32. +22 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/TableHeader.java
@@ -45,8 +45,7 @@
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
@@ -360,7 +360,7 @@ protected void addUseInfo(List<? extends Element> mems, Content heading, Content
writer.addSummaryLinkComment(this, element, desc);
useTable.addRow(summaryType, typeContent, desc);
}
contentTree.add(useTable.toContent());
contentTree.add(useTable);
}
}

@@ -453,7 +453,7 @@ public Content getSummaryTableTree(TypeElement tElement) {
if (table.needsScript()) {
writer.getMainBodyScript().append(table.getScript());
}
return table.toContent();
return table;
}

/**
@@ -28,10 +28,8 @@
import jdk.javadoc.internal.doclets.formats.html.markup.BodyContents;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
@@ -72,7 +70,7 @@ public AbstractOverviewIndexWriter(HtmlConfiguration configuration,
protected void addNavigationBarHeader(Content header) {
addTop(header);
navBar.setUserHeader(getUserHeaderFooter(true));
header.add(navBar.getContent(true));
header.add(navBar.getContent(Navigation.Position.TOP));
}

/**
@@ -83,7 +81,7 @@ protected void addNavigationBarHeader(Content header) {
*/
protected void addNavigationBarFooter(Content footer) {
navBar.setUserFooter(getUserHeaderFooter(false));
footer.add(navBar.getContent(false));
footer.add(navBar.getContent(Navigation.Position.BOTTOM));
addBottom(footer);
}

@@ -135,8 +133,7 @@ protected void buildOverviewIndexFile(String title, String description)
body.add(new BodyContents()
.setHeader(header)
.addMainContent(main)
.setFooter(footer)
.toContent());
.setFooter(footer));
printHtmlDocument(
configuration.metakeywords.getOverviewMetaKeywords(title, configuration.getOptions().docTitle()),
description, body);
@@ -34,10 +34,8 @@
import jdk.javadoc.internal.doclets.formats.html.markup.BodyContents;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -96,23 +94,22 @@ protected void buildAllClassesFile() throws DocFileIOException {
String label = resources.getText("doclet.All_Classes");
Content header = new ContentBuilder();
addTop(header);
Navigation navBar = new Navigation(null, configuration, PageMode.ALLCLASSES, path);
Navigation navBar = new Navigation(null, configuration, PageMode.ALL_CLASSES, path);
navBar.setUserHeader(getUserHeaderFooter(true));
header.add(navBar.getContent(true));
header.add(navBar.getContent(Navigation.Position.TOP));
Content allClassesContent = new ContentBuilder();
addContents(allClassesContent);
Content mainContent = new ContentBuilder();
mainContent.add(allClassesContent);
Content footer = HtmlTree.FOOTER();
navBar.setUserFooter(getUserHeaderFooter(false));
footer.add(navBar.getContent(false));
footer.add(navBar.getContent(Navigation.Position.BOTTOM));
addBottom(footer);
HtmlTree bodyTree = getBody(getWindowTitle(label));
bodyTree.add(new BodyContents()
.setHeader(header)
.addMainContent(mainContent)
.setFooter(footer)
.toContent());
.setFooter(footer));
printHtmlDocument(null, "class index", bodyTree);
}

@@ -149,7 +146,7 @@ protected void addContents(Content content) {
Content headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading);
content.add(headerDiv);
if (!table.isEmpty()) {
content.add(table.toContent());
content.add(table);
if (table.needsScript()) {
getMainBodyScript().append(table.getScript());
}
@@ -29,10 +29,8 @@
import jdk.javadoc.internal.doclets.formats.html.markup.BodyContents;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
@@ -77,10 +75,10 @@ private static void generate(HtmlConfiguration configuration, DocPath fileName)
protected void buildAllPackagesFile() throws DocFileIOException {
String label = resources.getText("doclet.All_Packages");
Content headerContent = new ContentBuilder();
Navigation navBar = new Navigation(null, configuration, PageMode.ALLPACKAGES, path);
Navigation navBar = new Navigation(null, configuration, PageMode.ALL_PACKAGES, path);
addTop(headerContent);
navBar.setUserHeader(getUserHeaderFooter(true));
headerContent.add(navBar.getContent(true));
headerContent.add(navBar.getContent(Navigation.Position.TOP));
Content mainContent = new ContentBuilder();
addPackages(mainContent);
Content titleContent = contents.allPackagesLabel;
@@ -89,15 +87,14 @@ protected void buildAllPackagesFile() throws DocFileIOException {
Content headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading);
Content footer = HtmlTree.FOOTER();
navBar.setUserFooter(getUserHeaderFooter(false));
footer.add(navBar.getContent(false));
footer.add(navBar.getContent(Navigation.Position.BOTTOM));
addBottom(footer);
HtmlTree bodyTree = getBody(getWindowTitle(label));
bodyTree.add(new BodyContents()
.setHeader(headerContent)
.addMainContent(headerDiv)
.addMainContent(mainContent)
.setFooter(footer)
.toContent());
.setFooter(footer));
printHtmlDocument(null, "package index", bodyTree);
}

@@ -119,6 +116,6 @@ protected void addPackages(Content content) {
table.addRow(pkg, packageLinkContent, summaryContent);
}
}
content.add(table.toContent());
content.add(table);
}
}
@@ -37,8 +37,7 @@
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -87,7 +86,7 @@ public Content getHeader(String header) {
navBar.setNavLinkModule(linkContent);
navBar.setMemberSummaryBuilder(configuration.getBuilderFactory().getMemberSummaryBuilder(this));
navBar.setUserHeader(getUserHeaderFooter(true));
headerContent.add(navBar.getContent(true));
headerContent.add(navBar.getContent(Navigation.Position.TOP));

HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.setStyle(HtmlStyle.header);
@@ -129,7 +128,7 @@ public Content getAnnotationContentHeader() {
public void addFooter() {
Content htmlTree = HtmlTree.FOOTER();
navBar.setUserFooter(getUserHeaderFooter(false));
htmlTree.add(navBar.getContent(false));
htmlTree.add(navBar.getContent(Navigation.Position.BOTTOM));
addBottom(htmlTree);
bodyContents.addMainContent(MarkerComments.END_OF_CLASS_DATA)
.setFooter(htmlTree);
@@ -140,7 +139,7 @@ public void printDocument(Content contentTree) throws DocFileIOException {
String description = getDescription("declaration", annotationType);
PackageElement pkg = utils.containingPackage(this.annotationType);
List<DocPath> localStylesheets = getLocalStylesheets(pkg);
contentTree.add(bodyContents.toContent());
contentTree.add(bodyContents);
printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType),
description, localStylesheets, contentTree);
}
@@ -45,8 +45,7 @@
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
@@ -229,10 +228,10 @@ protected void generateClassUseFile() throws DocFileIOException {
bodyContents.addMainContent(mainContent);
HtmlTree footer = HtmlTree.FOOTER();
navBar.setUserFooter(getUserHeaderFooter(false));
footer.add(navBar.getContent(false));
footer.add(navBar.getContent(Navigation.Position.BOTTOM));
addBottom(footer);
bodyContents.setFooter(footer);
body.add(bodyContents.toContent());
body.add(bodyContents);
String description = getDescription("use", typeElement);
printHtmlDocument(null, description, body);
}
@@ -269,7 +268,7 @@ protected void addPackageList(Content contentTree) {
for (PackageElement pkg : pkgSet) {
addPackageUse(pkg, table);
}
contentTree.add(table.toContent());
contentTree.add(table);
}

/**
@@ -297,7 +296,7 @@ protected void addPackageAnnotationList(Content contentTree) {
addSummaryComment(pkg, summary);
table.addRow(getPackageLink(pkg), summary);
}
contentTree.add(table.toContent());
contentTree.add(table);
}

/**
@@ -435,7 +434,7 @@ protected HtmlTree getClassUseHeader() {
.label(resources.getText("doclet.Class")));
navBar.setNavLinkClass(classLinkContent);
navBar.setUserHeader(getUserHeaderFooter(true));
headerContent.add(navBar.getContent(true));
headerContent.add(navBar.getContent(Navigation.Position.TOP));
ContentBuilder headingContent = new ContentBuilder();
headingContent.add(contents.getContent("doclet.ClassUse_Title", cltype));
headingContent.add(new HtmlTree(HtmlTag.BR));
@@ -47,8 +47,7 @@
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
import jdk.javadoc.internal.doclets.toolkit.Content;
@@ -115,7 +114,7 @@ public Content getHeader(String header) {
navBar.setNavLinkModule(linkContent);
navBar.setMemberSummaryBuilder(configuration.getBuilderFactory().getMemberSummaryBuilder(this));
navBar.setUserHeader(getUserHeaderFooter(true));
headerContent.add(navBar.getContent(true));
headerContent.add(navBar.getContent(Navigation.Position.TOP));
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.setStyle(HtmlStyle.header);
if (configuration.showModules) {
@@ -161,7 +160,7 @@ public void addFooter() {
bodyContents.addMainContent(MarkerComments.END_OF_CLASS_DATA);
Content htmlTree = HtmlTree.FOOTER();
navBar.setUserFooter(getUserHeaderFooter(false));
htmlTree.add(navBar.getContent(false));
htmlTree.add(navBar.getContent(Navigation.Position.BOTTOM));
addBottom(htmlTree);
bodyContents.setFooter(htmlTree);
}
@@ -171,7 +170,7 @@ public void printDocument(Content contentTree) throws DocFileIOException {
String description = getDescription("declaration", typeElement);
PackageElement pkg = utils.containingPackage(typeElement);
List<DocPath> localStylesheets = getLocalStylesheets(pkg);
contentTree.add(bodyContents.toContent());
contentTree.add(bodyContents);
printHtmlDocument(configuration.metakeywords.getMetaKeywords(typeElement),
description, localStylesheets, contentTree);
}
@@ -39,8 +39,7 @@
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
@@ -92,7 +91,7 @@ public ConstantsSummaryWriterImpl(HtmlConfiguration configuration) {
this.configuration = configuration;
constantsTableHeader = new TableHeader(
contents.modifierAndTypeLabel, contents.constantFieldLabel, contents.valueLabel);
this.navBar = new Navigation(null, configuration, PageMode.CONSTANTVALUES, path);
this.navBar = new Navigation(null, configuration, PageMode.CONSTANT_VALUES, path);
}

@Override
@@ -102,7 +101,7 @@ public Content getHeader() {
Content headerContent = new ContentBuilder();
addTop(headerContent);
navBar.setUserHeader(getUserHeaderFooter(true));
headerContent.add(navBar.getContent(true));
headerContent.add(navBar.getContent(Navigation.Position.TOP));
bodyContents.setHeader(headerContent);
return bodyTree;
}
@@ -215,7 +214,7 @@ public void addConstantMembers(TypeElement typeElement, Collection<VariableEleme
for (VariableElement field : fields) {
table.addRow(getTypeColumn(field), getNameColumn(field), getValue(field));
}
Content li = HtmlTree.LI(HtmlStyle.blockList, table.toContent());
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
classConstantTree.add(li);
}

@@ -277,14 +276,14 @@ public void addConstantSummaries(Content summariesTree) {
public void addFooter() {
Content htmlTree = HtmlTree.FOOTER();
navBar.setUserFooter(getUserHeaderFooter(false));
htmlTree.add(navBar.getContent(false));
htmlTree.add(navBar.getContent(Navigation.Position.BOTTOM));
addBottom(htmlTree);
bodyContents.setFooter(htmlTree);
}

@Override
public void printDocument(Content contentTree) throws DocFileIOException {
contentTree.add(bodyContents.toContent());
contentTree.add(bodyContents);
printHtmlDocument(null, "summary of constants", contentTree);
}
}
@@ -41,8 +41,7 @@
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder;
@@ -298,11 +297,11 @@ protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi)
bodyContents.addMainContent(content);
HtmlTree htmlTree = HtmlTree.FOOTER();
navBar.setUserFooter(getUserHeaderFooter(false));
htmlTree.add(navBar.getContent(false));
htmlTree.add(navBar.getContent(Navigation.Position.BOTTOM));
addBottom(htmlTree);
bodyContents.setFooter(htmlTree);
String description = "deprecated elements";
body.add(bodyContents.toContent());
body.add(bodyContents);
printHtmlDocument(null, description, body);
}

@@ -355,7 +354,7 @@ public HtmlTree getHeader() {
Content headerContent = new ContentBuilder();
addTop(headerContent);
navBar.setUserHeader(getUserHeaderFooter(true));
headerContent.add(navBar.getContent(true));
headerContent.add(navBar.getContent(Navigation.Position.TOP));
bodyContents.setHeader(headerContent);
return bodyTree;
}
@@ -402,7 +401,7 @@ protected void addDeprecatedAPI(SortedSet<Element> deprList, String id, String h
}
table.addRow(link, desc);
}
Content li = HtmlTree.LI(HtmlStyle.blockList, table.toContent());
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
contentTree.add(ul);
}

0 comments on commit 0fd2ac7

Please sign in to comment.