8215038: Add a page that lists all system properties
Co-authored-by: Priya Lakshmi Muthuswamy <priya.lakshmi.muthuswamy@oracle.com> Reviewed-by: hannesw, jjg
This commit is contained in:
parent
0de20e8d0d
commit
5ca3e6334a
@ -156,6 +156,7 @@ public class Contents {
|
||||
public final Content propertyDetailsLabel;
|
||||
public final Content propertySummaryLabel;
|
||||
public final Content record;
|
||||
public final Content referencedIn;
|
||||
public final Content seeLabel;
|
||||
public final Content serializedForm;
|
||||
public final Content servicesLabel;
|
||||
@ -163,6 +164,8 @@ public class Contents {
|
||||
public final Content subclassesLabel;
|
||||
public final Content subinterfacesLabel;
|
||||
public final Content summaryLabel;
|
||||
public final Content systemPropertiesLabel;
|
||||
public final Content systemPropertiesSummaryLabel;
|
||||
public final Content treeLabel;
|
||||
public final Content typeLabel;
|
||||
public final Content useLabel;
|
||||
@ -284,6 +287,7 @@ public class Contents {
|
||||
propertyDetailsLabel = getContent("doclet.Property_Detail");
|
||||
propertySummaryLabel = getContent("doclet.Property_Summary");
|
||||
record = getContent("doclet.Record");
|
||||
referencedIn = getContent("doclet.ReferencedIn");
|
||||
seeLabel = getContent("doclet.See");
|
||||
serializedForm = getContent("doclet.Serialized_Form");
|
||||
servicesLabel = getContent("doclet.Services");
|
||||
@ -291,6 +295,8 @@ public class Contents {
|
||||
subclassesLabel = getContent("doclet.Subclasses");
|
||||
subinterfacesLabel = getContent("doclet.Subinterfaces");
|
||||
summaryLabel = getContent("doclet.Summary");
|
||||
systemPropertiesLabel = getContent("doclet.systemProperties");
|
||||
systemPropertiesSummaryLabel = getContent("doclet.systemPropertiesSummary");
|
||||
treeLabel = getContent("doclet.Tree");
|
||||
typeLabel = getContent("doclet.Type");
|
||||
useLabel = getContent("doclet.navClassUse");
|
||||
|
@ -159,6 +159,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
if (!configuration.packages.isEmpty()) {
|
||||
AllPackagesIndexWriter.generate(configuration);
|
||||
}
|
||||
SystemPropertiesWriter.generate(configuration);
|
||||
}
|
||||
|
||||
if (configuration.createoverview) {
|
||||
|
@ -75,6 +75,7 @@ import com.sun.source.doctree.TextTree;
|
||||
import com.sun.source.util.SimpleDocTreeVisitor;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.FixedStringContent;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.Head;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
|
||||
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocument;
|
||||
@ -2185,4 +2186,7 @@ public class HtmlDocletWriter {
|
||||
return localStylesheets;
|
||||
}
|
||||
|
||||
Content getVerticalSeparator() {
|
||||
return HtmlTree.SPAN(HtmlStyle.verticalSeparator, new FixedStringContent("|"));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -51,6 +51,7 @@ public class SearchIndexItem {
|
||||
private String containingClass = "";
|
||||
private String holder = "";
|
||||
private String description = "";
|
||||
private boolean systemProperty;
|
||||
|
||||
public void setLabel(String l) {
|
||||
label = l;
|
||||
@ -100,6 +101,14 @@ public class SearchIndexItem {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setSystemProperty(boolean value) {
|
||||
systemProperty = value;
|
||||
}
|
||||
|
||||
public boolean isSystemProperty() {
|
||||
return systemProperty;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder item = new StringBuilder("");
|
||||
switch (category) {
|
||||
|
@ -148,9 +148,13 @@ public class SingleIndexWriter extends AbstractIndexWriter {
|
||||
contentTree.add(links.createLink(DocPaths.ALLCLASSES_INDEX,
|
||||
contents.allClassesLabel));
|
||||
if (!configuration.packages.isEmpty()) {
|
||||
contentTree.add(Entity.NO_BREAK_SPACE);
|
||||
contentTree.add(getVerticalSeparator());
|
||||
contentTree.add(links.createLink(DocPaths.ALLPACKAGES_INDEX,
|
||||
contents.allPackagesLabel));
|
||||
}
|
||||
if (!configuration.tagSearchIndex.isEmpty()) {
|
||||
contentTree.add(getVerticalSeparator());
|
||||
contentTree.add(links.createLink(DocPaths.SYSTEM_PROPERTIES, contents.systemPropertiesLabel));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,9 +172,14 @@ public class SplitIndexWriter extends AbstractIndexWriter {
|
||||
contentTree.add(links.createLink(pathToRoot.resolve(DocPaths.ALLCLASSES_INDEX),
|
||||
contents.allClassesLabel));
|
||||
if (!configuration.packages.isEmpty()) {
|
||||
contentTree.add(Entity.NO_BREAK_SPACE);
|
||||
contentTree.add(getVerticalSeparator());
|
||||
contentTree.add(links.createLink(pathToRoot.resolve(DocPaths.ALLPACKAGES_INDEX),
|
||||
contents.allPackagesLabel));
|
||||
}
|
||||
if (!configuration.tagSearchIndex.isEmpty()) {
|
||||
contentTree.add(getVerticalSeparator());
|
||||
contentTree.add(links.createLink(pathToRoot.resolve(DocPaths.SYSTEM_PROPERTIES),
|
||||
contents.systemPropertiesLabel));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.javadoc.internal.doclets.formats.html;
|
||||
|
||||
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.markup.StringContent;
|
||||
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;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
|
||||
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Generates the file with the summary of all the system properties.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*/
|
||||
public class SystemPropertiesWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* The HTML tree for main tag.
|
||||
*/
|
||||
private final HtmlTree mainTree = HtmlTree.MAIN();
|
||||
|
||||
private final Navigation navBar;
|
||||
|
||||
/**
|
||||
* Constructs SystemPropertiesWriter object.
|
||||
*
|
||||
* @param configuration The current configuration
|
||||
* @param filename Path to the file which is getting generated.
|
||||
*/
|
||||
public SystemPropertiesWriter(HtmlConfiguration configuration, DocPath filename) {
|
||||
super(configuration, filename);
|
||||
this.navBar = new Navigation(null, configuration, PageMode.SYSTEMPROPERTIES, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates SystemPropertiesWriter object.
|
||||
*
|
||||
* @param configuration The current configuration
|
||||
* @throws DocFileIOException
|
||||
*/
|
||||
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
|
||||
generate(configuration, DocPaths.SYSTEM_PROPERTIES);
|
||||
}
|
||||
|
||||
private static void generate(HtmlConfiguration configuration, DocPath fileName) throws DocFileIOException {
|
||||
SystemPropertiesWriter systemPropertiesGen = new SystemPropertiesWriter(configuration, fileName);
|
||||
systemPropertiesGen.buildSystemPropertiesPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
navBar.setUserHeader(getUserHeaderFooter(true));
|
||||
header.add(navBar.getContent(true));
|
||||
bodyTree.add(header);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.setStyle(HtmlStyle.systemPropertiesContainer);
|
||||
addSystemProperties(div);
|
||||
Content titleContent = new StringContent(resources.getText("doclet.systemProperties"));
|
||||
Content pHeading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true,
|
||||
HtmlStyle.title, titleContent);
|
||||
Content headerDiv = HtmlTree.DIV(HtmlStyle.header, pHeading);
|
||||
mainTree.add(headerDiv);
|
||||
mainTree.add(div);
|
||||
bodyTree.add(mainTree);
|
||||
Content footer = HtmlTree.FOOTER();
|
||||
navBar.setUserFooter(getUserHeaderFooter(false));
|
||||
footer.add(navBar.getContent(false));
|
||||
addBottom(footer);
|
||||
bodyTree.add(footer);
|
||||
printHtmlDocument(null, "system properties", bodyTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all the system properties to the content tree.
|
||||
*
|
||||
* @param content HtmlTree content to which the links will be added
|
||||
*/
|
||||
protected void addSystemProperties(Content content) {
|
||||
Map<String, List<SearchIndexItem>> searchIndexMap = groupSystemProperties();
|
||||
Content separator = new StringContent(", ");
|
||||
Table table = new Table(HtmlStyle.systemPropertiesSummary)
|
||||
.setCaption(getTableCaption(contents.systemPropertiesSummaryLabel))
|
||||
.setHeader(new TableHeader(contents.propertyLabel, contents.referencedIn))
|
||||
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast);
|
||||
for (Entry<String, List<SearchIndexItem>> entry : searchIndexMap.entrySet()) {
|
||||
Content propertyName = new StringContent(entry.getKey());
|
||||
List<SearchIndexItem> searchIndexItems = entry.getValue();
|
||||
Content separatedReferenceLinks = new ContentBuilder();
|
||||
separatedReferenceLinks.add(links.createLink(
|
||||
pathToRoot.resolve(searchIndexItems.get(0).getUrl()),
|
||||
getLinkLabel(searchIndexItems.get(0))));
|
||||
for (int i = 1; i < searchIndexItems.size(); i++) {
|
||||
separatedReferenceLinks.add(separator);
|
||||
separatedReferenceLinks.add(links.createLink(
|
||||
pathToRoot.resolve(searchIndexItems.get(i).getUrl()),
|
||||
getLinkLabel(searchIndexItems.get(i))));
|
||||
}
|
||||
table.addRow(propertyName, separatedReferenceLinks);
|
||||
}
|
||||
content.add(table.toContent());
|
||||
}
|
||||
|
||||
private Map<String, List<SearchIndexItem>> groupSystemProperties() {
|
||||
Map<String, List<SearchIndexItem>> searchIndexMap = new TreeMap<>();
|
||||
for (SearchIndexItem searchIndex : configuration.tagSearchIndex) {
|
||||
if (searchIndex.isSystemProperty()) {
|
||||
List<SearchIndexItem> list = searchIndexMap
|
||||
.computeIfAbsent(searchIndex.getLabel(), k -> new ArrayList<>());
|
||||
list.add(searchIndex);
|
||||
}
|
||||
}
|
||||
return searchIndexMap;
|
||||
}
|
||||
|
||||
private String getLinkLabel(SearchIndexItem searchIndexItem) {
|
||||
String holder = searchIndexItem.getHolder();
|
||||
String url = searchIndexItem.getUrl();
|
||||
final String docFiles = "/doc-files/";
|
||||
if (url.contains(docFiles)) {
|
||||
final int idx = url.indexOf(docFiles);
|
||||
final int len = docFiles.length();
|
||||
return url.substring(idx + len, url.indexOf("#", idx));
|
||||
}
|
||||
return holder;
|
||||
}
|
||||
}
|
@ -117,7 +117,7 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
}
|
||||
String desc = ch.getText(itt.getDescription());
|
||||
|
||||
return createAnchorAndSearchIndex(element, tagText, desc);
|
||||
return createAnchorAndSearchIndex(element, tagText, desc, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -326,7 +326,7 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
SystemPropertyTree itt = (SystemPropertyTree)tag;
|
||||
String tagText = itt.getPropertyName().toString();
|
||||
return HtmlTree.CODE(createAnchorAndSearchIndex(element, tagText,
|
||||
resources.getText("doclet.System_Property")));
|
||||
resources.getText("doclet.System_Property"), true));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -416,7 +416,7 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
}
|
||||
|
||||
@SuppressWarnings("preview")
|
||||
private Content createAnchorAndSearchIndex(Element element, String tagText, String desc) {
|
||||
private Content createAnchorAndSearchIndex(Element element, String tagText, String desc, boolean isSystemProperty) {
|
||||
Content result = null;
|
||||
if (isFirstSentence && inSummary) {
|
||||
result = new StringContent(tagText);
|
||||
@ -430,6 +430,7 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
result = HtmlTree.A_ID(HtmlStyle.searchTagResult, anchorName, new StringContent(tagText));
|
||||
if (configuration.createindex && !tagText.isEmpty()) {
|
||||
SearchIndexItem si = new SearchIndexItem();
|
||||
si.setSystemProperty(isSystemProperty);
|
||||
si.setLabel(tagText);
|
||||
si.setDescription(desc);
|
||||
si.setUrl(htmlWriter.path.getPath() + "#" + anchorName);
|
||||
|
@ -134,6 +134,8 @@ public enum HtmlStyle {
|
||||
subNavList,
|
||||
subTitle,
|
||||
summary,
|
||||
systemPropertiesContainer,
|
||||
systemPropertiesSummary,
|
||||
tabEnd,
|
||||
tableTab,
|
||||
throwsLabel,
|
||||
@ -145,5 +147,6 @@ public enum HtmlStyle {
|
||||
typeParametersLong,
|
||||
typeSummary,
|
||||
useSummary,
|
||||
usesSummary
|
||||
usesSummary,
|
||||
verticalSeparator
|
||||
}
|
||||
|
@ -98,6 +98,7 @@ public class Navigation {
|
||||
OVERVIEW,
|
||||
PACKAGE,
|
||||
SERIALIZEDFORM,
|
||||
SYSTEMPROPERTIES,
|
||||
TREE,
|
||||
USE;
|
||||
}
|
||||
@ -358,6 +359,7 @@ public class Navigation {
|
||||
case ALLPACKAGES:
|
||||
case CONSTANTVALUES:
|
||||
case SERIALIZEDFORM:
|
||||
case SYSTEMPROPERTIES:
|
||||
addOverviewLink(tree);
|
||||
addModuleLink(tree);
|
||||
addPackageLink(tree);
|
||||
|
@ -120,7 +120,10 @@ doclet.Interfaces=Interfaces
|
||||
doclet.Enclosing_Class=Enclosing class:
|
||||
doclet.Enclosing_Interface=Enclosing interface:
|
||||
doclet.Inheritance_Tree=Inheritance Tree
|
||||
doclet.ReferencedIn=Referenced In
|
||||
doclet.System_Property=System Property
|
||||
doclet.systemProperties=System Properties
|
||||
doclet.systemPropertiesSummary=System Properties Summary
|
||||
doclet.Window_Source_title=Source code
|
||||
doclet.Window_Help_title=API Help
|
||||
|
||||
|
@ -282,7 +282,7 @@ body.class-declaration .summary .inheritedList h2 {
|
||||
* Styles for page layout containers.
|
||||
*/
|
||||
.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer,
|
||||
.allClassesContainer, .allPackagesContainer {
|
||||
.allClassesContainer, .allPackagesContainer, .systemPropertiesContainer {
|
||||
clear:both;
|
||||
padding:10px 20px;
|
||||
position:relative;
|
||||
@ -343,19 +343,21 @@ table tr td dl, table tr td dl dt, table tr td dl dd {
|
||||
* Styles for tables.
|
||||
*/
|
||||
.overviewSummary table, .memberSummary table, .typeSummary table, .useSummary table, .constantsSummary table, .deprecatedSummary table,
|
||||
.requiresSummary table, .packagesSummary table, .providesSummary table, .usesSummary table {
|
||||
.requiresSummary table, .packagesSummary table, .providesSummary table, .usesSummary table, .systemPropertiesSummary table {
|
||||
width:100%;
|
||||
border-spacing:0;
|
||||
border-left:1px solid #EEE;
|
||||
border-right:1px solid #EEE;
|
||||
border-bottom:1px solid #EEE;
|
||||
}
|
||||
.overviewSummary table, .memberSummary table, .requiresSummary table, .packagesSummary table, .providesSummary table, .usesSummary table {
|
||||
.overviewSummary table, .memberSummary table, .requiresSummary table, .packagesSummary table,
|
||||
.providesSummary table, .usesSummary table, .systemPropertiesSummary table {
|
||||
padding:0px;
|
||||
}
|
||||
.overviewSummary caption, .memberSummary caption, .typeSummary caption,
|
||||
.useSummary caption, .constantsSummary caption, .deprecatedSummary caption,
|
||||
.requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {
|
||||
.requiresSummary caption, .packagesSummary caption, .providesSummary caption,
|
||||
.usesSummary caption, .systemPropertiesSummary caption {
|
||||
position:relative;
|
||||
text-align:left;
|
||||
background-repeat:no-repeat;
|
||||
@ -394,7 +396,7 @@ table tr td dl, table tr td dl dt, table tr td dl dd {
|
||||
.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,
|
||||
.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span,
|
||||
.requiresSummary caption span, .packagesSummary caption span, .providesSummary caption span,
|
||||
.usesSummary caption span {
|
||||
.usesSummary caption span, .systemPropertiesSummary caption span {
|
||||
white-space:nowrap;
|
||||
padding-top:5px;
|
||||
padding-left:12px;
|
||||
@ -438,13 +440,14 @@ table tr td dl, table tr td dl dt, table tr td dl dd {
|
||||
}
|
||||
.overviewSummary td, .memberSummary td, .typeSummary td,
|
||||
.useSummary td, .constantsSummary td, .deprecatedSummary td,
|
||||
.requiresSummary td, .packagesSummary td, .providesSummary td, .usesSummary td {
|
||||
.requiresSummary td, .packagesSummary td, .providesSummary td,
|
||||
.usesSummary td, .systemPropertiesSummary td {
|
||||
text-align:left;
|
||||
padding:0px 0px 12px 10px;
|
||||
}
|
||||
th.colFirst, th.colSecond, th.colLast, th.colConstructorName, th.colDeprecatedItemName, .useSummary th,
|
||||
.constantsSummary th, .packagesSummary th, td.colFirst, td.colSecond, td.colLast, .useSummary td,
|
||||
.constantsSummary td {
|
||||
.constantsSummary td, .systemPropertiesSummary th {
|
||||
vertical-align:top;
|
||||
padding-right:0px;
|
||||
padding-top:8px;
|
||||
@ -686,7 +689,9 @@ section.description {
|
||||
background-color:#ffffff;
|
||||
border:none;
|
||||
}
|
||||
|
||||
.verticalSeparator {
|
||||
padding: 0 5px;
|
||||
}
|
||||
/*
|
||||
* Indicator icon for external links.
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -172,6 +172,9 @@ public class DocPaths {
|
||||
/** The name of the file for the package usage info. */
|
||||
public static final DocPath PACKAGE_USE = DocPath.create("package-use.html");
|
||||
|
||||
/** The name of the file for all system properties. */
|
||||
public static final DocPath SYSTEM_PROPERTIES = DocPath.create("system-properties.html");
|
||||
|
||||
/**
|
||||
* Returns the path for a type element.
|
||||
* For example, if the type element is {@code java.lang.Object},
|
||||
|
@ -124,7 +124,7 @@ public class TestMetadata extends JavadocTester {
|
||||
|
||||
checking ("all body classes");
|
||||
if (allBodyClassesFound.equals(allBodyClasses)) {
|
||||
passed("all gbody classes found");
|
||||
passed("all body classes found");
|
||||
} else {
|
||||
Set<String> notFound = new TreeSet<>(allBodyClasses);
|
||||
notFound.removeAll(allBodyClassesFound);
|
||||
@ -156,6 +156,7 @@ public class TestMetadata extends JavadocTester {
|
||||
"single-index",
|
||||
"source",
|
||||
"split-index",
|
||||
"system-properties",
|
||||
"tree"
|
||||
);
|
||||
|
||||
@ -223,6 +224,7 @@ public class TestMetadata extends JavadocTester {
|
||||
"SingleIndexWriter",
|
||||
"SourceToHTMLConverter",
|
||||
"SplitIndexWriter",
|
||||
"SystemPropertiesWriter",
|
||||
"TreeWriter"
|
||||
);
|
||||
|
||||
@ -361,6 +363,10 @@ public class TestMetadata extends JavadocTester {
|
||||
check(generator, content, content.startsWith("source:"));
|
||||
break;
|
||||
|
||||
case "SystemPropertiesWriter":
|
||||
check(generator, content, content.contains("system properties"));
|
||||
break;
|
||||
|
||||
default:
|
||||
failed("unexpected generator: " + generator);
|
||||
break;
|
||||
|
@ -1343,7 +1343,8 @@ public class TestModules extends JavadocTester {
|
||||
checkOutput("package-search-index.js", true,
|
||||
"{\"l\":\"All Packages\",\"url\":\"allpackages-index.html\"}");
|
||||
checkOutput("index-all.html", true,
|
||||
"<br><a href=\"allclasses-index.html\">All Classes</a> "
|
||||
"<br><a href=\"allclasses-index.html\">All Classes</a>"
|
||||
+ "<span class=\"verticalSeparator\">|</span>"
|
||||
+ "<a href=\"allpackages-index.html\">All Packages</a>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,8 @@ public class TestPackagePage extends JavadocTester {
|
||||
checkOutput("package-search-index.js", true,
|
||||
"{\"l\":\"All Packages\",\"url\":\"allpackages-index.html\"}");
|
||||
checkOutput("index-all.html", true,
|
||||
"<br><a href=\"allclasses-index.html\">All Classes</a> "
|
||||
"<br><a href=\"allclasses-index.html\">All Classes</a>"
|
||||
+ "<span class=\"verticalSeparator\">|</span>"
|
||||
+ "<a href=\"allpackages-index.html\">All Packages</a>");
|
||||
}
|
||||
}
|
||||
|
@ -460,7 +460,8 @@ public class TestSearch extends JavadocTester {
|
||||
+ "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>",
|
||||
"<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#SingleWord\">"
|
||||
+ "SingleWord</a></span> - Search tag in package pkg</dt>",
|
||||
"<br><a href=\"../allclasses-index.html\">All Classes</a> "
|
||||
"<br><a href=\"../allclasses-index.html\">All Classes</a>"
|
||||
+ "<span class=\"verticalSeparator\">|</span>"
|
||||
+ "<a href=\"../allpackages-index.html\">All Packages</a>");
|
||||
checkOutput("index-files/index-10.html", true,
|
||||
"<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#phrasewithspaces\">"
|
||||
@ -698,7 +699,8 @@ public class TestSearch extends JavadocTester {
|
||||
checkOutput("package-search-index.js", true,
|
||||
"{\"l\":\"All Packages\",\"url\":\"allpackages-index.html\"}");
|
||||
checkOutput("index-all.html", true,
|
||||
"<br><a href=\"allclasses-index.html\">All Classes</a> "
|
||||
+ "<a href=\"allpackages-index.html\">All Packages</a>");
|
||||
}
|
||||
"<br><a href=\"allclasses-index.html\">All Classes</a>"
|
||||
+ "<span class=\"verticalSeparator\">|</span>"
|
||||
+ "<a href=\"allpackages-index.html\">All Packages</a>");
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,8 @@ public class TestStylesheet extends JavadocTester {
|
||||
+ "}",
|
||||
".overviewSummary caption, .memberSummary caption, .typeSummary caption,\n"
|
||||
+ ".useSummary caption, .constantsSummary caption, .deprecatedSummary caption,\n"
|
||||
+ ".requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {\n"
|
||||
+ ".requiresSummary caption, .packagesSummary caption, .providesSummary caption,\n"
|
||||
+ ".usesSummary caption, .systemPropertiesSummary caption {\n"
|
||||
+ " position:relative;\n"
|
||||
+ " text-align:left;\n"
|
||||
+ " background-repeat:no-repeat;\n"
|
||||
@ -94,7 +95,7 @@ public class TestStylesheet extends JavadocTester {
|
||||
".overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,\n"
|
||||
+ ".useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span,\n"
|
||||
+ ".requiresSummary caption span, .packagesSummary caption span, .providesSummary caption span,\n"
|
||||
+ ".usesSummary caption span {\n"
|
||||
+ ".usesSummary caption span, .systemPropertiesSummary caption span {\n"
|
||||
+ " white-space:nowrap;\n"
|
||||
+ " padding-top:5px;\n"
|
||||
+ " padding-left:12px;\n"
|
||||
@ -137,7 +138,8 @@ public class TestStylesheet extends JavadocTester {
|
||||
+ "}",
|
||||
".overviewSummary td, .memberSummary td, .typeSummary td,\n"
|
||||
+ ".useSummary td, .constantsSummary td, .deprecatedSummary td,\n"
|
||||
+ ".requiresSummary td, .packagesSummary td, .providesSummary td, .usesSummary td {\n"
|
||||
+ ".requiresSummary td, .packagesSummary td, .providesSummary td,\n"
|
||||
+ ".usesSummary td, .systemPropertiesSummary td {\n"
|
||||
+ " text-align:left;\n"
|
||||
+ " padding:0px 0px 12px 10px;\n"
|
||||
+ "}",
|
||||
|
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8215038
|
||||
* @summary Add a page that lists all system properties
|
||||
* @library /tools/lib ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build javadoc.tester.* toolbox.ToolBox builder.ClassBuilder
|
||||
* @run main TestSystemPropertyPage
|
||||
*/
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import builder.ClassBuilder;
|
||||
import javadoc.tester.JavadocTester;
|
||||
import toolbox.ToolBox;
|
||||
|
||||
public class TestSystemPropertyPage extends JavadocTester {
|
||||
|
||||
final ToolBox tb;
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
TestSystemPropertyPage tester = new TestSystemPropertyPage();
|
||||
tester.runTests(m -> new Object[]{Paths.get(m.getName())});
|
||||
}
|
||||
|
||||
TestSystemPropertyPage() {
|
||||
tb = new ToolBox();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test(Path base) throws Exception {
|
||||
Path srcDir = base.resolve("src");
|
||||
Path outDir = base.resolve("out");
|
||||
|
||||
new ClassBuilder(tb, "pkg1.A")
|
||||
.setComments("test with {@systemProperty user.name}")
|
||||
.setModifiers("public", "class")
|
||||
.write(srcDir);
|
||||
|
||||
new ClassBuilder(tb, "pkg2.B")
|
||||
.setComments("test with {@systemProperty user.address}, {@index user.home System Property}")
|
||||
.setModifiers("public", "class")
|
||||
.write(srcDir);
|
||||
|
||||
javadoc("-d", outDir.toString(),
|
||||
"-sourcepath", srcDir.toString(),
|
||||
"pkg1","pkg2");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
|
||||
checkOutput("index-all.html", true,
|
||||
"<a href=\"system-properties.html\">System Properties</a>");
|
||||
|
||||
checkOutput("system-properties.html", true,
|
||||
"<table>\n" +
|
||||
"<caption><span>System Properties Summary</span><span " +
|
||||
"class=\"tabEnd\"> </span></caption>\n" +
|
||||
"<thead>\n" +
|
||||
"<tr>\n" +
|
||||
"<th class=\"colFirst\" scope=\"col\">Property</th>\n" +
|
||||
"<th class=\"colLast\" scope=\"col\">Referenced In</th>\n" +
|
||||
"</tr>\n" +
|
||||
"</thead>\n" +
|
||||
"<tbody>\n" +
|
||||
"<tr class=\"altColor\">\n" +
|
||||
"<th class=\"colFirst\" scope=\"row\">user.address</th>\n" +
|
||||
"<td class=\"colLast\"><a href=\"pkg2/B.html#user.address\">class pkg2.B</a" +
|
||||
"></td>\n" +
|
||||
"</tr>\n" +
|
||||
"<tr class=\"rowColor\">\n" +
|
||||
"<th class=\"colFirst\" scope=\"row\">user.name</th>\n" +
|
||||
"<td class=\"colLast\"><a href=\"pkg1/A.html#user.name\">class pkg1.A</a></td" +
|
||||
">\n" +
|
||||
"</tr>\n" +
|
||||
"</tbody>\n" +
|
||||
"</table>");
|
||||
}
|
||||
}
|
@ -110,7 +110,8 @@ public class TestUnnamedPackage extends JavadocTester {
|
||||
"{\"l\":\"All Packages\",\"url\":\"allpackages-index.html\"}");
|
||||
|
||||
checkOutput("index-all.html", true,
|
||||
"<br><a href=\"allclasses-index.html\">All Classes</a> "
|
||||
"<br><a href=\"allclasses-index.html\">All Classes</a>"
|
||||
+ "<span class=\"verticalSeparator\">|</span>"
|
||||
+ "<a href=\"allpackages-index.html\">All Packages</a>");
|
||||
|
||||
checkOutput(Output.OUT, false,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -236,6 +236,7 @@ class APITest {
|
||||
"script.js",
|
||||
"search.js",
|
||||
"stylesheet.css",
|
||||
"system-properties.html",
|
||||
"type-search-index.js",
|
||||
"type-search-index.zip"
|
||||
));
|
||||
@ -243,7 +244,8 @@ class APITest {
|
||||
protected static Set<String> noIndexFiles = standardExpectFiles.stream()
|
||||
.filter(s -> !s.startsWith("script-dir") && !s.startsWith("resources") && !s.endsWith("zip")
|
||||
&& !s.equals("index-all.html") && !s.equals("search.js") && !s.endsWith("-search-index.js")
|
||||
&& !s.equals("allclasses-index.html") && !s.equals("allpackages-index.html"))
|
||||
&& !s.equals("allclasses-index.html") && !s.equals("allpackages-index.html")
|
||||
&& !s.equals("system-properties.html"))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user