8241030: rename HtmlTag to TagName

Reviewed-by: prappo
This commit is contained in:
Jonathan Gibbons 2020-03-18 13:20:13 -07:00
parent 34b9ac2287
commit ea367322f2
35 changed files with 278 additions and 271 deletions

@ -45,7 +45,7 @@ import com.sun.source.doctree.DocTree;
import jdk.javadoc.internal.doclets.formats.html.SearchIndexItem.Category;
import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
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.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.StringContent;
@ -238,7 +238,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
dt.add(contents.module_);
dt.add(" " + moduleName);
dlTree.add(dt);
Content dd = new HtmlTree(HtmlTag.DD);
Content dd = new HtmlTree(TagName.DD);
addSummaryComment(mdle, dd);
dlTree.add(dd);
}
@ -262,7 +262,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
dt.add(contents.package_);
dt.add(" " + utils.getPackageName(pkg));
dlTree.add(dt);
Content dd = new HtmlTree(HtmlTag.DD);
Content dd = new HtmlTree(TagName.DD);
addSummaryComment(pkg, dd);
dlTree.add(dd);
}
@ -284,7 +284,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
dt.add(" - ");
addClassInfo(typeElement, dt);
dlTree.add(dt);
Content dd = new HtmlTree(HtmlTag.DD);
Content dd = new HtmlTree(TagName.DD);
addComment(typeElement, dd);
dlTree.add(dd);
}
@ -334,7 +334,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
dt.add(" - ");
addMemberDesc(member, dt);
dlTree.add(dt);
Content dd = new HtmlTree(HtmlTag.DD);
Content dd = new HtmlTree(TagName.DD);
addComment(member, dd);
dlTree.add(dd);
}
@ -347,7 +347,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
dt.add(" - ");
dt.add(contents.getContent("doclet.Search_tag_in", sii.getHolder()));
dlTree.add(dt);
Content dd = new HtmlTree(HtmlTag.DD);
Content dd = new HtmlTree(TagName.DD);
if (sii.getDescription().isEmpty()) {
dd.add(Entity.NO_BREAK_SPACE);
} else {
@ -368,7 +368,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
protected void addComment(Element element, Content contentTree) {
List<? extends DocTree> tags;
Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(element));
HtmlTree div = new HtmlTree(HtmlTag.DIV);
HtmlTree div = new HtmlTree(TagName.DIV);
div.setStyle(HtmlStyle.deprecationBlock);
if (utils.isDeprecated(element)) {
div.add(span);

@ -43,7 +43,7 @@ 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.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
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.markup.Links;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
@ -205,7 +205,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
*/
protected void addModifierAndType(Element member, TypeMirror type,
Content tdSummaryType) {
HtmlTree code = new HtmlTree(HtmlTag.CODE);
HtmlTree code = new HtmlTree(TagName.CODE);
addModifier(member, code);
if (type == null) {
code.add(utils.isClass(member) ? "class" : "interface");
@ -220,7 +220,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
code.add(typeParameters);
//Code to avoid ugly wrapping in member summary table.
if (typeParameters.charCount() > 10) {
code.add(new HtmlTree(HtmlTag.BR));
code.add(new HtmlTree(TagName.BR));
} else {
code.add(Entity.NO_BREAK_SPACE);
}
@ -347,7 +347,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
&& !utils.isClass(element)
&& !utils.isInterface(element)
&& !utils.isAnnotationType(element)) {
HtmlTree name = new HtmlTree(HtmlTag.SPAN);
HtmlTree name = new HtmlTree(TagName.SPAN);
name.setStyle(HtmlStyle.typeNameLabel);
name.add(name(te) + ".");
typeContent.add(name);
@ -435,7 +435,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
*/
@Override
public Content getInheritedSummaryLinksTree() {
return new HtmlTree(HtmlTag.CODE);
return new HtmlTree(TagName.CODE);
}
/**
@ -581,7 +581,7 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
}
// Name
HtmlTree nameSpan = new HtmlTree(HtmlTag.SPAN);
HtmlTree nameSpan = new HtmlTree(TagName.SPAN);
nameSpan.setStyle(HtmlStyle.memberName);
if (options.linkSource()) {
Content name = new StringContent(name(element));

@ -30,7 +30,7 @@ import java.util.*;
import javax.lang.model.element.TypeElement;
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.TagName;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
@ -82,9 +82,9 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
protected void addLevelInfo(TypeElement parent, Collection<TypeElement> collection,
boolean isEnum, Content contentTree) {
if (!collection.isEmpty()) {
Content ul = new HtmlTree(HtmlTag.UL);
Content ul = new HtmlTree(TagName.UL);
for (TypeElement local : collection) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
HtmlTree li = new HtmlTree(TagName.LI);
li.setStyle(HtmlStyle.circle);
addPartialInfo(local, li);
addExtendsImplements(parent, local, li);

@ -35,7 +35,7 @@ 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.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
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.StringContent;
@ -88,7 +88,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
navBar.setUserHeader(getUserHeaderFooter(true));
headerContent.add(navBar.getContent(Navigation.Position.TOP));
HtmlTree div = new HtmlTree(HtmlTag.DIV);
HtmlTree div = new HtmlTree(TagName.DIV);
div.setStyle(HtmlStyle.header);
if (configuration.showModules) {
ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(annotationType);
@ -156,9 +156,9 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
@Override
public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) {
Content hr = new HtmlTree(HtmlTag.HR);
Content hr = new HtmlTree(TagName.HR);
annotationInfoTree.add(hr);
Content pre = new HtmlTree(HtmlTag.PRE);
Content pre = new HtmlTree(TagName.PRE);
addAnnotationInfo(annotationType, pre);
pre.add(modifiers);
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,

@ -43,7 +43,7 @@ import javax.tools.Diagnostic;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
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.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.StringContent;
@ -305,7 +305,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
* @param contentTree the content tree to which the class elements will be added
*/
protected void addClassList(Content contentTree) {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
for (PackageElement pkg : pkgSet) {
HtmlTree htmlTree = HtmlTree.SECTION(HtmlStyle.detail).setId(getPackageAnchorName(pkg));
@ -437,7 +437,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
headerContent.add(navBar.getContent(Navigation.Position.TOP));
ContentBuilder headingContent = new ContentBuilder();
headingContent.add(contents.getContent("doclet.ClassUse_Title", cltype));
headingContent.add(new HtmlTree(HtmlTag.BR));
headingContent.add(new HtmlTree(TagName.BR));
headingContent.add(clname);
Content heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, headingContent);

@ -45,7 +45,7 @@ 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.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.StringContent;
@ -115,7 +115,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
navBar.setMemberSummaryBuilder(configuration.getBuilderFactory().getMemberSummaryBuilder(this));
navBar.setUserHeader(getUserHeaderFooter(true));
headerContent.add(navBar.getContent(Navigation.Position.TOP));
HtmlTree div = new HtmlTree(HtmlTag.DIV);
HtmlTree div = new HtmlTree(TagName.DIV);
div.setStyle(HtmlStyle.header);
if (configuration.showModules) {
ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(typeElement);
@ -192,9 +192,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
@Override @SuppressWarnings("preview")
public void addClassSignature(String modifiers, Content classInfoTree) {
Content hr = new HtmlTree(HtmlTag.HR);
Content hr = new HtmlTree(TagName.HR);
classInfoTree.add(hr);
Content pre = new HtmlTree(HtmlTag.PRE);
Content pre = new HtmlTree(TagName.PRE);
addAnnotationInfo(typeElement, pre);
pre.add(modifiers);
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
@ -443,7 +443,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
dl.add(HtmlTree.DT(utils.isInterface(e)
? contents.enclosingInterfaceLabel
: contents.enclosingClassLabel));
Content dd = new HtmlTree(HtmlTag.DD);
Content dd = new HtmlTree(TagName.DD);
dd.add(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.CLASS, e)));
dl.add(dd);
@ -458,7 +458,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
if (isFunctionalInterface()) {
HtmlTree dl = HtmlTree.DL(HtmlStyle.notes);
dl.add(HtmlTree.DT(contents.functionalInterface));
Content dd = new HtmlTree(HtmlTag.DD);
Content dd = new HtmlTree(TagName.DD);
dd.add(contents.functionalInterfaceMessage);
dl.add(dd);
classInfoTree.add(dl);

@ -37,7 +37,7 @@ 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.Entity;
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.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.StringContent;
@ -108,7 +108,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
@Override
public Content getContentsHeader() {
return new HtmlTree(HtmlTag.UL);
return new HtmlTree(TagName.UL);
}
@Override
@ -176,7 +176,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
@Override
public Content getClassConstantHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
return ul;
}
@ -227,7 +227,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
private Content getTypeColumn(VariableElement member) {
Content typeContent = new ContentBuilder();
String id = currentTypeElement.getQualifiedName() + "." + member.getSimpleName();
Content code = new HtmlTree(HtmlTag.CODE).setId(id);
Content code = new HtmlTree(TagName.CODE).setId(id);
for (Modifier mod : member.getModifiers()) {
Content modifier = new StringContent(mod.toString());
code.add(modifier);

@ -35,7 +35,7 @@ import javax.lang.model.element.TypeElement;
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.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
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.markup.StringContent;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
@ -218,7 +218,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
@Override
protected void addSummaryType(Element member, Content tdSummaryType) {
if (foundNonPubConstructor) {
Content code = new HtmlTree(HtmlTag.CODE);
Content code = new HtmlTree(TagName.CODE);
if (utils.isProtected(member)) {
code.add("protected ");
} else if (utils.isPrivate(member)) {

@ -39,7 +39,7 @@ import javax.lang.model.element.PackageElement;
import com.sun.source.doctree.DocTree;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
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.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.StringContent;
@ -335,7 +335,7 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
Content headingContent = contents.contentsHeading;
div.add(HtmlTree.HEADING_TITLE(Headings.CONTENT_HEADING,
headingContent));
Content ul = new HtmlTree(HtmlTag.UL);
Content ul = new HtmlTree(TagName.UL);
for (DeprElementKind kind : DeprElementKind.values()) {
addIndexLink(deprapi, kind, ul);
}

@ -25,7 +25,7 @@
package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
/**
* Aliases for HTML heading tags (H1..H6) for different kinds of pages.
@ -39,19 +39,19 @@ class Headings {
/**
* Standard top-level heading for the page title for all pages.
*/
static final HtmlTag PAGE_TITLE_HEADING = HtmlTag.H1;
static final TagName PAGE_TITLE_HEADING = TagName.H1;
/**
* Standard second-level heading for sundry pages that do
* not have their own page group.
*/
static final HtmlTag CONTENT_HEADING = HtmlTag.H2;
static final TagName CONTENT_HEADING = TagName.H2;
/**
* Headings for the page for a module declaration.
*/
static class ModuleDeclaration {
static final HtmlTag SUMMARY_HEADING = HtmlTag.H2;
static final TagName SUMMARY_HEADING = TagName.H2;
}
/**
@ -63,31 +63,31 @@ class Headings {
* Heading for the different summary lists:
* Field Summary, Constructor Summary, Method Summary, etc.
*/
static final HtmlTag SUMMARY_HEADING = HtmlTag.H2;
static final TagName SUMMARY_HEADING = TagName.H2;
/**
* Subheading within a summary for the inherited elements:
* inherited methods, etc
*/
static final HtmlTag INHERITED_SUMMARY_HEADING = HtmlTag.H3;
static final TagName INHERITED_SUMMARY_HEADING = TagName.H3;
/**
* Heading for the different detail lists:
* Field Details, Constructor Details, Method Details, etc.
*/
static final HtmlTag DETAILS_HEADING = HtmlTag.H2;
static final TagName DETAILS_HEADING = TagName.H2;
/**
* Subheading with a Details list for an individual element.
*/
static final HtmlTag MEMBER_HEADING = HtmlTag.H3;
static final TagName MEMBER_HEADING = TagName.H3;
}
/**
* Headings for the Constants Summary page.
*/
static class ConstantsSummary {
static final HtmlTag PACKAGE_HEADING = HtmlTag.H2;
static final TagName PACKAGE_HEADING = TagName.H2;
}
/**
@ -97,29 +97,29 @@ class Headings {
/**
* Heading for the package name, preceding a list of types.
*/
static final HtmlTag PACKAGE_HEADING = HtmlTag.H2;
static final TagName PACKAGE_HEADING = TagName.H2;
/**
* Heading for a type name within a package.
*/
static final HtmlTag CLASS_HEADING = HtmlTag.H3;
static final TagName CLASS_HEADING = TagName.H3;
/**
* Subheading for info within a type.
*/
static final HtmlTag CLASS_SUBHEADING = HtmlTag.H4;
static final TagName CLASS_SUBHEADING = TagName.H4;
/**
* Heading for an individual member element within a type.
*/
static final HtmlTag MEMBER_HEADING = HtmlTag.H5;
static final TagName MEMBER_HEADING = TagName.H5;
}
/**
* Headings for a type Use page.
*/
static class TypeUse {
static final HtmlTag SUMMARY_HEADING = HtmlTag.H2;
static final TagName SUMMARY_HEADING = TagName.H2;
}
/**
@ -127,8 +127,8 @@ class Headings {
*/
static class IndexFrames {
/** Heading for a list of module names in an index frame. */
static final HtmlTag MODULE_HEADING = HtmlTag.H2;
static final TagName MODULE_HEADING = TagName.H2;
/** Heading for a list of package names in an index frame. */
static final HtmlTag PACKAGE_HEADING = HtmlTag.H2;
static final TagName PACKAGE_HEADING = TagName.H2;
}
}

@ -28,7 +28,7 @@ package jdk.javadoc.internal.doclets.formats.html;
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.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
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.StringContent;
@ -126,7 +126,7 @@ public class HelpWriter extends HtmlDocletWriter {
div.add(intro);
contentTree.add(div);
HtmlTree htmlTree;
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
// Overview
@ -153,7 +153,7 @@ public class HelpWriter extends HtmlDocletWriter {
Content moduleIntro = contents.getContent("doclet.help.module.intro");
Content modulePara = HtmlTree.P(moduleIntro);
htmlTree.add(modulePara);
HtmlTree ulModule = new HtmlTree(HtmlTag.UL);
HtmlTree ulModule = new HtmlTree(TagName.UL);
ulModule.add(HtmlTree.LI(contents.packagesLabel));
ulModule.add(HtmlTree.LI(contents.modulesLabel));
ulModule.add(HtmlTree.LI(contents.servicesLabel));
@ -168,7 +168,7 @@ public class HelpWriter extends HtmlDocletWriter {
Content packageIntro = contents.getContent("doclet.help.package.intro");
Content packagePara = HtmlTree.P(packageIntro);
htmlTree.add(packagePara);
HtmlTree ulPackage = new HtmlTree(HtmlTag.UL);
HtmlTree ulPackage = new HtmlTree(TagName.UL);
ulPackage.add(HtmlTree.LI(contents.interfaces));
ulPackage.add(HtmlTree.LI(contents.classes));
ulPackage.add(HtmlTree.LI(contents.enums));
@ -185,7 +185,7 @@ public class HelpWriter extends HtmlDocletWriter {
Content classIntro = contents.getContent("doclet.help.class_interface.intro");
Content classPara = HtmlTree.P(classIntro);
htmlTree.add(classPara);
HtmlTree ul1 = new HtmlTree(HtmlTag.UL);
HtmlTree ul1 = new HtmlTree(TagName.UL);
ul1.add(HtmlTree.LI(contents.getContent("doclet.help.class_interface.inheritance_diagram")));
ul1.add(HtmlTree.LI(contents.getContent("doclet.help.class_interface.subclasses")));
ul1.add(HtmlTree.LI(contents.getContent("doclet.help.class_interface.subinterfaces")));
@ -193,16 +193,16 @@ public class HelpWriter extends HtmlDocletWriter {
ul1.add(HtmlTree.LI(contents.getContent("doclet.help.class_interface.declaration")));
ul1.add(HtmlTree.LI(contents.getContent("doclet.help.class_interface.description")));
htmlTree.add(ul1);
htmlTree.add(new HtmlTree(HtmlTag.BR));
HtmlTree ul2 = new HtmlTree(HtmlTag.UL);
htmlTree.add(new HtmlTree(TagName.BR));
HtmlTree ul2 = new HtmlTree(TagName.UL);
ul2.add(HtmlTree.LI(contents.nestedClassSummary));
ul2.add(HtmlTree.LI(contents.fieldSummaryLabel));
ul2.add(HtmlTree.LI(contents.propertySummaryLabel));
ul2.add(HtmlTree.LI(contents.constructorSummaryLabel));
ul2.add(HtmlTree.LI(contents.methodSummary));
htmlTree.add(ul2);
htmlTree.add(new HtmlTree(HtmlTag.BR));
HtmlTree ul3 = new HtmlTree(HtmlTag.UL);
htmlTree.add(new HtmlTree(TagName.BR));
HtmlTree ul3 = new HtmlTree(TagName.UL);
ul3.add(HtmlTree.LI(contents.fieldDetailsLabel));
ul3.add(HtmlTree.LI(contents.propertyDetailsLabel));
ul3.add(HtmlTree.LI(contents.constructorDetailsLabel));
@ -220,7 +220,7 @@ public class HelpWriter extends HtmlDocletWriter {
Content aIntro = contents.getContent("doclet.help.annotation_type.intro");
Content aPara = HtmlTree.P(aIntro);
htmlTree.add(aPara);
HtmlTree aul = new HtmlTree(HtmlTag.UL);
HtmlTree aul = new HtmlTree(TagName.UL);
aul.add(HtmlTree.LI(contents.getContent("doclet.help.annotation_type.declaration")));
aul.add(HtmlTree.LI(contents.getContent("doclet.help.annotation_type.description")));
aul.add(HtmlTree.LI(contents.annotateTypeRequiredMemberSummaryLabel));
@ -235,7 +235,7 @@ public class HelpWriter extends HtmlDocletWriter {
Content eIntro = contents.getContent("doclet.help.enum.intro");
Content enumPara = HtmlTree.P(eIntro);
htmlTree.add(enumPara);
HtmlTree eul = new HtmlTree(HtmlTag.UL);
HtmlTree eul = new HtmlTree(TagName.UL);
eul.add(HtmlTree.LI(contents.getContent("doclet.help.enum.declaration")));
eul.add(HtmlTree.LI(contents.getContent("doclet.help.enum.definition")));
eul.add(HtmlTree.LI(contents.enumConstantSummary));
@ -265,7 +265,7 @@ public class HelpWriter extends HtmlDocletWriter {
HtmlTree.CODE(new StringContent("java.lang.Object")));
Content treePara = HtmlTree.P(treeIntro);
htmlTree.add(treePara);
HtmlTree tul = new HtmlTree(HtmlTag.UL);
HtmlTree tul = new HtmlTree(TagName.UL);
tul.add(HtmlTree.LI(contents.getContent("doclet.help.tree.overview")));
tul.add(HtmlTree.LI(contents.getContent("doclet.help.tree.package")));
htmlTree.add(tul);
@ -329,7 +329,7 @@ public class HelpWriter extends HtmlDocletWriter {
contents.getContent("doclet.help.search.head"));
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, searchHead);
Content searchIntro = HtmlTree.P(contents.getContent("doclet.help.search.intro"));
Content searchExamples = new HtmlTree(HtmlTag.UL);
Content searchExamples = new HtmlTree(TagName.UL);
for (String[] example : SEARCH_EXAMPLES) {
searchExamples.add(HtmlTree.LI(
contents.getContent("doclet.help.search.example",
@ -345,7 +345,7 @@ public class HelpWriter extends HtmlDocletWriter {
ul.add(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
contentTree.add(ul);
contentTree.add(new HtmlTree(HtmlTag.HR));
contentTree.add(new HtmlTree(TagName.HR));
contentTree.add(HtmlTree.SPAN(HtmlStyle.emphasizedPhrase,
contents.getContent("doclet.help.footnote")));
}

@ -80,7 +80,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.Head;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocument;
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.TagName;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Links;
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
@ -2095,7 +2095,7 @@ public class HtmlDocletWriter {
* @return an HtmlTree for the BODY tag
*/
public HtmlTree getBody(String title) {
HtmlTree body = new HtmlTree(HtmlTag.BODY);
HtmlTree body = new HtmlTree(TagName.BODY);
body.put(HtmlAttr.CLASS, getBodyClass());
this.winTitle = title;

@ -35,7 +35,7 @@ import com.sun.source.doctree.DocTree;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
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.TagName;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
@ -72,7 +72,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
*/
@Override
public Content getSerializableFieldsHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
return ul;
}
@ -85,7 +85,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
*/
@Override
public Content getFieldsContentHeader(boolean isLastContent) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
HtmlTree li = new HtmlTree(TagName.LI);
li.setStyle(HtmlStyle.blockList);
return li;
}
@ -116,7 +116,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
Content nameContent = new StringContent(fieldName);
Content heading = HtmlTree.HEADING(Headings.SerializedForm.MEMBER_HEADING, nameContent);
contentTree.add(heading);
Content pre = new HtmlTree(HtmlTag.PRE);
Content pre = new HtmlTree(TagName.PRE);
if (fieldType == null) {
pre.add(fieldTypeStr);
} else {
@ -132,9 +132,9 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
@Override
public void addMemberHeader(TypeMirror fieldType, String fieldName, Content contentTree) {
Content nameContent = new StringContent(fieldName);
Content heading = HtmlTree.HEADING(HtmlTag.H5, nameContent);
Content heading = HtmlTree.HEADING(TagName.H5, nameContent);
contentTree.add(heading);
Content pre = new HtmlTree(HtmlTag.PRE);
Content pre = new HtmlTree(TagName.PRE);
Content fieldContent = writer.getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.Kind.SERIAL_MEMBER, fieldType));
pre.add(fieldContent);

@ -30,7 +30,7 @@ import javax.lang.model.element.TypeElement;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
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.TagName;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
@ -62,7 +62,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
*/
@Override
public Content getSerializableMethodsHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
return ul;
}
@ -75,7 +75,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
*/
@Override
public Content getMethodsContentHeader(boolean isLastContent) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
HtmlTree li = new HtmlTree(TagName.LI);
li.setStyle(HtmlStyle.blockList);
return li;
}

@ -31,7 +31,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.Head;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocument;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
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.markup.Script;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
@ -93,7 +93,7 @@ public class IndexRedirectWriter extends HtmlDocletWriter {
Script script = new Script("window.location.replace(")
.appendStringLiteral(targetPath, '\'')
.append(")");
HtmlTree metaRefresh = new HtmlTree(HtmlTag.META)
HtmlTree metaRefresh = new HtmlTree(TagName.META)
.put(HtmlAttr.HTTP_EQUIV, "Refresh")
.put(HtmlAttr.CONTENT, "0;" + targetPath);
head.addContent(script.asContent(), HtmlTree.NOSCRIPT(metaRefresh));
@ -104,7 +104,7 @@ public class IndexRedirectWriter extends HtmlDocletWriter {
bodyContent.add(HtmlTree.P(HtmlTree.A(targetPath, new StringContent(targetPath))));
Content body = new HtmlTree(HtmlTag.BODY)
Content body = new HtmlTree(TagName.BODY)
.put(HtmlAttr.CLASS, "index-redirect");
HtmlTree main = HtmlTree.MAIN(bodyContent);
body.add(main);

@ -46,7 +46,7 @@ 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.Entity;
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.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.RawHtml;
@ -194,9 +194,9 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
navBar.setDisplaySummaryServicesLink(displayServices(uses, usesTrees) || displayServices(provides.keySet(), providesTrees));
navBar.setUserHeader(getUserHeaderFooter(true));
headerContent.add(navBar.getContent(Navigation.Position.TOP));
HtmlTree div = new HtmlTree(HtmlTag.DIV);
HtmlTree div = new HtmlTree(TagName.DIV);
div.setStyle(HtmlStyle.header);
Content annotationContent = new HtmlTree(HtmlTag.P);
Content annotationContent = new HtmlTree(TagName.P);
addAnnotationInfo(mdle, annotationContent);
div.add(annotationContent);
Content label = mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL)
@ -225,7 +225,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
*/
@Override
public Content getSummaryHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
return ul;
}
@ -793,7 +793,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
}
// Only display the implementation details in the "all" mode.
if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) {
desc.add(new HtmlTree(HtmlTag.BR));
desc.add(new HtmlTree(TagName.BR));
desc.add("(");
HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
desc.add(implSpan);
@ -819,7 +819,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
List<? extends DocTree> deprs = utils.getBlockTags(mdle, DocTree.Kind.DEPRECATED);
if (utils.isDeprecated(mdle)) {
CommentHelper ch = utils.getCommentHelper(mdle);
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
HtmlTree deprDiv = new HtmlTree(TagName.DIV);
deprDiv.setStyle(HtmlStyle.deprecationBlock);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle));
deprDiv.add(deprPhrase);
@ -883,7 +883,7 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
List<? extends DocTree> deprs;
if (utils.isDeprecated(pkg)) {
deprs = utils.getDeprecatedTrees(pkg);
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
HtmlTree deprDiv = new HtmlTree(TagName.DIV);
deprDiv.setStyle(HtmlStyle.deprecationBlock);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg));
deprDiv.add(deprPhrase);

@ -40,7 +40,7 @@ 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.TagName;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Links;
import jdk.javadoc.internal.doclets.toolkit.Content;
@ -917,7 +917,7 @@ public class Navigation {
}
Content tree = HtmlTree.NAV();
HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
HtmlTree navDiv = new HtmlTree(TagName.DIV);
Content skipNavLinks = contents.getContent("doclet.Skip_navigation_links");
SectionName navListSection;
Content aboutContent;
@ -951,7 +951,7 @@ public class Navigation {
throw new Error();
}
HtmlTree navList = new HtmlTree(HtmlTag.UL)
HtmlTree navList = new HtmlTree(TagName.UL)
.setId(navListSection.getName())
.setStyle(HtmlStyle.navList)
.put(HtmlAttr.TITLE, rowListTitle);
@ -961,15 +961,15 @@ public class Navigation {
navDiv.add(aboutDiv);
tree.add(navDiv);
HtmlTree subDiv = new HtmlTree(HtmlTag.DIV).setStyle(HtmlStyle.subNav);
HtmlTree subDiv = new HtmlTree(TagName.DIV).setStyle(HtmlStyle.subNav);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
HtmlTree div = new HtmlTree(TagName.DIV);
// Add the summary links if present.
HtmlTree ulNavSummary = new HtmlTree(HtmlTag.UL).setStyle(HtmlStyle.subNavList);
HtmlTree ulNavSummary = new HtmlTree(TagName.UL).setStyle(HtmlStyle.subNavList);
addSummaryLinks(ulNavSummary);
div.add(ulNavSummary);
// Add the detail links if present.
HtmlTree ulNavDetail = new HtmlTree(HtmlTag.UL).setStyle(HtmlStyle.subNavList);
HtmlTree ulNavDetail = new HtmlTree(TagName.UL).setStyle(HtmlStyle.subNavList);
addDetailLinks(ulNavDetail);
div.add(ulNavDetail);
subDiv.add(div);

@ -30,7 +30,7 @@ import javax.lang.model.element.PackageElement;
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.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
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.toolkit.Content;
@ -150,7 +150,7 @@ public class PackageTreeWriter extends AbstractTreeWriter {
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
contents.packageHierarchies);
div.add(span);
HtmlTree ul = new HtmlTree (HtmlTag.UL);
HtmlTree ul = new HtmlTree (TagName.UL);
ul.setStyle(HtmlStyle.horizontal);
ul.add(getNavLinkMainTree(resources.getText("doclet.All_Packages")));
div.add(ul);

@ -36,7 +36,7 @@ import javax.lang.model.element.TypeElement;
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.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
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.StringContent;
@ -192,7 +192,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
protected void addClassList(Content contentTree) {
TableHeader classTableHeader = new TableHeader(
contents.classLabel, contents.descriptionLabel);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
for (String packageName : usingPackageToUsedClasses.keySet()) {
PackageElement usingPackage = utils.elementUtils.getPackageElement(packageName);
@ -245,7 +245,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
headerContent.add(navBar.getContent(Navigation.Position.TOP));
ContentBuilder headingContent = new ContentBuilder();
headingContent.add(contents.getContent("doclet.ClassUse_Title", packageText));
headingContent.add(new HtmlTree(HtmlTag.BR));
headingContent.add(new HtmlTree(TagName.BR));
headingContent.add(name);
Content heading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
HtmlStyle.title, headingContent);

@ -37,7 +37,7 @@ 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.Entity;
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.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.StringContent;
@ -106,7 +106,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
navBar.setNavLinkModule(linkContent);
navBar.setUserHeader(getUserHeaderFooter(true));
headerContent.add(navBar.getContent(Navigation.Position.TOP));
HtmlTree div = new HtmlTree(HtmlTag.DIV);
HtmlTree div = new HtmlTree(TagName.DIV);
div.setStyle(HtmlStyle.header);
if (configuration.showModules) {
ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(packageElement);
@ -117,7 +117,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
new StringContent(mdle.getQualifiedName().toString())));
div.add(moduleNameDiv);
}
Content annotationContent = new HtmlTree(HtmlTag.P);
Content annotationContent = new HtmlTree(TagName.P);
addAnnotationInfo(packageElement, annotationContent);
div.add(annotationContent);
Content tHeading = HtmlTree.HEADING_TITLE(Headings.PAGE_TITLE_HEADING,
@ -145,7 +145,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
List<? extends DocTree> deprs = utils.getBlockTags(packageElement, DocTree.Kind.DEPRECATED);
if (utils.isDeprecated(packageElement)) {
CommentHelper ch = utils.getCommentHelper(packageElement);
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
HtmlTree deprDiv = new HtmlTree(TagName.DIV);
deprDiv.setStyle(HtmlStyle.deprecationBlock);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement));
deprDiv.add(deprPhrase);
@ -161,7 +161,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
@Override
public Content getSummaryHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
return ul;
}

@ -32,7 +32,7 @@ import javax.lang.model.element.TypeElement;
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.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
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.StringContent;
@ -94,7 +94,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
*/
@Override
public Content getSerializedSummariesHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
return ul;
}
@ -131,7 +131,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
*/
@Override
public Content getClassSerializedHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
return ul;
}
@ -212,7 +212,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
*/
@Override
public Content getClassContentHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
return ul;
}

@ -33,7 +33,7 @@ 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.Entity;
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.TagName;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
@ -143,7 +143,7 @@ public class SingleIndexWriter extends AbstractIndexWriter {
new StringContent(unicode)));
contentTree.add(Entity.NO_BREAK_SPACE);
}
contentTree.add(new HtmlTree(HtmlTag.BR));
contentTree.add(new HtmlTree(TagName.BR));
contentTree.add(links.createLink(DocPaths.ALLCLASSES_INDEX,
contents.allClassesLabel));
if (!configuration.packages.isEmpty()) {

@ -28,7 +28,6 @@ package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.Head;
import java.io.*;
import java.util.List;
import javax.lang.model.element.Element;
import javax.lang.model.element.ModuleElement;
@ -37,10 +36,9 @@ import javax.lang.model.element.TypeElement;
import javax.tools.FileObject;
import jdk.javadoc.doclet.DocletEnvironment;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlDocument;
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.TagName;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
@ -212,7 +210,7 @@ public class SourceToHTMLConverter {
.resolve(configuration.docPaths.forPackage(te))
.invert();
Content body = getHeader();
Content pre = new HtmlTree(HtmlTag.PRE);
Content pre = new HtmlTree(TagName.PRE);
try (LineNumberReader reader = new LineNumberReader(r)) {
while ((line = reader.readLine()) != null) {
addLineNo(pre, lineno);
@ -287,7 +285,7 @@ public class SourceToHTMLConverter {
* @return the header content for the HTML file
*/
private static Content getHeader() {
return new HtmlTree(HtmlTag.BODY).setStyle(HtmlStyle.source);
return new HtmlTree(TagName.BODY).setStyle(HtmlStyle.source);
}
/**
@ -297,7 +295,7 @@ public class SourceToHTMLConverter {
* @param lineno The line number
*/
private static void addLineNo(Content pre, int lineno) {
HtmlTree span = new HtmlTree(HtmlTag.SPAN);
HtmlTree span = new HtmlTree(TagName.SPAN);
span.setStyle(HtmlStyle.sourceLineNo);
if (lineno < 10) {
span.add("00" + Integer.toString(lineno));

@ -39,7 +39,7 @@ 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.Entity;
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.TagName;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
@ -169,7 +169,7 @@ public class SplitIndexWriter extends AbstractIndexWriter {
new StringContent(indexElements.get(i).toString())));
contentTree.add(Entity.NO_BREAK_SPACE);
}
contentTree.add(new HtmlTree(HtmlTag.BR));
contentTree.add(new HtmlTree(TagName.BR));
contentTree.add(links.createLink(pathToRoot.resolve(DocPaths.ALLCLASSES_INDEX),
contents.allClassesLabel));
if (!configuration.packages.isEmpty()) {

@ -34,7 +34,7 @@ import com.sun.source.doctree.DocTree;
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.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.TagName;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
@ -207,13 +207,13 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
* @return a content tree for the member header
*/
public Content getMemberTreeHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.blockList);
return ul;
}
public Content getMemberInheritedTree() {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
HtmlTree div = new HtmlTree(TagName.DIV);
div.setStyle(HtmlStyle.inheritedList);
return div;
}

@ -32,7 +32,7 @@ import javax.lang.model.element.PackageElement;
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.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
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.StringContent;
@ -142,7 +142,7 @@ public class TreeWriter extends AbstractTreeWriter {
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
contents.packageHierarchies);
contentTree.add(span);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
HtmlTree ul = new HtmlTree(TagName.UL);
ul.setStyle(HtmlStyle.horizontal);
int i = 0;
for (PackageElement pkg : packages) {

@ -253,7 +253,7 @@ public class Head extends Content {
* @return the HTML
*/
private Content toContent() {
HtmlTree tree = new HtmlTree(HtmlTag.HEAD);
HtmlTree tree = new HtmlTree(TagName.HEAD);
tree.add(getGeneratedBy(showTimestamp, generatedDate));
tree.add(HtmlTree.TITLE(title));
@ -279,7 +279,7 @@ public class Head extends Content {
}
if (canonicalLink != null) {
HtmlTree link = new HtmlTree(HtmlTag.LINK);
HtmlTree link = new HtmlTree(TagName.LINK);
link.put(HtmlAttr.REL, "canonical");
link.put(HtmlAttr.HREF, canonicalLink.getPath());
tree.add(link);

@ -35,6 +35,14 @@ import java.util.regex.Pattern;
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @apiNote
* Despite the name, the members of this enum provide values for the HTML {@code class} attribute,
* and <strong>not</strong> the HTML {@code style} attribute.
* This is to avoid confusion with the widespread use of the word "class" in the Java ecosystem,
* and the potential for clashes with methods called {@code setClass} instead of {@code setStyle}.
*
* @see <a href="https://html.spec.whatwg.org/#classes>WhatWG: {@code class} attribute</a>
*/
public enum HtmlStyle {
aboutLanguage,

@ -60,14 +60,17 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @see <a href="https://html.spec.whatwg.org/multipage/syntax.html#normal-elements">WhatWG: Normal Elements</a>
* @see <a href="https://www.w3.org/TR/html51/syntax.html#writing-html-documents-elements">HTML 5.1: Elements</a>
*/
public class HtmlTree extends Content {
/**
* The kind of tag for the HTML element.
* The name of the HTML element.
* This value is never {@code null}.
*/
public final HtmlTag htmlTag;
public final TagName tagName;
/**
* The attributes for the HTML element.
@ -87,12 +90,13 @@ public class HtmlTree extends Content {
public static final Content EMPTY = new StringContent("");
/**
* Creates an {@code HTMLTree} object with a given kind of tag.
* Creates an {@code HTMLTree} object representing an HTML element
* with the given name.
*
* @param tag the kind of tag
* @param tagName the name
*/
public HtmlTree(HtmlTag tag) {
htmlTag = Objects.requireNonNull(tag);
public HtmlTree(TagName tagName) {
this.tagName = Objects.requireNonNull(tagName);
}
/**
@ -290,7 +294,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree A(String ref, Content body) {
return new HtmlTree(HtmlTag.A)
return new HtmlTree(TagName.A)
.put(HtmlAttr.HREF, encodeURL(ref))
.add(body);
}
@ -302,7 +306,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree CAPTION(Content body) {
return new HtmlTree(HtmlTag.CAPTION)
return new HtmlTree(TagName.CAPTION)
.add(body);
}
@ -313,7 +317,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree CODE(Content body) {
return new HtmlTree(HtmlTag.CODE)
return new HtmlTree(TagName.CODE)
.add(body);
}
@ -324,7 +328,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree DD(Content body) {
return new HtmlTree(HtmlTag.DD)
return new HtmlTree(TagName.DD)
.add(body);
}
@ -335,7 +339,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree DL(HtmlStyle style) {
return new HtmlTree(HtmlTag.DL)
return new HtmlTree(TagName.DL)
.setStyle(style);
}
@ -347,7 +351,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree DL(HtmlStyle style, Content body) {
return new HtmlTree(HtmlTag.DL)
return new HtmlTree(TagName.DL)
.setStyle(style)
.add(body);
}
@ -359,7 +363,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree DIV(HtmlStyle style) {
return new HtmlTree(HtmlTag.DIV)
return new HtmlTree(TagName.DIV)
.setStyle(style);
}
@ -371,7 +375,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree DIV(HtmlStyle style, Content body) {
return new HtmlTree(HtmlTag.DIV)
return new HtmlTree(TagName.DIV)
.setStyle(style)
.add(body);
}
@ -383,7 +387,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree DIV(Content body) {
return new HtmlTree(HtmlTag.DIV)
return new HtmlTree(TagName.DIV)
.add(body);
}
@ -394,7 +398,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree DT(Content body) {
return new HtmlTree(HtmlTag.DT)
return new HtmlTree(TagName.DT)
.add(body);
}
@ -405,7 +409,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree FOOTER() {
return new HtmlTree(HtmlTag.FOOTER)
return new HtmlTree(TagName.FOOTER)
.setRole(Role.CONTENTINFO);
}
@ -416,7 +420,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree HEADER() {
return new HtmlTree(HtmlTag.HEADER)
return new HtmlTree(TagName.HEADER)
.setRole(Role.BANNER);
}
@ -427,7 +431,7 @@ public class HtmlTree extends Content {
* @param body the content
* @return the element
*/
public static HtmlTree HEADING(HtmlTag headingTag, Content body) {
public static HtmlTree HEADING(TagName headingTag, Content body) {
return new HtmlTree(checkHeading(headingTag))
.add(body);
}
@ -440,7 +444,7 @@ public class HtmlTree extends Content {
* @param body the content
* @return the element
*/
public static HtmlTree HEADING(HtmlTag headingTag, HtmlStyle style, Content body) {
public static HtmlTree HEADING(TagName headingTag, HtmlStyle style, Content body) {
return new HtmlTree(checkHeading(headingTag))
.setStyle(style)
.add(body);
@ -455,7 +459,7 @@ public class HtmlTree extends Content {
* @param body the content
* @return the element
*/
public static HtmlTree HEADING_TITLE(HtmlTag headingTag,
public static HtmlTree HEADING_TITLE(TagName headingTag,
HtmlStyle style, Content body) {
return new HtmlTree(checkHeading(headingTag))
.setTitle(body)
@ -471,13 +475,13 @@ public class HtmlTree extends Content {
* @param body the content
* @return the element
*/
public static HtmlTree HEADING_TITLE(HtmlTag headingTag, Content body) {
public static HtmlTree HEADING_TITLE(TagName headingTag, Content body) {
return new HtmlTree(checkHeading(headingTag))
.setTitle(body)
.add(body);
}
private static HtmlTag checkHeading(HtmlTag headingTag) {
private static TagName checkHeading(TagName headingTag) {
switch (headingTag) {
case H1: case H2: case H3: case H4: case H5: case H6:
return headingTag;
@ -496,7 +500,7 @@ public class HtmlTree extends Content {
* @return the {@code HTML} element
*/
public static HtmlTree HTML(String lang, Content head, Content body) {
return new HtmlTree(HtmlTag.HTML)
return new HtmlTree(TagName.HTML)
.put(HtmlAttr.LANG, lang)
.add(head)
.add(body);
@ -512,7 +516,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree INPUT(String type, String id, String value) {
return new HtmlTree(HtmlTag.INPUT)
return new HtmlTree(TagName.INPUT)
.put(HtmlAttr.TYPE, type)
.put(HtmlAttr.ID, id)
.put(HtmlAttr.VALUE, value)
@ -527,7 +531,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree LABEL(String forLabel, Content body) {
return new HtmlTree(HtmlTag.LABEL)
return new HtmlTree(TagName.LABEL)
.put(HtmlAttr.FOR, forLabel)
.add(body);
}
@ -539,7 +543,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree LI(Content body) {
return new HtmlTree(HtmlTag.LI)
return new HtmlTree(TagName.LI)
.add(body);
}
@ -565,7 +569,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree LINK(String rel, String type, String href, String title) {
return new HtmlTree(HtmlTag.LINK)
return new HtmlTree(TagName.LINK)
.put(HtmlAttr.REL, rel)
.put(HtmlAttr.TYPE, type)
.put(HtmlAttr.HREF, href)
@ -579,7 +583,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree MAIN() {
return new HtmlTree(HtmlTag.MAIN)
return new HtmlTree(TagName.MAIN)
.setRole(Role.MAIN);
}
@ -590,7 +594,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree MAIN(Content body) {
return new HtmlTree(HtmlTag.MAIN)
return new HtmlTree(TagName.MAIN)
.setRole(Role.MAIN)
.add(body);
}
@ -604,7 +608,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree META(String httpEquiv, String content, String charset) {
return new HtmlTree(HtmlTag.META)
return new HtmlTree(TagName.META)
.put(HtmlAttr.HTTP_EQUIV, httpEquiv)
.put(HtmlAttr.CONTENT, content + "; charset=" + charset);
}
@ -617,7 +621,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree META(String name, String content) {
return new HtmlTree(HtmlTag.META)
return new HtmlTree(TagName.META)
.put(HtmlAttr.NAME, name)
.put(HtmlAttr.CONTENT, content);
}
@ -629,7 +633,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree NAV() {
return new HtmlTree(HtmlTag.NAV)
return new HtmlTree(TagName.NAV)
.setRole(Role.NAVIGATION);
}
@ -640,7 +644,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree NOSCRIPT(Content body) {
return new HtmlTree(HtmlTag.NOSCRIPT)
return new HtmlTree(TagName.NOSCRIPT)
.add(body);
}
@ -651,7 +655,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree P(Content body) {
return new HtmlTree(HtmlTag.P)
return new HtmlTree(TagName.P)
.add(body);
}
@ -675,7 +679,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree SCRIPT(String src) {
return new HtmlTree(HtmlTag.SCRIPT)
return new HtmlTree(TagName.SCRIPT)
.put(HtmlAttr.TYPE, "text/javascript")
.put(HtmlAttr.SRC, src);
@ -688,7 +692,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree SECTION(HtmlStyle style) {
return new HtmlTree(HtmlTag.SECTION)
return new HtmlTree(TagName.SECTION)
.setStyle(style);
}
@ -700,7 +704,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree SECTION(HtmlStyle style, Content body) {
return new HtmlTree(HtmlTag.SECTION)
return new HtmlTree(TagName.SECTION)
.setStyle(style)
.add(body);
}
@ -712,7 +716,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree SMALL(Content body) {
return new HtmlTree(HtmlTag.SMALL)
return new HtmlTree(TagName.SMALL)
.add(body);
}
@ -723,7 +727,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree SPAN(Content body) {
return new HtmlTree(HtmlTag.SPAN)
return new HtmlTree(TagName.SPAN)
.add(body);
}
@ -747,7 +751,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree SPAN_ID(String id, Content body) {
return new HtmlTree(HtmlTag.SPAN)
return new HtmlTree(TagName.SPAN)
.setId(id)
.add(body);
}
@ -761,7 +765,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree SPAN(String id, HtmlStyle style, Content body) {
return new HtmlTree(HtmlTag.SPAN)
return new HtmlTree(TagName.SPAN)
.setId(id)
.setStyle(style)
.add(body);
@ -775,7 +779,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree TD(HtmlStyle style, Content body) {
return new HtmlTree(HtmlTag.TD)
return new HtmlTree(TagName.TD)
.setStyle(style)
.add(body);
}
@ -789,7 +793,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree TH(HtmlStyle style, String scope, Content body) {
return new HtmlTree(HtmlTag.TH)
return new HtmlTree(TagName.TH)
.setStyle(style)
.put(HtmlAttr.SCOPE, scope)
.add(body);
@ -803,7 +807,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree TH(String scope, Content body) {
return new HtmlTree(HtmlTag.TH)
return new HtmlTree(TagName.TH)
.put(HtmlAttr.SCOPE, scope)
.add(body);
}
@ -815,7 +819,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree TITLE(String body) {
return new HtmlTree(HtmlTag.TITLE)
return new HtmlTree(TagName.TITLE)
.add(body);
}
@ -828,7 +832,7 @@ public class HtmlTree extends Content {
* @return the element
*/
public static HtmlTree UL(HtmlStyle style, Content first, Content... more) {
HtmlTree htmlTree = new HtmlTree(HtmlTag.UL)
HtmlTree htmlTree = new HtmlTree(TagName.UL)
.setStyle(style);
htmlTree.add(first);
for (Content c : more) {
@ -879,7 +883,7 @@ public class HtmlTree extends Content {
*/
@Override
public boolean isValid() {
switch (htmlTag) {
switch (tagName) {
case A:
return (hasAttr(HtmlAttr.ID) || (hasAttr(HtmlAttr.HREF) && hasContent()));
case BR:
@ -904,19 +908,44 @@ public class HtmlTree extends Content {
}
/**
* Returns true if the element is an inline element.
* Returns true if the element is a normal element that is <em>phrasing content</em>.
*
* @return true if the HTML tag is an inline element
*
* @see <a href="https://www.w3.org/TR/html51/dom.html#kinds-of-content-phrasing-content">Phrasing Content</a>
*/
public boolean isInline() {
return (htmlTag.blockType == HtmlTag.BlockType.INLINE);
switch (tagName) {
case A: case BUTTON: case BR: case CODE: case EM: case I: case IMG:
case LABEL: case SMALL: case SPAN: case STRONG: case SUB:
return true;
default:
return false;
}
}
/**
* Returns whether or not this is a <em>void</em> element.
*
* @return whether or not this is a void element
*
* @see <a href="https://www.w3.org/TR/html51/syntax.html#void-elements">Void Elements</a>
*/
public boolean isVoid() {
switch (tagName) {
case BR: case HR: case IMG: case INPUT: case LINK: case META:
return true;
default:
return false;
}
}
@Override
public boolean write(Writer out, boolean atNewline) throws IOException {
if (!isInline() && !atNewline)
boolean isInline = isInline();
if (!isInline && !atNewline)
out.write(DocletConstants.NL);
String tagString = htmlTag.toString();
String tagString = tagName.toString();
out.write("<");
out.write(tagString);
Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
@ -937,12 +966,12 @@ public class HtmlTree extends Content {
boolean nl = false;
for (Content c : content)
nl = c.write(out, nl);
if (htmlTag.endTagRequired()) {
if (!isVoid()) {
out.write("</");
out.write(tagString);
out.write(">");
}
if (!isInline()) {
if (!isInline) {
out.write(DocletConstants.NL);
return true;
} else {

@ -106,7 +106,7 @@ public class Script {
*/
public Content asContent() {
ScriptContent scriptContent = new ScriptContent(sb);
HtmlTree tree = new HtmlTree(HtmlTag.SCRIPT) {
HtmlTree tree = new HtmlTree(TagName.SCRIPT) {
@Override
public HtmlTree add(Content c) {
if (c != scriptContent) {

@ -106,7 +106,7 @@ public class Table extends Content {
*/
public Table setCaption(Content captionContent) {
if (captionContent instanceof HtmlTree
&& ((HtmlTree) captionContent).htmlTag == HtmlTag.CAPTION) {
&& ((HtmlTree) captionContent).tagName == TagName.CAPTION) {
caption = captionContent;
} else {
caption = getCaption(captionContent);
@ -353,7 +353,7 @@ public class Table extends Content {
throw new NullPointerException();
}
HtmlTree row = new HtmlTree(HtmlTag.TR);
HtmlTree row = new HtmlTree(TagName.TR);
if (stripedStyles != null) {
int rowIndex = bodyRows.size();
@ -411,12 +411,12 @@ public class Table extends Content {
* @return the HTML
*/
private Content toContent() {
HtmlTree mainDiv = new HtmlTree(HtmlTag.DIV);
HtmlTree mainDiv = new HtmlTree(TagName.DIV);
mainDiv.setStyle(tableStyle);
if (id != null) {
mainDiv.setId(id);
}
HtmlTree table = new HtmlTree(HtmlTag.TABLE);
HtmlTree table = new HtmlTree(TagName.TABLE);
if (tabMap == null || tabs.size() == 1) {
if (tabMap == null) {
table.add(caption);
@ -427,7 +427,7 @@ public class Table extends Content {
table.add(getTableBody());
mainDiv.add(table);
} else {
HtmlTree tablist = new HtmlTree(HtmlTag.DIV)
HtmlTree tablist = new HtmlTree(TagName.DIV)
.put(HtmlAttr.ROLE, "tablist")
.put(HtmlAttr.ARIA_ORIENTATION, "horizontal");
@ -443,7 +443,7 @@ public class Table extends Content {
tablist.add(tab);
}
}
HtmlTree tabpanel = new HtmlTree(HtmlTag.DIV)
HtmlTree tabpanel = new HtmlTree(TagName.DIV)
.put(HtmlAttr.ID, tableStyle.cssName() + "_tabpanel")
.put(HtmlAttr.ROLE, "tabpanel");
table.add(getTableBody());
@ -455,7 +455,7 @@ public class Table extends Content {
}
private HtmlTree createTab(String tabId, HtmlStyle style, boolean defaultTab, String tabName) {
HtmlTree tab = new HtmlTree(HtmlTag.BUTTON)
HtmlTree tab = new HtmlTree(TagName.BUTTON)
.put(HtmlAttr.ROLE, "tab")
.put(HtmlAttr.ARIA_SELECTED, defaultTab ? "true" : "false")
.put(HtmlAttr.ARIA_CONTROLS, tableStyle.cssName() + "_tabpanel")
@ -469,10 +469,10 @@ public class Table extends Content {
private Content getTableBody() {
ContentBuilder tableContent = new ContentBuilder();
Content thead = new HtmlTree(HtmlTag.THEAD);
Content thead = new HtmlTree(TagName.THEAD);
thead.add(header);
tableContent.add(thead);
Content tbody = new HtmlTree(HtmlTag.TBODY);
Content tbody = new HtmlTree(TagName.TBODY);
bodyRows.forEach(tbody::add);
tableContent.add(tbody);
return tableContent;
@ -549,7 +549,7 @@ public class Table extends Content {
}
private HtmlTree getCaption(Content title) {
return new HtmlTree(HtmlTag.CAPTION)
return new HtmlTree(TagName.CAPTION)
.add(HtmlTree.SPAN(title))
.add(HtmlTree.SPAN(tabEnd, Entity.NO_BREAK_SPACE));
}

@ -137,7 +137,7 @@ public class TableHeader extends Content {
*/
private Content toContent() {
String scope = "col";
Content tr = new HtmlTree(HtmlTag.TR);
Content tr = new HtmlTree(TagName.TR);
int i = 0;
for (Content cellContent : cellContents) {
HtmlStyle style = (styles != null) ? styles.get(i)

@ -28,26 +28,29 @@ package jdk.javadoc.internal.doclets.formats.html.markup;
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
/**
* Enum representing HTML tags.
* Enum representing the names for HTML elements.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @see <a href=""https://html.spec.whatwg.org/multipage/syntax.html#syntax-tag-name>WhatWG: Tag Name</a>
* @see <a href="https://www.w3.org/TR/html51/syntax.html#tag-name">HTML 5.1: Tag Name</a>
*/
public enum HtmlTag {
A(BlockType.INLINE, EndTag.END),
BUTTON(BlockType.INLINE, EndTag.END),
public enum TagName {
A,
BUTTON,
BLOCKQUOTE,
BODY(BlockType.OTHER, EndTag.END),
BR(BlockType.INLINE, EndTag.NOEND),
BODY,
BR,
CAPTION,
CODE(BlockType.INLINE, EndTag.END),
CODE,
DD,
DIV,
DL,
DT,
EM(BlockType.INLINE, EndTag.END),
EM,
FOOTER,
H1,
H2,
@ -55,81 +58,46 @@ public enum HtmlTag {
H4,
H5,
H6,
HEAD(BlockType.OTHER, EndTag.END),
HEAD,
HEADER,
HR(BlockType.BLOCK, EndTag.NOEND),
HTML(BlockType.OTHER, EndTag.END),
I(BlockType.INLINE, EndTag.END),
IMG(BlockType.INLINE, EndTag.NOEND),
INPUT(BlockType.BLOCK, EndTag.NOEND),
LABEL(BlockType.INLINE, EndTag.END),
HR,
HTML,
I,
IMG,
INPUT,
LABEL,
LI,
LISTING,
LINK(BlockType.OTHER, EndTag.NOEND),
LINK,
MAIN,
MENU,
META(BlockType.OTHER, EndTag.NOEND),
META,
NAV,
NOSCRIPT(BlockType.OTHER, EndTag.END),
NOSCRIPT,
OL,
P,
PRE,
SCRIPT(BlockType.OTHER, EndTag.END),
SCRIPT,
SECTION,
SMALL(BlockType.INLINE, EndTag.END),
SPAN(BlockType.INLINE, EndTag.END),
STRONG(BlockType.INLINE, EndTag.END),
SUB(BlockType.INLINE, EndTag.END),
SMALL,
SPAN,
STRONG,
SUB,
TABLE,
TBODY,
THEAD,
TD,
TH,
TITLE(BlockType.OTHER, EndTag.END),
TITLE,
TR,
UL;
public final BlockType blockType;
public final EndTag endTag;
public final String value;
/**
* Enum representing the type of HTML element.
*/
public enum BlockType {
BLOCK,
INLINE,
OTHER
}
/**
* Enum representing HTML end tag requirement.
*/
public enum EndTag {
END,
NOEND
}
HtmlTag() {
this(BlockType.BLOCK, EndTag.END);
}
HtmlTag(BlockType blockType, EndTag endTag) {
this.blockType = blockType;
this.endTag = endTag;
TagName() {
this.value = Utils.toLowerCase(name());
}
/**
* Returns true if the end tag is required. This is specific to the standard
* doclet and does not exactly resemble the W3C specifications.
*
* @return true if end tag needs to be displayed else return false
*/
public boolean endTagRequired() {
return (endTag == EndTag.END);
}
public String toString() {
return value;
}

@ -37,5 +37,9 @@
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*
* @see <a href="https://html.spec.whatwg.org/multipage/">HTML: Living Standard</a>
* @see <a href="https://html.spec.whatwg.org/multipage/syntax,html">HTML: Living Standard: The HTML Syntax</a>
* @see <a href="https://www.w3.org/TR/html51/">HTML 5.1</a>
*/
package jdk.javadoc.internal.doclets.formats.html.markup;

@ -70,37 +70,37 @@ public class TestHtmlDocument extends JavadocTester {
// Generate the HTML output using the HTML document generation within doclet.
public static String generateHtmlTree() {
// Document type for the HTML document
HtmlTree html = new HtmlTree(HtmlTag.HTML);
HtmlTree head = new HtmlTree(HtmlTag.HEAD);
HtmlTree title = new HtmlTree(HtmlTag.TITLE);
HtmlTree html = new HtmlTree(TagName.HTML);
HtmlTree head = new HtmlTree(TagName.HEAD);
HtmlTree title = new HtmlTree(TagName.TITLE);
// String content within the document
StringContent titleContent = new StringContent("Markup test");
title.add(titleContent);
head.add(title);
// Test META tag
HtmlTree meta = new HtmlTree(HtmlTag.META);
HtmlTree meta = new HtmlTree(TagName.META);
meta.put(HtmlAttr.NAME, "keywords");
meta.put(HtmlAttr.CONTENT, "testContent");
head.add(meta);
// Test invalid META tag
HtmlTree invmeta = new HtmlTree(HtmlTag.META);
HtmlTree invmeta = new HtmlTree(TagName.META);
head.add(invmeta);
// Test LINK tag
HtmlTree link = new HtmlTree(HtmlTag.LINK);
HtmlTree link = new HtmlTree(TagName.LINK);
link.put(HtmlAttr.REL, "testRel");
link.put(HtmlAttr.HREF, "testLink.html");
head.add(link);
// Test invalid LINK tag
HtmlTree invlink = new HtmlTree(HtmlTag.LINK);
HtmlTree invlink = new HtmlTree(TagName.LINK);
head.add(invlink);
html.add(head);
// Comment within the document
Comment bodyMarker = new Comment("======== START OF BODY ========");
html.add(bodyMarker);
HtmlTree body = new HtmlTree(HtmlTag.BODY);
HtmlTree body = new HtmlTree(TagName.BODY);
Comment pMarker = new Comment("======== START OF PARAGRAPH ========");
body.add(pMarker);
HtmlTree p = new HtmlTree(HtmlTag.P);
HtmlTree p = new HtmlTree(TagName.P);
StringContent bodyContent = new StringContent(
"This document is generated from sample source code and HTML " +
"files with examples of a wide variety of Java language constructs: packages, " +
@ -113,24 +113,24 @@ public class TestHtmlDocument extends JavadocTester {
StringContent pContent = new StringContent(" to <test> out a link.");
p.add(pContent);
body.add(p);
HtmlTree p1 = new HtmlTree(HtmlTag.P);
HtmlTree p1 = new HtmlTree(TagName.P);
// Test another version of A tag.
HtmlTree anchor = new HtmlTree(HtmlTag.A);
HtmlTree anchor = new HtmlTree(TagName.A);
anchor.put(HtmlAttr.HREF, "testLink.html");
anchor.put(HtmlAttr.ID, "Another version of a tag");
p1.add(anchor);
body.add(p1);
// Test for empty tags.
HtmlTree dl = new HtmlTree(HtmlTag.DL);
HtmlTree dl = new HtmlTree(TagName.DL);
html.add(dl);
// Test for empty nested tags.
HtmlTree dlTree = new HtmlTree(HtmlTag.DL);
dlTree.add(new HtmlTree(HtmlTag.DT));
dlTree.add(new HtmlTree (HtmlTag.DD));
HtmlTree dlTree = new HtmlTree(TagName.DL);
dlTree.add(new HtmlTree(TagName.DT));
dlTree.add(new HtmlTree (TagName.DD));
html.add(dlTree);
HtmlTree dlDisplay = new HtmlTree(HtmlTag.DL);
dlDisplay.add(new HtmlTree(HtmlTag.DT));
HtmlTree dd = new HtmlTree (HtmlTag.DD);
HtmlTree dlDisplay = new HtmlTree(TagName.DL);
dlDisplay.add(new HtmlTree(TagName.DT));
HtmlTree dd = new HtmlTree (TagName.DD);
StringContent ddContent = new StringContent("Test DD");
dd.add(ddContent);
dlDisplay.add(dd);
@ -139,7 +139,7 @@ public class TestHtmlDocument extends JavadocTester {
body.add(emptyString);
Comment emptyComment = new Comment("");
body.add(emptyComment);
HtmlTree hr = new HtmlTree(HtmlTag.HR);
HtmlTree hr = new HtmlTree(TagName.HR);
body.add(hr);
html.add(body);
HtmlDocument htmlDoc = new HtmlDocument(html);