Skip to content

Commit

Permalink
Improving the UI, as suggested.
Browse files Browse the repository at this point in the history
  • Loading branch information
lahodaj committed Nov 6, 2024
1 parent 219b21b commit 088776f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@
import jdk.javadoc.internal.html.Content;
import jdk.javadoc.internal.html.ContentBuilder;
import jdk.javadoc.internal.html.Entity;
import jdk.javadoc.internal.html.HtmlId;
import jdk.javadoc.internal.html.HtmlStyle;
import jdk.javadoc.internal.html.HtmlTag;
import jdk.javadoc.internal.html.HtmlTree;
import jdk.javadoc.internal.html.RawHtml;
import jdk.javadoc.internal.html.Text;

/**
Expand Down Expand Up @@ -583,21 +584,49 @@ protected void addPackagesSummary(Content summariesList) {
TableHeader indirectPackagesHeader =
new TableHeader(contents.fromLabel, contents.packagesLabel);
if (display(indirectPackages)) {
Map<ModuleElement, SortedSet<PackageElement>> filteredIndirectPackages = indirectPackages;
boolean javaSEModule = mdle.getQualifiedName().contentEquals("java.se");
if (javaSEModule) {
filteredIndirectPackages = filteredIndirectPackages.entrySet().stream().filter(e -> !e.getKey().getQualifiedName().contentEquals("java.base")).collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
}
String aepText = resources.getText("doclet.Indirect_Exports_Summary");
var aepTable = getTable2(Text.of(aepText), indirectPackagesHeader);
addIndirectPackages(aepTable, filteredIndirectPackages);
section.add(aepTable);
if (javaSEModule) {
filteredIndirectPackages = indirectPackages.entrySet().stream().filter(e -> e.getKey().getQualifiedName().contentEquals("java.base")).collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
ModuleElement javaBase = this.utils.elementUtils.getModuleElement("java.base");
if (javaBase != null && indirectPackages.keySet().contains(javaBase)) {
Map<ModuleElement, SortedSet<PackageElement>> filteredIndirectPackages =
indirectPackages.entrySet()
.stream()
.filter(e -> !e.getKey().equals(javaBase))
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
String aepText = resources.getText("doclet.Indirect_Exports_Summary");
var aepTable = getTable2(Text.of(aepText), indirectPackagesHeader);
addIndirectPackages(aepTable, filteredIndirectPackages);
section.add(aepTable);
//add the preview box:
section.add(HtmlTree.DIV(HtmlTree.BR()));
section.add(HtmlTree.DIV(HtmlTree.BR()));
HtmlId previewRequiresTransitiveId = HtmlId.of("preview-requires-transitive-java.base");
var previewDiv = HtmlTree.DIV(HtmlStyles.previewBlock);
previewDiv.setId(previewRequiresTransitiveId);

Content note =
RawHtml.of(resources.getText("doclet.PreviewJavaSERequiresTransitiveJavaBase"));

previewDiv.add(HtmlTree.DIV(HtmlStyles.previewComment, note));
section.add(previewDiv);

//add the Indirect Exports
filteredIndirectPackages =
indirectPackages.entrySet()
.stream()
.filter(e -> e.getKey().equals(javaBase))
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
String aepPreviewText = resources.getText("doclet.Indirect_Exports_Preview_Summary");
var aepPreviewTable = getTable2(Text.of(aepPreviewText), indirectPackagesHeader);
ContentBuilder tableCaption = new ContentBuilder(
Text.of(aepPreviewText),
HtmlTree.SUP(links.createLink(previewRequiresTransitiveId,
contents.previewMark)));
var aepPreviewTable = getTable2(tableCaption, indirectPackagesHeader);
addIndirectPackages(aepPreviewTable, filteredIndirectPackages);
section.add(aepPreviewTable);
} else {
String aepText = resources.getText("doclet.Indirect_Exports_Summary");
var aepTable = getTable2(Text.of(aepText), indirectPackagesHeader);
addIndirectPackages(aepTable, indirectPackages);
section.add(aepTable);
}
}
if (display(indirectOpenPackages)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@ doclet.ReflectivePreviewAPI={0} refers to one or more reflective preview APIs:
doclet.UsesDeclaredUsingPreview={0} refers to one or more types which are declared using a preview feature of the Java language: {1}.
doclet.PreviewTrailingNote1=Programs can only use {0} when preview features are enabled.
doclet.PreviewTrailingNote2=Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
doclet.PreviewJavaSERequiresTransitiveJavaBase=\
<div><strong>Indirect exports from java.base are associated with <code>requires transitive java.base</code>, a preview feature of the Java language.</strong></div>\
<div>Programs can only use <code>requires transitive java.base<code> when preview features are enabled.</div>\
<div>Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.</div>
doclet.RestrictedMethod=restricted method
doclet.RestrictedLeadingNote={0} is a {1} of the Java platform.
doclet.RestrictedTrailingNote1=Programs can only use {0} when access to restricted methods is enabled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ doclet.Package_Summary=Package Summary
doclet.Requires_Summary=Requires
doclet.Indirect_Requires_Summary=Indirect Requires
doclet.Indirect_Exports_Summary=Indirect Exports
doclet.Indirect_Exports_Preview_Summary=Indirect Exports (Preview Feature)
doclet.Indirect_Exports_Preview_Summary=Indirect Exports
doclet.Indirect_Opens_Summary=Indirect Opens
doclet.Exported_Packages_Summary=Exports
doclet.Opened_Packages_Summary=Opens
Expand Down

0 comments on commit 088776f

Please sign in to comment.