8072945: Javadoc should generate valid and compliant HTML5 output

Reviewed-by: jjg, ksrini
This commit is contained in:
Bhavesh Patel 2015-04-13 18:05:23 -07:00
parent ec05163d91
commit 9c427df72e
119 changed files with 5913 additions and 701 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -108,6 +108,7 @@ public class Checker extends DocTreePathScanner<Void, Void> {
public enum Flag {
TABLE_HAS_CAPTION,
HAS_ELEMENT,
HAS_HEADING,
HAS_INLINE_TAG,
HAS_TEXT,
REPORTED_BAD_INLINE
@ -282,6 +283,8 @@ public class Checker extends DocTreePathScanner<Void, Void> {
final HtmlTag t = HtmlTag.get(treeName);
if (t == null) {
env.messages.error(HTML, tree, "dc.tag.unknown", treeName);
} else if (t.allowedVersion != HtmlVersion.ALL && t.allowedVersion != env.htmlVersion) {
env.messages.error(HTML, tree, "dc.tag.not.supported", treeName);
} else {
boolean done = false;
for (TagStackItem tsi: tagStack) {
@ -345,6 +348,12 @@ public class Checker extends DocTreePathScanner<Void, Void> {
parent.flags.add(Flag.TABLE_HAS_CAPTION);
break;
case H1: case H2: case H3: case H4: case H5: case H6:
if (parent != null && (parent.tag == HtmlTag.SECTION || parent.tag == HtmlTag.ARTICLE)) {
parent.flags.add(Flag.HAS_HEADING);
}
break;
case IMG:
if (!top.attrs.contains(HtmlTag.Attr.ALT))
env.messages.error(ACCESSIBILITY, tree, "dc.no.alt.attr.for.image");
@ -460,6 +469,14 @@ public class Checker extends DocTreePathScanner<Void, Void> {
env.messages.error(ACCESSIBILITY, tree,
"dc.no.summary.or.caption.for.table");
}
break;
case SECTION:
case ARTICLE:
if (env.htmlVersion == HtmlVersion.HTML5 && !top.flags.contains(Flag.HAS_HEADING)) {
env.messages.error(HTML, tree, "dc.tag.requires.heading", treeName);
}
break;
}
warnIfEmpty(top, tree);
tagStack.pop();
@ -519,25 +536,21 @@ public class Checker extends DocTreePathScanner<Void, Void> {
Name name = tree.getName();
HtmlTag.Attr attr = currTag.getAttr(name);
if (attr != null) {
if (env.htmlVersion == HtmlVersion.HTML4 && attr.name().contains("-")) {
env.messages.error(HTML, tree, "dc.attr.not.supported.html4", name);
}
boolean first = tagStack.peek().attrs.add(attr);
if (!first)
env.messages.error(HTML, tree, "dc.attr.repeated", name);
}
AttrKind k = currTag.getAttrKind(name);
switch (k) {
case OK:
switch (env.htmlVersion) {
case HTML4:
validateHtml4Attrs(tree, name, k);
break;
case INVALID:
env.messages.error(HTML, tree, "dc.attr.unknown", name);
break;
case OBSOLETE:
env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete", name);
break;
case USE_CSS:
env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete.use.css", name);
case HTML5:
validateHtml5Attrs(tree, name, k);
break;
}
@ -590,6 +603,20 @@ public class Checker extends DocTreePathScanner<Void, Void> {
}
}
break;
case BORDER:
if (currTag == HtmlTag.TABLE) {
String v = getAttrValue(tree);
try {
if (env.htmlVersion == HtmlVersion.HTML5
&& (v == null || (!v.isEmpty() && Integer.parseInt(v) != 1))) {
env.messages.error(HTML, tree, "dc.attr.table.border.html5", attr);
}
} catch (NumberFormatException ex) {
env.messages.error(HTML, tree, "dc.attr.table.border.html5", attr);
}
}
break;
}
}
}
@ -599,6 +626,45 @@ public class Checker extends DocTreePathScanner<Void, Void> {
return super.visitAttribute(tree, ignore);
}
private void validateHtml4Attrs(AttributeTree tree, Name name, AttrKind k) {
switch (k) {
case ALL:
case HTML4:
break;
case INVALID:
env.messages.error(HTML, tree, "dc.attr.unknown", name);
break;
case OBSOLETE:
env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete", name);
break;
case USE_CSS:
env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete.use.css", name);
break;
case HTML5:
env.messages.error(HTML, tree, "dc.attr.not.supported.html4", name);
break;
}
}
private void validateHtml5Attrs(AttributeTree tree, Name name, AttrKind k) {
switch (k) {
case ALL:
case HTML5:
break;
case INVALID:
case OBSOLETE:
case USE_CSS:
case HTML4:
env.messages.error(HTML, tree, "dc.attr.not.supported.html5", name);
break;
}
}
private boolean checkAnchor(String name) {
Element e = getEnclosingPackageOrClass(env.currElement);
if (e == null)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -80,6 +80,7 @@ public class DocLint implements Plugin {
private static final String STATS = "-stats";
public static final String XIMPLICIT_HEADERS = "-XimplicitHeaders:";
public static final String XCUSTOM_TAGS_PREFIX = "-XcustomTags:";
public static final String XHTML_VERSION_PREFIX = "-XhtmlVersion:";
public static final String XCHECK_PACKAGE = "-XcheckPackage:";
public static final String SEPARATOR = ",";
@ -210,6 +211,14 @@ public class DocLint implements Plugin {
env.messages.setOptions(arg.substring(arg.indexOf(":") + 1));
} else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) {
env.setCustomTags(arg.substring(arg.indexOf(":") + 1));
} else if (arg.startsWith(XHTML_VERSION_PREFIX)) {
String argsVersion = arg.substring(arg.indexOf(":") + 1);
HtmlVersion htmlVersion = HtmlVersion.getHtmlVersion(argsVersion);
if (htmlVersion != null) {
env.setHtmlVersion(htmlVersion);
} else {
throw new BadArgs("dc.bad.value.for.option", arg, argsVersion);
}
} else if (arg.equals("-h") || arg.equals("-help") || arg.equals("--help")
|| arg.equals("-?") || arg.equals("-usage")) {
needHelp = true;
@ -274,6 +283,14 @@ public class DocLint implements Plugin {
env.setImplicitHeaders(Character.digit(ch, 10));
} else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) {
env.setCustomTags(arg.substring(arg.indexOf(":") + 1));
} else if (arg.startsWith(XHTML_VERSION_PREFIX)) {
String argsVersion = arg.substring(arg.indexOf(":") + 1);
HtmlVersion htmlVersion = HtmlVersion.getHtmlVersion(argsVersion);
if (htmlVersion != null) {
env.setHtmlVersion(htmlVersion);
} else {
throw new IllegalArgumentException(argsVersion);
}
} else if (arg.startsWith(XCHECK_PACKAGE)) {
env.setCheckPackages(arg.substring(arg.indexOf(":") + 1));
} else

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -99,6 +99,8 @@ public class Env {
Set<Pattern> includePackages;
Set<Pattern> excludePackages;
HtmlVersion htmlVersion = HtmlVersion.HTML4;
// Utility classes
DocTrees trees;
Elements elements;
@ -193,6 +195,10 @@ public class Env {
return true;
}
void setHtmlVersion(HtmlVersion version) {
htmlVersion = version;
}
/** Set the current declaration and its doc comment. */
void setCurrent(TreePath path, DocCommentTree comment) {
currPath = path;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -51,26 +51,37 @@ import com.sun.tools.javac.util.StringUtils;
*
* @see <a href="http://www.w3.org/TR/REC-html40/">HTML 4.01 Specification</a>
* @see <a href="http://www.w3.org/TR/html5/">HTML 5 Specification</a>
* @see <a href="http://www.w3.org/TR/wai-aria/ ">WAI-ARIA Specification</a>
* @see <a href="http://www.w3.org/TR/aria-in-html/#recommendations-table">WAI-ARIA Recommendations Table</a>
* @author Bhavesh Patel
* @author Jonathan Gibbons (revised)
*/
public enum HtmlTag {
A(BlockType.INLINE, EndKind.REQUIRED,
attrs(AttrKind.OK, HREF, TARGET, NAME)),
attrs(AttrKind.ALL, HREF, TARGET, ID),
attrs(AttrKind.HTML4, REV, CHARSET, SHAPE, COORDS, NAME)),
ABBR(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
ACRONYM(BlockType.INLINE, EndKind.REQUIRED,
ACRONYM(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
ADDRESS(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
ARTICLE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
ASIDE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
B(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
BIG(BlockType.INLINE, EndKind.REQUIRED,
BDI(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED),
BIG(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT)),
BLOCKQUOTE(BlockType.BLOCK, EndKind.REQUIRED,
@ -82,9 +93,10 @@ public enum HtmlTag {
attrs(AttrKind.USE_CSS, CLEAR)),
CAPTION(BlockType.TABLE_ITEM, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)),
EnumSet.of(Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT),
attrs(AttrKind.USE_CSS, ALIGN)),
CENTER(BlockType.BLOCK, EndKind.REQUIRED,
CENTER(HtmlVersion.HTML4, BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
CITE(BlockType.INLINE, EndKind.REQUIRED,
@ -93,18 +105,30 @@ public enum HtmlTag {
CODE(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
COL(BlockType.TABLE_ITEM, EndKind.NONE,
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF, VALIGN, WIDTH)),
COLGROUP(BlockType.TABLE_ITEM, EndKind.REQUIRED,
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF, VALIGN, WIDTH)) {
@Override
public boolean accepts(HtmlTag t) {
return (t == COL);
}
},
DD(BlockType.LIST_ITEM, EndKind.OPTIONAL,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)),
DEL(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST),
attrs(AttrKind.OK, Attr.CITE, Attr.DATETIME)),
attrs(AttrKind.ALL, Attr.CITE, Attr.DATETIME)),
DFN(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
DIV(BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
attrs(AttrKind.USE_CSS, ALIGN)),
DL(BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT),
@ -121,49 +145,95 @@ public enum HtmlTag {
EM(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.NO_NEST)),
FONT(BlockType.INLINE, EndKind.REQUIRED, // tag itself is deprecated
FONT(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED, // tag itself is deprecated
EnumSet.of(Flag.EXPECT_CONTENT),
attrs(AttrKind.USE_CSS, SIZE, COLOR, FACE)),
FRAME(BlockType.OTHER, EndKind.NONE),
FOOTER(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)) {
@Override
public boolean accepts(HtmlTag t) {
switch (t) {
case HEADER: case FOOTER: case MAIN:
return false;
default:
return (t.blockType == BlockType.BLOCK) || (t.blockType == BlockType.INLINE);
}
}
},
FRAMESET(BlockType.OTHER, EndKind.REQUIRED),
FIGURE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
H1(BlockType.BLOCK, EndKind.REQUIRED),
H2(BlockType.BLOCK, EndKind.REQUIRED),
H3(BlockType.BLOCK, EndKind.REQUIRED),
H4(BlockType.BLOCK, EndKind.REQUIRED),
H5(BlockType.BLOCK, EndKind.REQUIRED),
H6(BlockType.BLOCK, EndKind.REQUIRED),
FIGCAPTION(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED),
FRAME(HtmlVersion.HTML4, BlockType.OTHER, EndKind.NONE),
FRAMESET(HtmlVersion.HTML4, BlockType.OTHER, EndKind.REQUIRED),
H1(BlockType.BLOCK, EndKind.REQUIRED,
attrs(AttrKind.USE_CSS, ALIGN)),
H2(BlockType.BLOCK, EndKind.REQUIRED,
attrs(AttrKind.USE_CSS, ALIGN)),
H3(BlockType.BLOCK, EndKind.REQUIRED,
attrs(AttrKind.USE_CSS, ALIGN)),
H4(BlockType.BLOCK, EndKind.REQUIRED,
attrs(AttrKind.USE_CSS, ALIGN)),
H5(BlockType.BLOCK, EndKind.REQUIRED,
attrs(AttrKind.USE_CSS, ALIGN)),
H6(BlockType.BLOCK, EndKind.REQUIRED,
attrs(AttrKind.USE_CSS, ALIGN)),
HEAD(BlockType.OTHER, EndKind.REQUIRED),
HEADER(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)) {
@Override
public boolean accepts(HtmlTag t) {
switch (t) {
case HEADER: case FOOTER: case MAIN:
return false;
default:
return (t.blockType == BlockType.BLOCK) || (t.blockType == BlockType.INLINE);
}
}
},
HR(BlockType.BLOCK, EndKind.NONE,
attrs(AttrKind.OK, WIDTH)), // OK in 4.01; not allowed in 5
attrs(AttrKind.HTML4, WIDTH),
attrs(AttrKind.USE_CSS, ALIGN, NOSHADE, SIZE)),
HTML(BlockType.OTHER, EndKind.REQUIRED),
I(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
IFRAME(BlockType.OTHER, EndKind.REQUIRED),
IMG(BlockType.INLINE, EndKind.NONE,
attrs(AttrKind.OK, SRC, ALT, HEIGHT, WIDTH),
attrs(AttrKind.ALL, SRC, ALT, HEIGHT, WIDTH),
attrs(AttrKind.HTML5, CROSSORIGIN),
attrs(AttrKind.OBSOLETE, NAME),
attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)),
INS(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST),
attrs(AttrKind.OK, Attr.CITE, Attr.DATETIME)),
attrs(AttrKind.ALL, Attr.CITE, Attr.DATETIME)),
KBD(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
LI(BlockType.LIST_ITEM, EndKind.OPTIONAL,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
attrs(AttrKind.OK, VALUE)),
attrs(AttrKind.ALL, VALUE),
attrs(AttrKind.USE_CSS, TYPE)),
LINK(BlockType.OTHER, EndKind.NONE),
MAIN(HtmlVersion.HTML5, BlockType.OTHER, EndKind.REQUIRED),
MARK(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED),
MENU(BlockType.BLOCK, EndKind.REQUIRED) {
@Override
public boolean accepts(HtmlTag t) {
@ -173,13 +243,18 @@ public enum HtmlTag {
META(BlockType.OTHER, EndKind.NONE),
NOFRAMES(BlockType.OTHER, EndKind.REQUIRED),
NAV(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
NOFRAMES(HtmlVersion.HTML4, BlockType.OTHER, EndKind.REQUIRED),
NOSCRIPT(BlockType.BLOCK, EndKind.REQUIRED),
OL(BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT),
attrs(AttrKind.OK, START, TYPE)) {
attrs(AttrKind.ALL, START, TYPE),
attrs(AttrKind.HTML5, REVERSED),
attrs(AttrKind.USE_CSS, COMPACT)) {
@Override
public boolean accepts(HtmlTag t) {
return (t == LI);
@ -191,7 +266,8 @@ public enum HtmlTag {
attrs(AttrKind.USE_CSS, ALIGN)),
PRE(BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT)) {
EnumSet.of(Flag.EXPECT_CONTENT),
attrs(AttrKind.USE_CSS, WIDTH)) {
@Override
public boolean accepts(HtmlTag t) {
switch (t) {
@ -214,13 +290,16 @@ public enum HtmlTag {
SCRIPT(BlockType.OTHER, EndKind.REQUIRED),
SECTION(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
SMALL(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT)),
SPAN(BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT)),
STRIKE(BlockType.INLINE, EndKind.REQUIRED,
STRIKE(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT)),
STRONG(BlockType.INLINE, EndKind.REQUIRED,
@ -234,13 +313,14 @@ public enum HtmlTag {
TABLE(BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT),
attrs(AttrKind.OK, SUMMARY, Attr.FRAME, RULES, BORDER,
CELLPADDING, CELLSPACING, WIDTH), // width OK in 4.01; not allowed in 5
attrs(AttrKind.ALL, BORDER),
attrs(AttrKind.HTML4, SUMMARY, CELLPADDING, CELLSPACING, Attr.FRAME, RULES, WIDTH),
attrs(AttrKind.USE_CSS, ALIGN, BGCOLOR)) {
@Override
public boolean accepts(HtmlTag t) {
switch (t) {
case CAPTION:
case COLGROUP:
case THEAD: case TBODY: case TFOOT:
case TR: // HTML 3.2
return true;
@ -252,7 +332,8 @@ public enum HtmlTag {
TBODY(BlockType.TABLE_ITEM, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT),
attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) {
attrs(AttrKind.ALL, VALIGN),
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF)) {
@Override
public boolean accepts(HtmlTag t) {
return (t == TR);
@ -261,12 +342,16 @@ public enum HtmlTag {
TD(BlockType.TABLE_ITEM, EndKind.OPTIONAL,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, Attr.ABBR, AXIS,
ALIGN, CHAR, CHAROFF, VALIGN),
attrs(AttrKind.ALL, COLSPAN, ROWSPAN, HEADERS, VALIGN),
attrs(AttrKind.HTML4, AXIS, Attr.ABBR, SCOPE, ALIGN, CHAR, CHAROFF),
attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)),
TEMPLATE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)),
TFOOT(BlockType.TABLE_ITEM, EndKind.REQUIRED,
attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) {
attrs(AttrKind.ALL, VALIGN),
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF)) {
@Override
public boolean accepts(HtmlTag t) {
return (t == TR);
@ -275,22 +360,27 @@ public enum HtmlTag {
TH(BlockType.TABLE_ITEM, EndKind.OPTIONAL,
EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, Attr.ABBR, AXIS,
ALIGN, CHAR, CHAROFF, VALIGN),
attrs(AttrKind.ALL, COLSPAN, ROWSPAN, HEADERS, SCOPE, Attr.ABBR,
VALIGN),
attrs(AttrKind.HTML4, AXIS, ALIGN, CHAR, CHAROFF),
attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)),
THEAD(BlockType.TABLE_ITEM, EndKind.REQUIRED,
attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) {
attrs(AttrKind.ALL, VALIGN),
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF)) {
@Override
public boolean accepts(HtmlTag t) {
return (t == TR);
}
},
TIME(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED),
TITLE(BlockType.OTHER, EndKind.REQUIRED),
TR(BlockType.TABLE_ITEM, EndKind.OPTIONAL,
attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN),
attrs(AttrKind.ALL, VALIGN),
attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF),
attrs(AttrKind.USE_CSS, BGCOLOR)) {
@Override
public boolean accepts(HtmlTag t) {
@ -298,7 +388,7 @@ public enum HtmlTag {
}
},
TT(BlockType.INLINE, EndKind.REQUIRED,
TT(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
U(BlockType.INLINE, EndKind.REQUIRED,
@ -306,13 +396,15 @@ public enum HtmlTag {
UL(BlockType.BLOCK, EndKind.REQUIRED,
EnumSet.of(Flag.EXPECT_CONTENT),
attrs(AttrKind.OK, COMPACT, TYPE)) { // OK in 4.01; not allowed in 5
attrs(AttrKind.HTML4, COMPACT, TYPE)) {
@Override
public boolean accepts(HtmlTag t) {
return (t == LI);
}
},
WBR(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED),
VAR(BlockType.INLINE, EndKind.REQUIRED);
/**
@ -345,34 +437,66 @@ public enum HtmlTag {
public static enum Attr {
ABBR,
ALIGN,
ALINK,
ALT,
ARIA_ACTIVEDESCENDANT,
ARIA_CONTROLS,
ARIA_DESCRIBEDBY,
ARIA_EXPANDED,
ARIA_LABEL,
ARIA_LABELLEDBY,
ARIA_LEVEL,
ARIA_MULTISELECTABLE,
ARIA_OWNS,
ARIA_POSINSET,
ARIA_SETSIZE,
ARIA_READONLY,
ARIA_REQUIRED,
ARIA_SELECTED,
ARIA_SORT,
AXIS,
BACKGROUND,
BGCOLOR,
BORDER,
CELLSPACING,
CELLPADDING,
CHAR,
CHAROFF,
CHARSET,
CITE,
CLEAR,
CLASS,
COLOR,
COLSPAN,
COMPACT,
COORDS,
CROSSORIGIN,
DATETIME,
FACE,
FRAME,
FRAMEBORDER,
HEADERS,
HEIGHT,
HREF,
HSPACE,
ID,
LINK,
LONGDESC,
MARGINHEIGHT,
MARGINWIDTH,
NAME,
NOSHADE,
NOWRAP,
PROFILE,
REV,
REVERSED,
ROLE,
ROWSPAN,
RULES,
SCHEME,
SCOPE,
SCROLLING,
SHAPE,
SIZE,
SPACE,
SRC,
@ -380,14 +504,23 @@ public enum HtmlTag {
STYLE,
SUMMARY,
TARGET,
TEXT,
TYPE,
VALIGN,
VALUE,
VERSION,
VLINK,
VSPACE,
WIDTH;
private final String name;
Attr() {
name = StringUtils.toLowerCase(name().replace("_", "-"));
}
public String getText() {
return StringUtils.toLowerCase(name());
return name;
}
static final Map<String,Attr> index = new HashMap<>();
@ -399,10 +532,12 @@ public enum HtmlTag {
}
public static enum AttrKind {
HTML4,
HTML5,
INVALID,
OBSOLETE,
USE_CSS,
OK
ALL
}
// This class exists to avoid warnings from using parameterized vararg type
@ -415,25 +550,52 @@ public enum HtmlTag {
}
public final HtmlVersion allowedVersion;
public final BlockType blockType;
public final EndKind endKind;
public final Set<Flag> flags;
private final Map<Attr,AttrKind> attrs;
HtmlTag(BlockType blockType, EndKind endKind, AttrMap... attrMaps) {
this(blockType, endKind, Collections.<Flag>emptySet(), attrMaps);
this(HtmlVersion.ALL, blockType, endKind, Collections.<Flag>emptySet(), attrMaps);
}
HtmlTag(HtmlVersion allowedVersion, BlockType blockType, EndKind endKind, AttrMap... attrMaps) {
this(allowedVersion, blockType, endKind, Collections.<Flag>emptySet(), attrMaps);
}
HtmlTag(BlockType blockType, EndKind endKind, Set<Flag> flags, AttrMap... attrMaps) {
this(HtmlVersion.ALL, blockType, endKind, flags, attrMaps);
}
HtmlTag(HtmlVersion allowedVersion, BlockType blockType, EndKind endKind, Set<Flag> flags, AttrMap... attrMaps) {
this.allowedVersion = allowedVersion;
this.blockType = blockType;
this.endKind = endKind;
this.flags = flags;
this.attrs = new EnumMap<>(Attr.class);
for (Map<Attr,AttrKind> m: attrMaps)
this.attrs.putAll(m);
attrs.put(Attr.CLASS, AttrKind.OK);
attrs.put(Attr.ID, AttrKind.OK);
attrs.put(Attr.STYLE, AttrKind.OK);
attrs.put(Attr.CLASS, AttrKind.ALL);
attrs.put(Attr.ID, AttrKind.ALL);
attrs.put(Attr.STYLE, AttrKind.ALL);
attrs.put(Attr.ROLE, AttrKind.HTML5);
// for now, assume that all ARIA attributes are allowed on all tags.
attrs.put(Attr.ARIA_ACTIVEDESCENDANT, AttrKind.HTML5);
attrs.put(Attr.ARIA_CONTROLS, AttrKind.HTML5);
attrs.put(Attr.ARIA_DESCRIBEDBY, AttrKind.HTML5);
attrs.put(Attr.ARIA_EXPANDED, AttrKind.HTML5);
attrs.put(Attr.ARIA_LABEL, AttrKind.HTML5);
attrs.put(Attr.ARIA_LABELLEDBY, AttrKind.HTML5);
attrs.put(Attr.ARIA_LEVEL, AttrKind.HTML5);
attrs.put(Attr.ARIA_MULTISELECTABLE, AttrKind.HTML5);
attrs.put(Attr.ARIA_OWNS, AttrKind.HTML5);
attrs.put(Attr.ARIA_POSINSET, AttrKind.HTML5);
attrs.put(Attr.ARIA_READONLY, AttrKind.HTML5);
attrs.put(Attr.ARIA_REQUIRED, AttrKind.HTML5);
attrs.put(Attr.ARIA_SELECTED, AttrKind.HTML5);
attrs.put(Attr.ARIA_SETSIZE, AttrKind.HTML5);
attrs.put(Attr.ARIA_SORT, AttrKind.HTML5);
}
public boolean accepts(HtmlTag t) {

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.tools.doclint;
/**
* Enum representing HTML version of the documentation comment.
*
* @author Bhavesh Patel
*/
public enum HtmlVersion {
HTML4,
HTML5,
ALL;
public static HtmlVersion getHtmlVersion(String argsVersion) {
switch (argsVersion) {
case "html4":
return HtmlVersion.HTML4;
case "html5":
return HtmlVersion.HTML5;
default:
return null;
}
}
}

View File

@ -27,9 +27,12 @@ dc.anchor.already.defined = anchor already defined: "{0}"
dc.anchor.value.missing = no value given for anchor
dc.attr.lacks.value = attribute lacks value
dc.attr.not.number = attribute value is not a number
dc.attr.not.supported.html4 = attribute not supported in HTML4: {0}
dc.attr.not.supported.html5 = attribute not supported in HTML5: {0}
dc.attr.obsolete = attribute obsolete: {0}
dc.attr.obsolete.use.css = attribute obsolete, use CSS instead: {0}
dc.attr.repeated = repeated attribute: {0}
dc.attr.table.border.html5 = attribute border for table only accepts "" or "1", use CSS instead: {0}
dc.attr.unknown = unknown attribute: {0}
dc.bad.option = bad option: {0}
dc.bad.value.for.option = bad value for option: {0} {1}
@ -63,9 +66,11 @@ dc.tag.not.allowed.inline.tag = block element not allowed within @{1}: {0}
dc.tag.not.allowed.inline.other = block element not allowed here: {0}
dc.tag.not.closed= element not closed: {0}
dc.tag.p.in.pre= unexpected use of <p> inside <pre> element
dc.tag.requires.heading = heading not found for </{0}>
dc.tag.self.closing = self-closing element not allowed
dc.tag.start.unmatched = end tag missing: </{0}>
dc.tag.unknown = unknown tag: {0}
dc.tag.not.supported = tag not supported in the generated HTML version: {0}
dc.text.not.allowed = text not allowed in <{0}> element
dc.type.arg.not.allowed = type arguments not allowed here
dc.unexpected.comment=documentation comment not expected here

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -415,8 +415,10 @@ public abstract class AbstractMemberWriter {
protected void addDeprecatedAPI(List<Doc> deprmembers, String headingKey,
String tableSummary, String[] tableHeader, Content contentTree) {
if (deprmembers.size() > 0) {
Content table = HtmlTree.TABLE(HtmlStyle.deprecatedSummary, 0, 3, 0, tableSummary,
writer.getTableCaption(configuration.getResource(headingKey)));
Content caption = writer.getTableCaption(configuration.getResource(headingKey));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
: HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
for (int i = 0; i < deprmembers.size(); i++) {
@ -455,8 +457,10 @@ public abstract class AbstractMemberWriter {
List<? extends ProgramElementDoc> members = mems;
boolean printedUseTableHeader = false;
if (members.size() > 0) {
Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, tableSummary,
writer.getTableCaption(heading));
Content caption = writer.getTableCaption(heading);
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
: HtmlTree.TABLE(HtmlStyle.useSummary, tableSummary, caption);
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<? extends ProgramElementDoc> it = members.iterator();
for (int i = 0; it.hasNext(); i++) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -149,13 +149,17 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
protected void addIndexContents(Collection<PackageDoc> packages, String text,
String tableSummary, Content body) {
if (!packages.isEmpty()) {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.indexHeader);
addAllClassesLink(div);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
? HtmlTree.NAV()
: new HtmlTree(HtmlTag.DIV);
htmlTree.addStyle(HtmlStyle.indexNav);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
addAllClassesLink(ul);
if (configuration.showProfiles) {
addAllProfilesLink(div);
addAllProfilesLink(ul);
}
body.addContent(div);
htmlTree.addContent(ul);
body.addContent(htmlTree);
if (configuration.showProfiles && configuration.profilePackages.size() > 0) {
Content profileSummary = configuration.getResource("doclet.Profiles");
addProfilesList(profileSummary, body);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -194,11 +194,15 @@ public abstract class AbstractProfileIndexWriter extends HtmlDocletWriter {
protected void addIndexContents(Profiles profiles, String text,
String tableSummary, Content body) {
if (profiles.getProfileCount() > 0) {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.indexHeader);
addAllClassesLink(div);
addAllPackagesLink(div);
body.addContent(div);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
? HtmlTree.NAV()
: new HtmlTree(HtmlTag.DIV);
htmlTree.addStyle(HtmlStyle.indexNav);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
addAllClassesLink(ul);
addAllPackagesLink(ul);
htmlTree.addContent(ul);
body.addContent(htmlTree);
addProfilesList(profiles, text, tableSummary, body);
}
}
@ -215,12 +219,16 @@ public abstract class AbstractProfileIndexWriter extends HtmlDocletWriter {
*/
protected void addProfilePackagesIndexContents(Profiles profiles, String text,
String tableSummary, Content body, String profileName) {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.indexHeader);
addAllClassesLink(div);
addAllPackagesLink(div);
addAllProfilesLink(div);
body.addContent(div);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
? HtmlTree.NAV()
: new HtmlTree(HtmlTag.DIV);
htmlTree.addStyle(HtmlStyle.indexNav);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
addAllClassesLink(ul);
addAllPackagesLink(ul);
addAllProfilesLink(ul);
htmlTree.addContent(ul);
body.addContent(htmlTree);
addProfilePackagesList(profiles, text, tableSummary, body, profileName);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -53,8 +53,6 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
*/
protected final ClassTree classtree;
private static final String LI_CIRCLE = "circle";
/**
* Constructor initializes classtree variable. This constructor will be used
* while generating global tree file "overview-tree.html".
@ -88,7 +86,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
Content ul = new HtmlTree(HtmlTag.UL);
for (ClassDoc local : list) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addAttr(HtmlAttr.TYPE, LI_CIRCLE);
li.addStyle(HtmlStyle.circle);
addPartialInfo(local, li);
addExtendsImplements(parent, local, li);
addLevelInfo(local, classtree.subs(local, isEnum),
@ -108,14 +106,24 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
* @param heading heading for the tree
* @param div the content tree to which the tree will be added
*/
protected void addTree(SortedSet<ClassDoc> list, String heading, Content div) {
protected void addTree(SortedSet<ClassDoc> list, String heading, HtmlTree div) {
if (!list.isEmpty()) {
ClassDoc firstClassDoc = list.first();
Content headingContent = getResource(heading);
div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
headingContent));
Content sectionHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
headingContent);
HtmlTree htmlTree;
if (configuration.allowTag(HtmlTag.SECTION)) {
htmlTree = HtmlTree.SECTION(sectionHeading);
} else {
div.addContent(sectionHeading);
htmlTree = div;
}
addLevelInfo(!firstClassDoc.isInterface()? firstClassDoc : null,
list, list == classtree.baseEnums(), div);
list, list == classtree.baseEnums(), htmlTree);
if (configuration.allowTag(HtmlTag.SECTION)) {
div.addContent(htmlTree);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -119,8 +119,10 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
Content ul = new HtmlTree(HtmlTag.UL);
// Generate the class links and add it to the tdFont tree.
addAllClasses(ul, wantFrames);
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, ul);
body.addContent(div);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN(HtmlStyle.indexContainer, ul)
: HtmlTree.DIV(HtmlStyle.indexContainer, ul);
body.addContent(htmlTree);
printHtmlDocument(null, false, body);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -74,6 +74,13 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
return writer.getMemberTreeHeader();
}
/**
* {@inheritDoc}
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
}
/**
* {@inheritDoc}
*/
@ -156,6 +163,10 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
* {@inheritDoc}
*/
public Content getAnnotationDetails(Content annotationDetailsTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(annotationDetailsTree));
return htmlTree;
}
return getMemberTree(annotationDetailsTree);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -69,6 +69,13 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
return memberTree;
}
/**
* {@inheritDoc}
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
}
/**
* {@inheritDoc}
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -75,6 +75,13 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
return writer.getMemberTreeHeader();
}
/**
* {@inheritDoc}
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
}
/**
* {@inheritDoc}
*/
@ -158,6 +165,10 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
* {@inheritDoc}
*/
public Content getAnnotationDetails(Content annotationDetailsTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(annotationDetailsTree));
return htmlTree;
}
return getMemberTree(annotationDetailsTree);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -151,9 +151,15 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
String pkgname = (annotationType.containingPackage() != null)?
annotationType.containingPackage().name(): "";
String clname = annotationType.name();
Content bodyTree = getBody(true, getWindowTitle(clname));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(clname));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.header);
@ -169,7 +175,11 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
HtmlStyle.title, headerContent);
heading.addContent(getTypeParameterLinks(linkInfo));
div.addContent(heading);
bodyTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
}
@ -185,8 +195,14 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
*/
public void addFooter(Content contentTree) {
contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
addNavLinks(false, contentTree);
addBottom(contentTree);
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: contentTree;
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
contentTree.addContent(htmlTree);
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -90,6 +90,11 @@ public class ClassUseWriter extends SubWriterHolderWriter {
final String methodUseTableSummary;
final String constructorUseTableSummary;
/**
* The HTML tree for main tag.
*/
protected HtmlTree mainTree = HtmlTree.MAIN();
/**
* Constructor.
*
@ -222,7 +227,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
* Generate the class use list.
*/
protected void generateClassUseFile() throws IOException {
Content body = getClassUseHeader();
HtmlTree body = getClassUseHeader();
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.classUseContainer);
if (pkgSet.size() > 0) {
@ -231,9 +236,20 @@ public class ClassUseWriter extends SubWriterHolderWriter {
div.addContent(getResource("doclet.ClassUse_No.usage.of.0",
classdoc.qualifiedName()));
}
body.addContent(div);
addNavLinks(false, body);
addBottom(body);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
body.addContent(mainTree);
} else {
body.addContent(div);
}
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: body;
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
body.addContent(htmlTree);
}
printHtmlDocument(null, true, body);
}
@ -259,11 +275,12 @@ public class ClassUseWriter extends SubWriterHolderWriter {
* @param contentTree the content tree to which the packages list will be added
*/
protected void addPackageList(Content contentTree) throws IOException {
Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary,
getTableCaption(configuration.getResource(
Content caption = getTableCaption(configuration.getResource(
"doclet.ClassUse_Packages.that.use.0",
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc
)))));
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc))));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
: HtmlTree.TABLE(HtmlStyle.useSummary, useTableSummary, caption);
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<PackageDoc> it = pkgSet.iterator();
@ -294,11 +311,13 @@ public class ClassUseWriter extends SubWriterHolderWriter {
pkgToPackageAnnotations.isEmpty()) {
return;
}
Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary,
getTableCaption(configuration.getResource(
Content caption = getTableCaption(configuration.getResource(
"doclet.ClassUse_PackageAnnotation",
getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)))));
LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc))));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
: HtmlTree.TABLE(HtmlStyle.useSummary, useTableSummary, caption);
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
@ -333,15 +352,22 @@ public class ClassUseWriter extends SubWriterHolderWriter {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
for (PackageDoc pkg : pkgSet) {
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(getPackageAnchorName(pkg)));
Content markerAnchor = getMarkerAnchor(getPackageAnchorName(pkg));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(markerAnchor)
: HtmlTree.LI(HtmlStyle.blockList, markerAnchor);
Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
classdoc)),
getPackageLink(pkg, utils.getPackageName(pkg)));
Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
li.addContent(heading);
addClassUse(pkg, li);
ul.addContent(li);
htmlTree.addContent(heading);
addClassUse(pkg, htmlTree);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
}
Content li = HtmlTree.LI(HtmlStyle.blockList, ul);
contentTree.addContent(li);
@ -443,15 +469,21 @@ public class ClassUseWriter extends SubWriterHolderWriter {
*
* @return a content tree representing the class use header
*/
protected Content getClassUseHeader() {
protected HtmlTree getClassUseHeader() {
String cltype = configuration.getText(classdoc.isInterface()?
"doclet.Interface":"doclet.Class");
String clname = classdoc.qualifiedName();
String title = configuration.getText("doclet.Window_ClassUse_Header",
cltype, clname);
Content bodyTree = getBody(true, getWindowTitle(title));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
ContentBuilder headContent = new ContentBuilder();
headContent.addContent(getResource("doclet.ClassUse_Title", cltype));
headContent.addContent(new HtmlTree(HtmlTag.BR));
@ -459,7 +491,11 @@ public class ClassUseWriter extends SubWriterHolderWriter {
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
true, HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
bodyTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@ import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.builders.*;
import com.sun.tools.doclets.internal.toolkit.taglets.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import java.io.IOException;
/**
@ -160,9 +161,15 @@ public class ClassWriterImpl extends SubWriterHolderWriter
String pkgname = (classDoc.containingPackage() != null)?
classDoc.containingPackage().name(): "";
String clname = classDoc.name();
Content bodyTree = getBody(true, getWindowTitle(clname));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(clname));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.header);
@ -194,7 +201,11 @@ public class ClassWriterImpl extends SubWriterHolderWriter
HtmlStyle.title, headerContent);
heading.addContent(getTypeParameterLinks(linkInfo));
div.addContent(heading);
bodyTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
}
@ -210,8 +221,14 @@ public class ClassWriterImpl extends SubWriterHolderWriter
*/
public void addFooter(Content contentTree) {
contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
addNavLinks(false, contentTree);
addBottom(contentTree);
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: contentTree;
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
contentTree.addContent(htmlTree);
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,7 @@ import java.util.*;
import javax.tools.JavaFileManager;
import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclint.DocLint;
@ -175,6 +175,11 @@ public class ConfigurationImpl extends Configuration {
*/
public boolean createoverview = false;
/**
* This is the HTML version of the generated pages. HTML 4.01 is the default output version.
*/
public HtmlVersion htmlVersion = HtmlVersion.HTML4;
/**
* Collected set of doclint options
*/
@ -279,6 +284,10 @@ public class ConfigurationImpl extends Configuration {
nooverview = true;
} else if (opt.equals("-overview")) {
overview = true;
} else if (opt.equals("-html4")) {
htmlVersion = HtmlVersion.HTML4;
} else if (opt.equals("-html5")) {
htmlVersion = HtmlVersion.HTML5;
} else if (opt.equals("-xdoclint")) {
doclintOpts.add(null);
} else if (opt.startsWith("-xdoclint:")) {
@ -300,7 +309,8 @@ public class ConfigurationImpl extends Configuration {
setTopFile(root);
if (root instanceof RootDocImpl) {
((RootDocImpl) root).initDocLint(doclintOpts, tagletManager.getCustomTagNames());
((RootDocImpl) root).initDocLint(doclintOpts, tagletManager.getCustomTagNames(),
StringUtils.toLowerCase(htmlVersion.name()));
}
}
@ -336,6 +346,8 @@ public class ConfigurationImpl extends Configuration {
option.equals("-use") ||
option.equals("-nonavbar") ||
option.equals("-nooverview") ||
option.equals("-html4") ||
option.equals("-html5") ||
option.equals("-xdoclint") ||
option.startsWith("-xdoclint:")) {
return 1;
@ -470,6 +482,20 @@ public class ConfigurationImpl extends Configuration {
return true;
}
/**
* Return true if the generated output is HTML5.
*/
public boolean isOutputHtml5() {
return htmlVersion == HtmlVersion.HTML5;
}
/**
* Return true if the tag is allowed for this specific version of HTML.
*/
public boolean allowTag(HtmlTag htmlTag) {
return htmlTag.allowTag(this.htmlVersion);
}
/**
* {@inheritDoc}
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -62,6 +62,16 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
private final String[] constantsTableHeader;
/**
* The HTML tree for main tag.
*/
private HtmlTree mainTree = HtmlTree.MAIN();
/**
* The HTML tree for constant values summary.
*/
private HtmlTree summaryTree;
/**
* Construct a ConstantsSummaryWriter.
* @param configuration the configuration used in this run
@ -85,9 +95,15 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
*/
public Content getHeader() {
String label = configuration.getText("doclet.Constants_Summary");
Content bodyTree = getBody(true, getWindowTitle(label));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(label));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
return bodyTree;
}
@ -123,7 +139,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
/**
* {@inheritDoc}
*/
public Content getContentsList(Content contentListTree) {
public void addContentsList(Content contentTree, Content contentListTree) {
Content titleContent = getResource(
"doclet.Constants_Summary");
Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
@ -131,10 +147,18 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
Content div = HtmlTree.DIV(HtmlStyle.header, pHeading);
Content headingContent = getResource(
"doclet.Contents");
div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
headingContent));
div.addContent(contentListTree);
return div;
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
headingContent);
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree section = HtmlTree.SECTION(heading);
section.addContent(contentListTree);
div.addContent(section);
mainTree.addContent(div);
} else {
div.addContent(heading);
div.addContent(contentListTree);
contentTree.addContent(div);
}
}
/**
@ -149,9 +173,11 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
/**
* {@inheritDoc}
*/
public void addPackageName(PackageDoc pkg, String parsedPackageName,
Content summariesTree) {
public void addPackageName(String parsedPackageName, Content summariesTree, boolean first) {
Content pkgNameContent;
if (!first && configuration.allowTag(HtmlTag.SECTION)) {
summariesTree.addContent(summaryTree);
}
if (parsedPackageName.length() == 0) {
summariesTree.addContent(getMarkerAnchor(
SectionName.UNNAMED_PACKAGE_ANCHOR));
@ -165,7 +191,11 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
pkgNameContent);
heading.addContent(headingContent);
summariesTree.addContent(heading);
if (configuration.allowTag(HtmlTag.SECTION)) {
summaryTree = HtmlTree.SECTION(heading);
} else {
summariesTree.addContent(heading);
}
}
/**
@ -177,6 +207,17 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
return ul;
}
/**
* {@inheritDoc}
*/
public void addClassConstant(Content summariesTree, Content classConstantTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
summaryTree.addContent(classConstantTree);
} else {
summariesTree.addContent(classConstantTree);
}
}
/**
* Get the table caption and header for the constant summary table
*
@ -208,8 +249,10 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
* @return the table caption and header
*/
protected Content getClassName(Content classStr) {
Content table = HtmlTree.TABLE(HtmlStyle.constantsSummary, 0, 3, 0, constantsTableSummary,
getTableCaption(classStr));
Content caption = getTableCaption(classStr);
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.constantsSummary, caption)
: HtmlTree.TABLE(HtmlStyle.constantsSummary, constantsTableSummary, caption);
table.addContent(getSummaryTableHeader(constantsTableHeader, "col"));
return table;
}
@ -297,12 +340,33 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
return HtmlTree.TD(HtmlStyle.colLast, code);
}
/**
* {@inheritDoc}
*/
public void addConstantSummaries(Content contentTree, Content summariesTree) {
if (configuration.allowTag(HtmlTag.SECTION) && summaryTree != null) {
summariesTree.addContent(summaryTree);
}
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(summariesTree);
contentTree.addContent(mainTree);
} else {
contentTree.addContent(summariesTree);
}
}
/**
* {@inheritDoc}
*/
public void addFooter(Content contentTree) {
addNavLinks(false, contentTree);
addBottom(contentTree);
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: contentTree;
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
contentTree.addContent(htmlTree);
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -89,6 +89,13 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
return memberTree;
}
/**
* {@inheritDoc}
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
}
/**
* {@inheritDoc}
*/
@ -177,6 +184,10 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
* {@inheritDoc}
*/
public Content getConstructorDetails(Content constructorDetailsTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(constructorDetailsTree));
return htmlTree;
}
return getMemberTree(constructorDetailsTree);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -138,8 +138,11 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
*/
protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi)
throws IOException {
Content body = getHeader();
body.addContent(getContentsList(deprapi));
HtmlTree body = getHeader();
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN()
: body;
htmlTree.addContent(getContentsList(deprapi));
String memberTableSummary;
String[] memberTableHeader = new String[1];
HtmlTree div = new HtmlTree(HtmlTag.DIV);
@ -164,9 +167,20 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
}
}
body.addContent(div);
addNavLinks(false, body);
addBottom(body);
if (configuration.allowTag(HtmlTag.MAIN)) {
htmlTree.addContent(div);
body.addContent(htmlTree);
} else {
body.addContent(div);
}
htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: body;
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
body.addContent(htmlTree);
}
printHtmlDocument(null, true, body);
}
@ -226,11 +240,17 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
*
* @return a content tree for the header
*/
public Content getHeader() {
public HtmlTree getHeader() {
String title = configuration.getText("doclet.Window_Deprecated_List");
Content bodyTree = getBody(true, getWindowTitle(title));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
return bodyTree;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -66,6 +66,13 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
return memberTree;
}
/**
* {@inheritDoc}
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
}
/**
* {@inheritDoc}
*/
@ -140,6 +147,10 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
* {@inheritDoc}
*/
public Content getEnumConstantsDetails(Content enumConstantsDetailsTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(enumConstantsDetailsTree));
return htmlTree;
}
return getMemberTree(enumConstantsDetailsTree);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -67,6 +67,13 @@ public class FieldWriterImpl extends AbstractMemberWriter
return memberTree;
}
/**
* {@inheritDoc}
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
}
/**
* {@inheritDoc}
*/
@ -161,6 +168,10 @@ public class FieldWriterImpl extends AbstractMemberWriter
* {@inheritDoc}
*/
public Content getFieldDetails(Content fieldDetailsTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(fieldDetailsTree));
return htmlTree;
}
return getMemberTree(fieldDetailsTree);
}

