mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8221991: Improve the HTML for the inheritance tree for a type
Reviewed-by: hannesw
This commit is contained in:
parent
61f35bf898
commit
a722889681
8 changed files with 39 additions and 74 deletions
|
@ -40,7 +40,9 @@ import javax.lang.model.type.TypeMirror;
|
|||
import javax.lang.model.util.SimpleElementVisitor8;
|
||||
|
||||
import com.sun.source.doctree.DocTree;
|
||||
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.HtmlAttr;
|
||||
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;
|
||||
|
@ -295,26 +297,17 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
*/
|
||||
private Content getClassInheritenceTree(TypeMirror type) {
|
||||
TypeMirror sup;
|
||||
HtmlTree classTreeUl = new HtmlTree(HtmlTag.UL);
|
||||
classTreeUl.setStyle(HtmlStyle.inheritance);
|
||||
Content liTree = null;
|
||||
HtmlTree classTree = null;
|
||||
do {
|
||||
sup = utils.getFirstVisibleSuperClass(type);
|
||||
if (sup != null) {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setStyle(HtmlStyle.inheritance);
|
||||
ul.add(getTreeForClassHelper(type));
|
||||
if (liTree != null)
|
||||
ul.add(liTree);
|
||||
Content li = HtmlTree.LI(ul);
|
||||
liTree = li;
|
||||
type = sup;
|
||||
} else
|
||||
classTreeUl.add(getTreeForClassHelper(type));
|
||||
HtmlTree htmlElement = HtmlTree.DIV(HtmlStyle.inheritance, getTreeForClassHelper(type));
|
||||
if (classTree != null)
|
||||
htmlElement.add(classTree);
|
||||
classTree = htmlElement;
|
||||
type = sup;
|
||||
} while (sup != null);
|
||||
if (liTree != null)
|
||||
classTreeUl.add(liTree);
|
||||
return classTreeUl;
|
||||
classTree.put(HtmlAttr.TITLE, contents.getContent("doclet.Inheritance_Tree").toString());
|
||||
return classTree;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -324,25 +317,25 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
|
|||
* @return a content tree for class helper
|
||||
*/
|
||||
private Content getTreeForClassHelper(TypeMirror type) {
|
||||
Content li = new HtmlTree(HtmlTag.LI);
|
||||
Content content = new ContentBuilder();
|
||||
if (type.equals(typeElement.asType())) {
|
||||
Content typeParameters = getTypeParameterLinks(
|
||||
new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
|
||||
typeElement));
|
||||
if (configuration.shouldExcludeQualifier(utils.containingPackage(typeElement).toString())) {
|
||||
li.add(utils.asTypeElement(type).getSimpleName());
|
||||
li.add(typeParameters);
|
||||
content.add(utils.asTypeElement(type).getSimpleName());
|
||||
content.add(typeParameters);
|
||||
} else {
|
||||
li.add(utils.asTypeElement(type).getQualifiedName());
|
||||
li.add(typeParameters);
|
||||
content.add(utils.asTypeElement(type).getQualifiedName());
|
||||
content.add(typeParameters);
|
||||
}
|
||||
} else {
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_TREE_PARENT, type)
|
||||
.label(configuration.getClassName(utils.asTypeElement(type))));
|
||||
li.add(link);
|
||||
content.add(link);
|
||||
}
|
||||
return li;
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -94,6 +94,7 @@ doclet.No_Non_Deprecated_Classes_To_Document=No non-deprecated classes found to
|
|||
doclet.Interfaces=Interfaces
|
||||
doclet.Enclosing_Class=Enclosing class:
|
||||
doclet.Enclosing_Interface=Enclosing interface:
|
||||
doclet.Inheritance_Tree=Inheritance Tree
|
||||
doclet.System_Property=System Property
|
||||
doclet.Window_Source_title=Source code
|
||||
doclet.Window_Help_title=API Help
|
||||
|
|
|
@ -364,18 +364,12 @@ ul.horizontal li {
|
|||
display:inline;
|
||||
font-size:0.9em;
|
||||
}
|
||||
ul.inheritance {
|
||||
div.inheritance {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
ul.inheritance li {
|
||||
display:inline;
|
||||
list-style:none;
|
||||
}
|
||||
ul.inheritance li ul.inheritance {
|
||||
margin-left:15px;
|
||||
padding-left:15px;
|
||||
padding-top:1px;
|
||||
div.inheritance div.inheritance {
|
||||
margin-left:2em;
|
||||
}
|
||||
ul.blockList, ul.blockListLast {
|
||||
margin:10px 0 10px 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue