Skip to content
Permalink
Browse files

8241895: use new "details-list" CSS class instead of general "block-l…

…ist" for list of details sections

Reviewed-by: hannesw
  • Loading branch information
jonathan-gibbons committed Apr 7, 2020
1 parent 8523e37 commit 7ac64b81ee564c27dd1da6ec53699a044058f293
Showing with 185 additions and 107 deletions.
  1. +5 −8 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java
  2. +5 −4 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java
  3. +5 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java
  4. +5 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java
  5. +22 −3 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java
  6. +5 −5 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactoryImpl.java
  7. +1 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java
  8. +15 −0 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ClassWriter.java
  9. +6 −8 ...re/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
  10. +24 −24 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java
  11. +6 −9 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstructorBuilder.java
  12. +7 −9 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/EnumConstantBuilder.java
  13. +6 −9 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/FieldBuilder.java
  14. +6 −8 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MethodBuilder.java
  15. +6 −9 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java
  16. +2 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css
  17. +1 −1 test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java
  18. +58 −2 test/langtools/jdk/javadoc/doclet/testLists/TestLists.java
@@ -153,16 +153,13 @@ public void addTags(ExecutableElement constructor, Content constructorDocTree) {

@Override
public Content getConstructorDetails(Content constructorDetailsTreeHeader, Content constructorDetailsTree) {
Content constructorDetails = new ContentBuilder(constructorDetailsTreeHeader, constructorDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.constructorDetails, constructorDetails)
.setId(SectionName.CONSTRUCTOR_DETAIL.getName()));
return writer.getDetailsListItem(
HtmlTree.SECTION(HtmlStyle.constructorDetails)
.setId(SectionName.CONSTRUCTOR_DETAIL.getName())
.add(constructorDetailsTreeHeader)
.add(constructorDetailsTree));
}

/**
* Let the writer know whether a non public constructor was found.
*
* @param foundNonPubConstructor true if we found a non public constructor.
*/
@Override
public void setFoundNonPubConstructor(boolean foundNonPubConstructor) {
this.foundNonPubConstructor = foundNonPubConstructor;
@@ -121,10 +121,11 @@ public void addTags(VariableElement enumConstant, Content enumConstantsTree) {
@Override
public Content getEnumConstantsDetails(Content enumConstantsDetailsTreeHeader,
Content enumConstantsDetailsTree) {
Content enumConstantsDetails =
new ContentBuilder(enumConstantsDetailsTreeHeader, enumConstantsDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.constantDetails, enumConstantsDetails)
.setId(SectionName.ENUM_CONSTANT_DETAIL.getName()));
return writer.getDetailsListItem(
HtmlTree.SECTION(HtmlStyle.constantDetails)
.setId(SectionName.ENUM_CONSTANT_DETAIL.getName())
.add(enumConstantsDetailsTreeHeader)
.add(enumConstantsDetailsTree));
}

@Override
@@ -122,9 +122,11 @@ public void addTags(VariableElement field, Content fieldTree) {

@Override
public Content getFieldDetails(Content fieldDetailsTreeHeader, Content fieldDetailsTree) {
Content fieldDetails = new ContentBuilder(fieldDetailsTreeHeader, fieldDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.fieldDetails, fieldDetails)
.setId(SectionName.FIELD_DETAIL.getName()));
return writer.getDetailsListItem(
HtmlTree.SECTION(HtmlStyle.fieldDetails)
.setId(SectionName.FIELD_DETAIL.getName())
.add(fieldDetailsTreeHeader)
.add(fieldDetailsTree));
}

@Override
@@ -134,9 +134,11 @@ public void addTags(ExecutableElement property, Content propertyDocTree) {

@Override
public Content getPropertyDetails(Content propertyDetailsTreeHeader, Content propertyDetailsTree) {
Content propertyDetails = new ContentBuilder(propertyDetailsTreeHeader, propertyDetailsTree);
return getMemberTree(HtmlTree.SECTION(HtmlStyle.propertyDetails, propertyDetails)
.setId(SectionName.PROPERTY_DETAIL.getName()));
return writer.getDetailsListItem(
HtmlTree.SECTION(HtmlStyle.propertyDetails)
.setId(SectionName.PROPERTY_DETAIL.getName())
.add(propertyDetailsTreeHeader)
.add(propertyDetailsTree));
}

@Override
@@ -212,6 +212,25 @@ public Content getMemberTreeHeader() {
return ul;
}

/**
* Returns a list to be used for the list of details for members of a given kind.
*
* @return a list to be used for the list of details for members of a given kind
*/
public Content getDetailsList() {
return new HtmlTree(TagName.UL).setStyle(HtmlStyle.detailsList);
}

/**
* Returns an item for the list of details for members of a given kind.
*
* @param content content for the item
* @return an item for the list of details for members of a given kind
*/
public Content getDetailsListItem(Content content) {
return HtmlTree.LI(content);
}

/**
* Returns a list to be used for the list of members of a given kind.
*
@@ -224,11 +243,11 @@ public Content getMemberList() {
/**
* Returns an item for the list of elements of a given kind
*
* @param contentTree the tree used to generate the complete member tree
* @param content content for the item
* @return an item for the list of elements of a given kind
*/
public Content getMemberListItem(Content contentTree) {
return HtmlTree.LI(contentTree);
public Content getMemberListItem(Content content) {
return HtmlTree.LI(content);
}

public Content getMemberInheritedTree() {
@@ -97,29 +97,29 @@ public AnnotationTypeRequiredMemberWriter getAnnotationTypeRequiredMemberWriter(

@Override
public EnumConstantWriterImpl getEnumConstantWriter(ClassWriter classWriter) {
return new EnumConstantWriterImpl((SubWriterHolderWriter) classWriter,
return new EnumConstantWriterImpl((ClassWriterImpl) classWriter,
classWriter.getTypeElement());
}

@Override
public FieldWriterImpl getFieldWriter(ClassWriter classWriter) {
return new FieldWriterImpl((SubWriterHolderWriter) classWriter, classWriter.getTypeElement());
return new FieldWriterImpl((ClassWriterImpl) classWriter, classWriter.getTypeElement());
}

@Override
public PropertyWriterImpl getPropertyWriter(ClassWriter classWriter) {
return new PropertyWriterImpl((SubWriterHolderWriter) classWriter,
return new PropertyWriterImpl((ClassWriterImpl) classWriter,
classWriter.getTypeElement());
}

@Override
public MethodWriterImpl getMethodWriter(ClassWriter classWriter) {
return new MethodWriterImpl((SubWriterHolderWriter) classWriter, classWriter.getTypeElement());
return new MethodWriterImpl((ClassWriterImpl) classWriter, classWriter.getTypeElement());
}

@Override
public ConstructorWriterImpl getConstructorWriter(ClassWriter classWriter) {
return new ConstructorWriterImpl((SubWriterHolderWriter) classWriter,
return new ConstructorWriterImpl((ClassWriterImpl) classWriter,
classWriter.getTypeElement());
}

@@ -68,6 +68,7 @@
deprecationComment,
descfrmTypeLabel,
details,
detailsList,
detail,
externalLink,
fieldDetails,
@@ -171,6 +171,21 @@
*/
Content getMemberTreeHeader();

/**
* Returns a list to be used for the list of details for members of a given kind.
*
* @return a list to be used for the list of details for members of a given kind
*/
Content getDetailsList();

/**
* Returns an item for the list of details for members of a given kind.
*
* @param content content for the item
* @return an item for the list of details for members of a given kind
*/
Content getDetailsListItem(Content content);

/**
* Add the class content tree.
*
@@ -78,7 +78,7 @@ protected AnnotationTypeRequiredMemberBuilder(Context context,
AnnotationTypeRequiredMemberWriter writer,
VisibleMemberTable.Kind memberType) {
super(context, typeElement);
this.writer = writer;
this.writer = Objects.requireNonNull(writer);
this.members = getVisibleMembers(memberType);
}

@@ -126,16 +126,13 @@ protected void buildAnnotationTypeRequiredMember(Content memberDetailsTree)
/**
* Build the member documentation.
*
* @param memberDetailsTree the content tree to which the documentation will be added
* @param detailsList the content tree to which the documentation will be added
* @throws DocletException if an error occurs
*/
protected void buildAnnotationTypeMember(Content memberDetailsTree)
protected void buildAnnotationTypeMember(Content detailsList)
throws DocletException {
if (writer == null) {
return;
}
if (hasMembersToDocument()) {
writer.addAnnotationDetailsMarker(memberDetailsTree);
writer.addAnnotationDetailsMarker(detailsList);
Content annotationDetailsTreeHeader = writer.getAnnotationDetailsTreeHeader();
Content memberList = writer.getMemberList();

@@ -147,7 +144,8 @@ protected void buildAnnotationTypeMember(Content memberDetailsTree)

memberList.add(writer.getMemberListItem(annotationDocTree));
}
memberDetailsTree.add(writer.getAnnotationDetails(annotationDetailsTreeHeader, memberList));
Content annotationDetails = writer.getAnnotationDetails(annotationDetailsTreeHeader, memberList);
detailsList.add(annotationDetails);
}
}

@@ -335,67 +335,67 @@ protected void buildMemberSummary(Content classContentTree) throws DocletExcepti
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildMemberDetails(Content classContentTree) throws DocletException {
Content memberDetailsTree = writer.getMemberTreeHeader();
Content detailsList = writer.getDetailsList();

buildEnumConstantsDetails(memberDetailsTree);
buildPropertyDetails(memberDetailsTree);
buildFieldDetails(memberDetailsTree);
buildConstructorDetails(memberDetailsTree);
buildAnnotationTypeRequiredMemberDetails(memberDetailsTree);
buildAnnotationTypeOptionalMemberDetails(memberDetailsTree);
buildMethodDetails(memberDetailsTree);
buildEnumConstantsDetails(detailsList);
buildPropertyDetails(detailsList);
buildFieldDetails(detailsList);
buildConstructorDetails(detailsList);
buildAnnotationTypeRequiredMemberDetails(detailsList);
buildAnnotationTypeOptionalMemberDetails(detailsList);
buildMethodDetails(detailsList);

classContentTree.add(writer.getMemberDetailsTree(memberDetailsTree));
classContentTree.add(writer.getMemberDetailsTree(detailsList));
}

/**
* Build the enum constants documentation.
*
* @param memberDetailsTree the content tree to which the documentation will be added
* @param detailsList the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildEnumConstantsDetails(Content memberDetailsTree) throws DocletException {
builderFactory.getEnumConstantsBuilder(writer).build(memberDetailsTree);
protected void buildEnumConstantsDetails(Content detailsList) throws DocletException {
builderFactory.getEnumConstantsBuilder(writer).build(detailsList);
}

/**
* Build the field documentation.
*
* @param memberDetailsTree the content tree to which the documentation will be added
* @param detailsList the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildFieldDetails(Content memberDetailsTree) throws DocletException {
builderFactory.getFieldBuilder(writer).build(memberDetailsTree);
protected void buildFieldDetails(Content detailsList) throws DocletException {
builderFactory.getFieldBuilder(writer).build(detailsList);
}

/**
* Build the property documentation.
*
* @param memberDetailsTree the content tree to which the documentation will be added
* @param detailsList the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
public void buildPropertyDetails( Content memberDetailsTree) throws DocletException {
builderFactory.getPropertyBuilder(writer).build(memberDetailsTree);
public void buildPropertyDetails( Content detailsList) throws DocletException {
builderFactory.getPropertyBuilder(writer).build(detailsList);
}

/**
* Build the constructor documentation.
*
* @param memberDetailsTree the content tree to which the documentation will be added
* @param detailsList the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildConstructorDetails(Content memberDetailsTree) throws DocletException {
builderFactory.getConstructorBuilder(writer).build(memberDetailsTree);
protected void buildConstructorDetails(Content detailsList) throws DocletException {
builderFactory.getConstructorBuilder(writer).build(detailsList);
}

/**
* Build the method documentation.
*
* @param memberDetailsTree the content tree to which the documentation will be added
* @param detailsList the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildMethodDetails(Content memberDetailsTree) throws DocletException {
builderFactory.getMethodBuilder(writer).build(memberDetailsTree);
protected void buildMethodDetails(Content detailsList) throws DocletException {
builderFactory.getMethodBuilder(writer).build(detailsList);
}

/**
@@ -74,7 +74,7 @@ private ConstructorBuilder(Context context,
TypeElement typeElement,
ConstructorWriter writer) {
super(context, typeElement);
this.writer = writer;
this.writer = Objects.requireNonNull(writer);
constructors = getVisibleMembers(CONSTRUCTORS);
for (Element ctor : constructors) {
if (utils.isProtected(ctor) || utils.isPrivate(ctor)) {
@@ -118,15 +118,12 @@ public void build(Content contentTree) throws DocletException {
/**
* Build the constructor documentation.
*
* @param memberDetailsTree the content tree to which the documentation will be added
* @param detailsList the content tree to which the documentation will be added
* @throws DocletException if there is a problem while building the documentation
*/
protected void buildConstructorDoc(Content memberDetailsTree) throws DocletException {
if (writer == null) {
return;
}
protected void buildConstructorDoc(Content detailsList) throws DocletException {
if (hasMembersToDocument()) {
Content constructorDetailsTreeHeader = writer.getConstructorDetailsTreeHeader(memberDetailsTree);
Content constructorDetailsTreeHeader = writer.getConstructorDetailsTreeHeader(detailsList);
Content memberList = writer.getMemberList();

for (Element constructor : constructors) {
@@ -140,8 +137,8 @@ protected void buildConstructorDoc(Content memberDetailsTree) throws DocletExcep

memberList.add(writer.getMemberListItem(constructorDocTree));
}
memberDetailsTree.add(
writer.getConstructorDetails(constructorDetailsTreeHeader, memberList));
Content constructorDetails = writer.getConstructorDetails(constructorDetailsTreeHeader, memberList);
detailsList.add(constructorDetails);
}
}

@@ -74,7 +74,7 @@
private EnumConstantBuilder(Context context,
TypeElement typeElement, EnumConstantWriter writer) {
super(context, typeElement);
this.writer = writer;
this.writer = Objects.requireNonNull(writer);
enumConstants = getVisibleMembers(ENUM_CONSTANTS);
}

@@ -109,16 +109,13 @@ public void build(Content contentTree) throws DocletException {
/**
* Build the enum constant documentation.
*
* @param memberDetailsTree the content tree to which the documentation will be added
* @param detailsList the content tree to which the documentation will be added
* @throws DocletException is there is a problem while building the documentation
*/
protected void buildEnumConstant(Content memberDetailsTree) throws DocletException {
if (writer == null) {
return;
}
protected void buildEnumConstant(Content detailsList) throws DocletException {
if (hasMembersToDocument()) {
Content enumConstantsDetailsTreeHeader = writer.getEnumConstantsDetailsTreeHeader(typeElement,
memberDetailsTree);
detailsList);
Content memberList = writer.getMemberList();

for (Element enumConstant : enumConstants) {
@@ -133,8 +130,9 @@ protected void buildEnumConstant(Content memberDetailsTree) throws DocletExcepti

memberList.add(writer.getMemberListItem(enumConstantsTree));
}
memberDetailsTree.add(
writer.getEnumConstantsDetails(enumConstantsDetailsTreeHeader, memberList));
Content enumConstantDetails = writer.getEnumConstantsDetails(
enumConstantsDetailsTreeHeader, memberList);
detailsList.add(enumConstantDetails);
}
}

0 comments on commit 7ac64b8

Please sign in to comment.