View File

@ -96,7 +96,12 @@ public class FrameOutputWriter extends HtmlDocletWriter {
protected void generateFrameFile() throws IOException {
Content frame = getFrameDetails();
HtmlTree body = new HtmlTree(HtmlTag.BODY);
body.addContent(frame);
if (configuration.allowTag(HtmlTag.MAIN)) {
HtmlTree main = HtmlTree.MAIN(frame);
body.addContent(main);
} else {
body.addContent(frame);
}
if (configuration.windowtitle.length() > 0) {
printFramesDocument(configuration.windowtitle, configuration,
body);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -44,6 +44,8 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
*/
public class HelpWriter extends HtmlDocletWriter {
HtmlTree mainTree = HtmlTree.MAIN();
/**
* Constructor to construct HelpWriter object.
* @param filename File to be generated.
@ -81,12 +83,24 @@ public class HelpWriter extends HtmlDocletWriter {
*/
protected void generateHelpFile() throws IOException {
String title = configuration.getText("doclet.Window_Help_title");
Content body = getBody(true, getWindowTitle(title));
addTop(body);
addNavLinks(true, body);
HtmlTree body = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: body;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
body.addContent(htmlTree);
}
addHelpFileContents(body);
addNavLinks(false, body);
addBottom(body);
if (configuration.allowTag(HtmlTag.FOOTER)) {
htmlTree = HtmlTree.FOOTER();
}
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
body.addContent(htmlTree);
}
printHtmlDocument(null, true, body);
}
@ -105,26 +119,39 @@ public class HelpWriter extends HtmlDocletWriter {
Content line2 = HtmlTree.DIV(HtmlStyle.subTitle,
getResource("doclet.Help_line_2"));
div.addContent(line2);
contentTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
contentTree.addContent(div);
}
HtmlTree htmlTree;
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
if (configuration.createoverview) {
Content overviewHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Overview"));
Content liOverview = HtmlTree.LI(HtmlStyle.blockList, overviewHeading);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(overviewHeading)
: HtmlTree.LI(HtmlStyle.blockList, overviewHeading);
Content line3 = getResource("doclet.Help_line_3",
getHyperLink(DocPaths.OVERVIEW_SUMMARY,
configuration.getText("doclet.Overview")));
Content overviewPara = HtmlTree.P(line3);
liOverview.addContent(overviewPara);
ul.addContent(liOverview);
htmlTree.addContent(overviewPara);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
}
Content packageHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Package"));
Content liPackage = HtmlTree.LI(HtmlStyle.blockList, packageHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(packageHead)
: HtmlTree.LI(HtmlStyle.blockList, packageHead);
Content line4 = getResource("doclet.Help_line_4");
Content packagePara = HtmlTree.P(line4);
liPackage.addContent(packagePara);
htmlTree.addContent(packagePara);
HtmlTree ulPackage = new HtmlTree(HtmlTag.UL);
ulPackage.addContent(HtmlTree.LI(
getResource("doclet.Interfaces_Italic")));
@ -138,14 +165,20 @@ public class HelpWriter extends HtmlDocletWriter {
getResource("doclet.Errors")));
ulPackage.addContent(HtmlTree.LI(
getResource("doclet.AnnotationTypes")));
liPackage.addContent(ulPackage);
ul.addContent(liPackage);
htmlTree.addContent(ulPackage);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
Content classHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Help_line_5"));
Content liClass = HtmlTree.LI(HtmlStyle.blockList, classHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(classHead)
: HtmlTree.LI(HtmlStyle.blockList, classHead);
Content line6 = getResource("doclet.Help_line_6");
Content classPara = HtmlTree.P(line6);
liClass.addContent(classPara);
htmlTree.addContent(classPara);
HtmlTree ul1 = new HtmlTree(HtmlTag.UL);
ul1.addContent(HtmlTree.LI(
getResource("doclet.Help_line_7")));
@ -159,7 +192,7 @@ public class HelpWriter extends HtmlDocletWriter {
getResource("doclet.Help_line_11")));
ul1.addContent(HtmlTree.LI(
getResource("doclet.Help_line_12")));
liClass.addContent(ul1);
htmlTree.addContent(ul1);
HtmlTree ul2 = new HtmlTree(HtmlTag.UL);
ul2.addContent(HtmlTree.LI(
getResource("doclet.Nested_Class_Summary")));
@ -169,7 +202,7 @@ public class HelpWriter extends HtmlDocletWriter {
getResource("doclet.Constructor_Summary")));
ul2.addContent(HtmlTree.LI(
getResource("doclet.Method_Summary")));
liClass.addContent(ul2);
htmlTree.addContent(ul2);
HtmlTree ul3 = new HtmlTree(HtmlTag.UL);
ul3.addContent(HtmlTree.LI(
getResource("doclet.Field_Detail")));
@ -177,18 +210,24 @@ public class HelpWriter extends HtmlDocletWriter {
getResource("doclet.Constructor_Detail")));
ul3.addContent(HtmlTree.LI(
getResource("doclet.Method_Detail")));
liClass.addContent(ul3);
htmlTree.addContent(ul3);
Content line13 = getResource("doclet.Help_line_13");
Content para = HtmlTree.P(line13);
liClass.addContent(para);
ul.addContent(liClass);
htmlTree.addContent(para);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
//Annotation Types
Content aHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.AnnotationType"));
Content liAnnotation = HtmlTree.LI(HtmlStyle.blockList, aHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(aHead)
: HtmlTree.LI(HtmlStyle.blockList, aHead);
Content aline1 = getResource("doclet.Help_annotation_type_line_1");
Content aPara = HtmlTree.P(aline1);
liAnnotation.addContent(aPara);
htmlTree.addContent(aPara);
HtmlTree aul = new HtmlTree(HtmlTag.UL);
aul.addContent(HtmlTree.LI(
getResource("doclet.Help_annotation_type_line_2")));
@ -200,15 +239,21 @@ public class HelpWriter extends HtmlDocletWriter {
getResource("doclet.Annotation_Type_Optional_Member_Summary")));
aul.addContent(HtmlTree.LI(
getResource("doclet.Annotation_Type_Member_Detail")));
liAnnotation.addContent(aul);
ul.addContent(liAnnotation);
htmlTree.addContent(aul);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
//Enums
Content enumHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Enum"));
Content liEnum = HtmlTree.LI(HtmlStyle.blockList, enumHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(enumHead)
: HtmlTree.LI(HtmlStyle.blockList, enumHead);
Content eline1 = getResource("doclet.Help_enum_line_1");
Content enumPara = HtmlTree.P(eline1);
liEnum.addContent(enumPara);
htmlTree.addContent(enumPara);
HtmlTree eul = new HtmlTree(HtmlTag.UL);
eul.addContent(HtmlTree.LI(
getResource("doclet.Help_enum_line_2")));
@ -218,46 +263,68 @@ public class HelpWriter extends HtmlDocletWriter {
getResource("doclet.Enum_Constant_Summary")));
eul.addContent(HtmlTree.LI(
getResource("doclet.Enum_Constant_Detail")));
liEnum.addContent(eul);
ul.addContent(liEnum);
htmlTree.addContent(eul);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
if (configuration.classuse) {
Content useHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Help_line_14"));
Content liUse = HtmlTree.LI(HtmlStyle.blockList, useHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(useHead)
: HtmlTree.LI(HtmlStyle.blockList, useHead);
Content line15 = getResource("doclet.Help_line_15");
Content usePara = HtmlTree.P(line15);
liUse.addContent(usePara);
ul.addContent(liUse);
htmlTree.addContent(usePara);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
}
if (configuration.createtree) {
Content treeHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Help_line_16"));
Content liTree = HtmlTree.LI(HtmlStyle.blockList, treeHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(treeHead)
: HtmlTree.LI(HtmlStyle.blockList, treeHead);
Content line17 = getResource("doclet.Help_line_17_with_tree_link",
getHyperLink(DocPaths.OVERVIEW_TREE,
configuration.getText("doclet.Class_Hierarchy")),
HtmlTree.CODE(new StringContent("java.lang.Object")));
Content treePara = HtmlTree.P(line17);
liTree.addContent(treePara);
htmlTree.addContent(treePara);
HtmlTree tul = new HtmlTree(HtmlTag.UL);
tul.addContent(HtmlTree.LI(
getResource("doclet.Help_line_18")));
tul.addContent(HtmlTree.LI(
getResource("doclet.Help_line_19")));
liTree.addContent(tul);
ul.addContent(liTree);
htmlTree.addContent(tul);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
}
if (!(configuration.nodeprecatedlist ||
configuration.nodeprecated)) {
Content dHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Deprecated_API"));
Content liDeprecated = HtmlTree.LI(HtmlStyle.blockList, dHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(dHead)
: HtmlTree.LI(HtmlStyle.blockList, dHead);
Content line20 = getResource("doclet.Help_line_20_with_deprecated_api_link",
getHyperLink(DocPaths.DEPRECATED_LIST,
configuration.getText("doclet.Deprecated_API")));
Content dPara = HtmlTree.P(line20);
liDeprecated.addContent(dPara);
ul.addContent(liDeprecated);
htmlTree.addContent(dPara);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
}
if (configuration.createindex) {
Content indexlink;
@ -270,55 +337,96 @@ public class HelpWriter extends HtmlDocletWriter {
}
Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Help_line_21"));
Content liIndex = HtmlTree.LI(HtmlStyle.blockList, indexHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(indexHead)
: HtmlTree.LI(HtmlStyle.blockList, indexHead);
Content line22 = getResource("doclet.Help_line_22", indexlink);
Content indexPara = HtmlTree.P(line22);
liIndex.addContent(indexPara);
ul.addContent(liIndex);
htmlTree.addContent(indexPara);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
}
Content prevHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Help_line_23"));
Content liPrev = HtmlTree.LI(HtmlStyle.blockList, prevHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(prevHead)
: HtmlTree.LI(HtmlStyle.blockList, prevHead);
Content line24 = getResource("doclet.Help_line_24");
Content prevPara = HtmlTree.P(line24);
liPrev.addContent(prevPara);
ul.addContent(liPrev);
htmlTree.addContent(prevPara);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
Content frameHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Help_line_25"));
Content liFrame = HtmlTree.LI(HtmlStyle.blockList, frameHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(frameHead)
: HtmlTree.LI(HtmlStyle.blockList, frameHead);
Content line26 = getResource("doclet.Help_line_26");
Content framePara = HtmlTree.P(line26);
liFrame.addContent(framePara);
ul.addContent(liFrame);
htmlTree.addContent(framePara);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
Content allclassesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.All_Classes"));
Content liAllClasses = HtmlTree.LI(HtmlStyle.blockList, allclassesHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(allclassesHead)
: HtmlTree.LI(HtmlStyle.blockList, allclassesHead);
Content line27 = getResource("doclet.Help_line_27",
getHyperLink(DocPaths.ALLCLASSES_NOFRAME,
configuration.getText("doclet.All_Classes")));
Content allclassesPara = HtmlTree.P(line27);
liAllClasses.addContent(allclassesPara);
ul.addContent(liAllClasses);
htmlTree.addContent(allclassesPara);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
Content sHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Serialized_Form"));
Content liSerial = HtmlTree.LI(HtmlStyle.blockList, sHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(sHead)
: HtmlTree.LI(HtmlStyle.blockList, sHead);
Content line28 = getResource("doclet.Help_line_28");
Content serialPara = HtmlTree.P(line28);
liSerial.addContent(serialPara);
ul.addContent(liSerial);
htmlTree.addContent(serialPara);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
Content constHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Constants_Summary"));
Content liConst = HtmlTree.LI(HtmlStyle.blockList, constHead);
htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(constHead)
: HtmlTree.LI(HtmlStyle.blockList, constHead);
Content line29 = getResource("doclet.Help_line_29",
getHyperLink(DocPaths.CONSTANT_VALUES,
configuration.getText("doclet.Constants_Summary")));
Content constPara = HtmlTree.P(line29);
liConst.addContent(constPara);
ul.addContent(liConst);
htmlTree.addContent(constPara);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul);
Content line30 = HtmlTree.SPAN(HtmlStyle.emphasizedPhrase, getResource("doclet.Help_line_30"));
divContent.addContent(line30);
contentTree.addContent(divContent);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(divContent);
contentTree.addContent(mainTree);
} else {
contentTree.addContent(divContent);
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -183,8 +183,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
* @return a content tree for the script
*/
public Content getAllClassesLinkScript(String id) {
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
script.addAttr(HtmlAttr.TYPE, "text/javascript");
HtmlTree script = HtmlTree.SCRIPT();
String scriptCode = "<!--" + DocletConstants.NL +
" allClassesLink = document.getElementById(\"" + id + "\");" + DocletConstants.NL +
" if(window==top) {" + DocletConstants.NL +
@ -197,6 +196,9 @@ public class HtmlDocletWriter extends HtmlDocWriter {
Content scriptContent = new RawHtml(scriptCode);
script.addContent(scriptContent);
Content div = HtmlTree.DIV(script);
Content div_noscript = HtmlTree.DIV(getResource("doclet.No_Script_Message"));
Content noScript = HtmlTree.NOSCRIPT(div_noscript);
div.addContent(noScript);
return div;
}
@ -342,8 +344,9 @@ public class HtmlDocletWriter extends HtmlDocWriter {
if(classes.length > 0) {
Arrays.sort(classes);
Content caption = getTableCaption(new RawHtml(label));
Content table = HtmlTree.TABLE(HtmlStyle.typeSummary, 0, 3, 0,
tableSummary, caption);
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.typeSummary, caption)
: HtmlTree.TABLE(HtmlStyle.typeSummary, tableSummary, caption);
table.addContent(getSummaryTableHeader(tableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
for (int i = 0; i < classes.length; i++) {
@ -393,7 +396,9 @@ public class HtmlDocletWriter extends HtmlDocWriter {
*/
public void printHtmlDocument(String[] metakeywords, boolean includeScript,
Content body) throws IOException {
Content htmlDocType = DocType.TRANSITIONAL;
Content htmlDocType = configuration.isOutputHtml5()
? DocType.HTML5
: DocType.TRANSITIONAL;
Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
Content head = new HtmlTree(HtmlTag.HEAD);
head.addContent(getGeneratedBy(!configuration.notimestamp));
@ -404,7 +409,9 @@ public class HtmlDocletWriter extends HtmlDocWriter {
head.addContent(meta);
if (!configuration.notimestamp) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
meta = HtmlTree.META("date", dateFormat.format(new Date()));
meta = HtmlTree.META(configuration.isOutputHtml5()
? "dc.created"
: "date", dateFormat.format(new Date()));
head.addContent(meta);
}
if (metakeywords != null) {
@ -459,38 +466,41 @@ public class HtmlDocletWriter extends HtmlDocWriter {
/**
* Adds the user specified top.
*
* @param body the content tree to which user specified top will be added
* @param htmlTree the content tree to which user specified top will be added
*/
public void addTop(Content body) {
public void addTop(Content htmlTree) {
Content top = new RawHtml(replaceDocRootDir(configuration.top));
body.addContent(top);
htmlTree.addContent(top);
}
/**
* Adds the user specified bottom.
*
* @param body the content tree to which user specified bottom will be added
* @param htmlTree the content tree to which user specified bottom will be added
*/
public void addBottom(Content body) {
public void addBottom(Content htmlTree) {
Content bottom = new RawHtml(replaceDocRootDir(configuration.bottom));
Content small = HtmlTree.SMALL(bottom);
Content p = HtmlTree.P(HtmlStyle.legalCopy, small);
body.addContent(p);
htmlTree.addContent(p);
}
/**
* Adds the navigation bar for the Html page at the top and and the bottom.
*
* @param header If true print navigation bar at the top of the page else
* @param body the HtmlTree to which the nav links will be added
* @param htmlTree the HtmlTree to which the nav links will be added
*/
protected void addNavLinks(boolean header, Content body) {
protected void addNavLinks(boolean header, Content htmlTree) {
if (!configuration.nonavbar) {
Content tree = (configuration.allowTag(HtmlTag.NAV))
? HtmlTree.NAV()
: htmlTree;
String allClassesId = "allclasses_";
HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
Content skipNavLinks = configuration.getResource("doclet.Skip_navigation_links");
if (header) {
body.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
tree.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
navDiv.addStyle(HtmlStyle.topNav);
allClassesId += "navbar_top";
Content a = getMarkerAnchor(SectionName.NAVBAR_TOP);
@ -501,7 +511,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
skipNavLinks.toString(), ""));
navDiv.addContent(skipLinkContent);
} else {
body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
tree.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
navDiv.addStyle(HtmlStyle.bottomNav);
allClassesId += "navbar_bottom";
Content a = getMarkerAnchor(SectionName.NAVBAR_BOTTOM);
@ -548,7 +558,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
navDiv.addContent(navList);
Content aboutDiv = HtmlTree.DIV(HtmlStyle.aboutLanguage, getUserHeaderFooter(header));
navDiv.addContent(aboutDiv);
body.addContent(navDiv);
tree.addContent(navDiv);
Content ulNav = HtmlTree.UL(HtmlStyle.navList, getNavLinkPrevious());
ulNav.addContent(getNavLinkNext());
Content subDiv = HtmlTree.DIV(HtmlStyle.subNav, ulNav);
@ -562,12 +572,15 @@ public class HtmlDocletWriter extends HtmlDocWriter {
addSummaryDetailLinks(subDiv);
if (header) {
subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_TOP));
body.addContent(subDiv);
body.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
tree.addContent(subDiv);
tree.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
} else {
subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_BOTTOM));
body.addContent(subDiv);
body.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR);
tree.addContent(subDiv);
tree.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR);
}
if (configuration.allowTag(HtmlTag.NAV)) {
htmlTree.addContent(tree);
}
}
}
@ -904,7 +917,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
public Content getMarkerAnchor(String anchorName, Content anchorContent) {
if (anchorContent == null)
anchorContent = new Comment(" ");
Content markerAnchor = HtmlTree.A_NAME(anchorName, anchorContent);
Content markerAnchor = HtmlTree.A_ID(anchorName, anchorContent);
return markerAnchor;
}
@ -942,8 +955,10 @@ public class HtmlDocletWriter extends HtmlDocWriter {
protected void addPackageDeprecatedAPI(List<Doc> deprPkgs, String headingKey,
String tableSummary, String[] tableHeader, Content contentTree) {
if (deprPkgs.size() > 0) {
Content table = HtmlTree.TABLE(HtmlStyle.deprecatedSummary, 0, 3, 0, tableSummary,
getTableCaption(configuration.getResource(headingKey)));
Content caption = getTableCaption(configuration.getResource(headingKey));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
: HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
table.addContent(getSummaryTableHeader(tableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
for (int i = 0; i < deprPkgs.size(); i++) {
@ -1829,8 +1844,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
* @return an HtmlTree for the Script tag which provides the JavaScript location
*/
public HtmlTree getScriptProperties() {
HtmlTree script = HtmlTree.SCRIPT("text/javascript",
pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath());
HtmlTree script = HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath());
return script;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -150,7 +150,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
writer.getTagletWriterInstance(false), tagContent);
Content dlTags = new HtmlTree(HtmlTag.DL);
dlTags.addContent(tagContent);
methodsContentTree.addContent(dlTags); // TODO: what if empty?
methodsContentTree.addContent(dlTags);
MethodDoc method = member;
if (method.name().compareTo("writeExternal") == 0
&& method.tags("serialData").length == 0) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -79,6 +79,13 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
return memberTree;
}
/**
* {@inheritDoc}
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
}
/**
* {@inheritDoc}
*/
@ -182,6 +189,10 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
* {@inheritDoc}
*/
public Content getMethodDetails(Content methodDetailsTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(methodDetailsTree));
return htmlTree;
}
return getMemberTree(methodDetailsTree);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -68,6 +68,13 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
return memberTree;
}
/**
* {@inheritDoc}
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
}
/**
* Close the writer.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -93,15 +93,21 @@ public class PackageFrameWriter extends HtmlDocletWriter {
try {
packgen = new PackageFrameWriter(configuration, packageDoc);
String pkgName = configuration.utils.getPackageName(packageDoc);
Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
HtmlTree body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
Content pkgNameContent = new StringContent(pkgName);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN()
: body;
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
packgen.getTargetPackageLink(packageDoc, "classFrame", pkgNameContent));
body.addContent(heading);
htmlTree.addContent(heading);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.indexContainer);
packgen.addClassListing(div);
body.addContent(div);
htmlTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
body.addContent(htmlTree);
}
packgen.printHtmlDocument(
configuration.metakeywords.getMetaKeywords(packageDoc), false, body);
packgen.close();
@ -120,7 +126,7 @@ public class PackageFrameWriter extends HtmlDocletWriter {
*
* @param contentTree the content tree to which the listing will be added
*/
protected void addClassListing(Content contentTree) {
protected void addClassListing(HtmlTree contentTree) {
Configuration config = configuration;
if (packageDoc.isIncluded()) {
addClassKindListing(packageDoc.interfaces(),
@ -160,11 +166,14 @@ public class PackageFrameWriter extends HtmlDocletWriter {
* @param contentTree the content tree to which the class kind listing will be added
*/
protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
Content contentTree) {
HtmlTree contentTree) {
arr = utils.filterOutPrivateClasses(arr, configuration.javafx);
if(arr.length > 0) {
Arrays.sort(arr);
boolean printedHeader = false;
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION()
: contentTree;
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setTitle(labelContent);
for (ClassDoc classDoc : arr) {
@ -177,7 +186,7 @@ public class PackageFrameWriter extends HtmlDocletWriter {
if (!printedHeader) {
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
true, labelContent);
contentTree.addContent(heading);
htmlTree.addContent(heading);
printedHeader = true;
}
Content arr_i_name = new StringContent(classDoc.name());
@ -188,7 +197,10 @@ public class PackageFrameWriter extends HtmlDocletWriter {
Content li = HtmlTree.LI(link);
ul.addContent(li);
}
contentTree.addContent(ul);
htmlTree.addContent(ul);
if (configuration.allowTag(HtmlTag.SECTION)) {
contentTree.addContent(htmlTree);
}
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -83,7 +83,9 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
String tableSummary, Content body) {
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
packagesLabel);
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN(HtmlStyle.indexContainer, heading)
: HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setTitle(packagesLabel);
for (PackageDoc aPackage : packages) {
@ -94,8 +96,8 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
ul.addContent(getPackage(aPackage));
}
}
div.addContent(ul);
body.addContent(div);
htmlTree.addContent(ul);
body.addContent(htmlTree);
}
/**
@ -146,26 +148,26 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
* Adds "All Classes" link for the top of the left-hand frame page to the
* documentation tree.
*
* @param div the Content object to which the all classes link should be added
* @param ul the Content object to which the "All Classes" link should be added
*/
protected void addAllClassesLink(Content div) {
protected void addAllClassesLink(Content ul) {
Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
allclassesLabel, "", "packageFrame");
Content span = HtmlTree.SPAN(linkContent);
div.addContent(span);
Content li = HtmlTree.LI(linkContent);
ul.addContent(li);
}
/**
* Adds "All Profiles" link for the top of the left-hand frame page to the
* documentation tree.
*
* @param div the Content object to which the all profiles link should be added
* @param ul the Content object to which the "All Profiles" link should be added
*/
protected void addAllProfilesLink(Content div) {
protected void addAllProfilesLink(Content ul) {
Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
allprofilesLabel, "", "packageListFrame");
Content span = HtmlTree.SPAN(linkContent);
div.addContent(span);
Content li = HtmlTree.LI(linkContent);
ul.addContent(li);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -66,6 +66,11 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
*/
private List<String> groupList;
/**
* HTML tree for main tag.
*/
private HtmlTree htmlTree = HtmlTree.MAIN();
/**
* Construct the PackageIndexWriter. Also constructs the grouping
* information as provided on the command line by "-group" option. Stores
@ -140,7 +145,11 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
}
profilesDiv.addContent(ul);
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, profilesDiv);
body.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
htmlTree.addContent(div);
} else {
body.addContent(div);
}
}
/**
@ -148,14 +157,19 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
*/
protected void addPackagesList(Collection<PackageDoc> packages, String text,
String tableSummary, Content body) {
Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
getTableCaption(new RawHtml(text)));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.overviewSummary, getTableCaption(new RawHtml(text)))
: HtmlTree.TABLE(HtmlStyle.overviewSummary, tableSummary, getTableCaption(new RawHtml(text)));
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
addPackagesList(packages, tbody);
table.addContent(tbody);
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
body.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
htmlTree.addContent(div);
} else {
body.addContent(div);
}
}
/**
@ -192,6 +206,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
* @param body the documentation tree to which the overview header will be added
*/
protected void addOverviewHeader(Content body) {
addConfigurationTitle(body);
if (root.inlineTags().length > 0) {
HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV);
subTitleDiv.addStyle(HtmlStyle.subTitle);
@ -205,7 +220,11 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
descriptionLabel, "", "");
descPara.addContent(descLink);
div.addContent(descPara);
body.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
htmlTree.addContent(div);
} else {
body.addContent(div);
}
}
}
@ -235,7 +254,12 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
div.addStyle(HtmlStyle.contentContainer);
addOverviewComment(div);
addTagsInfo(root, div);
body.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
htmlTree.addContent(div);
body.addContent(htmlTree);
} else {
body.addContent(div);
}
}
/**
@ -246,9 +270,14 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
* @body the documentation tree to which the navigation bar header will be added
*/
protected void addNavigationBarHeader(Content body) {
addTop(body);
addNavLinks(true, body);
addConfigurationTitle(body);
Content htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: body;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
body.addContent(htmlTree);
}
}
/**
@ -258,7 +287,13 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
* @param body the documentation tree to which the navigation bar footer will be added
*/
protected void addNavigationBarFooter(Content body) {
addNavLinks(false, body);
addBottom(body);
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: body;
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
body.addContent(htmlTree);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -113,7 +113,10 @@ public class PackageTreeWriter extends AbstractTreeWriter {
* Generate a separate tree file for each package.
*/
protected void generatePackageTreeFile() throws IOException {
Content body = getPackageTreeHeader();
HtmlTree body = getPackageTreeHeader();
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN()
: body;
Content headContent = getResource("doclet.Hierarchy_For_Package",
utils.getPackageName(packagedoc));
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
@ -122,16 +125,25 @@ public class PackageTreeWriter extends AbstractTreeWriter {
if (configuration.packages.size() > 1) {
addLinkToMainTree(div);
}
body.addContent(div);
htmlTree.addContent(div);
HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
divTree.addStyle(HtmlStyle.contentContainer);
addTree(classtree.baseclasses(), "doclet.Class_Hierarchy", divTree);
addTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy", divTree);
addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", divTree);
addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", divTree);
body.addContent(divTree);
addNavLinks(false, body);
addBottom(body);
htmlTree.addContent(divTree);
if (configuration.allowTag(HtmlTag.MAIN)) {
body.addContent(htmlTree);
}
HtmlTree tree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: body;
addNavLinks(false, tree);
addBottom(tree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
body.addContent(tree);
}
printHtmlDocument(null, true, body);
}
@ -140,12 +152,18 @@ public class PackageTreeWriter extends AbstractTreeWriter {
*
* @return a content tree for the header
*/
protected Content getPackageTreeHeader() {
protected HtmlTree getPackageTreeHeader() {
String title = packagedoc.name() + " " +
configuration.getText("doclet.Window_Class_Hierarchy");
Content bodyTree = getBody(true, getWindowTitle(title));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
return bodyTree;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,6 +48,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
final PackageDoc pkgdoc;
final SortedMap<String,Set<ClassDoc>> usingPackageToUsedClasses = new TreeMap<>();
protected HtmlTree mainTree = HtmlTree.MAIN();
/**
* Constructor.
@ -112,7 +113,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
* Generate the package use list.
*/
protected void generatePackageUseFile() throws IOException {
Content body = getPackageUseHeader();
HtmlTree body = getPackageUseHeader();
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.contentContainer);
if (usingPackageToUsedClasses.isEmpty()) {
@ -121,9 +122,20 @@ public class PackageUseWriter extends SubWriterHolderWriter {
} else {
addPackageUse(div);
}
body.addContent(div);
addNavLinks(false, body);
addBottom(body);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
body.addContent(mainTree);
} else {
body.addContent(div);
}
HtmlTree tree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: body;
addNavLinks(false, tree);
addBottom(tree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
body.addContent(tree);
}
printHtmlDocument(null, true, body);
}
@ -148,10 +160,12 @@ public class PackageUseWriter extends SubWriterHolderWriter {
* @param contentTree the content tree to which the package list will be added
*/
protected void addPackageList(Content contentTree) throws IOException {
Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary,
getTableCaption(configuration.getResource(
Content caption = getTableCaption(configuration.getResource(
"doclet.ClassUse_Packages.that.use.0",
getPackageLink(pkgdoc, utils.getPackageName(pkgdoc)))));
getPackageLink(pkgdoc, utils.getPackageName(pkgdoc))));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
: HtmlTree.TABLE(HtmlStyle.useSummary, useTableSummary, caption);
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<String> it = usingPackageToUsedClasses.keySet().iterator();
@ -191,11 +205,13 @@ public class PackageUseWriter extends SubWriterHolderWriter {
}
String tableSummary = configuration.getText("doclet.Use_Table_Summary",
configuration.getText("doclet.classes"));
Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, tableSummary,
getTableCaption(configuration.getResource(
"doclet.ClassUse_Classes.in.0.used.by.1",
getPackageLink(pkgdoc, utils.getPackageName(pkgdoc)),
getPackageLink(usingPackage, utils.getPackageName(usingPackage)))));
Content caption = getTableCaption(configuration.getResource(
"doclet.ClassUse_Classes.in.0.used.by.1",
getPackageLink(pkgdoc, utils.getPackageName(pkgdoc)),
getPackageLink(usingPackage, utils.getPackageName(usingPackage))));
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
: HtmlTree.TABLE(HtmlStyle.useSummary, tableSummary, caption);
table.addContent(getSummaryTableHeader(classTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<ClassDoc> itc =
@ -259,14 +275,20 @@ public class PackageUseWriter extends SubWriterHolderWriter {
*
* @return a content tree representing the package use header
*/
protected Content getPackageUseHeader() {
protected HtmlTree getPackageUseHeader() {
String packageText = configuration.getText("doclet.Package");
String name = pkgdoc.name();
String title = configuration.getText("doclet.Window_ClassUse_Header",
packageText, name);
Content bodyTree = getBody(true, getWindowTitle(title));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
ContentBuilder headContent = new ContentBuilder();
headContent.addContent(getResource("doclet.ClassUse_Title", packageText));
headContent.addContent(new HtmlTree(HtmlTag.BR));
@ -274,7 +296,11 @@ public class PackageUseWriter extends SubWriterHolderWriter {
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
bodyTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -64,6 +64,16 @@ public class PackageWriterImpl extends HtmlDocletWriter
*/
protected PackageDoc packageDoc;
/**
* The HTML tree for main tag.
*/
protected HtmlTree mainTree = HtmlTree.MAIN();
/**
* The HTML tree for section tag.
*/
protected HtmlTree sectionTree = HtmlTree.SECTION();
/**
* Constructor to construct PackageWriter object and to generate
* "package-summary.html" file in the respective package directory.
@ -90,9 +100,15 @@ public class PackageWriterImpl extends HtmlDocletWriter
* {@inheritDoc}
*/
public Content getPackageHeader(String heading) {
Content bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageDoc)));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageDoc)));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.header);
Content annotationContent = new HtmlTree(HtmlTag.P);
@ -117,7 +133,11 @@ public class PackageWriterImpl extends HtmlDocletWriter
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
div.addContent(descPara);
}
bodyTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
}
@ -169,8 +189,9 @@ public class PackageWriterImpl extends HtmlDocletWriter
if(classes.length > 0) {
Arrays.sort(classes);
Content caption = getTableCaption(new RawHtml(label));
Content table = HtmlTree.TABLE(HtmlStyle.typeSummary, 0, 3, 0,
tableSummary, caption);
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.typeSummary, caption)
: HtmlTree.TABLE(HtmlStyle.typeSummary, tableSummary, caption);
table.addContent(getSummaryTableHeader(tableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
for (int i = 0; i < classes.length; i++) {
@ -216,9 +237,14 @@ public class PackageWriterImpl extends HtmlDocletWriter
Content h2Content = new StringContent(
configuration.getText("doclet.Package_Description",
packageDoc.name()));
packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
true, h2Content));
addInlineComment(packageDoc, packageContentTree);
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, h2Content);
if (configuration.allowTag(HtmlTag.SECTION)) {
sectionTree.addContent(heading);
addInlineComment(packageDoc, sectionTree);
} else {
packageContentTree.addContent(heading);
addInlineComment(packageDoc, packageContentTree);
}
}
}
@ -226,15 +252,37 @@ public class PackageWriterImpl extends HtmlDocletWriter
* {@inheritDoc}
*/
public void addPackageTags(Content packageContentTree) {
addTagsInfo(packageDoc, packageContentTree);
Content htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? sectionTree
: packageContentTree;
addTagsInfo(packageDoc, htmlTree);
}
/**
* {@inheritDoc}
*/
public void addPackageContent(Content contentTree, Content packageContentTree) {
if (configuration.allowTag(HtmlTag.MAIN)) {
packageContentTree.addContent(sectionTree);
mainTree.addContent(packageContentTree);
contentTree.addContent(mainTree);
} else {
contentTree.addContent(packageContentTree);
}
}
/**
* {@inheritDoc}
*/
public void addPackageFooter(Content contentTree) {
addNavLinks(false, contentTree);
addBottom(contentTree);
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: contentTree;
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
contentTree.addContent(htmlTree);
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -85,7 +85,9 @@ public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter {
String tableSummary, Content body) {
Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true,
profilesLabel);
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN(HtmlStyle.indexContainer, heading)
: HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setTitle(profilesLabel);
String profileName;
@ -96,8 +98,8 @@ public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter {
if (configuration.shouldDocumentProfile(profileName))
ul.addContent(getProfile(profileName));
}
div.addContent(ul);
body.addContent(div);
htmlTree.addContent(ul);
body.addContent(htmlTree);
}
/**
@ -141,26 +143,26 @@ public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter {
* Adds "All Classes" link for the top of the left-hand frame page to the
* documentation tree.
*
* @param div the Content object to which the all classes link should be added
* @param ul the Content object to which the all classes link should be added
*/
protected void addAllClassesLink(Content div) {
protected void addAllClassesLink(Content ul) {
Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
allclassesLabel, "", "packageFrame");
Content span = HtmlTree.SPAN(linkContent);
div.addContent(span);
Content li = HtmlTree.LI(linkContent);
ul.addContent(li);
}
/**
* Adds "All Packages" link for the top of the left-hand frame page to the
* documentation tree.
*
* @param div the Content object to which the all packages link should be added
* @param ul the Content object to which the all packages link should be added
*/
protected void addAllPackagesLink(Content div) {
protected void addAllPackagesLink(Content ul) {
Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
allpackagesLabel, "", "packageListFrame");
Content span = HtmlTree.SPAN(linkContent);
div.addContent(span);
Content li = HtmlTree.LI(linkContent);
ul.addContent(li);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -93,21 +93,27 @@ public class ProfilePackageFrameWriter extends HtmlDocletWriter {
winTitle.append(sep);
String pkgName = configuration.utils.getPackageName(packageDoc);
winTitle.append(pkgName);
Content body = profpackgen.getBody(false,
HtmlTree body = profpackgen.getBody(false,
profpackgen.getWindowTitle(winTitle.toString()));
Content profName = new StringContent(profileName);
Content sepContent = new StringContent(sep);
Content pkgNameContent = new RawHtml(pkgName);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN()
: body;
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
profpackgen.getTargetProfileLink("classFrame", profName, profileName));
heading.addContent(sepContent);
heading.addContent(profpackgen.getTargetProfilePackageLink(packageDoc,
"classFrame", pkgNameContent, profileName));
body.addContent(heading);
htmlTree.addContent(heading);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.indexContainer);
profpackgen.addClassListing(div, profileValue);
body.addContent(div);
htmlTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
body.addContent(htmlTree);
}
profpackgen.printHtmlDocument(
configuration.metakeywords.getMetaKeywords(packageDoc), false, body);
profpackgen.close();
@ -127,7 +133,7 @@ public class ProfilePackageFrameWriter extends HtmlDocletWriter {
* @param contentTree the content tree to which the listing will be added
* @param profileValue the value of the profile being documented
*/
protected void addClassListing(Content contentTree, int profileValue) {
protected void addClassListing(HtmlTree contentTree, int profileValue) {
if (packageDoc.isIncluded()) {
addClassKindListing(packageDoc.interfaces(),
getResource("doclet.Interfaces"), contentTree, profileValue);
@ -153,10 +159,13 @@ public class ProfilePackageFrameWriter extends HtmlDocletWriter {
* @param profileValue the value of the profile being documented
*/
protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
Content contentTree, int profileValue) {
HtmlTree contentTree, int profileValue) {
if(arr.length > 0) {
Arrays.sort(arr);
boolean printedHeader = false;
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION()
: contentTree;
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setTitle(labelContent);
for (ClassDoc classDoc : arr) {
@ -170,7 +179,7 @@ public class ProfilePackageFrameWriter extends HtmlDocletWriter {
if (!printedHeader) {
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
true, labelContent);
contentTree.addContent(heading);
htmlTree.addContent(heading);
printedHeader = true;
}
Content arr_i_name = new StringContent(classDoc.name());
@ -181,7 +190,10 @@ public class ProfilePackageFrameWriter extends HtmlDocletWriter {
Content li = HtmlTree.LI(link);
ul.addContent(li);
}
contentTree.addContent(ul);
htmlTree.addContent(ul);
if (configuration.allowTag(HtmlTag.SECTION)) {
contentTree.addContent(htmlTree);
}
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -90,7 +90,9 @@ public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter {
getTargetProfileLink("classFrame", profNameContent, profileName));
heading.addContent(getSpace());
heading.addContent(packagesLabel);
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN(HtmlStyle.indexContainer, heading)
: HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setTitle(packagesLabel);
List<PackageDoc> packages = configuration.profilePackages.get(profileName);
@ -99,8 +101,8 @@ public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter {
ul.addContent(getPackage(packageDoc, profileName));
}
}
div.addContent(ul);
body.addContent(div);
htmlTree.addContent(ul);
body.addContent(htmlTree);
}
/**
@ -156,39 +158,39 @@ public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter {
* Adds "All Classes" link for the top of the left-hand frame page to the
* documentation tree.
*
* @param div the Content object to which the all classes link should be added
* @param ul the Content object to which the all classes link should be added
*/
protected void addAllClassesLink(Content div) {
protected void addAllClassesLink(Content ul) {
Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
allclassesLabel, "", "packageFrame");
Content span = HtmlTree.SPAN(linkContent);
div.addContent(span);
Content li = HtmlTree.LI(linkContent);
ul.addContent(li);
}
/**
* Adds "All Packages" link for the top of the left-hand frame page to the
* documentation tree.
*
* @param div the Content object to which the all packages link should be added
* @param ul the Content object to which the all packages link should be added
*/
protected void addAllPackagesLink(Content div) {
protected void addAllPackagesLink(Content ul) {
Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
allpackagesLabel, "", "packageListFrame");
Content span = HtmlTree.SPAN(linkContent);
div.addContent(span);
Content li = HtmlTree.LI(linkContent);
ul.addContent(li);
}
/**
* Adds "All Profiles" link for the top of the left-hand frame page to the
* documentation tree.
*
* @param div the Content object to which the all profiles link should be added
* @param ul the Content object to which the all profiles link should be added
*/
protected void addAllProfilesLink(Content div) {
protected void addAllProfilesLink(Content ul) {
Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
allprofilesLabel, "", "packageListFrame");
Content span = HtmlTree.SPAN(linkContent);
div.addContent(span);
Content li = HtmlTree.LI(linkContent);
ul.addContent(li);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -73,6 +73,16 @@ public class ProfilePackageWriterImpl extends HtmlDocletWriter
*/
protected int profileValue;
/**
* The HTML tree for main tag.
*/
protected HtmlTree mainTree = HtmlTree.MAIN();
/**
* The HTML tree for section tag.
*/
protected HtmlTree sectionTree = HtmlTree.SECTION();
/**
* Constructor to construct ProfilePackageWriter object and to generate
* "profilename-package-summary.html" file in the respective package directory.
@ -103,9 +113,15 @@ public class ProfilePackageWriterImpl extends HtmlDocletWriter
* {@inheritDoc}
*/
public Content getPackageHeader(String heading) {
Content bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageDoc)));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageDoc)));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.header);
Content profileContent = new StringContent(profileName);
@ -133,7 +149,11 @@ public class ProfilePackageWriterImpl extends HtmlDocletWriter
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
div.addContent(descPara);
}
bodyTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
}
@ -199,9 +219,14 @@ public class ProfilePackageWriterImpl extends HtmlDocletWriter
Content h2Content = new StringContent(
configuration.getText("doclet.Package_Description",
packageDoc.name()));
packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
true, h2Content));
addInlineComment(packageDoc, packageContentTree);
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, h2Content);
if (configuration.allowTag(HtmlTag.SECTION)) {
sectionTree.addContent(heading);
addInlineComment(packageDoc, sectionTree);
} else {
packageContentTree.addContent(heading);
addInlineComment(packageDoc, packageContentTree);
}
}
}
@ -209,15 +234,37 @@ public class ProfilePackageWriterImpl extends HtmlDocletWriter
* {@inheritDoc}
*/
public void addPackageTags(Content packageContentTree) {
addTagsInfo(packageDoc, packageContentTree);
Content htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? sectionTree
: packageContentTree;
addTagsInfo(packageDoc, htmlTree);
}
/**
* {@inheritDoc}
*/
public void addPackageContent(Content contentTree, Content packageContentTree) {
if (configuration.allowTag(HtmlTag.MAIN)) {
packageContentTree.addContent(sectionTree);
mainTree.addContent(packageContentTree);
contentTree.addContent(mainTree);
} else {
contentTree.addContent(packageContentTree);
}
}
/**
* {@inheritDoc}
*/
public void addPackageFooter(Content contentTree) {
addNavLinks(false, contentTree);
addBottom(contentTree);
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: contentTree;
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
contentTree.addContent(htmlTree);
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -64,6 +64,11 @@ public class ProfileWriterImpl extends HtmlDocletWriter
*/
protected Profile profile;
/**
* The HTML tree for main tag.
*/
protected HtmlTree mainTree = HtmlTree.MAIN();
/**
* Constructor to construct ProfileWriter object and to generate
* "profileName-summary.html" file.
@ -87,9 +92,15 @@ public class ProfileWriterImpl extends HtmlDocletWriter
*/
public Content getProfileHeader(String heading) {
String profileName = profile.name;
Content bodyTree = getBody(true, getWindowTitle(profileName));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(profileName));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.header);
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
@ -98,7 +109,11 @@ public class ProfileWriterImpl extends HtmlDocletWriter
Content profileHead = new RawHtml(heading);
tHeading.addContent(profileHead);
div.addContent(tHeading);
bodyTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
}
@ -133,20 +148,29 @@ public class ProfileWriterImpl extends HtmlDocletWriter
* {@inheritDoc}
*/
public Content getPackageSummaryHeader(PackageDoc pkg) {
Content pkgName = getTargetProfilePackageLink(pkg,
"classFrame", new StringContent(pkg.name()), profile.name);
Content heading = HtmlTree.HEADING(HtmlTag.H3, pkgName);
HtmlTree li = HtmlTree.LI(HtmlStyle.blockList, heading);
addPackageDeprecationInfo(li, pkg);
return li;
Content pkgName = new StringContent(pkg.name());
Content pkgNameLink = getTargetProfilePackageLink(pkg,
"classFrame", pkgName, profile.name);
Content heading = HtmlTree.HEADING(HtmlTag.H3, pkgNameLink);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(heading)
: HtmlTree.LI(HtmlStyle.blockList, heading);
addPackageDeprecationInfo(htmlTree, pkg);
return htmlTree;
}
/**
* {@inheritDoc}
*/
public Content getPackageSummaryTree(Content packageSummaryContentTree) {
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, packageSummaryContentTree);
return ul;
HtmlTree htmlTree;
if (configuration.allowTag(HtmlTag.SECTION)) {
htmlTree = HtmlTree.UL(HtmlStyle.blockList,
HtmlTree.LI(HtmlStyle.blockList, packageSummaryContentTree));
} else {
htmlTree = HtmlTree.UL(HtmlStyle.blockList, packageSummaryContentTree);
}
return htmlTree;
}
/**
@ -158,12 +182,30 @@ public class ProfileWriterImpl extends HtmlDocletWriter
packageSummaryContentTree, profile.value);
}
/**
* {@inheritDoc}
*/
public void addProfileContent(Content contentTree, Content profileContentTree) {
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(profileContentTree);
contentTree.addContent(mainTree);
} else {
contentTree.addContent(profileContentTree);
}
}
/**
* {@inheritDoc}
*/
public void addProfileFooter(Content contentTree) {
addNavLinks(false, contentTree);
addBottom(contentTree);
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: contentTree;
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
contentTree.addContent(htmlTree);
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -63,6 +63,13 @@ public class PropertyWriterImpl extends AbstractMemberWriter
return memberTree;
}
/**
* {@inheritDoc}
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
writer.addMemberTree(memberSummaryTree, memberTree);
}
/**
* {@inheritDoc}
*/
@ -157,6 +164,10 @@ public class PropertyWriterImpl extends AbstractMemberWriter
* {@inheritDoc}
*/
public Content getPropertyDetails(Content propertyDetailsTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(propertyDetailsTree));
return htmlTree;
}
return getMemberTree(propertyDetailsTree);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,7 @@ package com.sun.tools.doclets.formats.html;
import java.io.*;
import java.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
@ -48,6 +49,11 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
List<ClassDoc> visibleClasses;
/**
* HTML tree for main tag.
*/
private HtmlTree mainTree = HtmlTree.MAIN();
/**
* @param configuration the configuration data for the doclet
* @throws IOException
@ -66,14 +72,24 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
* @return the body content tree
*/
public Content getHeader(String header) {
Content bodyTree = getBody(true, getWindowTitle(header));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(header));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
Content h1Content = new StringContent(header);
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
HtmlStyle.title, h1Content);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
bodyTree.addContent(div);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
}
@ -94,9 +110,14 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
* @return the package serialized form header tree
*/
public Content getPackageSerializedHeader() {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addStyle(HtmlStyle.blockList);
return li;
HtmlTree htmlTree;
if (configuration.allowTag(HtmlTag.SECTION)) {
htmlTree = HtmlTree.SECTION();
} else {
htmlTree = new HtmlTree(HtmlTag.LI);
htmlTree.addStyle(HtmlStyle.blockList);
}
return htmlTree;
}
/**
@ -211,9 +232,24 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
* @return a div content tree
*/
public Content getSerializedContent(Content serializedTreeContent) {
Content divContent = HtmlTree.DIV(HtmlStyle.serializedFormContainer,
HtmlTree divContent = HtmlTree.DIV(HtmlStyle.serializedFormContainer,
serializedTreeContent);
return divContent;
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(divContent);
return mainTree;
} else {
return divContent;
}
}
/**
* {@inheritDoc}
*/
public void addPackageSerializedTree(Content serializedSummariesTree,
Content packageSerializedTree) {
serializedSummariesTree.addContent((configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.LI(HtmlStyle.blockList, packageSerializedTree)
: packageSerializedTree);
}
/**
@ -222,8 +258,14 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
* @param serializedTree the serialized tree to be added
*/
public void addFooter(Content serializedTree) {
addNavLinks(false, serializedTree);
addBottom(serializedTree);
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: serializedTree;
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
serializedTree.addContent(htmlTree);
}
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -89,9 +89,15 @@ public class SingleIndexWriter extends AbstractIndexWriter {
*/
protected void generateIndexFile() throws IOException {
String title = configuration.getText("doclet.Window_Single_Index");
Content body = getBody(true, getWindowTitle(title));
addTop(body);
addNavLinks(true, body);
HtmlTree body = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: body;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
body.addContent(htmlTree);
}
HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
divTree.addStyle(HtmlStyle.contentContainer);
addLinksForIndexes(divTree);
@ -100,9 +106,17 @@ public class SingleIndexWriter extends AbstractIndexWriter {
addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
}
addLinksForIndexes(divTree);
body.addContent(divTree);
addNavLinks(false, body);
addBottom(body);
body.addContent((configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN(divTree)
: divTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
htmlTree = HtmlTree.FOOTER();
}
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
body.addContent(htmlTree);
}
printHtmlDocument(null, true, body);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -176,7 +176,7 @@ public class SourceToHTMLConverter {
}
addBlankLines(pre);
Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
body.addContent(div);
body.addContent((configuration.allowTag(HtmlTag.MAIN)) ? HtmlTree.MAIN(div) : div);
writeToFile(body, outputdir.resolve(DocPath.forClass(cd)));
} catch (IOException e) {
e.printStackTrace();
@ -190,7 +190,9 @@ public class SourceToHTMLConverter {
* @param path the path for the file.
*/
private void writeToFile(Content body, DocPath path) throws IOException {
Content htmlDocType = DocType.TRANSITIONAL;
Content htmlDocType = configuration.isOutputHtml5()
? DocType.HTML5
: DocType.TRANSITIONAL;
Content head = new HtmlTree(HtmlTag.HEAD);
head.addContent(HtmlTree.TITLE(new StringContent(
configuration.getText("doclet.Window_Source_title"))));
@ -262,8 +264,8 @@ public class SourceToHTMLConverter {
*/
private void addLine(Content pre, String line, int currentLineNo) {
if (line != null) {
pre.addContent(utils.replaceTabs(configuration, line));
Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
Content anchor = HtmlTree.A_ID("line." + Integer.toString(currentLineNo),
new StringContent(utils.replaceTabs(configuration, line)));
pre.addContent(anchor);
pre.addContent(NEW_LINE);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -116,17 +116,29 @@ public class SplitIndexWriter extends AbstractIndexWriter {
protected void generateIndexFile(Character unicode) throws IOException {
String title = configuration.getText("doclet.Window_Split_Index",
unicode.toString());
Content body = getBody(true, getWindowTitle(title));
addTop(body);
addNavLinks(true, body);
HtmlTree body = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: body;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
body.addContent(htmlTree);
}
HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
divTree.addStyle(HtmlStyle.contentContainer);
addLinksForIndexes(divTree);
addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
addLinksForIndexes(divTree);
body.addContent(divTree);
addNavLinks(false, body);
addBottom(body);
body.addContent((configuration.allowTag(HtmlTag.MAIN)) ? HtmlTree.MAIN(divTree) : divTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
htmlTree = HtmlTree.FOOTER();
}
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
body.addContent(htmlTree);
}
printHtmlDocument(null, true, body);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -55,6 +55,11 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
*/
public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
/**
* The HTML tree for main tag.
*/
protected HtmlTree mainTree = HtmlTree.MAIN();
public SubWriterHolderWriter(ConfigurationImpl configuration, DocPath filename)
throws IOException {
super(configuration, filename);
@ -92,8 +97,9 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
else {
caption = getTableCaption(mw.getCaption());
}
Content table = HtmlTree.TABLE(HtmlStyle.memberSummary, 0, 3, 0,
mw.getTableSummary(), caption);
Content table = (configuration.isOutputHtml5())
? HtmlTree.TABLE(HtmlStyle.memberSummary, caption)
: HtmlTree.TABLE(HtmlStyle.memberSummary, mw.getTableSummary(), caption);
table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col"));
for (Content tableContent : tableContents) {
table.addContent(tableContent);
@ -260,6 +266,31 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
return div;
}
/**
* Add the class content tree.
*
* @param contentTree content tree to which the class content will be added
* @param classContentTree class content tree which will be added to the content tree
*/
public void addClassContentTree(Content contentTree, Content classContentTree) {
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(classContentTree);
contentTree.addContent(mainTree);
} else {
contentTree.addContent(classContentTree);
}
}
/**
* Add the annotation content tree.
*
* @param contentTree content tree to which the annotation content will be added
* @param annotationContentTree annotation content tree which will be added to the content tree
*/
public void addAnnotationContentTree(Content contentTree, Content annotationContentTree) {
addClassContentTree(contentTree, annotationContentTree);
}
/**
* Get the member header tree
*
@ -271,6 +302,21 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
return li;
}
/**
* Add the member tree.
*
* @param memberSummaryTree the content tree representing the member summary
* @param memberTree the content tree representing the member
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(memberTree));
memberSummaryTree.addContent(htmlTree);
} else {
memberSummaryTree.addContent(getMemberTree(memberTree));
}
}
/**
* Get the member tree
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -101,22 +101,36 @@ public class TreeWriter extends AbstractTreeWriter {
* Generate the interface hierarchy and class hierarchy.
*/
public void generateTreeFile() throws IOException {
Content body = getTreeHeader();
HtmlTree body = getTreeHeader();
Content headContent = getResource("doclet.Hierarchy_For_All_Packages");
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
addPackageTreeLinks(div);
body.addContent(div);
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN()
: body;
htmlTree.addContent(div);
HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
divTree.addStyle(HtmlStyle.contentContainer);
addTree(classtree.baseclasses(), "doclet.Class_Hierarchy", divTree);
addTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy", divTree);
addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", divTree);
addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", divTree);
body.addContent(divTree);
addNavLinks(false, body);
addBottom(body);
htmlTree.addContent(divTree);
if (configuration.allowTag(HtmlTag.MAIN)) {
body.addContent(htmlTree);
}
if (configuration.allowTag(HtmlTag.FOOTER)) {
htmlTree = HtmlTree.FOOTER();
} else {
htmlTree = body;
}
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
body.addContent(htmlTree);
}
printHtmlDocument(null, true, body);
}
@ -164,11 +178,17 @@ public class TreeWriter extends AbstractTreeWriter {
*
* @return a content tree for the tree header
*/
protected Content getTreeHeader() {
protected HtmlTree getTreeHeader() {
String title = configuration.getText("doclet.Window_Class_Hierarchy");
Content bodyTree = getBody(true, getWindowTitle(title));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree bodyTree = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
return bodyTree;
}

View File

@ -48,16 +48,26 @@ public class DocType extends Content {
public static final DocType TRANSITIONAL =
new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd");
public static final DocType HTML5 = new DocType();
/**
* Constructor to construct a DocType object.
*
* @param type the doctype to be added
* @param dtd the dtd of the doctype
*/
private DocType(String type, String dtd) {
docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " + type +
"//EN\" \"" + dtd + "\">" + DocletConstants.NL;
}
/**
* Constructor to construct a DocType object.
*/
private DocType() {
docType = "<!DOCTYPE HTML>" + DocletConstants.NL;
}
/**
* This method is not supported by the class.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,9 +39,6 @@ import com.sun.tools.javac.util.StringUtils;
*/
public enum HtmlAttr {
ALT,
BORDER,
CELLPADDING,
CELLSPACING,
CLASS,
CLEAR,
COLS,
@ -53,6 +50,7 @@ public enum HtmlAttr {
NAME,
ONLOAD,
REL,
ROLE,
ROWS,
SCOPE,
SCROLLING,
@ -65,6 +63,25 @@ public enum HtmlAttr {
private final String value;
public enum Role {
BANNER,
CONTENTINFO,
MAIN,
NAVIGATION,
REGION;
private final String role;
Role() {
role = StringUtils.toLowerCase(name());
}
public String toString() {
return role;
}
}
HtmlAttr() {
this.value = StringUtils.toLowerCase(name());
}

View File

@ -307,11 +307,13 @@ public abstract class HtmlDocWriter extends HtmlWriter {
*
* @param title Title of this HTML document
* @param configuration the configuration object
* @param frame the frame content tree to be added to the HTML document
* @param body the body content tree to be added to the HTML document
*/
public void printFramesDocument(String title, ConfigurationImpl configuration,
HtmlTree body) throws IOException {
Content htmlDocType = DocType.TRANSITIONAL;
Content htmlDocType = configuration.isOutputHtml5()
? DocType.HTML5
: DocType.TRANSITIONAL;
Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
Content head = new HtmlTree(HtmlTag.HEAD);
head.addContent(getGeneratedBy(!configuration.notimestamp));

View File

@ -44,6 +44,7 @@ public enum HtmlStyle {
blockList,
blockListLast,
bottomNav,
circle,
classUseContainer,
colFirst,
colLast,
@ -64,7 +65,7 @@ public enum HtmlStyle {
horizontal,
footer,
indexContainer,
indexHeader,
indexNav,
inheritance,
interfaceName,
leftContainer,

View File

@ -43,15 +43,16 @@ public enum HtmlTag {
BODY(BlockType.OTHER, EndTag.END),
BR(BlockType.INLINE, EndTag.NOEND),
CAPTION,
CENTER,
CENTER(HtmlVersion.HTML4),
CODE(BlockType.INLINE, EndTag.END),
DD,
DIR,
DIR(HtmlVersion.HTML4),
DIV,
DL,
DT,
EM(BlockType.INLINE, EndTag.END),
FONT(BlockType.INLINE, EndTag.END),
FONT(HtmlVersion.HTML4, BlockType.INLINE, EndTag.END),
FOOTER(HtmlVersion.HTML5),
H1,
H2,
H3,
@ -59,6 +60,7 @@ public enum HtmlTag {
H5,
H6,
HEAD(BlockType.OTHER, EndTag.END),
HEADER(HtmlVersion.HTML5),
HR(BlockType.BLOCK, EndTag.NOEND),
HTML(BlockType.OTHER, EndTag.END),
I(BlockType.INLINE, EndTag.END),
@ -67,14 +69,16 @@ public enum HtmlTag {
LI,
LISTING,
LINK(BlockType.OTHER, EndTag.NOEND),
MAIN(HtmlVersion.HTML5),
MENU,
META(BlockType.OTHER, EndTag.NOEND),
NOFRAMES(BlockType.OTHER, EndTag.END),
NAV(HtmlVersion.HTML5),
NOSCRIPT(BlockType.OTHER, EndTag.END),
OL,
P,
PRE,
SCRIPT(BlockType.OTHER, EndTag.END),
SECTION(HtmlVersion.HTML5),
SMALL(BlockType.INLINE, EndTag.END),
SPAN(BlockType.INLINE, EndTag.END),
STRONG(BlockType.INLINE, EndTag.END),
@ -85,12 +89,13 @@ public enum HtmlTag {
TH,
TITLE(BlockType.OTHER, EndTag.END),
TR,
TT(BlockType.INLINE, EndTag.END),
TT(HtmlVersion.HTML4, BlockType.INLINE, EndTag.END),
UL;
public final BlockType blockType;
public final EndTag endTag;
public final String value;
public final HtmlVersion htmlVersion;
/**
* Enum representing the type of HTML element.
@ -110,10 +115,19 @@ public enum HtmlTag {
}
HtmlTag() {
this(BlockType.BLOCK, EndTag.END);
this(HtmlVersion.ALL, BlockType.BLOCK, EndTag.END);
}
HtmlTag(HtmlVersion htmlVersion) {
this(htmlVersion, BlockType.BLOCK, EndTag.END);
}
HtmlTag(BlockType blockType, EndTag endTag ) {
this(HtmlVersion.ALL, blockType, endTag);
}
HtmlTag(HtmlVersion htmlVersion, BlockType blockType, EndTag endTag ) {
this.htmlVersion = htmlVersion;
this.blockType = blockType;
this.endTag = endTag;
this.value = StringUtils.toLowerCase(name());
@ -129,6 +143,16 @@ public enum HtmlTag {
return (endTag == EndTag.END);
}
/**
* Returns true if the tag is allowed in the output HTML version of this javadoc run.
*
* @param htmlVer the output HTML version for this javadoc run
* @return true if the tag is allowed
*/
public boolean allowTag(HtmlVersion htmlVer) {
return (this.htmlVersion == HtmlVersion.ALL || this.htmlVersion == htmlVer);
}
public String toString() {
return value;
}

View File

@ -32,6 +32,7 @@ import java.nio.charset.*;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.HtmlAttr.Role;
/**
* Class for generating HTML tree for javadoc output.
@ -87,6 +88,10 @@ public class HtmlTree extends Content {
addAttr(HtmlAttr.TITLE, stripHtml(body));
}
public void setRole(Role role) {
addAttr(HtmlAttr.ROLE, role.toString());
}
/**
* Adds a style for the HTML tag.
*
@ -221,27 +226,16 @@ public class HtmlTree extends Content {
}
/**
* Generates an HTML anchor tag with name attribute and content.
* Generates an HTML anchor tag with id attribute and content.
*
* @param name name for the anchor tag
* @param id id for the anchor tag
* @param body content for the anchor tag
* @return an HtmlTree object
*/
public static HtmlTree A_NAME(String name, Content body) {
HtmlTree htmltree = HtmlTree.A_NAME(name);
htmltree.addContent(nullCheck(body));
return htmltree;
}
/**
* Generates an HTML anchor tag with name attribute.
*
* @param name name for the anchor tag
* @return an HtmlTree object
*/
public static HtmlTree A_NAME(String name) {
public static HtmlTree A_ID(String id, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.A);
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
htmltree.addContent(nullCheck(body));
return htmltree;
}
@ -326,18 +320,24 @@ public class HtmlTree extends Content {
}
/**
* Generates a IFRAME tag.
* Generates a FOOTER tag with role attribute.
*
* @param src the url of the document to be shown in the frame
* @param name specifies the name of the frame
* @param title the title for the frame
* @return an HtmlTree object for the IFRAME tag
* @return an HtmlTree object for the FOOTER tag
*/
public static HtmlTree IFRAME(String src, String name, String title) {
HtmlTree htmltree = new HtmlTree(HtmlTag.IFRAME);
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
public static HtmlTree FOOTER() {
HtmlTree htmltree = new HtmlTree(HtmlTag.FOOTER);
htmltree.setRole(Role.CONTENTINFO);
return htmltree;
}
/**
* Generates a HEADER tag with role attribute.
*
* @return an HtmlTree object for the HEADER tag
*/
public static HtmlTree HEADER() {
HtmlTree htmltree = new HtmlTree(HtmlTag.HEADER);
htmltree.setRole(Role.BANNER);
return htmltree;
}
@ -413,6 +413,22 @@ public class HtmlTree extends Content {
return htmltree;
}
/**
* Generates a IFRAME tag.
*
* @param src the url of the document to be shown in the frame
* @param name specifies the name of the frame
* @param title the title for the frame
* @return an HtmlTree object for the IFRAME tag
*/
public static HtmlTree IFRAME(String src, String name, String title) {
HtmlTree htmltree = new HtmlTree(HtmlTag.IFRAME);
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
return htmltree;
}
/**
* Generates a LI tag with some content.
*
@ -455,6 +471,44 @@ public class HtmlTree extends Content {
return htmltree;
}
/**
* Generates a MAIN tag with role attribute.
*
* @return an HtmlTree object for the MAIN tag
*/
public static HtmlTree MAIN() {
HtmlTree htmltree = new HtmlTree(HtmlTag.MAIN);
htmltree.setRole(Role.MAIN);
return htmltree;
}
/**
* Generates a MAIN tag with role attribute and some content.
*
* @param body content of the MAIN tag
* @return an HtmlTree object for the MAIN tag
*/
public static HtmlTree MAIN(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.MAIN, nullCheck(body));
htmltree.setRole(Role.MAIN);
return htmltree;
}
/**
* Generates a MAIN tag with role attribute, style attribute and some content.
*
* @param styleClass style of the MAIN tag
* @param body content of the MAIN tag
* @return an HtmlTree object for the MAIN tag
*/
public static HtmlTree MAIN(HtmlStyle styleClass, Content body) {
HtmlTree htmltree = HtmlTree.MAIN(body);
if (styleClass != null) {
htmltree.addStyle(styleClass);
}
return htmltree;
}
/**
* Generates a META tag with the http-equiv, content and charset attributes.
*
@ -485,6 +539,17 @@ public class HtmlTree extends Content {
return htmltree;
}
/**
* Generates a NAV tag with the role attribute.
*
* @return an HtmlTree object for the NAV tag
*/
public static HtmlTree NAV() {
HtmlTree htmltree = new HtmlTree(HtmlTag.NAV);
htmltree.setRole(Role.NAVIGATION);
return htmltree;
}
/**
* Generates a NOSCRIPT tag with some content.
*
@ -527,13 +592,46 @@ public class HtmlTree extends Content {
* @param src the path for the script
* @return an HtmlTree object for the SCRIPT tag
*/
public static HtmlTree SCRIPT(String type, String src) {
HtmlTree htmltree = new HtmlTree(HtmlTag.SCRIPT);
htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
public static HtmlTree SCRIPT(String src) {
HtmlTree htmltree = HtmlTree.SCRIPT();
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
return htmltree;
}
/**
* Generates a SCRIPT tag with the type attribute.
*
* @return an HtmlTree object for the SCRIPT tag
*/
public static HtmlTree SCRIPT() {
HtmlTree htmltree = new HtmlTree(HtmlTag.SCRIPT);
htmltree.addAttr(HtmlAttr.TYPE, "text/javascript");
return htmltree;
}
/**
* Generates a SECTION tag with role attribute.
*
* @return an HtmlTree object for the SECTION tag
*/
public static HtmlTree SECTION() {
HtmlTree htmltree = new HtmlTree(HtmlTag.SECTION);
htmltree.setRole(Role.REGION);
return htmltree;
}
/**
* Generates a SECTION tag with role attribute and some content.
*
* @param body content of the section tag
* @return an HtmlTree object for the SECTION tag
*/
public static HtmlTree SECTION(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.SECTION, nullCheck(body));
htmltree.setRole(Role.REGION);
return htmltree;
}
/**
* Generates a SMALL tag with some content.
*
@ -587,29 +685,36 @@ public class HtmlTree extends Content {
}
/**
* Generates a Table tag with style class, border, cell padding,
* cellspacing and summary attributes and some content.
* Generates a Table tag with style class and summary attributes and some content.
*
* @param styleClass style of the table
* @param border border for the table
* @param cellPadding cell padding for the table
* @param cellSpacing cell spacing for the table
* @param summary summary for the table
* @param body content for the table
* @return an HtmlTree object for the TABLE tag
*/
public static HtmlTree TABLE(HtmlStyle styleClass, int border, int cellPadding,
int cellSpacing, String summary, Content body) {
public static HtmlTree TABLE(HtmlStyle styleClass, String summary, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border));
htmltree.addAttr(HtmlAttr.CELLPADDING, Integer.toString(cellPadding));
htmltree.addAttr(HtmlAttr.CELLSPACING, Integer.toString(cellSpacing));
htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
return htmltree;
}
/**
* Generates a Table tag with style class attribute and some content.
*
* @param styleClass style of the table
* @param body content for the table
* @return an HtmlTree object for the TABLE tag
*/
public static HtmlTree TABLE(HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
if (styleClass != null) {
htmltree.addStyle(styleClass);
}
return htmltree;
}
/**
* Generates a TD tag with style class attribute and some content.
*
@ -741,7 +846,7 @@ public class HtmlTree extends Content {
public boolean isValid() {
switch (htmlTag) {
case A :
return (hasAttr(HtmlAttr.NAME) || (hasAttr(HtmlAttr.HREF) && hasContent()));
return (hasAttr(HtmlAttr.ID) || (hasAttr(HtmlAttr.HREF) && hasContent()));
case BR :
return (!hasContent() && (!hasAttrs() || hasAttr(HtmlAttr.CLEAR)));
case IFRAME :

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.tools.doclets.formats.html.markup;
/**
* Enum representing the version of HTML generated by javadoc.
*
* @author Bhavesh Patel
*/
public enum HtmlVersion {
HTML4,
HTML5,
ALL
}

View File

@ -306,9 +306,8 @@ public class HtmlWriter {
* @return an HtmlTree for the SCRIPT tag
*/
protected HtmlTree getWinTitleScript(){
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
HtmlTree script = HtmlTree.SCRIPT();
if(winTitle != null && winTitle.length() > 0) {
script.addAttr(HtmlAttr.TYPE, "text/javascript");
String scriptCode = "<!--" + DocletConstants.NL +
" try {" + DocletConstants.NL +
" if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
@ -377,8 +376,7 @@ public class HtmlWriter {
* @return a content for the SCRIPT tag
*/
protected Content getFramesJavaScript() {
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
script.addAttr(HtmlAttr.TYPE, "text/javascript");
HtmlTree script = HtmlTree.SCRIPT();
String scriptCode = DocletConstants.NL +
" targetPage = \"\" + window.location.search;" + DocletConstants.NL +
" if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +

View File

@ -192,6 +192,8 @@ doclet.usage=Provided by Standard doclet:\n\
\ -windowtitle <text> Browser window title for the documentation\n\
\ -doctitle <html-code> Include title for the overview page\n\
\ -header <html-code> Include header text for each page\n\
\ -html4 Generate HTML 4.01 output\n\
\ -html5 Generate HTML 5 output\n\
\ -footer <html-code> Include footer text for each page\n\
\ -top <html-code> Include top text for each page\n\
\ -bottom <html-code> Include bottom text for each page\n\

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -110,6 +110,14 @@ public interface AnnotationTypeWriter {
*/
public Content getMemberTreeHeader();
/**
* Add the annotation content tree to the documentation content tree.
*
* @param contentTree content tree to which the annotation content will be added
* @param annotationContentTree annotation content tree which will be added to the content tree
*/
public void addAnnotationContentTree(Content contentTree, Content annotationContentTree);
/**
* Get the member tree.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -175,6 +175,14 @@ public interface ClassWriter {
*/
public Content getMemberTreeHeader();
/**
* Add the class content tree.
*
* @param contentTree content tree to which the class content will be added
* @param classContentTree class content tree which will be added to the content tree
*/
public void addClassContentTree(Content contentTree, Content classContentTree);
/**
* Add the footer of the page.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -81,12 +81,12 @@ public interface ConstantsSummaryWriter {
Set<String> WriteedPackageHeaders, Content contentListTree);
/**
* Get the content list to be added to the documentation tree.
* Add the content list to the documentation tree.
*
* @param contentTree the tree to which the contents list will be added
* @param contentListTree the content that will be added to the list
* @return content list that will be added to the documentation tree
*/
public abstract Content getContentsList(Content contentListTree);
public abstract void addContentsList(Content contentTree, Content contentListTree);
/**
* Get the constant summaries for the document.
@ -98,16 +98,15 @@ public interface ConstantsSummaryWriter {
/**
* Adds the given package name.
*
* @param pkg the {@link PackageDoc} to index.
* @param parsedPackageName the parsed package name. We only Write the
* first 2 directory levels of the package
* name. For example, java.lang.ref would be
* indexed as java.lang.*.
* @param summariesTree the documentation tree to which the package name will
* @param summariesTree the summaries documentation tree
* @param first true if the first package is listed
* be written
*/
public abstract void addPackageName(PackageDoc pkg,
String parsedPackageName, Content summariesTree);
public abstract void addPackageName(String parsedPackageName, Content summariesTree, boolean first);
/**
* Get the class summary header for the constants summary.
@ -116,6 +115,14 @@ public interface ConstantsSummaryWriter {
*/
public abstract Content getClassConstantHeader();
/**
* Add the content list to the documentation summaries tree.
*
* @param summariesTree the tree to which the class constants list will be added
* @param classConstantTree the class constant tree that will be added to the list
*/
public abstract void addClassConstant(Content summariesTree, Content classConstantTree);
/**
* Adds the constant member table to the documentation tree.
*
@ -127,6 +134,14 @@ public interface ConstantsSummaryWriter {
public abstract void addConstantMembers(ClassDoc cd, List<FieldDoc> fields,
Content classConstantTree);
/**
* Add the summaries list to the content tree.
*
* @param contentTree the tree to which the summaries list will be added
* @param summariesTree the summaries content tree that will be added to the list
*/
public abstract void addConstantSummaries(Content contentTree, Content summariesTree);
/**
* Adds the footer for the summary documentation.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -100,14 +100,22 @@ public interface MemberSummaryWriter {
/**
* Get inherited summary links.
*
* @return a content tree conatining the inherited summary links
* @return a content tree containing the inherited summary links
*/
public Content getInheritedSummaryLinksTree();
/**
* Add the member tree to the member summary tree.
*
* @param memberSummaryTree the content tree representing the member summary
* @param memberTree the content tree representing the member
*/
public void addMemberTree(Content memberSummaryTree, Content memberTree);
/**
* Get the member tree.
*
* @param memberTree the content tree representating the member
* @param memberTree the content tree representing the member
* @return a content tree for the member
*/
public Content getMemberTree(Content memberTree);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -96,6 +96,15 @@ public interface PackageSummaryWriter {
*/
public abstract void addPackageTags(Content packageContentTree);
/**
* Adds the tag information from the "packages.html" or "package-info.java" file to the
* documentation tree.
*
* @param contentTree the content tree to which the package content tree will be added
* @param packageContentTree the package content tree to be added
*/
public abstract void addPackageContent(Content contentTree, Content packageContentTree);
/**
* Adds the footer to the documentation tree.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -94,6 +94,15 @@ public interface ProfilePackageSummaryWriter {
*/
public abstract void addPackageTags(Content packageContentTree);
/**
* Adds the tag information from the "packages.html" or "package-info.java" file to the
* documentation tree.
*
* @param contentTree the content tree to which the package content tree will be added
* @param packageContentTree the package content tree to be added
*/
public abstract void addPackageContent(Content contentTree, Content packageContentTree);
/**
* Adds the footer to the documentation tree.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -98,6 +98,14 @@ public interface ProfileSummaryWriter {
public abstract void addClassesSummary(ClassDoc[] classes, String label,
String tableSummary, String[] tableHeader, Content packageSummaryContentTree);
/**
* Adds the profile content tree to the documentation tree.
*
* @param contentTree the tree to which the profile content tree will be added
* @param profileContentTree the content tree that will be added
*/
public abstract void addProfileContent(Content contentTree, Content profileContentTree);
/**
* Adds the footer to the documentation tree.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -65,6 +65,14 @@ public interface SerializedFormWriter {
*/
public Content getPackageSerializedHeader();
/**
* Add the serialized tree per package to the serialized summaries tree.
*
* @param serializedSummariesTree the serialized tree to which the package serialized tree will be added
* @param packageSerializedTree the serialized tree per package that needs to be added
*/
public void addPackageSerializedTree(Content serializedSummariesTree, Content packageSerializedTree);
/**
* Get the given package header.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -118,7 +118,7 @@ public class AnnotationTypeBuilder extends AbstractBuilder {
" " + annotationTypeDoc.name());
Content annotationContentTree = writer.getAnnotationContentHeader();
buildChildren(node, annotationContentTree);
contentTree.addContent(annotationContentTree);
writer.addAnnotationContentTree(contentTree, annotationContentTree);
writer.addFooter(contentTree);
writer.printDocument(contentTree);
writer.close();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -144,7 +144,7 @@ public class ClassBuilder extends AbstractBuilder {
classDoc.name());
Content classContentTree = writer.getClassContentHeader();
buildChildren(node, classContentTree);
contentTree.addContent(classContentTree);
writer.addClassContentTree(contentTree, classContentTree);
writer.addFooter(contentTree);
writer.printDocument(contentTree);
writer.close();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -87,6 +87,11 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
*/
private Content contentTree;
/**
* True if first package is listed.
*/
private boolean first = true;
/**
* Construct a new ConstantsSummaryBuilder.
*
@ -159,7 +164,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
printedPackageHeaders, contentListTree);
}
}
contentTree.addContent(writer.getContentsList(contentListTree));
writer.addContentsList(contentTree, contentListTree);
}
/**
@ -176,9 +181,10 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
currentPackage = aPackage;
//Build the documentation for the current package.
buildChildren(node, summariesTree);
first = false;
}
}
contentTree.addContent(summariesTree);
writer.addConstantSummaries(contentTree, summariesTree);
}
/**
@ -190,8 +196,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
public void buildPackageHeader(XMLNode node, Content summariesTree) {
String parsedPackageName = parsePackageName(currentPackage.name());
if (! printedPackageHeaders.contains(parsedPackageName)) {
writer.addPackageName(currentPackage,
parsePackageName(currentPackage.name()), summariesTree);
writer.addPackageName(parsePackageName(currentPackage.name()), summariesTree, first);
printedPackageHeaders.add(parsedPackageName);
}
}
@ -218,7 +223,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
//Build the documentation for the current class.
buildChildren(node, classConstantTree);
}
summariesTree.addContent(classConstantTree);
writer.addClassConstant(summariesTree, classConstantTree);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -524,7 +524,7 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
for (Content aSummaryTreeList : summaryTreeList) {
memberTree.addContent(aSummaryTreeList);
}
memberSummaryTree.addContent(writer.getMemberTree(memberTree));
writer.addMemberTree(memberSummaryTree, memberTree);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -137,7 +137,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
public void buildContent(XMLNode node, Content contentTree) {
Content packageContentTree = packageWriter.getContentHeader();
buildChildren(node, packageContentTree);
contentTree.addContent(packageContentTree);
packageWriter.addPackageContent(contentTree, packageContentTree);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -153,7 +153,7 @@ public class ProfilePackageSummaryBuilder extends AbstractBuilder {
public void buildContent(XMLNode node, Content contentTree) {
Content packageContentTree = profilePackageWriter.getContentHeader();
buildChildren(node, packageContentTree);
contentTree.addContent(packageContentTree);
profilePackageWriter.addPackageContent(contentTree, packageContentTree);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -142,7 +142,7 @@ public class ProfileSummaryBuilder extends AbstractBuilder {
public void buildContent(XMLNode node, Content contentTree) {
Content profileContentTree = profileWriter.getContentHeader();
buildChildren(node, profileContentTree);
contentTree.addContent(profileContentTree);
profileWriter.addProfileContent(contentTree, profileContentTree);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -190,7 +190,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
return;
}
buildChildren(node, packageSerializedTree);
serializedSummariesTree.addContent(packageSerializedTree);
writer.addPackageSerializedTree(serializedSummariesTree, packageSerializedTree);
}
/**

View File

@ -214,14 +214,20 @@ Page header and footer styles
margin:0 20px;
padding:5px 0 0 0;
}
.indexHeader {
.indexNav {
margin:10px;
position:relative;
}
.indexHeader span{
margin-right:15px;
.indexNav ul {
padding:0;
margin:0;
}
.indexHeader h1 {
.indexNav ul li {
display:inline;
list-style-type:none;
padding-right:10px;
}
.indexNav h1 {
font-size:13px;
}
.title {
@ -314,6 +320,9 @@ Page layout container styles
/*
List styles
*/
li.circle {
list-style:circle;
}
ul.horizontal li {
display:inline;
font-size:0.9em;
@ -370,6 +379,7 @@ Table styles
*/
.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary {
width:100%;
border-spacing:0;
border-left:1px solid #EEE;
border-right:1px solid #EEE;
border-bottom:1px solid #EEE;
@ -638,3 +648,9 @@ IFRAME specific styles
overflow:visible;
margin-bottom:30px;
}
/*
HTML5 specific styles
*/
main, nav, header, footer, section {
display:block;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -814,7 +814,7 @@ public class DocEnv {
return result;
}
void initDoclint(Collection<String> opts, Collection<String> customTagNames) {
void initDoclint(Collection<String> opts, Collection<String> customTagNames, String htmlVersion) {
ArrayList<String> doclintOpts = new ArrayList<>();
for (String opt: opts) {
@ -836,6 +836,7 @@ public class DocEnv {
sep = DocLint.SEPARATOR;
}
doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());
doclintOpts.add(DocLint.XHTML_VERSION_PREFIX + htmlVersion);
JavacTask t = BasicJavacTask.instance(context);
doclint = new DocLint();

View File

@ -377,8 +377,9 @@ public class RootDocImpl extends DocImpl implements RootDoc {
return env.fileManager;
}
public void initDocLint(Collection<String> opts, Collection<String> customTagNames) {
env.initDoclint(opts, customTagNames);
public void initDocLint(Collection<String> opts, Collection<String> customTagNames,
String htmlVersion) {
env.initDoclint(opts, customTagNames, htmlVersion);
}
public boolean isFunctionalInterface(AnnotationDesc annotationDesc) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,14 +49,14 @@ public class AccessSkipNav extends JavadocTester {
checkOutput("p1/C1.html", true,
// Top navbar <a href>
"<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
// Top navbar <a name>
"<a name=\"skip.navbar.top\">\n"
// Top navbar <a id>
"<a id=\"skip.navbar.top\">\n"
+ "<!-- -->\n"
+ "</a>",
// Bottom navbar <a href>
"<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
// Bottom navbar <a name>
"<a name=\"skip.navbar.bottom\">\n"
// Bottom navbar <a id>
"<a id=\"skip.navbar.bottom\">\n"
+ "<!-- -->\n"
+ "</a>");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -53,15 +53,15 @@ public class TestAnchorNames extends JavadocTester {
// Test some section markers and links to these markers
checkOutput("pkg1/RegClass.html", true,
"<a name=\"skip.navbar.top\">",
"<a id=\"skip.navbar.top\">",
"<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">",
"<a name=\"nested.class.summary\">",
"<a id=\"nested.class.summary\">",
"<a href=\"#nested.class.summary\">",
"<a name=\"method.summary\">",
"<a id=\"method.summary\">",
"<a href=\"#method.summary\">",
"<a name=\"field.detail\">",
"<a id=\"field.detail\">",
"<a href=\"#field.detail\">",
"<a name=\"constructor.detail\">",
"<a id=\"constructor.detail\">",
"<a href=\"#constructor.detail\">");
// Test some members and link to these members
@ -72,59 +72,59 @@ public class TestAnchorNames extends JavadocTester {
// Test some fields
checkOutput("pkg1/RegClass.html", true,
"<a name=\"Z:Z_\">",
"<a id=\"Z:Z_\">",
"<a href=\"../pkg1/RegClass.html#Z:Z_\">",
"<a name=\"Z:Z_:D\">",
"<a id=\"Z:Z_:D\">",
"<a href=\"../pkg1/RegClass.html#Z:Z_:D\">",
"<a name=\"Z:Z:D_\">",
"<a id=\"Z:Z:D_\">",
"<a href=\"../pkg1/RegClass.html#Z:Z:D_\">",
"<a name=\"Z:Z:Dfield\">",
"<a id=\"Z:Z:Dfield\">",
"<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">",
"<a name=\"fieldInCla:D:D\">",
"<a id=\"fieldInCla:D:D\">",
"<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">",
"<a name=\"S_:D:D:D:D:DINT\">",
"<a id=\"S_:D:D:D:D:DINT\">",
"<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">",
"<a name=\"method:D:D\">",
"<a id=\"method:D:D\">",
"<a href=\"../pkg1/RegClass.html#method:D:D\">");
checkOutput("pkg1/DeprMemClass.html", true,
"<a name=\"Z:Z_field_In_Class\">",
"<a id=\"Z:Z_field_In_Class\">",
"<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">");
// Test constructor
checkOutput("pkg1/RegClass.html", true,
"<a name=\"RegClass-java.lang.String-int-\">",
"<a id=\"RegClass-java.lang.String-int-\">",
"<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">");
// Test some methods
checkOutput("pkg1/RegClass.html", true,
"<a name=\"Z:Z_methodInClass-java.lang.String-\">",
"<a id=\"Z:Z_methodInClass-java.lang.String-\">",
"<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">",
"<a name=\"method--\">",
"<a id=\"method--\">",
"<a href=\"../pkg1/RegClass.html#method--\">",
"<a name=\"foo-java.util.Map-\">",
"<a id=\"foo-java.util.Map-\">",
"<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">",
"<a name=\"methodInCla:Ds-java.lang.String:A-\">",
"<a id=\"methodInCla:Ds-java.lang.String:A-\">",
"<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">",
"<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">",
"<a id=\"Z:Z_methodInClas:D-java.lang.String-int-\">",
"<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">",
"<a name=\"methodD-pkg1.RegClass.:DA-\">",
"<a id=\"methodD-pkg1.RegClass.:DA-\">",
"<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">",
"<a name=\"methodD-pkg1.RegClass.D:A-\">",
"<a id=\"methodD-pkg1.RegClass.D:A-\">",
"<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">");
checkOutput("pkg1/DeprMemClass.html", true,
"<a name=\"Z:Z:Dmethod_In_Class--\">",
"<a id=\"Z:Z:Dmethod_In_Class--\">",
"<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">");
// Test enum
checkOutput("pkg1/RegClass.Te$t_Enum.html", true,
"<a name=\"Z:Z:DFLD2\">",
"<a id=\"Z:Z:DFLD2\">",
"<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">");
// Test nested class
checkOutput("pkg1/RegClass._NestedClas$.html", true,
"<a name=\"Z:Z_NestedClas:D--\">",
"<a id=\"Z:Z_NestedClas:D--\">",
"<a href=\"../pkg1/RegClass._NestedClas$.html#Z:Z_NestedClas:D--\">");
// Test class use page
@ -143,11 +143,11 @@ public class TestAnchorNames extends JavadocTester {
// Test serialized form page
checkOutput("serialized-form.html", true,
//This is the marker for the link that appears in the pkg1.RegClass.html page
"<a name=\"pkg1.RegClass\">");
"<a id=\"pkg1.RegClass\">");
// Test member name index page
checkOutput("index-all.html", true,
"<a name=\"I:Z:Z:D\">",
"<a id=\"I:Z:Z:D\">",
"<a href=\"#I:Z:Z:D\">$",
"<a href=\"#I:Z:Z_\">_");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -47,6 +47,6 @@ public class TestAnnotationOptional extends JavadocTester {
checkExit(Exit.OK);
checkOutput("pkg/AnnotationOptional.html", true,
"<a name=\"annotation.type.element.detail\">");
"<a id=\"annotation.type.element.detail\">");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,22 +50,22 @@ public class TestClassTree extends JavadocTester {
checkOutput("pkg/package-tree.html", true,
"<ul>\n"
+ "<li type=\"circle\">pkg.<a href=\"../pkg/ParentClass.html\" "
+ "<li class=\"circle\">pkg.<a href=\"../pkg/ParentClass.html\" "
+ "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a>",
"<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>\n"
+ "<ul>\n"
+ "<li type=\"circle\">pkg.<a href=\"../pkg/AnnotationType.html\" "
+ "<li class=\"circle\">pkg.<a href=\"../pkg/AnnotationType.html\" "
+ "title=\"annotation in pkg\"><span class=\"typeNameLink\">AnnotationType</span></a> "
+ "(implements java.lang.annotation.Annotation)</li>\n"
+ "</ul>",
"<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>\n"
+ "<ul>\n"
+ "<li type=\"circle\">java.lang.Object\n"
+ "<li class=\"circle\">java.lang.Object\n"
+ "<ul>\n"
+ "<li type=\"circle\">java.lang.Enum&lt;E&gt; (implements java.lang."
+ "<li class=\"circle\">java.lang.Enum&lt;E&gt; (implements java.lang."
+ "Comparable&lt;T&gt;, java.io.Serializable)\n"
+ "<ul>\n"
+ "<li type=\"circle\">pkg.<a href=\"../pkg/Coin.html\" "
+ "<li class=\"circle\">pkg.<a href=\"../pkg/Coin.html\" "
+ "title=\"enum in pkg\"><span class=\"typeNameLink\">Coin</span></a></li>\n"
+ "</ul>\n"
+ "</li>\n"
@ -74,7 +74,7 @@ public class TestClassTree extends JavadocTester {
+ "</ul>");
checkOutput("pkg/package-tree.html", false,
"<li type=\"circle\">class pkg.<a href=\"../pkg/ParentClass.html\" "
"<li class=\"circle\">class pkg.<a href=\"../pkg/ParentClass.html\" "
+ "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a></li>");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -58,21 +58,21 @@ public class TestConstructors extends JavadocTester {
+ "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>"
+ "NestedInner(int)</code></a>",
"<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()",
"<a name=\"Outer--\">",
"<a id=\"Outer--\">",
"<a href=\"../pkg1/Outer.html#Outer-int-\">Outer</a></span>(int&nbsp;i)",
"<a name=\"Outer-int-\">");
"<a id=\"Outer-int-\">");
checkOutput("pkg1/Outer.Inner.html", true,
"<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>()",
"<a name=\"Inner--\">",
"<a id=\"Inner--\">",
"<a href=\"../pkg1/Outer.Inner.html#Inner-int-\">Inner</a></span>(int&nbsp;i)",
"<a name=\"Inner-int-\">");
"<a id=\"Inner-int-\">");
checkOutput("pkg1/Outer.Inner.NestedInner.html", true,
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>()",
"<a name=\"NestedInner--\">",
"<a id=\"NestedInner--\">",
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\">NestedInner</a></span>(int&nbsp;i)",
"<a name=\"NestedInner-int-\">");
"<a id=\"NestedInner-int-\">");
checkOutput("pkg1/Outer.Inner.html", false,
"Outer.Inner--",

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -53,11 +53,11 @@ public class TestHref extends JavadocTester {
//Member summary table link.
"href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\"",
//Anchor test.
"<a name=\"method-int-int-java.util.ArrayList-\">\n"
"<a id=\"method-int-int-java.util.ArrayList-\">\n"
+ "<!-- -->\n"
+ "</a>",
//Backward compatibility anchor test."pkg/C1.html",
"<a name=\"method-int-int-java.util.ArrayList-\">\n"
"<a id=\"method-int-int-java.util.ArrayList-\">\n"
+ "<!-- -->\n"
+ "</a>");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -113,7 +113,7 @@ public class TestHtmlDocument extends JavadocTester {
// Test another version of A tag.
HtmlTree anchor = new HtmlTree(HtmlTag.A);
anchor.addAttr(HtmlAttr.HREF, "testLink.html");
anchor.addAttr(HtmlAttr.NAME, "Another version of a tag");
anchor.addAttr(HtmlAttr.ID, "Another version of a tag");
p1.addContent(anchor);
body.addContent(p1);
// Test for empty tags.

View File

@ -9,7 +9,7 @@
<body>
<!-- ======== START OF PARAGRAPH ======== -->
<p>This document is generated from sample source code and HTML files with examples of a wide variety of Java language constructs: packages, subclasses, subinterfaces, nested classes, nested interfaces,inheriting from other packages, constructors, fields,methods, and so forth. <a href="testLink.html">Click Here</a> to &lt;test&gt; out a link.</p>
<p><a href="testLink.html" name="Another version of a tag"></a></p>
<p><a href="testLink.html" id="Another version of a tag"></a></p>
<dl>
<dd>Test DD</dd>
</dl>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,37 +48,30 @@ public class TestHtmlTableStyles extends JavadocTester {
checkOutput("pkg1/TestTable.html", true,
"<table summary=\"Summary\" border cellpadding=3 cellspacing=1>",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Field Summary table, listing fields, "
"<table class=\"memberSummary\" summary=\"Field Summary table, listing fields, "
+ "and an explanation\">",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Constructor Summary table, listing "
"<table class=\"memberSummary\" summary=\"Constructor Summary table, listing "
+ "constructors, and an explanation\">",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Method Summary table, listing methods, "
"<table class=\"memberSummary\" summary=\"Method Summary table, listing methods, "
+ "and an explanation\">");
checkOutput("pkg1/package-summary.html", true,
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Class Summary table, listing classes, "
"<table class=\"typeSummary\" summary=\"Class Summary table, listing classes, "
+ "and an explanation\">");
checkOutput("pkg1/class-use/TestTable.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Use table, listing fields, and an explanation\">");
"<table class=\"useSummary\" summary=\"Use table, listing fields, and an explanation\">");
checkOutput("overview-summary.html", true,
"<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Packages table, listing packages, and an explanation\">");
"<table class=\"overviewSummary\" "
+ "summary=\"Packages table, listing packages, and an explanation\">");
checkOutput("deprecated-list.html", true,
"<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Deprecated Methods table, listing " +
"<table class=\"deprecatedSummary\" summary=\"Deprecated Methods table, listing " +
"deprecated methods, and an explanation\">");
checkOutput("constant-values.html", true,
"<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Constant Field Values table, listing " +
"<table class=\"constantsSummary\" summary=\"Constant Field Values table, listing " +
"constant fields, and values\">");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -63,111 +63,85 @@ public class TestHtmlTableTags extends JavadocTester {
void checkHtmlTableSummaries() {
//Package summary
checkOutput("pkg1/package-summary.html", true,
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ " cellspacing=\"0\" summary=\"Class Summary table, "
"<table class=\"typeSummary\" summary=\"Class Summary table, "
+ "listing classes, and an explanation\">",
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ " cellspacing=\"0\" summary=\"Interface Summary table, "
"<table class=\"typeSummary\" summary=\"Interface Summary table, "
+ "listing interfaces, and an explanation\">");
checkOutput("pkg2/package-summary.html", true,
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ " cellspacing=\"0\" summary=\"Enum Summary table, "
"<table class=\"typeSummary\" summary=\"Enum Summary table, "
+ "listing enums, and an explanation\">",
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ " cellspacing=\"0\" summary=\"Annotation Types Summary table, "
"<table class=\"typeSummary\" summary=\"Annotation Types Summary table, "
+ "listing annotation types, and an explanation\">");
// Class documentation
checkOutput("pkg1/C1.html", true,
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Field Summary table, listing fields, "
"<table class=\"memberSummary\" summary=\"Field Summary table, listing fields, "
+ "and an explanation\">",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Method Summary table, listing methods, "
"<table class=\"memberSummary\" summary=\"Method Summary table, listing methods, "
+ "and an explanation\">");
checkOutput("pkg2/C2.html", true,
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Nested Class Summary table, listing "
"<table class=\"memberSummary\" summary=\"Nested Class Summary table, listing "
+ "nested classes, and an explanation\">",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Constructor Summary table, listing "
"<table class=\"memberSummary\" summary=\"Constructor Summary table, listing "
+ "constructors, and an explanation\">");
checkOutput("pkg2/C2.ModalExclusionType.html", true,
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Enum Constant Summary table, listing "
"<table class=\"memberSummary\" summary=\"Enum Constant Summary table, listing "
+ "enum constants, and an explanation\">");
checkOutput("pkg2/C3.html", true,
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Required Element Summary table, "
"<table class=\"memberSummary\" summary=\"Required Element Summary table, "
+ "listing required elements, and an explanation\">");
checkOutput("pkg2/C4.html", true,
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Optional Element Summary table, "
"<table class=\"memberSummary\" summary=\"Optional Element Summary table, "
+ "listing optional elements, and an explanation\">");
// Class use documentation
checkOutput("pkg1/class-use/I1.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing packages, and an explanation\">");
"<table class=\"useSummary\" summary=\"Use table, listing packages, and an explanation\">");
checkOutput("pkg1/class-use/C1.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing fields, and an explanation\">",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing methods, and an explanation\">");
"<table class=\"useSummary\" summary=\"Use table, listing fields, and an explanation\">",
"<table class=\"useSummary\" summary=\"Use table, listing methods, and an explanation\">");
checkOutput("pkg2/class-use/C2.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing fields, and an explanation\">",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing methods, and an explanation\">");
"<table class=\"useSummary\" summary=\"Use table, listing fields, and an explanation\">",
"<table class=\"useSummary\" summary=\"Use table, listing methods, and an explanation\">");
checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing packages, and an explanation\">");
"<table class=\"useSummary\" summary=\"Use table, listing packages, and an explanation\">");
checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing methods, and an explanation\">");
"<table class=\"useSummary\" summary=\"Use table, listing methods, and an explanation\">");
// Package use documentation
checkOutput("pkg1/package-use.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing packages, and an explanation\">",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing classes, and an explanation\">");
"<table class=\"useSummary\" summary=\"Use table, listing packages, and an explanation\">",
"<table class=\"useSummary\" summary=\"Use table, listing classes, and an explanation\">");
checkOutput("pkg2/package-use.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing packages, and an explanation\">",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing classes, and an explanation\">");
"<table class=\"useSummary\" summary=\"Use table, listing packages, and an explanation\">",
"<table class=\"useSummary\" summary=\"Use table, listing classes, and an explanation\">");
// Deprecated
checkOutput("deprecated-list.html", true,
"<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+ "summary=\"Deprecated Fields table, listing deprecated fields, "
"<table class=\"deprecatedSummary\" summary=\"Deprecated Fields table, listing deprecated fields, "
+ "and an explanation\">",
"<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+ "summary=\"Deprecated Methods table, listing deprecated methods, "
"<table class=\"deprecatedSummary\" summary=\"Deprecated Methods table, listing deprecated methods, "
+ "and an explanation\">");
// Constant values
checkOutput("constant-values.html", true,
"<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+ "summary=\"Constant Field Values table, listing "
"<table class=\"constantsSummary\" summary=\"Constant Field Values table, listing "
+ "constant fields, and values\">");
// Overview Summary
checkOutput("overview-summary.html", true,
"<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Packages table, "
+ "listing packages, and an explanation\">");
"<table class=\"overviewSummary\" "
+ "summary=\"Packages table, listing packages, and an explanation\">");
}
/*

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg;
import java.lang.annotation.*;
/**
* This is a test annotation type.
*
* @author Bhavesh Patel.
* @since 9
*/
@Documented public @interface AnnotationType {
}

View File

@ -0,0 +1,78 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg;
import pkg1.*;
/**
* Another test class.
*
* @author Bhavesh Patel
*/
public class AnotherClass {
/**
* A test field.
*/
public RegClass field;
/**
* Constant field.
*/
public static final String CONSTANT_FIELD_3 = "constant";
/**
* @deprecated don't use this field anymore.
*/
public RegClass dep_field;
/**
* A sample enum.
*/
public static enum ModalExclusionType {
/**
* Test comment.
*/
NO_EXCLUDE,
/**
* Another comment.
*/
APPLICATION_EXCLUDE
};
/**
* A string constant.
*/
public static final String CONSTANT1 = "C2";
/**
* A sample method.
*
* @param param some parameter.
* @return a test object.
*/
public Class method(pkg1.RegClass param) {
return param;
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg;
/**
* Error class.
*/
public class TestError extends Error {
/**
* Constructs a test error.
*/
public TestError() {
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg;
/**
* Thrown when a TestException occurs.
*/
public class TestException extends Exception {
/**
* Constructs a {@code TestException} with no detail message.
*/
public TestException() {
}
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg;
/**
* This is a description for an Interface.
*/
public interface TestInterface {
public void method();
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Test package.
*/
package pkg;

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg1;
import java.io.*;
/**
* A test class where the outer class is package private and the inner class is private
* and a nested inner class is protected.
*
* @author Bhavesh Patel
*/
class NestedInnerClass {
private static class InnerClass {
protected static class ProNestedInnerClass implements java.io.Serializable {
public final int SERIALIZABLE_CONSTANT2 = 1;
/**
* @param s ObjectInputStream.
* @throws IOException when there is an I/O error.
* @serial
*/
private void readObject(ObjectInputStream s) throws IOException {
}
/**
* @param s ObjectOutputStream.
* @throws IOException when there is an I/O error.
* @serial
*/
private void writeObject(ObjectOutputStream s) throws IOException {
}
}
}
}

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg1;
import java.io.*;
/**
* A test class where the outer class is package private and inner class
* is private which is included using the tag.
*
* @author Bhavesh Patel
*/
class PrivateIncludeInnerClass {
/**
* @serial include
*/
private static class PriInnerClass implements java.io.Serializable {
public final int SERIALIZABLE_CONSTANT = 1;
/**
* @param s ObjectInputStream.
* @throws IOException when there is an I/O error.
* @serial
*/
private void readObject(ObjectInputStream s) throws IOException {
}
/**
* @param s ObjectOutputStream.
* @throws IOException when there is an I/O error.
* @serial
*/
private void writeObject(ObjectOutputStream s) throws IOException {
}
}
}

View File

@ -0,0 +1,59 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg1;
import java.io.*;
/**
* A test class where outer class is package private and the inner class is
* protected.
*
* @author Bhavesh Patel
*/
class ProtectedInnerClass {
protected static class ProInnerClass implements java.io.Serializable {
public final int SERIALIZABLE_CONSTANT1 = 1;
/**
* @param s ObjectInputStream.
* @throws IOException when there is an I/O error.
* @serial
*/
private void readObject(ObjectInputStream s) throws IOException {
}
/**
* @param s ObjectOutputStream.
* @throws IOException when there is an I/O error.
* @serial
*/
private void writeObject(ObjectOutputStream s) throws IOException {
}
}
}

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg1;
import java.io.*;
/**
* A test class where the outer class is package private and inner class
* is public which is excluded using the tag.
*
* @author Bhavesh Patel
*/
class PublicExcludeInnerClass {
/**
* @serial exclude
*/
public static class PubInnerClass implements java.io.Serializable {
public final int SERIALIZABLE_CONSTANT3 = 1;
/**
* @param s ObjectInputStream.
* @throws IOException when there is an I/O error.
* @serial
*/
private void readObject(ObjectInputStream s) throws IOException {
}
/**
* @param s ObjectOutputStream.
* @throws IOException when there is an I/O error.
* @serial
*/
private void writeObject(ObjectOutputStream s) throws IOException {
}
}
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg1;
/**
*This is a description for Class.
*/
public class RegClass {
/**
* Constant field.
*/
public static final String CONSTANT_FIELD_1 = "constant";
/**
* Another constant field.
*/
public static final int CONSTANT_FIELD_2 = 1;
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg2;
@Deprecated()
public class DeprecatedClassByAnnotation {
@Deprecated()
public int field;
@Deprecated()
public DeprecatedClassByAnnotation() {}
@Deprecated()
public void method() {}
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg2;
/**
* This is a description for an Interface.
*/
public interface Interface {
public void method1();
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg2;
import java.lang.annotation.*;
/**
* @deprecated annotation_test1 passes.
*/
@Documented public @interface TestAnnotationType {
/**
* @deprecated annotation_test2 passes.
*/
String optional() default "unknown";
/**
* @deprecated annotation_test3 passes.
*/
int required();
}

Some files were not shown because too many files have changed in this diff Show More