mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8240136: Cleanup/simplify HTML/CSS for definition lists
Reviewed-by: prappo
This commit is contained in:
parent
b38f3cf3bd
commit
1be89d9640
22 changed files with 89 additions and 97 deletions
|
@ -111,7 +111,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
|||
addHeading(uc, contentTree);
|
||||
// Display the list only if there are elements to be displayed.
|
||||
if (!memberlist.isEmpty()) {
|
||||
Content dl = new HtmlTree(HtmlTag.DL);
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.index);
|
||||
for (Element element : memberlist) {
|
||||
addDescription(dl, element);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
|||
addHeading(uc, contentTree);
|
||||
// Display the list only if there are elements to be displayed.
|
||||
if (!searchList.isEmpty()) {
|
||||
Content dl = new HtmlTree(HtmlTag.DL);
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.index);
|
||||
for (SearchIndexItem sii : searchList) {
|
||||
addDescription(sii, dl);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
|||
int searchListSize = searchList.size();
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
Content dl = new HtmlTree(HtmlTag.DL);
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.index);
|
||||
while (i < memberListSize && j < searchListSize) {
|
||||
Element elem = memberlist.get(i);
|
||||
String name = (utils.isModule(elem))
|
||||
|
|
|
@ -82,13 +82,12 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
|
|||
@Override
|
||||
public void addDefaultValueInfo(Element member, Content annotationDocTree) {
|
||||
if (utils.isAnnotationType(member)) {
|
||||
ExecutableElement ee = (ExecutableElement)member;
|
||||
ExecutableElement ee = (ExecutableElement) member;
|
||||
AnnotationValue value = ee.getDefaultValue();
|
||||
if (value != null) {
|
||||
Content dt = HtmlTree.DT(contents.default_);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
Content dd = HtmlTree.DD(new StringContent(value.toString()));
|
||||
dl.add(dd);
|
||||
Content dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.default_));
|
||||
dl.add(HtmlTree.DD(new StringContent(value.toString())));
|
||||
annotationDocTree.add(dl);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -351,7 +351,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
Content paramInfo = (new ParamTaglet()).getTagletOutput(typeElement,
|
||||
getTagletWriterInstance(false));
|
||||
if (!paramInfo.isEmpty()) {
|
||||
classInfoTree.add(HtmlTree.DL(paramInfo).setStyle(HtmlStyle.notes));
|
||||
classInfoTree.add(HtmlTree.DL(HtmlStyle.notes, paramInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,11 +366,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
}
|
||||
Set<TypeElement> subclasses = classtree.directSubClasses(typeElement, false);
|
||||
if (!subclasses.isEmpty()) {
|
||||
Content label = contents.subclassesLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.add(getClassLinks(LinkInfoImpl.Kind.SUBCLASSES,
|
||||
subclasses));
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.subclassesLabel));
|
||||
dl.add(HtmlTree.DD(getClassLinks(LinkInfoImpl.Kind.SUBCLASSES, subclasses)));
|
||||
classInfoTree.add(dl);
|
||||
}
|
||||
}
|
||||
|
@ -381,11 +379,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
if (utils.isInterface(typeElement)) {
|
||||
Set<TypeElement> subInterfaces = classtree.allSubClasses(typeElement, false);
|
||||
if (!subInterfaces.isEmpty()) {
|
||||
Content label = contents.subinterfacesLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.add(getClassLinks(LinkInfoImpl.Kind.SUBINTERFACES,
|
||||
subInterfaces));
|
||||
Content dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.subinterfacesLabel));
|
||||
dl.add(HtmlTree.DD(getClassLinks(LinkInfoImpl.Kind.SUBINTERFACES, subInterfaces)));
|
||||
classInfoTree.add(dl);
|
||||
}
|
||||
}
|
||||
|
@ -403,11 +399,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
}
|
||||
Set<TypeElement> implcl = classtree.implementingClasses(typeElement);
|
||||
if (!implcl.isEmpty()) {
|
||||
Content label = contents.implementingClassesLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.add(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_CLASSES,
|
||||
implcl));
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.implementingClassesLabel));
|
||||
dl.add(HtmlTree.DD(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_CLASSES, implcl)));
|
||||
classInfoTree.add(dl);
|
||||
}
|
||||
}
|
||||
|
@ -417,10 +411,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
SortedSet<TypeMirror> interfaces = new TreeSet<>(utils.makeTypeMirrorClassUseComparator());
|
||||
interfaces.addAll(utils.getAllInterfaces(typeElement));
|
||||
if (utils.isClass(typeElement) && !interfaces.isEmpty()) {
|
||||
Content label = contents.allImplementedInterfacesLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.add(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_INTERFACES, interfaces));
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.allImplementedInterfacesLabel));
|
||||
dl.add(HtmlTree.DD(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_INTERFACES, interfaces)));
|
||||
classInfoTree.add(dl);
|
||||
}
|
||||
}
|
||||
|
@ -432,10 +425,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
interfaces.addAll(utils.getAllInterfaces(typeElement));
|
||||
|
||||
if (utils.isInterface(typeElement) && !interfaces.isEmpty()) {
|
||||
Content label = contents.allSuperinterfacesLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.add(getClassLinks(LinkInfoImpl.Kind.SUPER_INTERFACES, interfaces));
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.allSuperinterfacesLabel));
|
||||
dl.add(HtmlTree.DD(getClassLinks(LinkInfoImpl.Kind.SUPER_INTERFACES, interfaces)));
|
||||
classInfoTree.add(dl);
|
||||
}
|
||||
}
|
||||
|
@ -448,11 +440,10 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
new SimpleElementVisitor8<Void, Void>() {
|
||||
@Override
|
||||
public Void visitType(TypeElement e, Void p) {
|
||||
Content label = utils.isInterface(e)
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(utils.isInterface(e)
|
||||
? contents.enclosingInterfaceLabel
|
||||
: contents.enclosingClassLabel;
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
: contents.enclosingClassLabel));
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
dd.add(getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS, e)));
|
||||
|
@ -466,8 +457,8 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
@Override
|
||||
public void addFunctionalInterfaceInfo (Content classInfoTree) {
|
||||
if (isFunctionalInterface()) {
|
||||
Content dt = HtmlTree.DT(contents.functionalInterface);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(HtmlTree.DT(contents.functionalInterface));
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
dd.add(contents.functionalInterfaceMessage);
|
||||
dl.add(dd);
|
||||
|
@ -512,12 +503,12 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
* @return a content tree for the class list
|
||||
*/
|
||||
private Content getClassLinks(LinkInfoImpl.Kind context, Collection<?> list) {
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
Content content = new ContentBuilder();
|
||||
boolean isFirst = true;
|
||||
for (Object type : list) {
|
||||
if (!isFirst) {
|
||||
Content separator = new StringContent(", ");
|
||||
dd.add(separator);
|
||||
content.add(separator);
|
||||
} else {
|
||||
isFirst = false;
|
||||
}
|
||||
|
@ -525,14 +516,14 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
if (type instanceof TypeElement) {
|
||||
Content link = getLink(
|
||||
new LinkInfoImpl(configuration, context, (TypeElement)(type)));
|
||||
dd.add(HtmlTree.CODE(link));
|
||||
content.add(HtmlTree.CODE(link));
|
||||
} else {
|
||||
Content link = getLink(
|
||||
new LinkInfoImpl(configuration, context, ((TypeMirror)type)));
|
||||
dd.add(HtmlTree.CODE(link));
|
||||
content.add(HtmlTree.CODE(link));
|
||||
}
|
||||
}
|
||||
return dd;
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -348,7 +348,7 @@ public class HtmlDocletWriter {
|
|||
if (options.noComment()) {
|
||||
return;
|
||||
}
|
||||
Content dl = new HtmlTree(HtmlTag.DL).setStyle(HtmlStyle.notes);
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
if (utils.isExecutableElement(e) && !utils.isConstructor(e)) {
|
||||
addMethodInfo((ExecutableElement)e, dl);
|
||||
}
|
||||
|
|
|
@ -200,9 +200,9 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
|
|||
TagletWriter.genTagOutput(configuration.tagletManager, field,
|
||||
configuration.tagletManager.getBlockTaglets(field),
|
||||
writer.getTagletWriterInstance(false), tagContent);
|
||||
Content dlTags = new HtmlTree(HtmlTag.DL).setStyle(HtmlStyle.notes);
|
||||
dlTags.add(tagContent);
|
||||
contentTree.add(dlTags); // TODO: what if empty?
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(tagContent);
|
||||
contentTree.add(dl); // TODO: what if empty?
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -159,9 +159,9 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
|||
TagletWriter.genTagOutput(tagletManager, member,
|
||||
tagletManager.getSerializedFormTaglets(),
|
||||
writer.getTagletWriterInstance(false), tagContent);
|
||||
Content dlTags = new HtmlTree(HtmlTag.DL).setStyle(HtmlStyle.notes);
|
||||
dlTags.add(tagContent);
|
||||
methodsContentTree.add(dlTags);
|
||||
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
|
||||
dl.add(tagContent);
|
||||
methodsContentTree.add(dl);
|
||||
if (name(member).compareTo("writeExternal") == 0
|
||||
&& utils.getSerialDataTrees(member).isEmpty()) {
|
||||
serialWarning(member, "doclet.MissingSerialDataTag",
|
||||
|
|
|
@ -184,7 +184,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
|
|||
*/
|
||||
@Override
|
||||
public Content getSerialUIDInfoHeader() {
|
||||
return new HtmlTree(HtmlTag.DL).setStyle(HtmlStyle.nameValue);
|
||||
return HtmlTree.DL(HtmlStyle.nameValue);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -79,6 +79,7 @@ public enum HtmlStyle {
|
|||
hierarchy,
|
||||
horizontal,
|
||||
implementationLabel,
|
||||
index,
|
||||
inheritance,
|
||||
inheritedList,
|
||||
interfaceName,
|
||||
|
|
|
@ -309,14 +309,24 @@ public class HtmlTree extends Content {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generates a DL tag with some content.
|
||||
* Generates a DL tag with a given style.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @param style the style
|
||||
* @return an HtmlTree object for the DL tag
|
||||
*/
|
||||
public static HtmlTree DL(Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.DL, nullCheck(body));
|
||||
return htmltree;
|
||||
public static HtmlTree DL(HtmlStyle style) {
|
||||
return new HtmlTree(HtmlTag.DL).setStyle(style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a DL tag with some content.
|
||||
*
|
||||
* @param style the style for the tag
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the DL tag
|
||||
*/
|
||||
public static HtmlTree DL(HtmlStyle style, Content body) {
|
||||
return new HtmlTree(HtmlTag.DL, nullCheck(body)).setStyle(style);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue