Skip to content

Commit

Permalink
fix merge conflicts and slight refactor due to 8335122
Browse files Browse the repository at this point in the history
  • Loading branch information
hns authored and nizarbenalla committed Jan 5, 2025
1 parent bf744e4 commit ffb46dd
Showing 1 changed file with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2025, 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
Expand Down Expand Up @@ -28,21 +28,14 @@
import java.util.List;

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.HtmlId;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.BodyContents;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyles;
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 jdk.javadoc.internal.html.Content;
import jdk.javadoc.internal.html.ContentBuilder;
import jdk.javadoc.internal.html.HtmlId;
import jdk.javadoc.internal.html.HtmlTag;
import jdk.javadoc.internal.html.HtmlTree;
import jdk.javadoc.internal.html.Text;

Expand Down Expand Up @@ -117,10 +110,10 @@ protected void addHelpFileContents(Content content) {
.add(getPageKindSection())
.add(options.noSince()
? new ContentBuilder()
: new ContentBuilder(new HtmlTree(TagName.HR),
: new ContentBuilder(HtmlTree.HR(),
getReleasesSection()))
.add(new HtmlTree(TagName.HR))
.add(HtmlTree.SPAN(HtmlStyle.helpFootnote,
.add(HtmlTree.HR())
.add(HtmlTree.SPAN(HtmlStyles.helpFootnote,
getContent("doclet.help.footnote")));
tableOfContents.popNestedList();
}
Expand All @@ -140,7 +133,7 @@ private Content getNavigationSection() {
Content content = new ContentBuilder();

Content navHeading = contents.getContent("doclet.help.navigation.head");
var navSection = HtmlTree.DIV(HtmlStyle.subTitle)
var navSection = HtmlTree.DIV(HtmlStyles.subTitle)
.add(HtmlTree.HEADING(Headings.CONTENT_HEADING, navHeading).setId(HtmlIds.HELP_NAVIGATION))
.add(contents.getContent("doclet.help.navigation.intro", overviewLink));
if (options.createIndex()) {
Expand Down Expand Up @@ -193,15 +186,15 @@ private Content getNavigationSection() {
* <li>Declaration pages: module, package, classes
* <li>Derived info for declarations: use and tree
* <li>General summary info: deprecated, preview
* <li>Detailed summary info: constant values, serialized form, system properties
* <li>Detailed summary info: constant values, search tags, serialized form, system properties
* <li>Index info: all packages, all classes, full index
* </ul>
*
* @return the content containing the help
*/
private Content getPageKindSection() {
Content pageKindsHeading = contents.getContent("doclet.help.page_kinds.head");
var pageKindsSection = HtmlTree.DIV(HtmlStyle.subTitle)
var pageKindsSection = HtmlTree.DIV(HtmlStyles.subTitle)
.add(HtmlTree.HEADING(Headings.CONTENT_HEADING, pageKindsHeading).setId(HtmlIds.HELP_PAGES))
.add(contents.getContent("doclet.help.page_kinds.intro"));

Expand Down Expand Up @@ -246,7 +239,7 @@ private Content getPageKindSection() {

// Class/interface
Content notes = new ContentBuilder(
HtmlTree.SPAN(HtmlStyle.helpNote, getContent("doclet.help.class_interface.note")),
HtmlTree.SPAN(HtmlStyles.helpNote, getContent("doclet.help.class_interface.note")),
Text.of(" "),
getContent("doclet.help.class_interface.anno"),
Text.of(" "),
Expand All @@ -265,7 +258,7 @@ private Content getPageKindSection() {
getContent("doclet.help.class_interface.implementations"),
getContent("doclet.help.class_interface.declaration"),
getContent("doclet.help.class_interface.description")))
.add(new HtmlTree(TagName.BR))
.add(HtmlTree.BR())
.add(newHelpSectionList(
contents.nestedClassSummary,
contents.enumConstantSummary,
Expand All @@ -275,7 +268,7 @@ private Content getPageKindSection() {
contents.methodSummary,
contents.annotateTypeRequiredMemberSummaryLabel,
contents.annotateTypeOptionalMemberSummaryLabel))
.add(new HtmlTree(TagName.BR))
.add(HtmlTree.BR())
.add(newHelpSectionList(
contents.enumConstantDetailLabel,
contents.fieldDetailsLabel,
Expand Down Expand Up @@ -356,6 +349,15 @@ private Content getPageKindSection() {
pageKindsSection.add(section);
}

// Search Tags
if (configuration.conditionalPages.contains(HtmlConfiguration.ConditionalPage.SEARCH_TAGS)) {
section = newHelpSection(contents.searchTagsLabel, PageMode.SEARCH_TAGS);
Content searchTagsBody = getContent("doclet.help.searchTags.body",
links.createLink(DocPaths.SEARCH_TAGS, resources.getText("doclet.searchTags")));
section.add(HtmlTree.P(searchTagsBody));
pageKindsSection.add(section);
}

// Serialized Form
if (configuration.conditionalPages.contains(HtmlConfiguration.ConditionalPage.SERIALIZED_FORM)) {
section = newHelpSection(contents.serializedForm, PageMode.SERIALIZED_FORM)
Expand Down Expand Up @@ -443,7 +445,7 @@ private Content getContent(String key, Object arg1, Object arg2) {
private HtmlTree newHelpSection(Content headingContent, HtmlId id) {
tableOfContents.addLink(id, headingContent);

return HtmlTree.SECTION(HtmlStyle.helpSection,
return HtmlTree.SECTION(HtmlStyles.helpSection,
HtmlTree.HEADING(Headings.SUB_HEADING, headingContent))
.setId(id);
}
Expand All @@ -453,7 +455,7 @@ private HtmlTree newHelpSection(Content headingContent, Navigation.PageMode pm)
}

private HtmlTree newHelpSectionList(Content first, Content... rest) {
var list = HtmlTree.UL(HtmlStyle.helpSectionList, HtmlTree.LI(first));
var list = HtmlTree.UL(HtmlStyles.helpSectionList, HtmlTree.LI(first));
List.of(rest).forEach(i -> list.add(HtmlTree.LI(i)));
return list;
}
Expand Down

0 comments on commit ffb46dd

Please sign in to comment.