8240476: SystemPropertiesWriter does not conform to standard page layout

Reviewed-by: prappo
This commit is contained in:
Jonathan Gibbons 2020-03-19 11:25:05 -07:00
parent 029fea432a
commit 32cba67284
2 changed files with 24 additions and 21 deletions

View File

@ -25,6 +25,7 @@
package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.SearchIndexItem.Category;
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.FixedStringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
@ -61,11 +62,6 @@ import static java.util.stream.Collectors.toList;
*/
public class SystemPropertiesWriter extends HtmlDocletWriter {
/**
* The HTML tree for main tag.
*/
private final HtmlTree mainTree = HtmlTree.MAIN();
private final Navigation navBar;
/**
@ -108,28 +104,26 @@ public class SystemPropertiesWriter extends HtmlDocletWriter {
* Prints all the system properties to the file.
*/
protected void buildSystemPropertiesPage() throws DocFileIOException {
String label = resources.getText("doclet.systemProperties");
HtmlTree bodyTree = getBody(getWindowTitle(label));
HtmlTree header = HtmlTree.HEADER();
addTop(header);
String title = resources.getText("doclet.systemProperties");
HtmlTree body = getBody(getWindowTitle(title));
Content headerContent = new ContentBuilder();
addTop(headerContent);
navBar.setUserHeader(getUserHeaderFooter(true));
header.add(navBar.getContent(Navigation.Position.TOP));
bodyTree.add(header);
headerContent.add(navBar.getContent(Navigation.Position.TOP));
Content mainContent = new ContentBuilder();
addSystemProperties(mainContent);
Content titleContent = new StringContent(resources.getText("doclet.systemProperties"));
Content pHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, titleContent);
Content headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading);
mainTree.add(headerDiv);
mainTree.add(mainContent);
bodyTree.add(mainTree);
Content footer = HtmlTree.FOOTER();
navBar.setUserFooter(getUserHeaderFooter(false));
footer.add(navBar.getContent(Navigation.Position.BOTTOM));
addBottom(footer);
bodyTree.add(footer);
printHtmlDocument(null, "system properties", bodyTree);
body.add(new BodyContents()
.setHeader(headerContent)
.addMainContent(HtmlTree.DIV(HtmlStyle.header,
HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
contents.getContent("doclet.systemProperties"))))
.addMainContent(mainContent)
.setFooter(footer));
printHtmlDocument(null, "system properties", body);
}
/**

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 8215038 8239487
* @bug 8215038 8239487 8240476
* @summary Add a page that lists all system properties
* @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -65,6 +65,15 @@ public class TestSystemPropertyPage extends JavadocTester {
"<a href=\"system-properties.html\">System Properties</a>");
checkOutput("system-properties.html", true,
"<div class=\"flex-box\">\n" +
"<header role=\"banner\" class=\"flex-header\">",
"<div class=\"flex-content\">\n" +
"<main role=\"main\">\n" +
"<div class=\"header\">\n" +
"<h1>System Properties</h1>\n" +
"</div>",
"<table>\n" +
"<caption><span>System Properties Summary</span><span class=\"tab-end\">&nbsp;</span></caption>\n" +
"<thead>\n" +