6851834: Javadoc doclet needs a structured approach to generate the output HTML

Reviewed-by: jjg
This commit is contained in:
Bhavesh Patel 2010-12-01 11:02:38 -08:00
parent 6edf2ff9a3
commit 275e77646d
148 changed files with 12175 additions and 7441 deletions

View file

@ -26,12 +26,16 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
/** /**
* Print method and constructor info. * Print method and constructor info.
* *
* @author Robert Field * @author Robert Field
* @author Atul M Dambalkar * @author Atul M Dambalkar
* @author Bhavesh Patel (Modified)
*/ */
public abstract class AbstractExecutableMemberWriter extends AbstractMemberWriter { public abstract class AbstractExecutableMemberWriter extends AbstractMemberWriter {
@ -45,82 +49,111 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
} }
/** /**
* Write the type parameters for the executable member. * Add the type parameters for the executable member.
* *
* @param member the member to write type parameters for. * @param member the member to write type parameters for.
* @param htmltree the content tree to which the parameters will be added.
* @return the display length required to write this information. * @return the display length required to write this information.
*/ */
protected int writeTypeParameters(ExecutableMemberDoc member) { protected int addTypeParameters(ExecutableMemberDoc member, Content htmltree) {
LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl linkInfo = new LinkInfoImpl(
LinkInfoImpl.CONTEXT_MEMBER_TYPE_PARAMS, member, false); LinkInfoImpl.CONTEXT_MEMBER_TYPE_PARAMS, member, false);
String typeParameters = writer.getTypeParameterLinks(linkInfo); String typeParameters = writer.getTypeParameterLinks(linkInfo);
if (linkInfo.displayLength > 0) { if (linkInfo.displayLength > 0) {
writer.print(typeParameters + " "); Content linkContent = new RawHtml(typeParameters);
htmltree.addContent(linkContent);
htmltree.addContent(writer.getSpace());
writer.displayLength += linkInfo.displayLength + 1; writer.displayLength += linkInfo.displayLength + 1;
} }
return linkInfo.displayLength; return linkInfo.displayLength;
} }
protected void writeSignature(ExecutableMemberDoc member) { /**
writer.displayLength = 0; * {@inheritDoc}
writer.pre(); */
writer.writeAnnotationInfo(member); protected Content getDeprecatedLink(ProgramElementDoc member) {
printModifiers(member);
writeTypeParameters(member);
if (configuration().linksource &&
member.position().line() != classdoc.position().line()) {
writer.printSrcLink(member, member.name());
} else {
strong(member.name());
}
writeParameters(member);
writeExceptions(member);
writer.preEnd();
}
protected void writeDeprecatedLink(ProgramElementDoc member) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)member; ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, (MemberDoc) emd, return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, (MemberDoc) emd,
emd.qualifiedName() + emd.flatSignature(), false); emd.qualifiedName() + emd.flatSignature());
} }
protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) { /**
* Add the summary link for the member.
*
* @param context the id of the context where the link will be printed
* @param classDoc the classDoc that we should link to
* @param member the member being linked to
* @param tdSummary the content tree to which the link will be added
*/
protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)member; ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
String name = emd.name(); String name = emd.name();
writer.strong(); Content strong = HtmlTree.STRONG(new RawHtml(
writer.printDocLink(context, cd, (MemberDoc) emd, writer.getDocLink(context, cd, (MemberDoc) emd,
name, false); name, false)));
writer.strongEnd(); Content code = HtmlTree.CODE(strong);
writer.displayLength = name.length(); writer.displayLength = name.length();
writeParameters(emd, false); addParameters(emd, false, code);
tdSummary.addContent(code);
} }
protected void writeInheritedSummaryLink(ClassDoc cd, /**
ProgramElementDoc member) { * Add the inherited summary link for the member.
writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc) member, *
member.name(), false); * @param classDoc the classDoc that we should link to
* @param member the member being linked to
* @param linksTree the content tree to which the link will be added
*/
protected void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member, Content linksTree) {
linksTree.addContent(new RawHtml(
writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc) member,
member.name(), false)));
} }
protected void writeParam(ExecutableMemberDoc member, Parameter param, /**
boolean isVarArg) { * Add the parameter for the executable member.
*
* @param member the member to write parameter for.
* @param param the parameter that needs to be written.
* @param isVarArg true if this is a link to var arg.
* @param tree the content tree to which the parameter information will be added.
*/
protected void addParam(ExecutableMemberDoc member, Parameter param,
boolean isVarArg, Content tree) {
if (param.type() != null) { if (param.type() != null) {
writer.printLink(new LinkInfoImpl( Content link = new RawHtml(writer.getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_EXECUTABLE_MEMBER_PARAM, param.type(), LinkInfoImpl.CONTEXT_EXECUTABLE_MEMBER_PARAM, param.type(),
isVarArg)); isVarArg)));
tree.addContent(link);
} }
if(param.name().length() > 0) { if(param.name().length() > 0) {
writer.space(); tree.addContent(writer.getSpace());
writer.print(param.name()); tree.addContent(param.name());
} }
} }
protected void writeParameters(ExecutableMemberDoc member) { /**
writeParameters(member, true); * Add all the parameters for the executable member.
*
* @param member the member to write parameters for.
* @param tree the content tree to which the parameters information will be added.
*/
protected void addParameters(ExecutableMemberDoc member, Content htmltree) {
addParameters(member, true, htmltree);
} }
protected void writeParameters(ExecutableMemberDoc member, /**
boolean includeAnnotations) { * Add all the parameters for the executable member.
print('('); *
* @param member the member to write parameters for.
* @param includeAnnotations true if annotation information needs to be added.
* @param tree the content tree to which the parameters information will be added.
*/
protected void addParameters(ExecutableMemberDoc member,
boolean includeAnnotations, Content htmltree) {
htmltree.addContent("(");
Parameter[] params = member.parameters(); Parameter[] params = member.parameters();
String indent = makeSpace(writer.displayLength); String indent = makeSpace(writer.displayLength);
if (configuration().linksource) { if (configuration().linksource) {
@ -132,58 +165,70 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
Parameter param = params[paramstart]; Parameter param = params[paramstart];
if (!param.name().startsWith("this$")) { if (!param.name().startsWith("this$")) {
if (includeAnnotations) { if (includeAnnotations) {
boolean foundAnnotations = boolean foundAnnotations =
writer.writeAnnotationInfo(indent.length(), member, param); writer.addAnnotationInfo(indent.length(),
if (foundAnnotations) { member, param, htmltree);
writer.println(); if (foundAnnotations) {
writer.print(indent); htmltree.addContent(DocletConstants.NL);
htmltree.addContent(indent);
} }
} }
writeParam(member, param, addParam(member, param,
(paramstart == params.length - 1) && member.isVarArgs()); (paramstart == params.length - 1) && member.isVarArgs(), htmltree);
break; break;
} }
} }
for (int i = paramstart + 1; i < params.length; i++) { for (int i = paramstart + 1; i < params.length; i++) {
writer.print(','); htmltree.addContent(",");
writer.println(); htmltree.addContent(DocletConstants.NL);
writer.print(indent); htmltree.addContent(indent);
if (includeAnnotations) { if (includeAnnotations) {
boolean foundAnnotations = boolean foundAnnotations =
writer.writeAnnotationInfo(indent.length(), member, params[i]); writer.addAnnotationInfo(indent.length(), member, params[i],
htmltree);
if (foundAnnotations) { if (foundAnnotations) {
writer.println(); htmltree.addContent(DocletConstants.NL);
writer.print(indent); htmltree.addContent(indent);
} }
} }
writeParam(member, params[i], (i == params.length - 1) && member.isVarArgs()); addParam(member, params[i], (i == params.length - 1) && member.isVarArgs(),
htmltree);
} }
writer.print(')'); htmltree.addContent(")");
} }
protected void writeExceptions(ExecutableMemberDoc member) { /**
* Add exceptions for the executable member.
*
* @param member the member to write exceptions for.
* @param htmltree the content tree to which the exceptions information will be added.
*/
protected void addExceptions(ExecutableMemberDoc member, Content htmltree) {
Type[] exceptions = member.thrownExceptionTypes(); Type[] exceptions = member.thrownExceptionTypes();
if(exceptions.length > 0) { if(exceptions.length > 0) {
LinkInfoImpl memberTypeParam = new LinkInfoImpl( LinkInfoImpl memberTypeParam = new LinkInfoImpl(
LinkInfoImpl.CONTEXT_MEMBER, member, false); LinkInfoImpl.CONTEXT_MEMBER, member, false);
int retlen = getReturnTypeLength(member); int retlen = getReturnTypeLength(member);
writer.getTypeParameterLinks(memberTypeParam); writer.getTypeParameterLinks(memberTypeParam);
retlen += memberTypeParam.displayLength == 0 ? retlen += memberTypeParam.displayLength == 0 ?
0 : memberTypeParam.displayLength + 1; 0 : memberTypeParam.displayLength + 1;
String indent = makeSpace(modifierString(member).length() + String indent = makeSpace(modifierString(member).length() +
member.name().length() + retlen - 4); member.name().length() + retlen - 4);
writer.println(); htmltree.addContent(DocletConstants.NL);
writer.print(indent); htmltree.addContent(indent);
writer.print("throws "); htmltree.addContent("throws ");
indent += " "; indent += " ";
writer.printLink(new LinkInfoImpl( Content link = new RawHtml(writer.getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_MEMBER, exceptions[0])); LinkInfoImpl.CONTEXT_MEMBER, exceptions[0])));
htmltree.addContent(link);
for(int i = 1; i < exceptions.length; i++) { for(int i = 1; i < exceptions.length; i++) {
writer.println(","); htmltree.addContent(",");
writer.print(indent); htmltree.addContent(DocletConstants.NL);
writer.printLink(new LinkInfoImpl( htmltree.addContent(indent);
LinkInfoImpl.CONTEXT_MEMBER, exceptions[i])); Content exceptionLink = new RawHtml(writer.getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_MEMBER, exceptions[i])));
htmltree.addContent(exceptionLink);
} }
} }
} }

View file

@ -30,6 +30,8 @@ import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
* Generate Index for all the Member Names with Indexing in * Generate Index for all the Member Names with Indexing in
@ -39,6 +41,7 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
* *
* @see IndexBuilder * @see IndexBuilder
* @author Atul M Dambalkar * @author Atul M Dambalkar
* @author Bhavesh Patel (Modified)
*/ */
public class AbstractIndexWriter extends HtmlDocletWriter { public class AbstractIndexWriter extends HtmlDocletWriter {
@ -78,175 +81,187 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
} }
/** /**
* Print the text "Index" in strong format in the navigation bar. * Get the index label for navigation bar.
*
* @return a content tree for the tree label
*/ */
protected void navLinkIndex() { protected Content getNavLinkIndex() {
navCellRevStart(); Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, indexLabel);
fontStyle("NavBarFont1Rev"); return li;
strongText("doclet.Index");
fontEnd();
navCellEnd();
} }
/** /**
* Generate the member information for the unicode character along with the * Add the member information for the unicode character along with the
* list of the members. * list of the members.
* *
* @param unicode Unicode for which member list information to be generated. * @param unicode Unicode for which member list information to be generated
* @param memberlist List of members for the unicode character. * @param memberlist List of members for the unicode character
* @param contentTree the content tree to which the information will be added
*/ */
protected void generateContents(Character unicode, List<? extends Doc> memberlist) { protected void addContents(Character unicode, List<? extends Doc> memberlist,
anchor("_" + unicode + "_"); Content contentTree) {
h2(); contentTree.addContent(getMarkerAnchor("_" + unicode + "_"));
strong(unicode.toString()); Content headContent = new StringContent(unicode.toString());
h2End(); Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false,
HtmlStyle.title, headContent);
contentTree.addContent(heading);
int memberListSize = memberlist.size(); int memberListSize = memberlist.size();
// Display the list only if there are elements to be displayed. // Display the list only if there are elements to be displayed.
if (memberListSize > 0) { if (memberListSize > 0) {
dl(); Content dl = new HtmlTree(HtmlTag.DL);
for (int i = 0; i < memberListSize; i++) { for (int i = 0; i < memberListSize; i++) {
Doc element = memberlist.get(i); Doc element = memberlist.get(i);
if (element instanceof MemberDoc) { if (element instanceof MemberDoc) {
printDescription((MemberDoc)element); addDescription((MemberDoc)element, dl);
} else if (element instanceof ClassDoc) { } else if (element instanceof ClassDoc) {
printDescription((ClassDoc)element); addDescription((ClassDoc)element, dl);
} else if (element instanceof PackageDoc) { } else if (element instanceof PackageDoc) {
printDescription((PackageDoc)element); addDescription((PackageDoc)element, dl);
} }
} }
dlEnd(); contentTree.addContent(dl);
} }
hr();
} }
/** /**
* Print one line summary comment for the package. * Add one line summary comment for the package.
* *
* @param pkg PackageDoc passed. * @param pkg the package to be documented
* @param dlTree the content tree to which the description will be added
*/ */
protected void printDescription(PackageDoc pkg) { protected void addDescription(PackageDoc pkg, Content dlTree) {
dt(); Content link = getPackageLink(pkg, new StringContent(Util.getPackageName(pkg)));
printPackageLink(pkg, Util.getPackageName(pkg), true); Content dt = HtmlTree.DT(link);
print(" - "); dt.addContent(" - ");
print(configuration.getText("doclet.package") + " " + pkg.name()); dt.addContent(getResource("doclet.package"));
dtEnd(); dt.addContent(" " + pkg.name());
dd(); dlTree.addContent(dt);
printSummaryComment(pkg); Content dd = new HtmlTree(HtmlTag.DD);
ddEnd(); addSummaryComment(pkg, dd);
dlTree.addContent(dd);
} }
/** /**
* Print one line summary comment for the class. * Add one line summary comment for the class.
* *
* @param cd ClassDoc passed. * @param cd the class being documented
* @param dlTree the content tree to which the description will be added
*/ */
protected void printDescription(ClassDoc cd) { protected void addDescription(ClassDoc cd, Content dlTree) {
dt(); Content link = new RawHtml(
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_INDEX, cd, true)); getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_INDEX, cd, true)));
print(" - "); Content dt = HtmlTree.DT(link);
printClassInfo(cd); dt.addContent(" - ");
dtEnd(); addClassInfo(cd, dt);
dd(); dlTree.addContent(dt);
printComment(cd); Content dd = new HtmlTree(HtmlTag.DD);
ddEnd(); addComment(cd, dd);
dlTree.addContent(dd);
} }
/** /**
* Print the classkind(class, interface, exception, error of the class * Add the classkind(class, interface, exception, error of the class
* passed. * passed.
* *
* @param cd ClassDoc. * @param cd the class being documented
* @param contentTree the content tree to which the class info will be added
*/ */
protected void printClassInfo(ClassDoc cd) { protected void addClassInfo(ClassDoc cd, Content contentTree) {
print(configuration.getText("doclet.in", contentTree.addContent(getResource("doclet.in",
Util.getTypeName(configuration, cd, false), Util.getTypeName(configuration, cd, false),
getPackageLink(cd.containingPackage(), getPackageLinkString(cd.containingPackage(),
Util.getPackageName(cd.containingPackage()), false))); Util.getPackageName(cd.containingPackage()), false)));
} }
/** /**
* Generate Description for Class, Field, Method or Constructor. * Add description for Class, Field, Method or Constructor.
* for Java.* Packages Class Members.
* *
* @param member MemberDoc for the member of the Class Kind. * @param member MemberDoc for the member of the Class Kind
* @see com.sun.javadoc.MemberDoc * @param dlTree the content tree to which the description will be added
*/ */
protected void printDescription(MemberDoc member) { protected void addDescription(MemberDoc member, Content dlTree) {
String name = (member instanceof ExecutableMemberDoc)? String name = (member instanceof ExecutableMemberDoc)?
member.name() + ((ExecutableMemberDoc)member).flatSignature() : member.name() + ((ExecutableMemberDoc)member).flatSignature() :
member.name(); member.name();
if (name.indexOf("<") != -1 || name.indexOf(">") != -1) { if (name.indexOf("<") != -1 || name.indexOf(">") != -1) {
name = Util.escapeHtmlChars(name); name = Util.escapeHtmlChars(name);
} }
ClassDoc containing = member.containingClass(); Content span = HtmlTree.SPAN(HtmlStyle.strong,
dt(); getDocLink(LinkInfoImpl.CONTEXT_INDEX, member, name));
printDocLink(LinkInfoImpl.CONTEXT_INDEX, member, name, true); Content dt = HtmlTree.DT(span);
println(" - "); dt.addContent(" - ");
printMemberDesc(member); addMemberDesc(member, dt);
println(); dlTree.addContent(dt);
dtEnd(); Content dd = new HtmlTree(HtmlTag.DD);
dd(); addComment(member, dd);
printComment(member); dlTree.addContent(dd);
ddEnd();
println();
} }
/** /**
* Print comment for each element in the index. If the element is deprecated * Add comment for each element in the index. If the element is deprecated
* and it has a @deprecated tag, use that comment. Else if the containing * and it has a @deprecated tag, use that comment. Else if the containing
* class for this element is deprecated, then add the word "Deprecated." at * class for this element is deprecated, then add the word "Deprecated." at
* the start and then print the normal comment. * the start and then print the normal comment.
* *
* @param element Index element. * @param element Index element
* @param contentTree the content tree to which the comment will be added
*/ */
protected void printComment(ProgramElementDoc element) { protected void addComment(ProgramElementDoc element, Content contentTree) {
Tag[] tags; Tag[] tags;
Content span = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.block);
if (Util.isDeprecated(element)) { if (Util.isDeprecated(element)) {
strongText("doclet.Deprecated"); space(); div.addContent(span);
if ((tags = element.tags("deprecated")).length > 0) if ((tags = element.tags("deprecated")).length > 0)
printInlineDeprecatedComment(element, tags[0]); addInlineDeprecatedComment(element, tags[0], div);
contentTree.addContent(div);
} else { } else {
ClassDoc cont = element.containingClass(); ClassDoc cont = element.containingClass();
while (cont != null) { while (cont != null) {
if (Util.isDeprecated(cont)) { if (Util.isDeprecated(cont)) {
strongText("doclet.Deprecated"); space(); div.addContent(span);
contentTree.addContent(div);
break; break;
} }
cont = cont.containingClass(); cont = cont.containingClass();
} }
printSummaryComment(element); addSummaryComment(element, contentTree);
} }
} }
/** /**
* Print description about the Static Varible/Method/Constructor for a * Add description about the Static Varible/Method/Constructor for a
* member. * member.
* *
* @param member MemberDoc for the member within the Class Kind. * @param member MemberDoc for the member within the Class Kind
* @see com.sun.javadoc.MemberDoc * @param contentTree the content tree to which the member description will be added
*/ */
protected void printMemberDesc(MemberDoc member) { protected void addMemberDesc(MemberDoc member, Content contentTree) {
ClassDoc containing = member.containingClass(); ClassDoc containing = member.containingClass();
String classdesc = Util.getTypeName(configuration, containing, true) + " " + String classdesc = Util.getTypeName(
getPreQualifiedClassLink(LinkInfoImpl.CONTEXT_INDEX, containing, configuration, containing, true) + " ";
false);
if (member.isField()) { if (member.isField()) {
if (member.isStatic()) { if (member.isStatic()) {
printText("doclet.Static_variable_in", classdesc); contentTree.addContent(
getResource("doclet.Static_variable_in", classdesc));
} else { } else {
printText("doclet.Variable_in", classdesc); contentTree.addContent(
getResource("doclet.Variable_in", classdesc));
} }
} else if (member.isConstructor()) { } else if (member.isConstructor()) {
printText("doclet.Constructor_for", classdesc); contentTree.addContent(
getResource("doclet.Constructor_for", classdesc));
} else if (member.isMethod()) { } else if (member.isMethod()) {
if (member.isStatic()) { if (member.isStatic()) {
printText("doclet.Static_method_in", classdesc); contentTree.addContent(
getResource("doclet.Static_method_in", classdesc));
} else { } else {
printText("doclet.Method_in", classdesc); contentTree.addContent(
getResource("doclet.Method_in", classdesc));
} }
} }
addPreQualifiedClassLink(LinkInfoImpl.CONTEXT_INDEX, containing,
false, contentTree);
} }
} }

View file

@ -25,10 +25,11 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import java.lang.reflect.Modifier;
import java.util.*; import java.util.*;
import java.lang.reflect.Modifier;
import com.sun.javadoc.*; import com.sun.javadoc.*;
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.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.taglets.*; import com.sun.tools.doclets.internal.toolkit.taglets.*;
@ -60,36 +61,125 @@ public abstract class AbstractMemberWriter {
/*** abstracts ***/ /*** abstracts ***/
public abstract void printSummaryLabel(); /**
* Add the summary label for the member.
*
* @param memberTree the content tree to which the label will be added
*/
public abstract void addSummaryLabel(Content memberTree);
public abstract void printTableSummary(); /**
* Get the summary for the member summary table.
*
* @return a string for the table summary
*/
public abstract String getTableSummary();
public abstract void printSummaryTableHeader(ProgramElementDoc member); /**
* Get the caption for the member summary table.
*
* @return a string for the table caption
*/
public abstract String getCaption();
public abstract void printInheritedSummaryLabel(ClassDoc cd); /**
* Get the summary table header for the member.
*
* @param member the member to be documented
* @return the summary table header
*/
public abstract String[] getSummaryTableHeader(ProgramElementDoc member);
public abstract void printSummaryAnchor(ClassDoc cd); /**
* Add inherited summary lable for the member.
*
* @param cd the class doc to which to link to
* @param inheritedTree the content tree to which the inherited summary label will be added
*/
public abstract void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree);
public abstract void printInheritedSummaryAnchor(ClassDoc cd); /**
* Add the anchor for the summary section of the member.
*
* @param cd the class doc to be documented
* @param memberTree the content tree to which the summary anchor will be added
*/
public abstract void addSummaryAnchor(ClassDoc cd, Content memberTree);
protected abstract void printSummaryType(ProgramElementDoc member); /**
* Add the anchor for the inherited summary section of the member.
*
* @param cd the class doc to be documented
* @param inheritedTree the content tree to which the inherited summary anchor will be added
*/
public abstract void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree);
protected void writeSummaryLink(ClassDoc cd, ProgramElementDoc member) { /**
writeSummaryLink(LinkInfoImpl.CONTEXT_MEMBER, cd, member); * Add the summary type for the member.
*
* @param member the member to be documented
* @param tdSummaryType the content tree to which the type will be added
*/
protected abstract void addSummaryType(ProgramElementDoc member,
Content tdSummaryType);
/**
* Add the summary link for the member.
*
* @param cd the class doc to be documented
* @param member the member to be documented
* @param tdSummary the content tree to which the link will be added
*/
protected void addSummaryLink(ClassDoc cd, ProgramElementDoc member,
Content tdSummary) {
addSummaryLink(LinkInfoImpl.CONTEXT_MEMBER, cd, member, tdSummary);
} }
protected abstract void writeSummaryLink(int context, /**
ClassDoc cd, * Add the summary link for the member.
ProgramElementDoc member); *
* @param context the id of the context where the link will be printed
* @param cd the class doc to be documented
* @param member the member to be documented
* @param tdSummary the content tree to which the summary link will be added
*/
protected abstract void addSummaryLink(int context,
ClassDoc cd, ProgramElementDoc member, Content tdSummary);
protected abstract void writeInheritedSummaryLink(ClassDoc cd, /**
ProgramElementDoc member); * Add the inherited summary link for the member.
*
* @param cd the class doc to be documented
* @param member the member to be documented
* @param linksTree the content tree to which the inherited summary link will be added
*/
protected abstract void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member, Content linksTree);
protected abstract void writeDeprecatedLink(ProgramElementDoc member); /**
* Get the deprecated link.
*
* @param member the member being linked to
* @return a content tree representing the link
*/
protected abstract Content getDeprecatedLink(ProgramElementDoc member);
protected abstract void printNavSummaryLink(ClassDoc cd, boolean link); /**
* Get the navigation summary link.
*
* @param cd the class doc to be documented
* @param link true if its a link else the label to be printed
* @return a content tree for the navigation summary link.
*/
protected abstract Content getNavSummaryLink(ClassDoc cd, boolean link);
protected abstract void printNavDetailLink(boolean link); /**
* Add the navigation detail link.
*
* @param link true if its a link else the label to be printed
* @param liNav the content tree to which the navigation detail link will be added
*/
protected abstract void addNavDetailLink(boolean link, Content liNav);
/*** ***/ /*** ***/
@ -108,6 +198,17 @@ public abstract class AbstractMemberWriter {
writer.displayLength += str.length(); writer.displayLength += str.length();
} }
/**
* Add the member name to the content tree and modifies the display length.
*
* @param name the member name to be added to the content tree.
* @param htmltree the content tree to which the name will be added.
*/
protected void addName(String name, Content htmltree) {
htmltree.addContent(name);
writer.displayLength += name.length();
}
/** /**
* Return a string describing the access modifier flags. * Return a string describing the access modifier flags.
* Don't include native or synchronized. * Don't include native or synchronized.
@ -131,18 +232,24 @@ public abstract class AbstractMemberWriter {
return type; return type;
} }
protected void printModifiers(MemberDoc member) { /**
* Add the modifier for the member.
*
* @param member the member for which teh modifier will be added.
* @param htmltree the content tree to which the modifier information will be added.
*/
protected void addModifiers(MemberDoc member, Content htmltree) {
String mod = modifierString(member); String mod = modifierString(member);
// According to JLS, we should not be showing public modifier for // According to JLS, we should not be showing public modifier for
// interface methods. // interface methods.
if ((member.isField() || member.isMethod()) && if ((member.isField() || member.isMethod()) &&
writer instanceof ClassWriterImpl && writer instanceof ClassWriterImpl &&
((ClassWriterImpl) writer).getClassDoc().isInterface()) { ((ClassWriterImpl) writer).getClassDoc().isInterface()) {
mod = Util.replaceText(mod, "public", "").trim(); mod = Util.replaceText(mod, "public", "").trim();
} }
if(mod.length() > 0) { if(mod.length() > 0) {
print(mod); htmltree.addContent(mod);
print(' '); htmltree.addContent(writer.getSpace());
} }
} }
@ -158,66 +265,43 @@ public abstract class AbstractMemberWriter {
} }
/** /**
* Print 'static' if static and type link. * Add the modifier and type for the member in the member summary.
*/
protected void printStaticAndType(boolean isStatic, Type type) {
writer.printTypeSummaryHeader();
if (isStatic) {
print("static");
}
writer.space();
if (type != null) {
writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
type));
}
writer.printTypeSummaryFooter();
}
/**
* Print the modifier and type for the member in the member summary.
* *
* @param member the member to print the type for. * @param member the member to add the type for
* @param type the type to print. * @param type the type to add
* @param tdSummaryType the content tree to which the modified and type will be added
*/ */
protected void printModifierAndType(ProgramElementDoc member, Type type) { protected void addModifierAndType(ProgramElementDoc member, Type type,
writer.printTypeSummaryHeader(); Content tdSummaryType) {
printModifier(member); HtmlTree code = new HtmlTree(HtmlTag.CODE);
addModifier(member, code);
if (type == null) { if (type == null) {
writer.space();
if (member.isClass()) { if (member.isClass()) {
print("class"); code.addContent("class");
} else { } else {
print("interface"); code.addContent("interface");
} }
code.addContent(writer.getSpace());
} else { } else {
if (member instanceof ExecutableMemberDoc && if (member instanceof ExecutableMemberDoc &&
((ExecutableMemberDoc) member).typeParameters().length > 0) { ((ExecutableMemberDoc) member).typeParameters().length > 0) {
//Code to avoid ugly wrapping in member summary table. //Code to avoid ugly wrapping in member summary table.
writer.table(0,0,0); int displayLength = ((AbstractExecutableMemberWriter) this).addTypeParameters(
writer.trAlignVAlign("right", ""); (ExecutableMemberDoc) member, code);
writer.tdNowrap();
writer.font("-1");
writer.code();
int displayLength = ((AbstractExecutableMemberWriter) this).
writeTypeParameters((ExecutableMemberDoc) member);
if (displayLength > 10) { if (displayLength > 10) {
writer.br(); code.addContent(new HtmlTree(HtmlTag.BR));
} }
writer.printLink(new LinkInfoImpl( code.addContent(new RawHtml(
LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)); writer.getLink(new LinkInfoImpl(
writer.codeEnd(); LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
writer.fontEnd();
writer.tdEnd();
writer.trEnd();
writer.tableEnd();
} else { } else {
writer.space(); code.addContent(new RawHtml(
writer.printLink(new LinkInfoImpl( writer.getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)); LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
} }
} }
writer.printTypeSummaryFooter(); tdSummaryType.addContent(code);
} }
private void printModifier(ProgramElementDoc member) { private void printModifier(ProgramElementDoc member) {
@ -238,25 +322,53 @@ public abstract class AbstractMemberWriter {
} }
/** /**
* Print the deprecated output for the given member. * Add the modifier for the member.
* *
* @param member the member being documented. * @param member the member to add the type for
* @param code the content tree to which the modified will be added
*/ */
protected void printDeprecated(ProgramElementDoc member) { private void addModifier(ProgramElementDoc member, Content code) {
String output = (new DeprecatedTaglet()).getTagletOutput(member, if (member.isProtected()) {
writer.getTagletWriterInstance(false)).toString().trim(); code.addContent("protected ");
if (!output.isEmpty()) { } else if (member.isPrivate()) {
writer.printMemberDetailsListStartTag(); code.addContent("private ");
writer.print(output); } else if (!member.isPublic()) { // Package private
code.addContent(configuration().getText("doclet.Package_private"));
code.addContent(" ");
}
if (member.isMethod() && ((MethodDoc)member).isAbstract()) {
code.addContent("abstract ");
}
if (member.isStatic()) {
code.addContent("static ");
} }
} }
protected void printComment(ProgramElementDoc member) { /**
* Add the deprecated information for the given member.
*
* @param member the member being documented.
* @param contentTree the content tree to which the deprecated information will be added.
*/
protected void addDeprecatedInfo(ProgramElementDoc member, Content contentTree) {
String output = (new DeprecatedTaglet()).getTagletOutput(member,
writer.getTagletWriterInstance(false)).toString().trim();
if (!output.isEmpty()) {
Content deprecatedContent = new RawHtml(output);
Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
contentTree.addContent(div);
}
}
/**
* Add the comment for the given member.
*
* @param member the member being documented.
* @param contentTree the content tree to which the comment will be added.
*/
protected void addComment(ProgramElementDoc member, Content htmltree) {
if (member.inlineTags().length > 0) { if (member.inlineTags().length > 0) {
writer.printMemberDetailsListStartTag(); writer.addInlineComment(member, htmltree);
writer.dd();
writer.printInlineComment(member);
writer.ddEnd();
} }
} }
@ -264,67 +376,19 @@ public abstract class AbstractMemberWriter {
return member.name(); return member.name();
} }
protected void printHead(MemberDoc member) { /**
writer.h3(); * Get the header for the section.
writer.print(member.name()); *
writer.h3End(); * @param member the member being documented.
} * @return a header content for the section.
*/
protected void printFullComment(ProgramElementDoc member) { protected Content getHead(MemberDoc member) {
if(configuration().nocomment){ Content memberContent = new RawHtml(member.name());
return; Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent);
} return heading;
writer.dl();
print(((TagletOutputImpl)
(new DeprecatedTaglet()).getTagletOutput(member,
writer.getTagletWriterInstance(false))).toString());
printCommentAndTags(member);
writer.dlEnd();
}
protected void printCommentAndTags(ProgramElementDoc member) {
printComment(member);
writer.printTags(member);
} }
/** /**
* Write the member footer.
*/
protected void printMemberFooter() {
writer.printMemberDetailsListEndTag();
assert !writer.getMemberDetailsListPrinted();
}
/**
* Forward to containing writer
*/
public void printSummaryHeader(ClassDoc cd) {
printedSummaryHeader = true;
writer.printSummaryHeader(this, cd);
}
/**
* Forward to containing writer
*/
public void printInheritedSummaryHeader(ClassDoc cd) {
writer.printInheritedSummaryHeader(this, cd);
}
/**
* Forward to containing writer
*/
public void printInheritedSummaryFooter(ClassDoc cd) {
writer.printInheritedSummaryFooter(this, cd);
}
/**
* Forward to containing writer
*/
public void printSummaryFooter(ClassDoc cd) {
writer.printSummaryFooter(this, cd);
}
/**
* Return true if the given <code>ProgramElement</code> is inherited * Return true if the given <code>ProgramElement</code> is inherited
* by the class that is being documented. * by the class that is being documented.
* *
@ -340,102 +404,134 @@ public abstract class AbstractMemberWriter {
return true; return true;
} }
/** /**
* Generate the code for listing the deprecated APIs. Create the table * Add deprecated information to the documentation tree
* format for listing the API. Call methods from the sub-class to complete *
* the generation. * @param deprmembers list of deprecated members
* @param headingKey the caption for the deprecated members table
* @param tableSummary the summary for the deprecated members table
* @param tableHeader table headers for the deprecated members table
* @param contentTree the content tree to which the deprecated members table will be added
*/ */
protected void printDeprecatedAPI(List<Doc> deprmembers, String headingKey, String tableSummary, String[] tableHeader) { protected void addDeprecatedAPI(List<Doc> deprmembers, String headingKey,
String tableSummary, String[] tableHeader, Content contentTree) {
if (deprmembers.size() > 0) { if (deprmembers.size() > 0) {
writer.tableIndexSummary(tableSummary); Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
writer.tableCaptionStart(); writer.getTableCaption(configuration().getText(headingKey)));
writer.printText(headingKey); table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
writer.tableCaptionEnd(); Content tbody = new HtmlTree(HtmlTag.TBODY);
writer.summaryTableHeader(tableHeader, "col");
for (int i = 0; i < deprmembers.size(); i++) { for (int i = 0; i < deprmembers.size(); i++) {
ProgramElementDoc member =(ProgramElementDoc)deprmembers.get(i); ProgramElementDoc member =(ProgramElementDoc)deprmembers.get(i);
writer.trBgcolorStyle("white", "TableRowColor"); HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, getDeprecatedLink(member));
writer.summaryRow(0);
writeDeprecatedLink(member);
writer.br();
writer.printNbsps();
if (member.tags("deprecated").length > 0) if (member.tags("deprecated").length > 0)
writer.printInlineDeprecatedComment(member, member.tags("deprecated")[0]); writer.addInlineDeprecatedComment(member,
writer.space(); member.tags("deprecated")[0], td);
writer.summaryRowEnd(); HtmlTree tr = HtmlTree.TR(td);
writer.trEnd(); if (i%2 == 0)
tr.addStyle(HtmlStyle.altColor);
else
tr.addStyle(HtmlStyle.rowColor);
tbody.addContent(tr);
} }
writer.tableEnd(); table.addContent(tbody);
writer.space(); Content li = HtmlTree.LI(HtmlStyle.blockList, table);
writer.p(); Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
contentTree.addContent(ul);
} }
} }
/** /**
* Print use info. * Add use information to the documentation tree.
*
* @param mems list of program elements for which the use information will be added
* @param heading the section heading
* @param tableSummary the summary for the use table
* @param contentTree the content tree to which the use information will be added
*/ */
protected void printUseInfo(List<? extends ProgramElementDoc> mems, String heading, String tableSummary) { protected void addUseInfo(List<? extends ProgramElementDoc> mems,
String heading, String tableSummary, Content contentTree) {
if (mems == null) { if (mems == null) {
return; return;
} }
List<? extends ProgramElementDoc> members = mems; List<? extends ProgramElementDoc> members = mems;
boolean printedUseTableHeader = false; boolean printedUseTableHeader = false;
if (members.size() > 0) { if (members.size() > 0) {
writer.tableIndexSummary(tableSummary); Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
writer.tableSubCaptionStart(); writer.getTableCaption(heading));
writer.print(heading); Content tbody = new HtmlTree(HtmlTag.TBODY);
writer.tableCaptionEnd(); Iterator<? extends ProgramElementDoc> it = members.iterator();
for (Iterator<? extends ProgramElementDoc> it = members.iterator(); it.hasNext(); ) { for (int i = 0; it.hasNext(); i++) {
ProgramElementDoc pgmdoc = it.next(); ProgramElementDoc pgmdoc = it.next();
ClassDoc cd = pgmdoc.containingClass(); ClassDoc cd = pgmdoc.containingClass();
if (!printedUseTableHeader) { if (!printedUseTableHeader) {
// Passing ProgramElementDoc helps decides printing table.addContent(writer.getSummaryTableHeader(
// interface or class header in case of nested classes. this.getSummaryTableHeader(pgmdoc), "col"));
this.printSummaryTableHeader(pgmdoc);
printedUseTableHeader = true; printedUseTableHeader = true;
} }
HtmlTree tr = new HtmlTree(HtmlTag.TR);
writer.printSummaryLinkType(this, pgmdoc); if (i % 2 == 0) {
tr.addStyle(HtmlStyle.altColor);
} else {
tr.addStyle(HtmlStyle.rowColor);
}
HtmlTree tdFirst = new HtmlTree(HtmlTag.TD);
tdFirst.addStyle(HtmlStyle.colFirst);
writer.addSummaryType(this, pgmdoc, tdFirst);
tr.addContent(tdFirst);
HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
tdLast.addStyle(HtmlStyle.colLast);
if (cd != null && !(pgmdoc instanceof ConstructorDoc) if (cd != null && !(pgmdoc instanceof ConstructorDoc)
&& !(pgmdoc instanceof ClassDoc)) { && !(pgmdoc instanceof ClassDoc)) {
// Add class context HtmlTree name = new HtmlTree(HtmlTag.SPAN);
writer.strong(cd.name() + "."); name.addStyle(HtmlStyle.strong);
name.addContent(cd.name() + ".");
tdLast.addContent(name);
} }
writeSummaryLink( addSummaryLink(pgmdoc instanceof ClassDoc ?
pgmdoc instanceof ClassDoc ? LinkInfoImpl.CONTEXT_CLASS_USE : LinkInfoImpl.CONTEXT_MEMBER,
LinkInfoImpl.CONTEXT_CLASS_USE : LinkInfoImpl.CONTEXT_MEMBER, cd, pgmdoc, tdLast);
cd, pgmdoc); writer.addSummaryLinkComment(this, pgmdoc, tdLast);
writer.printSummaryLinkComment(this, pgmdoc); tr.addContent(tdLast);
tbody.addContent(tr);
} }
writer.tableEnd(); table.addContent(tbody);
writer.space(); contentTree.addContent(table);
writer.p();
} }
} }
protected void navDetailLink(List<?> members) { /**
printNavDetailLink(members.size() > 0? true: false); * Add the navigation detail link.
*
* @param members the members to be linked
* @param liNav the content tree to which the navigation detail link will be added
*/
protected void addNavDetailLink(List<?> members, Content liNav) {
addNavDetailLink(members.size() > 0 ? true : false, liNav);
} }
/**
protected void navSummaryLink(List<?> members, * Add the navigation summary link.
VisibleMemberMap visibleMemberMap) { *
* @param members members to be linked
* @param visibleMemberMap the visible inherited members map
* @param liNav the content tree to which the navigation summary link will be added
*/
protected void addNavSummaryLink(List<?> members,
VisibleMemberMap visibleMemberMap, Content liNav) {
if (members.size() > 0) { if (members.size() > 0) {
printNavSummaryLink(null, true); liNav.addContent(getNavSummaryLink(null, true));
return; return;
} else {
ClassDoc icd = classdoc.superclass();
while (icd != null) {
List<?> inhmembers = visibleMemberMap.getMembersFor(icd);
if (inhmembers.size() > 0) {
printNavSummaryLink(icd, true);
return;
}
icd = icd.superclass();
}
} }
printNavSummaryLink(null, false); ClassDoc icd = classdoc.superclass();
while (icd != null) {
List<?> inhmembers = visibleMemberMap.getMembersFor(icd);
if (inhmembers.size() > 0) {
liNav.addContent(getNavSummaryLink(icd, true));
return;
}
icd = icd.superclass();
}
liNav.addContent(getNavSummaryLink(null, false));
} }
protected void serialWarning(SourcePosition pos, String key, String a1, String a2) { protected void serialWarning(SourcePosition pos, String key, String a1, String a2) {
@ -453,12 +549,109 @@ public abstract class AbstractMemberWriter {
} }
/** /**
* {@inheritDoc} * Add the member summary for the given class.
*
* @param classDoc the class that is being documented
* @param member the member being documented
* @param firstSentenceTags the first sentence tags to be added to the summary
* @param tableTree the content tree to which the documentation will be added
* @param counter the counter for determing style for the table row
*/ */
public void writeMemberSummary(ClassDoc classDoc, ProgramElementDoc member, public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
Tag[] firstSentenceTags, boolean isFirst, boolean isLast) { Tag[] firstSentenceTags, Content tableTree, int counter) {
writer.printSummaryLinkType(this, member); HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
writeSummaryLink(classDoc, member); tdSummaryType.addStyle(HtmlStyle.colFirst);
writer.printSummaryLinkComment(this, member, firstSentenceTags); writer.addSummaryType(this, member, tdSummaryType);
HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
setSummaryColumnStyle(tdSummary);
addSummaryLink(classDoc, member, tdSummary);
writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
HtmlTree tr = HtmlTree.TR(tdSummaryType);
tr.addContent(tdSummary);
if (counter%2 == 0)
tr.addStyle(HtmlStyle.altColor);
else
tr.addStyle(HtmlStyle.rowColor);
tableTree.addContent(tr);
}
/**
* Set the style for the summary column.
*
* @param tdTree the column for which the style will be set
*/
public void setSummaryColumnStyle(HtmlTree tdTree) {
tdTree.addStyle(HtmlStyle.colLast);
}
/**
* Add inherited member summary for the given class and member.
*
* @param classDoc the class the inherited member belongs to
* @param nestedClass the inherited member that is summarized
* @param isFirst true if this is the first member in the list
* @param isLast true if this is the last member in the list
* @param linksTree the content tree to which the summary will be added
*/
public void addInheritedMemberSummary(ClassDoc classDoc,
ProgramElementDoc nestedClass, boolean isFirst, boolean isLast,
Content linksTree) {
writer.addInheritedMemberSummary(this, classDoc, nestedClass, isFirst,
linksTree);
}
/**
* Get the inherited summary header for the given class.
*
* @param classDoc the class the inherited member belongs to
* @return a content tree for the inherited summary header
*/
public Content getInheritedSummaryHeader(ClassDoc classDoc) {
Content inheritedTree = writer.getMemberTreeHeader();
writer.addInheritedSummaryHeader(this, classDoc, inheritedTree);
return inheritedTree;
}
/**
* Get the inherited summary links tree.
*
* @return a content tree for the inherited summary links
*/
public Content getInheritedSummaryLinksTree() {
return new HtmlTree(HtmlTag.CODE);
}
/**
* Get the summary table tree for the given class.
*
* @param classDoc the class for which the summary table is generated
* @return a content tree for the summary table
*/
public Content getSummaryTableTree(ClassDoc classDoc) {
return writer.getSummaryTableTree(this, classDoc);
}
/**
* Get the member tree to be documented.
*
* @param memberTree the content tree of member to be documented
* @return a content tree that will be added to the class documentation
*/
public Content getMemberTree(Content memberTree) {
return writer.getMemberTree(memberTree);
}
/**
* Get the member tree to be documented.
*
* @param memberTree the content tree of member to be documented
* @param isLastContent true if the content to be added is the last content
* @return a content tree that will be added to the class documentation
*/
public Content getMemberTree(Content memberTree, boolean isLastContent) {
if (isLastContent)
return HtmlTree.UL(HtmlStyle.blockListLast, memberTree);
else
return HtmlTree.UL(HtmlStyle.blockList, memberTree);
} }
} }

View file

@ -25,9 +25,11 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
* Abstract class to generate the overview files in * Abstract class to generate the overview files in
@ -56,105 +58,127 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
packages = configuration.packages; packages = configuration.packages;
} }
protected abstract void printNavigationBarHeader(); /**
* Adds the navigation bar header to the documentation tree.
protected abstract void printNavigationBarFooter(); *
* @param body the document tree to which the navigation bar header will be added
protected abstract void printOverviewHeader(); */
protected abstract void addNavigationBarHeader(Content body);
protected abstract void printIndexHeader(String text, String tableSummary);
protected abstract void printIndexRow(PackageDoc pkg);
protected abstract void printIndexFooter();
/** /**
* Generate the contants in the package index file. Call appropriate * Adds the navigation bar footer to the documentation tree.
*
* @param body the document tree to which the navigation bar footer will be added
*/
protected abstract void addNavigationBarFooter(Content body);
/**
* Adds the overview header to the documentation tree.
*
* @param body the document tree to which the overview header will be added
*/
protected abstract void addOverviewHeader(Content body);
/**
* Adds the packages list to the documentation tree.
*
* @param packages an array of packagedoc objects
* @param text caption for the table
* @param tableSummary summary for the table
* @param body the document tree to which the packages list will be added
*/
protected abstract void addPackagesList(PackageDoc[] packages, String text,
String tableSummary, Content body);
/**
* Generate and prints the contents in the package index file. Call appropriate
* methods from the sub-class in order to generate Frame or Non * methods from the sub-class in order to generate Frame or Non
* Frame format. * Frame format.
*
* @param title the title of the window. * @param title the title of the window.
* @param includeScript boolean set true if windowtitle script is to be included * @param includeScript boolean set true if windowtitle script is to be included
*/ */
protected void generatePackageIndexFile(String title, boolean includeScript) throws IOException { protected void buildPackageIndexFile(String title, boolean includeScript) throws IOException {
String windowOverview = configuration.getText(title); String windowOverview = configuration.getText(title);
printHtmlHeader(windowOverview, Content body = getBody(includeScript, getWindowTitle(windowOverview));
configuration.metakeywords.getOverviewMetaKeywords(title, addNavigationBarHeader(body);
configuration.doctitle), addOverviewHeader(body);
includeScript); addIndex(body);
printNavigationBarHeader(); addOverview(body);
printOverviewHeader(); addNavigationBarFooter(body);
printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
generateIndex(); configuration.doctitle), includeScript, body);
printOverview();
printNavigationBarFooter();
printBodyHtmlEnd();
} }
/** /**
* Default to no overview, overwrite to add overview. * Default to no overview, override to add overview.
*
* @param body the document tree to which the overview will be added
*/ */
protected void printOverview() throws IOException { protected void addOverview(Content body) throws IOException {
} }
/** /**
* Generate the frame or non-frame package index. * Adds the frame or non-frame package index to the documentation tree.
*
* @param body the document tree to which the index will be added
*/ */
protected void generateIndex() { protected void addIndex(Content body) {
printIndexContents(packages, "doclet.Package_Summary", addIndexContents(packages, "doclet.Package_Summary",
configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Package_Summary"), configuration.getText("doclet.Package_Summary"),
configuration.getText("doclet.packages"))); configuration.getText("doclet.packages")), body);
} }
/** /**
* Generate code for package index contents. Call appropriate methods from * Adds package index contents. Call appropriate methods from
* the sub-classes. * the sub-classes. Adds it to the body HtmlTree
* *
* @param packages Array of packages to be documented. * @param packages array of packages to be documented
* @param text String which will be used as the heading. * @param text string which will be used as the heading
* @param tableSummary summary for the table
* @param body the document tree to which the index contents will be added
*/ */
protected void printIndexContents(PackageDoc[] packages, String text, String tableSummary) { protected void addIndexContents(PackageDoc[] packages, String text,
String tableSummary, Content body) {
if (packages.length > 0) { if (packages.length > 0) {
Arrays.sort(packages); Arrays.sort(packages);
printIndexHeader(text, tableSummary); addAllClassesLink(body);
printAllClassesPackagesLink(); addPackagesList(packages, text, tableSummary, body);
for(int i = 0; i < packages.length; i++) {
if (packages[i] != null) {
printIndexRow(packages[i]);
}
}
printIndexFooter();
} }
} }
/** /**
* Print the doctitle, if it is specified on the command line. * Adds the doctitle to the documentation tree, if it is specified on the command line.
*
* @param body the document tree to which the title will be added
*/ */
protected void printConfigurationTitle() { protected void addConfigurationTitle(Content body) {
if (configuration.doctitle.length() > 0) { if (configuration.doctitle.length() > 0) {
center(); Content title = new RawHtml(configuration.doctitle);
h1(configuration.doctitle); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
centerEnd(); HtmlStyle.title, title);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
body.addContent(div);
} }
} }
/** /**
* Highlight "Overview" in the strong format, in the navigation bar as this * Returns highlighted "Overview", in the navigation bar as this is the
* is the overview page. * overview page.
*
* @return a Content object to be added to the documentation tree
*/ */
protected void navLinkContents() { protected Content getNavLinkContents() {
navCellRevStart(); Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
fontStyle("NavBarFont1Rev"); return li;
strongText("doclet.Overview");
fontEnd();
navCellEnd();
} }
/** /**
* Do nothing. This will be overridden in PackageIndexFrameWriter. * Do nothing. This will be overridden in PackageIndexFrameWriter.
*
* @param body the document tree to which the all classes link will be added
*/ */
protected void printAllClassesPackagesLink() { protected void addAllClassesLink(Content body) {
} }
} }

View file

@ -25,11 +25,12 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.javadoc.*;
/** /**
* Abstract class to print the class hierarchy page for all the Classes. This * Abstract class to print the class hierarchy page for all the Classes. This
@ -46,6 +47,8 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
*/ */
protected final ClassTree classtree; protected final ClassTree classtree;
private static final String LI_CIRCLE = "circle";
/** /**
* Constructor initilises classtree variable. This constructor will be used * Constructor initilises classtree variable. This constructor will be used
* while generating global tree file "overview-tree.html". * while generating global tree file "overview-tree.html".
@ -87,55 +90,64 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
} }
/** /**
* Generate each level of the class tree. For each sub-class or * Add each level of the class tree. For each sub-class or
* sub-interface indents the next level information. * sub-interface indents the next level information.
* Recurses itself to generate subclasses info. * Recurses itself to add subclasses info.
* To iterate is human, to recurse is divine - L. Peter Deutsch.
* *
* @param parent the superclass or superinterface of the list. * @param parent the superclass or superinterface of the list
* @param list list of the sub-classes at this level. * @param list list of the sub-classes at this level
* @param isEnum true if we are generating a tree for enums. * @param isEnum true if we are generating a tree for enums
* @param contentTree the content tree to which the level information will be added
*/ */
protected void generateLevelInfo(ClassDoc parent, List<ClassDoc> list, protected void addLevelInfo(ClassDoc parent, List<ClassDoc> list,
boolean isEnum) { boolean isEnum, Content contentTree) {
if (list.size() > 0) { int size = list.size();
ul(); if (size > 0) {
for (int i = 0; i < list.size(); i++) { Content ul = new HtmlTree(HtmlTag.UL);
for (int i = 0; i < size; i++) {
ClassDoc local = list.get(i); ClassDoc local = list.get(i);
printPartialInfo(local); HtmlTree li = new HtmlTree(HtmlTag.LI);
printExtendsImplements(parent, local); li.addAttr(HtmlAttr.TYPE, LI_CIRCLE);
generateLevelInfo(local, classtree.subs(local, isEnum), addPartialInfo(local, li);
isEnum); // Recurse addExtendsImplements(parent, local, li);
addLevelInfo(local, classtree.subs(local, isEnum),
isEnum, li); // Recurse
ul.addContent(li);
} }
ulEnd(); contentTree.addContent(ul);
} }
} }
/** /**
* Generate the heading for the tree depending upon tree type if it's a * Add the heading for the tree depending upon tree type if it's a
* Class Tree or Interface tree and also print the tree. * Class Tree or Interface tree.
* *
* @param list List of classes which are at the most base level, all the * @param list List of classes which are at the most base level, all the
* other classes in this run will derive from these classes. * other classes in this run will derive from these classes
* @param heading Heading for the tree. * @param heading heading for the tree
* @param div the content tree to which the tree will be added
*/ */
protected void generateTree(List<ClassDoc> list, String heading) { protected void addTree(List<ClassDoc> list, String heading, Content div) {
if (list.size() > 0) { if (list.size() > 0) {
ClassDoc firstClassDoc = list.get(0); ClassDoc firstClassDoc = list.get(0);
printTreeHeading(heading); Content headingContent = getResource(heading);
generateLevelInfo(!firstClassDoc.isInterface()? firstClassDoc : null, div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
list, headingContent));
list == classtree.baseEnums()); addLevelInfo(!firstClassDoc.isInterface()? firstClassDoc : null,
list, list == classtree.baseEnums(), div);
} }
} }
/** /**
* Print the information regarding the classes which this class extends or * Add information regarding the classes which this class extends or
* implements. * implements.
* *
* @param cd The classdoc under consideration. * @param parent the parent class of the class being documented
* @param cd the classdoc under consideration
* @param contentTree the content tree to which the information will be added
*/ */
protected void printExtendsImplements(ClassDoc parent, ClassDoc cd) { protected void addExtendsImplements(ClassDoc parent, ClassDoc cd,
Content contentTree) {
ClassDoc[] interfaces = cd.interfaces(); ClassDoc[] interfaces = cd.interfaces();
if (interfaces.length > (cd.isInterface()? 1 : 0)) { if (interfaces.length > (cd.isInterface()? 1 : 0)) {
Arrays.sort(interfaces); Arrays.sort(interfaces);
@ -148,53 +160,43 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
} }
if (counter == 0) { if (counter == 0) {
if (cd.isInterface()) { if (cd.isInterface()) {
print(" (" + configuration.getText("doclet.also") + " extends "); contentTree.addContent(" (");
contentTree.addContent(getResource("doclet.also"));
contentTree.addContent(" extends ");
} else { } else {
print(" (implements "); contentTree.addContent(" (implements ");
} }
} else { } else {
print(", "); contentTree.addContent(", ");
} }
printPreQualifiedClassLink(LinkInfoImpl.CONTEXT_TREE, addPreQualifiedClassLink(LinkInfoImpl.CONTEXT_TREE,
interfaces[i]); interfaces[i], contentTree);
counter++; counter++;
} }
} }
if (counter > 0) { if (counter > 0) {
println(")"); contentTree.addContent(")");
} }
} }
} }
/** /**
* Print information about the class kind, if it's a "class" or "interface". * Add information about the class kind, if it's a "class" or "interface".
* *
* @param cd classdoc. * @param cd the class being documented
* @param contentTree the content tree to which the information will be added
*/ */
protected void printPartialInfo(ClassDoc cd) { protected void addPartialInfo(ClassDoc cd, Content contentTree) {
li("circle"); addPreQualifiedStrongClassLink(LinkInfoImpl.CONTEXT_TREE, cd, contentTree);
printPreQualifiedStrongClassLink(LinkInfoImpl.CONTEXT_TREE, cd);
} }
/** /**
* Print the heading for the tree. * Get the tree label for the navigation bar.
* *
* @param heading Heading for the tree. * @return a content tree for the tree label
*/ */
protected void printTreeHeading(String heading) { protected Content getNavLinkTree() {
h2(); Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, treeLabel);
println(configuration.getText(heading)); return li;
h2End();
}
/**
* Highlight "Tree" word in the navigation bar, since this is the tree page.
*/
protected void navLinkTree() {
navCellRevStart();
fontStyle("NavBarFont1Rev");
strongText("doclet.Tree");
fontEnd();
navCellEnd();
} }
} }

View file

@ -25,11 +25,14 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Generate the file with list of all the classes in this run. This page will be * Generate the file with list of all the classes in this run. This page will be
* used in the left-hand bottom frame, when "All Classes" link is clicked in * used in the left-hand bottom frame, when "All Classes" link is clicked in
@ -38,6 +41,7 @@ import java.util.*;
* *
* @author Atul M Dambalkar * @author Atul M Dambalkar
* @author Doug Kramer * @author Doug Kramer
* @author Bhavesh Patel (Modified)
*/ */
public class AllClassesFrameWriter extends HtmlDocletWriter { public class AllClassesFrameWriter extends HtmlDocletWriter {
@ -56,6 +60,11 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
*/ */
protected IndexBuilder indexbuilder; protected IndexBuilder indexbuilder;
/**
* BR tag to be used within a document tree.
*/
final HtmlTree BR = new HtmlTree(HtmlTag.BR);
/** /**
* Construct AllClassesFrameWriter object. Also initilises the indexbuilder * Construct AllClassesFrameWriter object. Also initilises the indexbuilder
* variable in this class. * variable in this class.
@ -84,12 +93,12 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
try { try {
allclassgen = new AllClassesFrameWriter(configuration, allclassgen = new AllClassesFrameWriter(configuration,
filename, indexbuilder); filename, indexbuilder);
allclassgen.generateAllClassesFile(true); allclassgen.buildAllClassesFile(true);
allclassgen.close(); allclassgen.close();
filename = OUTPUT_FILE_NAME_NOFRAMES; filename = OUTPUT_FILE_NAME_NOFRAMES;
allclassgen = new AllClassesFrameWriter(configuration, allclassgen = new AllClassesFrameWriter(configuration,
filename, indexbuilder); filename, indexbuilder);
allclassgen.generateAllClassesFile(false); allclassgen.buildAllClassesFile(false);
allclassgen.close(); allclassgen.close();
} catch (IOException exc) { } catch (IOException exc) {
configuration.standardmessage. configuration.standardmessage.
@ -100,30 +109,34 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
} }
/** /**
* Print all the classes in table format in the file. * Print all the classes in the file.
* @param wantFrames True if we want frames. * @param wantFrames True if we want frames.
*/ */
protected void generateAllClassesFile(boolean wantFrames) throws IOException { protected void buildAllClassesFile(boolean wantFrames) throws IOException {
String label = configuration.getText("doclet.All_Classes"); String label = configuration.getText("doclet.All_Classes");
Content body = getBody(false, getWindowTitle(label));
printHtmlHeader(label, null, false); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
HtmlStyle.bar, allclassesLabel);
printAllClassesTableHeader(); body.addContent(heading);
printAllClasses(wantFrames); Content ul = new HtmlTree(HtmlTag.UL);
printAllClassesTableFooter(); // Generate the class links and add it to the tdFont tree.
addAllClasses(ul, wantFrames);
printBodyHtmlEnd(); Content div = HtmlTree.DIV(HtmlStyle.indexContainer, ul);
body.addContent(div);
printHtmlDocument(null, false, body);
} }
/** /**
* Use the sorted index of all the classes and print all the classes. * Use the sorted index of all the classes and add all the classes to the
* content list.
* *
* @param content HtmlTree content to which all classes information will be added
* @param wantFrames True if we want frames. * @param wantFrames True if we want frames.
*/ */
protected void printAllClasses(boolean wantFrames) { protected void addAllClasses(Content content, boolean wantFrames) {
for (int i = 0; i < indexbuilder.elements().length; i++) { for (int i = 0; i < indexbuilder.elements().length; i++) {
Character unicode = (Character)((indexbuilder.elements())[i]); Character unicode = (Character)((indexbuilder.elements())[i]);
generateContents(indexbuilder.getMemberList(unicode), wantFrames); addContents(indexbuilder.getMemberList(unicode), wantFrames, content);
} }
} }
@ -136,46 +149,25 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
* *
* @param classlist Sorted list of classes. * @param classlist Sorted list of classes.
* @param wantFrames True if we want frames. * @param wantFrames True if we want frames.
* @param content HtmlTree content to which the links will be added
*/ */
protected void generateContents(List<Doc> classlist, boolean wantFrames) { protected void addContents(List<Doc> classlist, boolean wantFrames,
Content content) {
for (int i = 0; i < classlist.size(); i++) { for (int i = 0; i < classlist.size(); i++) {
ClassDoc cd = (ClassDoc)classlist.get(i); ClassDoc cd = (ClassDoc)classlist.get(i);
if (!Util.isCoreClass(cd)) { if (!Util.isCoreClass(cd)) {
continue; continue;
} }
String label = italicsClassName(cd, false); String label = italicsClassName(cd, false);
Content linkContent;
if(wantFrames){ if(wantFrames){
printLink(new LinkInfoImpl(LinkInfoImpl.ALL_CLASSES_FRAME, cd, linkContent = new RawHtml(getLink(new LinkInfoImpl(
label, "classFrame") LinkInfoImpl.ALL_CLASSES_FRAME, cd, label, "classFrame")));
);
} else { } else {
printLink(new LinkInfoImpl(cd, label)); linkContent = new RawHtml(getLink(new LinkInfoImpl(cd, label)));
} }
br(); Content li = HtmlTree.LI(linkContent);
content.addContent(li);
} }
} }
/**
* Print the heading "All Classes" and also print Html table tag.
*/
protected void printAllClassesTableHeader() {
fontSizeStyle("+1", "FrameHeadingFont");
strongText("doclet.All_Classes");
fontEnd();
br();
table();
tr();
tdNowrap();
fontStyle("FrameItemFont");
}
/**
* Print Html closing table tag.
*/
protected void printAllClassesTableFooter() {
fontEnd();
tdEnd();
trEnd();
tableEnd();
}
} }

View file

@ -28,6 +28,7 @@ package com.sun.tools.doclets.formats.html;
import java.io.*; import java.io.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
/** /**
@ -54,29 +55,26 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeMemberSummaryHeader(ClassDoc classDoc) { public Content getMemberSummaryHeader(ClassDoc classDoc,
writer.println("<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->"); Content memberSummaryTree) {
writer.println(); memberSummaryTree.addContent(
writer.printSummaryHeader(this, classDoc); HtmlConstants.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
writer.addSummaryHeader(this, classDoc, memberTree);
return memberTree;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeDefaultValueInfo(MemberDoc member) { public void addDefaultValueInfo(MemberDoc member, Content annotationDocTree) {
if (((AnnotationTypeElementDoc) member).defaultValue() != null) { if (((AnnotationTypeElementDoc) member).defaultValue() != null) {
writer.printMemberDetailsListStartTag(); Content dt = HtmlTree.DT(writer.getResource("doclet.Default"));
writer.dd(); Content dl = HtmlTree.DL(dt);
writer.dl(); Content dd = HtmlTree.DD(new StringContent(
writer.dt(); ((AnnotationTypeElementDoc) member).defaultValue().toString()));
writer.strong(ConfigurationImpl.getInstance(). dl.addContent(dd);
getText("doclet.Default")); annotationDocTree.addContent(dl);
writer.dtEnd();
writer.dd();
writer.print(((AnnotationTypeElementDoc) member).defaultValue());
writer.ddEnd();
writer.dlEnd();
writer.ddEnd();
} }
} }
@ -90,45 +88,58 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void printSummaryLabel() { public void addSummaryLabel(Content memberTree) {
writer.printText("doclet.Annotation_Type_Optional_Member_Summary"); Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
writer.getResource("doclet.Annotation_Type_Optional_Member_Summary"));
memberTree.addContent(label);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void printTableSummary() { public String getTableSummary() {
writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary", return configuration().getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Annotation_Type_Optional_Member_Summary"), configuration().getText("doclet.Annotation_Type_Optional_Member_Summary"),
configuration().getText("doclet.annotation_type_optional_members"))); configuration().getText("doclet.annotation_type_optional_members"));
} }
public void printSummaryTableHeader(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
public String getCaption() {
return configuration().getText("doclet.Annotation_Type_Optional_Members");
}
/**
* {@inheritDoc}
*/
public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header = new String[] { String[] header = new String[] {
writer.getModifierTypeHeader(), writer.getModifierTypeHeader(),
configuration().getText("doclet.0_and_1", configuration().getText("doclet.0_and_1",
configuration().getText("doclet.Annotation_Type_Optional_Member"), configuration().getText("doclet.Annotation_Type_Optional_Member"),
configuration().getText("doclet.Description")) configuration().getText("doclet.Description"))
}; };
writer.summaryTableHeader(header, "col"); return header;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void printSummaryAnchor(ClassDoc cd) { public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
writer.anchor("annotation_type_optional_element_summary"); memberTree.addContent(writer.getMarkerAnchor(
"annotation_type_optional_element_summary"));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void printNavSummaryLink(ClassDoc cd, boolean link) { protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) { if (link) {
writer.printHyperLink("", "annotation_type_optional_element_summary", return writer.getHyperLink("", "annotation_type_optional_element_summary",
configuration().getText("doclet.navAnnotationTypeOptionalMember")); writer.getResource("doclet.navAnnotationTypeOptionalMember"));
} else { } else {
writer.printText("doclet.navAnnotationTypeOptionalMember"); return writer.getResource("doclet.navAnnotationTypeOptionalMember");
} }
} }
} }

View file

@ -28,6 +28,7 @@ package com.sun.tools.doclets.formats.html;
import java.io.*; import java.io.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
/** /**
@ -51,122 +52,102 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
} }
/** /**
* Write the annotation type member summary header for the given class. * {@inheritDoc}
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeMemberSummaryHeader(ClassDoc classDoc) { public Content getMemberSummaryHeader(ClassDoc classDoc,
writer.println("<!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== -->"); Content memberSummaryTree) {
writer.println(); memberSummaryTree.addContent(
writer.printSummaryHeader(this, classDoc); HtmlConstants.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY);
} Content memberTree = writer.getMemberTreeHeader();
writer.addSummaryHeader(this, classDoc, memberTree);
/** return memberTree;
* Write the annotation type member summary footer for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeMemberSummaryFooter(ClassDoc classDoc) {
writer.printSummaryFooter(this, classDoc);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) { public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
//Not appliable. Content memberDetailsTree) {
} if (!writer.printedAnnotationHeading) {
memberDetailsTree.addContent(writer.getMarkerAnchor(
/** "annotation_type_element_detail"));
* {@inheritDoc} Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
*/ writer.annotationTypeDetailsLabel);
public void writeInheritedMemberSummary(ClassDoc classDoc, memberDetailsTree.addContent(heading);
ProgramElementDoc member, boolean isFirst, boolean isLast) { writer.printedAnnotationHeading = true;
//Not appliable.
}
/**
* {@inheritDoc}
*/
public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
//Not appliable.
}
/**
* {@inheritDoc}
*/
public void writeHeader(ClassDoc classDoc, String header) {
writer.println();
writer.println("<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->");
writer.println();
writer.anchor("annotation_type_element_detail");
writer.printTableHeadingBackground(header);
writer.println();
}
/**
* {@inheritDoc}
*/
public void writeMemberHeader(MemberDoc member, boolean isFirst) {
if (! isFirst) {
writer.printMemberHeader();
writer.println("");
} }
writer.anchor(member.name() + ((ExecutableMemberDoc) member).signature());
writer.h3();
writer.print(member.name());
writer.h3End();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeSignature(MemberDoc member) { public Content getAnnotationDocTreeHeader(MemberDoc member,
writer.pre(); Content annotationDetailsTree) {
writer.writeAnnotationInfo(member); annotationDetailsTree.addContent(
printModifiers(member); writer.getMarkerAnchor(member.name() +
writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, ((ExecutableMemberDoc) member).signature()));
getType(member))); Content annotationDocTree = writer.getMemberTreeHeader();
print(' '); Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
heading.addContent(member.name());
annotationDocTree.addContent(heading);
return annotationDocTree;
}
/**
* {@inheritDoc}
*/
public Content getSignature(MemberDoc member) {
Content pre = new HtmlTree(HtmlTag.PRE);
writer.addAnnotationInfo(member, pre);
addModifiers(member, pre);
Content link = new RawHtml(
writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
getType(member))));
pre.addContent(link);
pre.addContent(writer.getSpace());
if (configuration().linksource) { if (configuration().linksource) {
writer.printSrcLink(member, member.name()); Content memberName = new StringContent(member.name());
writer.addSrcLink(member, memberName, pre);
} else { } else {
strong(member.name()); addName(member.name(), pre);
} }
writer.preEnd(); return pre;
assert !writer.getMemberDetailsListPrinted();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeComments(MemberDoc member) { public void addDeprecated(MemberDoc member, Content annotationDocTree) {
printComment(member); addDeprecatedInfo(member, annotationDocTree);
} }
/** /**
* Write the tag output for the given member. * {@inheritDoc}
*
* @param member the member being documented.
*/ */
public void writeTags(MemberDoc member) { public void addComments(MemberDoc member, Content annotationDocTree) {
writer.printTags(member); addComment(member, annotationDocTree);
} }
/** /**
* Write the annotation type member footer. * {@inheritDoc}
*/ */
public void writeMemberFooter() { public void addTags(MemberDoc member, Content annotationDocTree) {
printMemberFooter(); writer.addTagsInfo(member, annotationDocTree);
} }
/** /**
* Write the footer for the annotation type member documentation. * {@inheritDoc}
*
* @param classDoc the class that the annotation type member belong to.
*/ */
public void writeFooter(ClassDoc classDoc) { public Content getAnnotationDetails(Content annotationDetailsTree) {
//No footer to write for annotation type member documentation return getMemberTree(annotationDetailsTree);
}
/**
* {@inheritDoc}
*/
public Content getAnnotationDoc(Content annotationDocTree,
boolean isLastContent) {
return getMemberTree(annotationDocTree, isLastContent);
} }
/** /**
@ -179,113 +160,120 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void printSummaryLabel() { public void addSummaryLabel(Content memberTree) {
writer.printText("doclet.Annotation_Type_Required_Member_Summary"); Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
writer.getResource("doclet.Annotation_Type_Required_Member_Summary"));
memberTree.addContent(label);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void printTableSummary() { public String getTableSummary() {
writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary", return configuration().getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Annotation_Type_Required_Member_Summary"), configuration().getText("doclet.Annotation_Type_Required_Member_Summary"),
configuration().getText("doclet.annotation_type_required_members"))); configuration().getText("doclet.annotation_type_required_members"));
} }
public void printSummaryTableHeader(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
public String getCaption() {
return configuration().getText("doclet.Annotation_Type_Required_Members");
}
/**
* {@inheritDoc}
*/
public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header = new String[] { String[] header = new String[] {
writer.getModifierTypeHeader(), writer.getModifierTypeHeader(),
configuration().getText("doclet.0_and_1", configuration().getText("doclet.0_and_1",
configuration().getText("doclet.Annotation_Type_Required_Member"), configuration().getText("doclet.Annotation_Type_Required_Member"),
configuration().getText("doclet.Description")) configuration().getText("doclet.Description"))
}; };
writer.summaryTableHeader(header, "col"); return header;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void printSummaryAnchor(ClassDoc cd) { public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
writer.anchor("annotation_type_required_element_summary"); memberTree.addContent(writer.getMarkerAnchor(
"annotation_type_required_element_summary"));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void printInheritedSummaryAnchor(ClassDoc cd) { public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
} // no such
/**
* {@inheritDoc}
*/
public void printInheritedSummaryLabel(ClassDoc cd) {
// no such
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) { public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
writer.strong();
writer.printDocLink(context, (MemberDoc) member, member.name(), false);
writer.strongEnd();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void writeInheritedSummaryLink(ClassDoc cd, protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
ProgramElementDoc member) { Content tdSummary) {
Content strong = HtmlTree.STRONG(new RawHtml(
writer.getDocLink(context, (MemberDoc) member, member.name(), false)));
Content code = HtmlTree.CODE(strong);
tdSummary.addContent(code);
}
/**
* {@inheritDoc}
*/
protected void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member, Content linksTree) {
//Not applicable. //Not applicable.
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void printSummaryType(ProgramElementDoc member) { protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
MemberDoc m = (MemberDoc)member; MemberDoc m = (MemberDoc)member;
printModifierAndType(m, getType(m)); addModifierAndType(m, getType(m), tdSummaryType);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void writeDeprecatedLink(ProgramElementDoc member) { protected Content getDeprecatedLink(ProgramElementDoc member) {
writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER,
(MemberDoc) member, ((MemberDoc)member).qualifiedName(), false); (MemberDoc) member, ((MemberDoc)member).qualifiedName());
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void printNavSummaryLink(ClassDoc cd, boolean link) { protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) { if (link) {
writer.printHyperLink("", "annotation_type_required_element_summary", return writer.getHyperLink("", "annotation_type_required_element_summary",
configuration().getText("doclet.navAnnotationTypeRequiredMember")); writer.getResource("doclet.navAnnotationTypeRequiredMember"));
} else { } else {
writer.printText("doclet.navAnnotationTypeRequiredMember"); return writer.getResource("doclet.navAnnotationTypeRequiredMember");
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void printNavDetailLink(boolean link) { protected void addNavDetailLink(boolean link, Content liNav) {
if (link) { if (link) {
writer.printHyperLink("", "annotation_type_element_detail", liNav.addContent(writer.getHyperLink("", "annotation_type_element_detail",
configuration().getText("doclet.navAnnotationTypeMember")); writer.getResource("doclet.navAnnotationTypeMember")));
} else { } else {
writer.printText("doclet.navAnnotationTypeMember"); liNav.addContent(writer.getResource("doclet.navAnnotationTypeMember"));
} }
} }
/**
* {@inheritDoc}
*/
public void writeDeprecated(MemberDoc member) {
printDeprecated(member);
}
private Type getType(MemberDoc member) { private Type getType(MemberDoc member) {
if (member instanceof FieldDoc) { if (member instanceof FieldDoc) {
return ((FieldDoc) member).type(); return ((FieldDoc) member).type();

View file

@ -29,6 +29,7 @@ import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.builders.*; import com.sun.tools.doclets.internal.toolkit.builders.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Generate the Class Information Page. * Generate the Class Information Page.
@ -40,6 +41,7 @@ import com.sun.tools.doclets.internal.toolkit.builders.*;
* *
* @author Atul M Dambalkar * @author Atul M Dambalkar
* @author Robert Field * @author Robert Field
* @author Bhavesh Patel (Modified)
*/ */
public class AnnotationTypeWriterImpl extends SubWriterHolderWriter public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
implements AnnotationTypeWriter { implements AnnotationTypeWriter {
@ -69,126 +71,168 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
} }
/** /**
* Print this package link * Get this package link.
*
* @return a content tree for the package link
*/ */
protected void navLinkPackage() { protected Content getNavLinkPackage() {
navCellStart(); Content linkContent = getHyperLink("package-summary.html", "",
printHyperLink("package-summary.html", "", packageLabel);
configuration.getText("doclet.Package"), true, "NavBarFont1"); Content li = HtmlTree.LI(linkContent);
navCellEnd(); return li;
} }
/** /**
* Print class page indicator * Get the class link.
*
* @return a content tree for the class link
*/ */
protected void navLinkClass() { protected Content getNavLinkClass() {
navCellRevStart(); Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
fontStyle("NavBarFont1Rev"); return li;
strongText("doclet.Class");
fontEnd();
navCellEnd();
} }
/** /**
* Print class use link * Get the class use link.
*
* @return a content tree for the class use link
*/ */
protected void navLinkClassUse() { protected Content getNavLinkClassUse() {
navCellStart(); Content linkContent = getHyperLink("class-use/" + filename, "", useLabel);
printHyperLink("class-use/" + filename, "", Content li = HtmlTree.LI(linkContent);
configuration.getText("doclet.navClassUse"), true, "NavBarFont1"); return li;
navCellEnd();
} }
/** /**
* Print previous package link * Get link to previous class.
*
* @return a content tree for the previous class link
*/ */
protected void navLinkPrevious() { public Content getNavLinkPrevious() {
if (prev == null) { Content li;
printText("doclet.Prev_Class"); if (prev != null) {
} else { Content prevLink = new RawHtml(getLink(new LinkInfoImpl(
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, LinkInfoImpl.CONTEXT_CLASS, prev.asClassDoc(), "",
prev.asClassDoc(), "", configuration.getText("doclet.Prev_Class"), true)));
configuration.getText("doclet.Prev_Class"), true)); li = HtmlTree.LI(prevLink);
} }
else
li = HtmlTree.LI(prevclassLabel);
return li;
} }
/** /**
* Print next package link * Get link to next class.
*
* @return a content tree for the next class link
*/ */
protected void navLinkNext() { public Content getNavLinkNext() {
if (next == null) { Content li;
printText("doclet.Next_Class"); if (next != null) {
} else { Content nextLink = new RawHtml(getLink(new LinkInfoImpl(
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, LinkInfoImpl.CONTEXT_CLASS, next.asClassDoc(), "",
next.asClassDoc(), "", configuration.getText("doclet.Next_Class"), true)));
configuration.getText("doclet.Next_Class"), true)); li = HtmlTree.LI(nextLink);
} }
else
li = HtmlTree.LI(nextclassLabel);
return li;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeHeader(String header) { public Content getHeader(String header) {
String pkgname = (annotationType.containingPackage() != null)? String pkgname = (annotationType.containingPackage() != null)?
annotationType.containingPackage().name(): ""; annotationType.containingPackage().name(): "";
String clname = annotationType.name(); String clname = annotationType.name();
Content bodyTree = getBody(true, getWindowTitle(clname));
printHtmlHeader(clname, addTop(bodyTree);
configuration.metakeywords.getMetaKeywords(annotationType), true); addNavLinks(true, bodyTree);
printTop(); bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
navLinks(true); HtmlTree div = new HtmlTree(HtmlTag.DIV);
hr(); div.addStyle(HtmlStyle.header);
println("<!-- ======== START OF CLASS DATA ======== -->");
h2();
if (pkgname.length() > 0) { if (pkgname.length() > 0) {
font("-1"); print(pkgname); fontEnd(); br(); Content pkgNameContent = new StringContent(pkgname);
Content pkgNamePara = HtmlTree.P(HtmlStyle.subTitle, pkgNameContent);
div.addContent(pkgNamePara);
} }
print(header + getTypeParameterLinks(new LinkInfoImpl( LinkInfoImpl linkInfo = new LinkInfoImpl(
LinkInfoImpl.CONTEXT_CLASS_HEADER, LinkInfoImpl.CONTEXT_CLASS_HEADER, annotationType, false);
annotationType, false))); Content headerContent = new StringContent(header);
h2End(); Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
HtmlStyle.title, headerContent);
heading.addContent(new RawHtml(getTypeParameterLinks(linkInfo)));
div.addContent(heading);
bodyTree.addContent(div);
return bodyTree;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeFooter() { public Content getAnnotationContentHeader() {
println("<!-- ========= END OF CLASS DATA ========= -->"); return getContentHeader();
hr();
navLinks(false);
printBottom();
printBodyHtmlEnd();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeAnnotationTypeSignature(String modifiers) { public void addFooter(Content contentTree) {
preNoNewLine(); contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
writeAnnotationInfo(annotationType); addNavLinks(false, contentTree);
print(modifiers); addBottom(contentTree);
String name = annotationType.name() + }
getTypeParameterLinks(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false)); /**
* {@inheritDoc}
*/
public void printDocument(Content contentTree) {
printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType),
true, contentTree);
}
/**
* {@inheritDoc}
*/
public Content getAnnotationInfoTreeHeader() {
return getMemberTreeHeader();
}
/**
* {@inheritDoc}
*/
public Content getAnnotationInfo(Content annotationInfoTree) {
return getMemberTree(HtmlStyle.description, annotationInfoTree);
}
/**
* {@inheritDoc}
*/
public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) {
annotationInfoTree.addContent(new HtmlTree(HtmlTag.BR));
Content pre = new HtmlTree(HtmlTag.PRE);
addAnnotationInfo(annotationType, pre);
pre.addContent(modifiers);
LinkInfoImpl linkInfo = new LinkInfoImpl(
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false);
Content name = new RawHtml (annotationType.name() +
getTypeParameterLinks(linkInfo));
if (configuration().linksource) { if (configuration().linksource) {
printSrcLink(annotationType, name); addSrcLink(annotationType, name, pre);
} else { } else {
strong(name); pre.addContent(HtmlTree.STRONG(name));
} }
preEnd(); annotationInfoTree.addContent(pre);
p();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeAnnotationTypeDescription() { public void addAnnotationTypeDescription(Content annotationInfoTree) {
if(!configuration.nocomment) { if(!configuration.nocomment) {
// generate documentation for the class.
if (annotationType.inlineTags().length > 0) { if (annotationType.inlineTags().length > 0) {
printInlineComment(annotationType); addInlineComment(annotationType, annotationInfoTree);
p();
} }
} }
} }
@ -196,148 +240,152 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeAnnotationTypeTagInfo() { public void addAnnotationTypeTagInfo(Content annotationInfoTree) {
boolean needHr = annotationType.elements().length > 0;
if(!configuration.nocomment) { if(!configuration.nocomment) {
// Print Information about all the tags here addTagsInfo(annotationType, annotationInfoTree);
printTags(annotationType);
if (needHr) {
hr();
}
p();
} else if (needHr) {
hr();
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeAnnotationTypeDeprecationInfo() { public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) {
hr(); Content hr = new HtmlTree(HtmlTag.HR);
annotationInfoTree.addContent(hr);
Tag[] deprs = annotationType.tags("deprecated"); Tag[] deprs = annotationType.tags("deprecated");
if (Util.isDeprecated(annotationType)) { if (Util.isDeprecated(annotationType)) {
strongText("doclet.Deprecated"); Content strong = HtmlTree.STRONG(deprecatedPhrase);
Content div = HtmlTree.DIV(HtmlStyle.block, strong);
if (deprs.length > 0) { if (deprs.length > 0) {
Tag[] commentTags = deprs[0].inlineTags(); Tag[] commentTags = deprs[0].inlineTags();
if (commentTags.length > 0) { if (commentTags.length > 0) {
div.addContent(getSpace());
space(); addInlineDeprecatedComment(annotationType, deprs[0], div);
printInlineDeprecatedComment(annotationType, deprs[0]);
} }
} }
p(); annotationInfoTree.addContent(div);
} }
} }
protected void navLinkTree() { /**
navCellStart(); * {@inheritDoc}
printHyperLink("package-tree.html", "", */
configuration.getText("doclet.Tree"), true, "NavBarFont1"); public void addAnnotationDetailsMarker(Content memberDetails) {
navCellEnd(); memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS);
} }
protected void printSummaryDetailLinks() { /**
try { * {@inheritDoc}
tr(); */
tdVAlignClass("top", "NavBarCell3"); protected Content getNavLinkTree() {
font("-2"); Content treeLinkContent = getHyperLink("package-tree.html",
print(" "); "", treeLabel, "", "");
navSummaryLinks(); Content li = HtmlTree.LI(treeLinkContent);
fontEnd(); return li;
tdEnd(); }
tdVAlignClass("top", "NavBarCell3"); /**
font("-2"); * Add summary details to the navigation bar.
navDetailLinks(); *
fontEnd(); * @param subDiv the content tree to which the summary detail links will be added
tdEnd(); */
trEnd(); protected void addSummaryDetailLinks(Content subDiv) {
try {
Content div = HtmlTree.DIV(getNavSummaryLinks());
div.addContent(getNavDetailLinks());
subDiv.addContent(div);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new DocletAbortException(); throw new DocletAbortException();
} }
} }
protected void navSummaryLinks() throws Exception { /**
printText("doclet.Summary"); * Get summary links for navigation bar.
space(); *
* @return the content tree for the navigation summary links
*/
protected Content getNavSummaryLinks() throws Exception {
Content li = HtmlTree.LI(summaryLabel);
li.addContent(getSpace());
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
configuration.getBuilderFactory().getMemberSummaryBuilder(this); configuration.getBuilderFactory().getMemberSummaryBuilder(this);
writeNavSummaryLink(memberSummaryBuilder, Content liNavReq = new HtmlTree(HtmlTag.LI);
"doclet.navAnnotationTypeRequiredMember", addNavSummaryLink(memberSummaryBuilder,
VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED); "doclet.navAnnotationTypeRequiredMember",
navGap(); VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED, liNavReq);
writeNavSummaryLink(memberSummaryBuilder, addNavGap(liNavReq);
"doclet.navAnnotationTypeOptionalMember", ulNav.addContent(liNavReq);
VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL); Content liNavOpt = new HtmlTree(HtmlTag.LI);
addNavSummaryLink(memberSummaryBuilder,
"doclet.navAnnotationTypeOptionalMember",
VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL, liNavOpt);
ulNav.addContent(liNavOpt);
return ulNav;
} }
private void writeNavSummaryLink(MemberSummaryBuilder builder, /**
String label, int type) { * Add the navigation summary link.
*
* @param builder builder for the member to be documented
* @param label the label for the navigation
* @param type type to be documented
* @param liNav the content tree to which the navigation summary link will be added
*/
protected void addNavSummaryLink(MemberSummaryBuilder builder,
String label, int type, Content liNav) {
AbstractMemberWriter writer = ((AbstractMemberWriter) builder. AbstractMemberWriter writer = ((AbstractMemberWriter) builder.
getMemberSummaryWriter(type)); getMemberSummaryWriter(type));
if (writer == null) { if (writer == null) {
printText(label); liNav.addContent(getResource(label));
} else { } else {
writer.printNavSummaryLink(null, liNav.addContent(writer.getNavSummaryLink(null,
! builder.getVisibleMemberMap(type).noVisibleMembers()); ! builder.getVisibleMemberMap(type).noVisibleMembers()));
} }
} }
/** /**
* Method navDetailLinks * Get detail links for the navigation bar.
*
* @throws Exception
* *
* @return the content tree for the detail links
*/ */
protected void navDetailLinks() throws Exception { protected Content getNavDetailLinks() throws Exception {
printText("doclet.Detail"); Content li = HtmlTree.LI(detailLabel);
space(); li.addContent(getSpace());
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
configuration.getBuilderFactory().getMemberSummaryBuilder(this); configuration.getBuilderFactory().getMemberSummaryBuilder(this);
AbstractMemberWriter writerOptional = AbstractMemberWriter writerOptional =
((AbstractMemberWriter) memberSummaryBuilder. ((AbstractMemberWriter) memberSummaryBuilder.
getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL)); getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL));
AbstractMemberWriter writerRequired = AbstractMemberWriter writerRequired =
((AbstractMemberWriter) memberSummaryBuilder. ((AbstractMemberWriter) memberSummaryBuilder.
getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED)); getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED));
if (writerOptional != null){ if (writerOptional != null){
writerOptional.printNavDetailLink(annotationType.elements().length > 0); Content liNavOpt = new HtmlTree(HtmlTag.LI);
writerOptional.addNavDetailLink(annotationType.elements().length > 0, liNavOpt);
ulNav.addContent(liNavOpt);
} else if (writerRequired != null){ } else if (writerRequired != null){
writerRequired.printNavDetailLink(annotationType.elements().length > 0); Content liNavReq = new HtmlTree(HtmlTag.LI);
writerRequired.addNavDetailLink(annotationType.elements().length > 0, liNavReq);
ulNav.addContent(liNavReq);
} else { } else {
printText("doclet.navAnnotationTypeMember"); Content liNav = HtmlTree.LI(getResource("doclet.navAnnotationTypeMember"));
ulNav.addContent(liNav);
} }
} return ulNav;
protected void navGap() {
space();
print('|');
space();
} }
/** /**
* If this is an inner class or interface, write the enclosing class or * Add gap between navigation bar elements.
* interface. *
* @param liNav the content tree to which the gap will be added
*/ */
public void writeNestedClassInfo() { protected void addNavGap(Content liNav) {
ClassDoc outerClass = annotationType.containingClass(); liNav.addContent(getSpace());
if (outerClass != null) { liNav.addContent("|");
dl(); liNav.addContent(getSpace());
dt();
if (annotationType.isInterface()) {
strongText("doclet.Enclosing_Interface");
} else {
strongText("doclet.Enclosing_Class");
}
dtEnd();
dd();
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
false));
ddEnd();
dlEnd();
}
} }
/** /**
@ -346,11 +394,4 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
public AnnotationTypeDoc getAnnotationTypeDoc() { public AnnotationTypeDoc getAnnotationTypeDoc() {
return annotationType; return annotationType;
} }
/**
* {@inheritDoc}
*/
public void completeMemberSummaryBuild() {
p();
}
} }

View file

@ -25,10 +25,12 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
* Generate class usage information. * Generate class usage information.
@ -207,257 +209,301 @@ public class ClassUseWriter extends SubWriterHolderWriter {
} }
/** /**
* Print the class use list. * Generate the class use list.
*/ */
protected void generateClassUseFile() throws IOException { protected void generateClassUseFile() throws IOException {
Content body = getClassUseHeader();
printClassUseHeader(); HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.classUseContainer);
if (pkgSet.size() > 0) { if (pkgSet.size() > 0) {
generateClassUse(); addClassUse(div);
} else { } else {
printText("doclet.ClassUse_No.usage.of.0", div.addContent(getResource("doclet.ClassUse_No.usage.of.0",
classdoc.qualifiedName()); classdoc.qualifiedName()));
p();
} }
body.addContent(div);
printClassUseFooter(); addNavLinks(false, body);
addBottom(body);
printHtmlDocument(null, true, body);
} }
protected void generateClassUse() throws IOException { /**
* Add the class use documentation.
*
* @param contentTree the content tree to which the class use information will be added
*/
protected void addClassUse(Content contentTree) throws IOException {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
if (configuration.packages.length > 1) { if (configuration.packages.length > 1) {
generatePackageList(); addPackageList(ul);
generatePackageAnnotationList(); addPackageAnnotationList(ul);
} }
generateClassList(); addClassList(ul);
contentTree.addContent(ul);
} }
protected void generatePackageList() throws IOException { /**
tableIndexSummary(useTableSummary); * Add the packages list that use the given class.
tableCaptionStart(); *
printText("doclet.ClassUse_Packages.that.use.0", * @param contentTree the content tree to which the packages list will be added
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, */
false))); protected void addPackageList(Content contentTree) throws IOException {
tableCaptionEnd(); Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
summaryTableHeader(packageTableHeader, "col"); getTableCaption(configuration().getText(
"doclet.ClassUse_Packages.that.use.0",
for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) { getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
false)))));
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<PackageDoc> it = pkgSet.iterator();
for (int i = 0; it.hasNext(); i++) {
PackageDoc pkg = it.next(); PackageDoc pkg = it.next();
generatePackageUse(pkg); HtmlTree tr = new HtmlTree(HtmlTag.TR);
if (i % 2 == 0) {
tr.addStyle(HtmlStyle.altColor);
} else {
tr.addStyle(HtmlStyle.rowColor);
}
addPackageUse(pkg, tr);
tbody.addContent(tr);
} }
tableEnd(); table.addContent(tbody);
space(); Content li = HtmlTree.LI(HtmlStyle.blockList, table);
p(); contentTree.addContent(li);
} }
protected void generatePackageAnnotationList() throws IOException { /**
if ((! classdoc.isAnnotationType()) || * Add the package annotation list.
pkgToPackageAnnotations == null || *
pkgToPackageAnnotations.size() == 0) * @param contentTree the content tree to which the package annotation list will be added
*/
protected void addPackageAnnotationList(Content contentTree) throws IOException {
if ((!classdoc.isAnnotationType()) ||
pkgToPackageAnnotations == null ||
pkgToPackageAnnotations.size() == 0) {
return; return;
tableIndexSummary(useTableSummary);
tableCaptionStart();
printText("doclet.ClassUse_PackageAnnotation",
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
false)));
tableCaptionEnd();
summaryTableHeader(packageTableHeader, "col");
for (Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator(); it.hasNext();) {
PackageDoc pkg = it.next();
trBgcolorStyle("white", "TableRowColor");
summaryRow(0);
//Just want an anchor here.
printPackageLink(pkg, pkg.name(), true);
summaryRowEnd();
summaryRow(0);
printSummaryComment(pkg);
space();
summaryRowEnd();
trEnd();
} }
tableEnd(); Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
space(); getTableCaption(configuration().getText(
p(); "doclet.ClassUse_PackageAnnotation",
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
false)))));
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
for (int i = 0; it.hasNext(); i++) {
PackageDoc pkg = it.next();
HtmlTree tr = new HtmlTree(HtmlTag.TR);
if (i % 2 == 0) {
tr.addStyle(HtmlStyle.altColor);
} else {
tr.addStyle(HtmlStyle.rowColor);
}
Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
getPackageLink(pkg, new StringContent(pkg.name())));
tr.addContent(tdFirst);
HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
tdLast.addStyle(HtmlStyle.colLast);
if (pkg != null) {
addSummaryComment(pkg, tdLast);
} else {
tdLast.addContent(getSpace());
}
tr.addContent(tdLast);
tbody.addContent(tr);
}
table.addContent(tbody);
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
contentTree.addContent(li);
} }
protected void generateClassList() throws IOException { /**
* Add the class list that use the given class.
*
* @param contentTree the content tree to which the class list will be added
*/
protected void addClassList(Content contentTree) throws IOException {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) { for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) {
PackageDoc pkg = it.next(); PackageDoc pkg = it.next();
anchor(pkg.name()); Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name()));
tableIndexSummary(); Content link = new RawHtml(
tableHeaderStart("#CCCCFF"); configuration.getText("doclet.ClassUse_Uses.of.0.in.1",
printText("doclet.ClassUse_Uses.of.0.in.1", getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER,
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER,
classdoc, false)), classdoc, false)),
getPackageLink(pkg, Util.getPackageName(pkg), false)); getPackageLinkString(pkg, Util.getPackageName(pkg), false)));
tableHeaderEnd(); Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
tableEnd(); li.addContent(heading);
space(); addClassUse(pkg, li);
p(); ul.addContent(li);
generateClassUse(pkg);
} }
Content li = HtmlTree.LI(HtmlStyle.blockList, ul);
contentTree.addContent(li);
} }
/** /**
* Print the package use list. * Add the package use information.
*
* @param pkg the package that uses the given class
* @param contentTree the content tree to which the package use information will be added
*/ */
protected void generatePackageUse(PackageDoc pkg) throws IOException { protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
trBgcolorStyle("white", "TableRowColor"); Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
summaryRow(0); getHyperLink("", pkg.name(), new StringContent(Util.getPackageName(pkg))));
//Just want an anchor here. contentTree.addContent(tdFirst);
printHyperLink("", pkg.name(), Util.getPackageName(pkg), true); HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
summaryRowEnd(); tdLast.addStyle(HtmlStyle.colLast);
summaryRow(0); if (pkg != null)
printSummaryComment(pkg); addSummaryComment(pkg, tdLast);
space(); else
summaryRowEnd(); tdLast.addContent(getSpace());
trEnd(); contentTree.addContent(tdLast);
} }
/** /**
* Print the class use list. * Add the class use information.
*
* @param pkg the package that uses the given class
* @param contentTree the content tree to which the class use information will be added
*/ */
protected void generateClassUse(PackageDoc pkg) throws IOException { protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
String classLink = getLink(new LinkInfoImpl( String classLink = getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false)); LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false));
String pkgLink = getPackageLink(pkg, Util.getPackageName(pkg), false); String pkgLink = getPackageLinkString(pkg, Util.getPackageName(pkg), false);
classSubWriter.printUseInfo(pkgToClassAnnotations.get(pkg.name()), classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_Annotation", classLink, configuration.getText("doclet.ClassUse_Annotation", classLink,
pkgLink), classUseTableSummary); pkgLink), classUseTableSummary, contentTree);
classSubWriter.printUseInfo(pkgToClassTypeParameter.get(pkg.name()), classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_TypeParameter", classLink, configuration.getText("doclet.ClassUse_TypeParameter", classLink,
pkgLink), classUseTableSummary); pkgLink), classUseTableSummary, contentTree);
classSubWriter.printUseInfo(pkgToSubclass.get(pkg.name()), classSubWriter.addUseInfo(pkgToSubclass.get(pkg.name()),
configuration.getText("doclet.ClassUse_Subclass", classLink, configuration.getText("doclet.ClassUse_Subclass", classLink,
pkgLink), subclassUseTableSummary); pkgLink), subclassUseTableSummary, contentTree);
classSubWriter.printUseInfo(pkgToSubinterface.get(pkg.name()), classSubWriter.addUseInfo(pkgToSubinterface.get(pkg.name()),
configuration.getText("doclet.ClassUse_Subinterface", classLink, configuration.getText("doclet.ClassUse_Subinterface", classLink,
pkgLink), subinterfaceUseTableSummary); pkgLink), subinterfaceUseTableSummary, contentTree);
classSubWriter.printUseInfo(pkgToImplementingClass.get(pkg.name()), classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg.name()),
configuration.getText("doclet.ClassUse_ImplementingClass", classLink, configuration.getText("doclet.ClassUse_ImplementingClass", classLink,
pkgLink), classUseTableSummary); pkgLink), classUseTableSummary, contentTree);
fieldSubWriter.printUseInfo(pkgToField.get(pkg.name()), fieldSubWriter.addUseInfo(pkgToField.get(pkg.name()),
configuration.getText("doclet.ClassUse_Field", classLink, configuration.getText("doclet.ClassUse_Field", classLink,
pkgLink), fieldUseTableSummary); pkgLink), fieldUseTableSummary, contentTree);
fieldSubWriter.printUseInfo(pkgToFieldAnnotations.get(pkg.name()), fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_FieldAnnotations", classLink, configuration.getText("doclet.ClassUse_FieldAnnotations", classLink,
pkgLink), fieldUseTableSummary); pkgLink), fieldUseTableSummary, contentTree);
fieldSubWriter.printUseInfo(pkgToFieldTypeParameter.get(pkg.name()), fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_FieldTypeParameter", classLink, configuration.getText("doclet.ClassUse_FieldTypeParameter", classLink,
pkgLink), fieldUseTableSummary); pkgLink), fieldUseTableSummary, contentTree);
methodSubWriter.printUseInfo(pkgToMethodAnnotations.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodAnnotations", classLink, configuration.getText("doclet.ClassUse_MethodAnnotations", classLink,
pkgLink), methodUseTableSummary); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.printUseInfo(pkgToMethodParameterAnnotations.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodParameterAnnotations", classLink, configuration.getText("doclet.ClassUse_MethodParameterAnnotations", classLink,
pkgLink), methodUseTableSummary); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.printUseInfo(pkgToMethodTypeParameter.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodTypeParameter", classLink, configuration.getText("doclet.ClassUse_MethodTypeParameter", classLink,
pkgLink), methodUseTableSummary); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.printUseInfo(pkgToMethodReturn.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodReturn", classLink, configuration.getText("doclet.ClassUse_MethodReturn", classLink,
pkgLink), methodUseTableSummary); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.printUseInfo(pkgToMethodReturnTypeParameter.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodReturnTypeParameter", classLink, configuration.getText("doclet.ClassUse_MethodReturnTypeParameter", classLink,
pkgLink), methodUseTableSummary); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.printUseInfo(pkgToMethodArgs.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodArgs", classLink, configuration.getText("doclet.ClassUse_MethodArgs", classLink,
pkgLink), methodUseTableSummary); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.printUseInfo(pkgToMethodArgTypeParameter.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodArgsTypeParameters", classLink, configuration.getText("doclet.ClassUse_MethodArgsTypeParameters", classLink,
pkgLink), methodUseTableSummary); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.printUseInfo(pkgToMethodThrows.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodThrows", classLink, configuration.getText("doclet.ClassUse_MethodThrows", classLink,
pkgLink), methodUseTableSummary); pkgLink), methodUseTableSummary, contentTree);
constrSubWriter.printUseInfo(pkgToConstructorAnnotations.get(pkg.name()), constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_ConstructorAnnotations", classLink, configuration.getText("doclet.ClassUse_ConstructorAnnotations", classLink,
pkgLink), constructorUseTableSummary); pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.printUseInfo(pkgToConstructorParameterAnnotations.get(pkg.name()), constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_ConstructorParameterAnnotations", classLink, configuration.getText("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
pkgLink), constructorUseTableSummary); pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.printUseInfo(pkgToConstructorArgs.get(pkg.name()), constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg.name()),
configuration.getText("doclet.ClassUse_ConstructorArgs", classLink, configuration.getText("doclet.ClassUse_ConstructorArgs", classLink,
pkgLink), constructorUseTableSummary); pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.printUseInfo(pkgToConstructorArgTypeParameter.get(pkg.name()), constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_ConstructorArgsTypeParameters", classLink, configuration.getText("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
pkgLink), constructorUseTableSummary); pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.printUseInfo(pkgToConstructorThrows.get(pkg.name()), constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg.name()),
configuration.getText("doclet.ClassUse_ConstructorThrows", classLink, configuration.getText("doclet.ClassUse_ConstructorThrows", classLink,
pkgLink), constructorUseTableSummary); pkgLink), constructorUseTableSummary, contentTree);
} }
/** /**
* Print the header for the class use Listing. * Get the header for the class use Listing.
*
* @return a content tree representing the class use header
*/ */
protected void printClassUseHeader() { protected Content getClassUseHeader() {
String cltype = configuration.getText(classdoc.isInterface()? String cltype = configuration.getText(classdoc.isInterface()?
"doclet.Interface": "doclet.Interface":"doclet.Class");
"doclet.Class");
String clname = classdoc.qualifiedName(); String clname = classdoc.qualifiedName();
printHtmlHeader(configuration.getText("doclet.Window_ClassUse_Header", String title = configuration.getText("doclet.Window_ClassUse_Header",
cltype, clname), null, true); cltype, clname);
printTop(); Content bodyTree = getBody(true, getWindowTitle(title));
navLinks(true); addTop(bodyTree);
hr(); addNavLinks(true, bodyTree);
center(); Content headContent = getResource("doclet.ClassUse_Title", cltype, clname);
h2(); Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
strongText("doclet.ClassUse_Title", cltype, clname); true, HtmlStyle.title, headContent);
h2End(); Content div = HtmlTree.DIV(HtmlStyle.header, heading);
centerEnd(); bodyTree.addContent(div);
return bodyTree;
} }
/** /**
* Print the footer for the class use Listing. * Get this package link.
*
* @return a content tree for the package link
*/ */
protected void printClassUseFooter() { protected Content getNavLinkPackage() {
hr(); Content linkContent = getHyperLink("../package-summary.html", "",
navLinks(false); packageLabel);
printBottom(); Content li = HtmlTree.LI(linkContent);
printBodyHtmlEnd(); return li;
}
/**
* Print this package link
*/
protected void navLinkPackage() {
navCellStart();
printHyperLink("../package-summary.html", "",
configuration.getText("doclet.Package"), true, "NavBarFont1");
navCellEnd();
} }
/** /**
* Print class page indicator * Get class page link.
*
* @return a content tree for the class page link
*/ */
protected void navLinkClass() { protected Content getNavLinkClass() {
navCellStart(); Content linkContent = new RawHtml(getLink(new LinkInfoImpl(
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, "", LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, "",
configuration.getText("doclet.Class"), true, "NavBarFont1")); configuration.getText("doclet.Class"), false)));
navCellEnd(); Content li = HtmlTree.LI(linkContent);
return li;
} }
/** /**
* Print class use link * Get the use link.
*
* @return a content tree for the use link
*/ */
protected void navLinkClassUse() { protected Content getNavLinkClassUse() {
navCellRevStart(); Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, useLabel);
fontStyle("NavBarFont1Rev"); return li;
strongText("doclet.navClassUse");
fontEnd();
navCellEnd();
} }
protected void navLinkTree() { /**
navCellStart(); * Get the tree link.
if (classdoc.containingPackage().isIncluded()) { *
printHyperLink("../package-tree.html", "", * @return a content tree for the tree link
configuration.getText("doclet.Tree"), true, "NavBarFont1"); */
} else { protected Content getNavLinkTree() {
printHyperLink(relativePath + "overview-tree.html", "", Content linkContent = classdoc.containingPackage().isIncluded() ?
configuration.getText("doclet.Tree"), true, "NavBarFont1"); getHyperLink("../package-tree.html", "", treeLabel) :
} getHyperLink(relativePath + "overview-tree.html", "", treeLabel);
navCellEnd(); Content li = HtmlTree.LI(linkContent);
return li;
} }
} }

View file

@ -32,6 +32,7 @@ import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.builders.*; import com.sun.tools.doclets.internal.toolkit.builders.*;
import com.sun.tools.doclets.internal.toolkit.taglets.*; import com.sun.tools.doclets.internal.toolkit.taglets.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Generate the Class Information Page. * Generate the Class Information Page.
@ -43,6 +44,7 @@ import com.sun.tools.doclets.internal.toolkit.taglets.*;
* *
* @author Atul M Dambalkar * @author Atul M Dambalkar
* @author Robert Field * @author Robert Field
* @author Bhavesh Patel (Modified)
*/ */
public class ClassWriterImpl extends SubWriterHolderWriter public class ClassWriterImpl extends SubWriterHolderWriter
implements ClassWriter { implements ClassWriter {
@ -76,124 +78,173 @@ public class ClassWriterImpl extends SubWriterHolderWriter
} }
/** /**
* Print this package link * Get this package link.
*
* @return a content tree for the package link
*/ */
protected void navLinkPackage() { protected Content getNavLinkPackage() {
navCellStart(); Content linkContent = getHyperLink("package-summary.html", "",
printHyperLink("package-summary.html", "", packageLabel);
configuration.getText("doclet.Package"), true, "NavBarFont1"); Content li = HtmlTree.LI(linkContent);
navCellEnd(); return li;
} }
/** /**
* Print class page indicator * Get the class link.
*
* @return a content tree for the class link
*/ */
protected void navLinkClass() { protected Content getNavLinkClass() {
navCellRevStart(); Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
fontStyle("NavBarFont1Rev"); return li;
strongText("doclet.Class");
fontEnd();
navCellEnd();
} }
/** /**
* Print class use link * Get the class use link.
*
* @return a content tree for the class use link
*/ */
protected void navLinkClassUse() { protected Content getNavLinkClassUse() {
navCellStart(); Content linkContent = getHyperLink("class-use/" + filename, "", useLabel);
printHyperLink("class-use/" + filename, "", Content li = HtmlTree.LI(linkContent);
configuration.getText("doclet.navClassUse"), true, "NavBarFont1"); return li;
navCellEnd();
} }
/** /**
* Print previous package link * Get link to previous class.
*
* @return a content tree for the previous class link
*/ */
protected void navLinkPrevious() { public Content getNavLinkPrevious() {
if (prev == null) { Content li;
printText("doclet.Prev_Class"); if (prev != null) {
} else { Content prevLink = new RawHtml(getLink(new LinkInfoImpl(
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, prev, "", LinkInfoImpl.CONTEXT_CLASS, prev, "",
configuration.getText("doclet.Prev_Class"), true)); configuration.getText("doclet.Prev_Class"), true)));
li = HtmlTree.LI(prevLink);
} }
else
li = HtmlTree.LI(prevclassLabel);
return li;
} }
/** /**
* Print next package link * Get link to next class.
*
* @return a content tree for the next class link
*/ */
protected void navLinkNext() { public Content getNavLinkNext() {
if (next == null) { Content li;
printText("doclet.Next_Class"); if (next != null) {
} else { Content nextLink = new RawHtml(getLink(new LinkInfoImpl(
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, next, "", LinkInfoImpl.CONTEXT_CLASS, next, "",
configuration.getText("doclet.Next_Class"), true)); configuration.getText("doclet.Next_Class"), true)));
li = HtmlTree.LI(nextLink);
} }
else
li = HtmlTree.LI(nextclassLabel);
return li;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeHeader(String header) { public Content getHeader(String header) {
String pkgname = (classDoc.containingPackage() != null)? String pkgname = (classDoc.containingPackage() != null)?
classDoc.containingPackage().name(): ""; classDoc.containingPackage().name(): "";
String clname = classDoc.name(); String clname = classDoc.name();
printHtmlHeader(clname, Content bodyTree = getBody(true, getWindowTitle(clname));
configuration.metakeywords.getMetaKeywords(classDoc), true); addTop(bodyTree);
printTop(); addNavLinks(true, bodyTree);
navLinks(true); bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
hr(); HtmlTree div = new HtmlTree(HtmlTag.DIV);
println("<!-- ======== START OF CLASS DATA ======== -->"); div.addStyle(HtmlStyle.header);
h2();
if (pkgname.length() > 0) { if (pkgname.length() > 0) {
font("-1"); print(pkgname); fontEnd(); br(); Content pkgNameContent = new StringContent(pkgname);
Content pkgNamePara = HtmlTree.P(HtmlStyle.subTitle, pkgNameContent);
div.addContent(pkgNamePara);
} }
LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl.CONTEXT_CLASS_HEADER, LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl.CONTEXT_CLASS_HEADER,
classDoc, false); classDoc, false);
//Let's not link to ourselves in the header. //Let's not link to ourselves in the header.
linkInfo.linkToSelf = false; linkInfo.linkToSelf = false;
print(header + getTypeParameterLinks(linkInfo)); Content headerContent = new StringContent(header);
h2End(); Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
HtmlStyle.title, headerContent);
heading.addContent(new RawHtml(getTypeParameterLinks(linkInfo)));
div.addContent(heading);
bodyTree.addContent(div);
return bodyTree;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeFooter() { public Content getClassContentHeader() {
println("<!-- ========= END OF CLASS DATA ========= -->"); return getContentHeader();
hr();
navLinks(false);
printBottom();
printBodyHtmlEnd();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeClassSignature(String modifiers) { public void addFooter(Content contentTree) {
contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
addNavLinks(false, contentTree);
addBottom(contentTree);
}
/**
* {@inheritDoc}
*/
public void printDocument(Content contentTree) {
printHtmlDocument(configuration.metakeywords.getMetaKeywords(classDoc),
true, contentTree);
}
/**
* {@inheritDoc}
*/
public Content getClassInfoTreeHeader() {
return getMemberTreeHeader();
}
/**
* {@inheritDoc}
*/
public Content getClassInfo(Content classInfoTree) {
return getMemberTree(HtmlStyle.description, classInfoTree);
}
/**
* {@inheritDoc}
*/
public void addClassSignature(String modifiers, Content classInfoTree) {
boolean isInterface = classDoc.isInterface(); boolean isInterface = classDoc.isInterface();
preNoNewLine(); classInfoTree.addContent(new HtmlTree(HtmlTag.BR));
writeAnnotationInfo(classDoc); Content pre = new HtmlTree(HtmlTag.PRE);
print(modifiers); addAnnotationInfo(classDoc, pre);
pre.addContent(modifiers);
LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl linkInfo = new LinkInfoImpl(
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false); LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false);
//Let's not link to ourselves in the signature. //Let's not link to ourselves in the signature.
linkInfo.linkToSelf = false; linkInfo.linkToSelf = false;
String name = classDoc.name() + Content name = new RawHtml (classDoc.name() +
getTypeParameterLinks(linkInfo); getTypeParameterLinks(linkInfo));
if (configuration().linksource) { if (configuration().linksource) {
printSrcLink(classDoc, name); addSrcLink(classDoc, name, pre);
} else { } else {
strong(name); pre.addContent(HtmlTree.STRONG(name));
} }
if (!isInterface) { if (!isInterface) {
Type superclass = Util.getFirstVisibleSuperClass(classDoc, Type superclass = Util.getFirstVisibleSuperClass(classDoc,
configuration()); configuration());
if (superclass != null) { if (superclass != null) {
println(); pre.addContent("\n");
print("extends "); pre.addContent("extends ");
printLink(new LinkInfoImpl( Content link = new RawHtml(getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME, LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
superclass)); superclass)));
pre.addContent(link);
} }
} }
Type[] implIntfacs = classDoc.interfaceTypes(); Type[] implIntfacs = classDoc.interfaceTypes();
@ -202,34 +253,33 @@ public class ClassWriterImpl extends SubWriterHolderWriter
for (int i = 0; i < implIntfacs.length; i++) { for (int i = 0; i < implIntfacs.length; i++) {
ClassDoc classDoc = implIntfacs[i].asClassDoc(); ClassDoc classDoc = implIntfacs[i].asClassDoc();
if (! (classDoc.isPublic() || if (! (classDoc.isPublic() ||
Util.isLinkable(classDoc, configuration()))) { Util.isLinkable(classDoc, configuration()))) {
continue; continue;
} }
if (counter == 0) { if (counter == 0) {
println(); pre.addContent("\n");
print(isInterface? "extends " : "implements "); pre.addContent(isInterface? "extends " : "implements ");
} else { } else {
print(", "); pre.addContent(", ");
} }
printLink(new LinkInfoImpl( Content link = new RawHtml(getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME, LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
implIntfacs[i])); implIntfacs[i])));
pre.addContent(link);
counter++; counter++;
} }
} }
preEnd(); classInfoTree.addContent(pre);
p();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeClassDescription() { public void addClassDescription(Content classInfoTree) {
if(!configuration.nocomment) { if(!configuration.nocomment) {
// generate documentation for the class. // generate documentation for the class.
if (classDoc.inlineTags().length > 0) { if (classDoc.inlineTags().length > 0) {
printInlineComment(classDoc); addInlineComment(classDoc, classInfoTree);
p();
} }
} }
} }
@ -237,131 +287,118 @@ public class ClassWriterImpl extends SubWriterHolderWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeClassTagInfo() { public void addClassTagInfo(Content classInfoTree) {
if(!configuration.nocomment) { if(!configuration.nocomment) {
// Print Information about all the tags here // Print Information about all the tags here
printTags(classDoc); addTagsInfo(classDoc, classInfoTree);
hr();
p();
} else {
hr();
} }
} }
/** /**
* {@inheritDoc} * Get the class hierarchy tree for the given class.
*/
public void writeClassDeprecationInfo() {
hr();
Tag[] deprs = classDoc.tags("deprecated");
if (Util.isDeprecated(classDoc)) {
strongText("doclet.Deprecated");
if (deprs.length > 0) {
Tag[] commentTags = deprs[0].inlineTags();
if (commentTags.length > 0) {
space();
printInlineDeprecatedComment(classDoc, deprs[0]);
}
}
p();
}
}
/**
* Generate the indent and get the line image for the class tree.
* For user accessibility, the image includes the alt attribute
* "extended by". (This method is not intended for a class
* implementing an interface, where "implemented by" would be required.)
* *
* indent integer indicating the number of spaces to indent * @param type the class to print the hierarchy for
* @return a content tree for class inheritence
*/ */
private void writeStep(int indent) { private Content getClassInheritenceTree(Type type) {
print(spaces(4 * indent - 2)); Type sup;
print("<IMG SRC=\"" + relativepathNoSlash + "/resources/inherit.gif\" " + HtmlTree classTreeUl = new HtmlTree(HtmlTag.UL);
"ALT=\"" + configuration.getText("doclet.extended_by") + " \">"); classTreeUl.addStyle(HtmlStyle.inheritance);
Content liTree = null;
do {
sup = Util.getFirstVisibleSuperClass(
type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(),
configuration());
if (sup != null) {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.inheritance);
ul.addContent(getTreeForClassHelper(type));
if (liTree != null)
ul.addContent(liTree);
Content li = HtmlTree.LI(ul);
liTree = li;
type = sup;
}
else
classTreeUl.addContent(getTreeForClassHelper(type));
}
while (sup != null);
if (liTree != null)
classTreeUl.addContent(liTree);
return classTreeUl;
} }
/** /**
* Print the class hierarchy tree for the given class. * Get the class helper tree for the given class.
* @param type the class to print the hierarchy for. *
* @return return the amount that should be indented in * @param type the class to print the helper for
* the next level of the tree. * @return a content tree for class helper
*/ */
private int writeTreeForClassHelper(Type type) { private Content getTreeForClassHelper(Type type) {
Type sup = Util.getFirstVisibleSuperClass( Content li = new HtmlTree(HtmlTag.LI);
type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(),
configuration());
int indent = 0;
if (sup != null) {
indent = writeTreeForClassHelper(sup);
writeStep(indent);
}
if (type.equals(classDoc)) { if (type.equals(classDoc)) {
String typeParameters = getTypeParameterLinks( String typeParameters = getTypeParameterLinks(
new LinkInfoImpl( new LinkInfoImpl(LinkInfoImpl.CONTEXT_TREE,
LinkInfoImpl.CONTEXT_TREE,
classDoc, false)); classDoc, false));
if (configuration.shouldExcludeQualifier( if (configuration.shouldExcludeQualifier(
classDoc.containingPackage().name())) { classDoc.containingPackage().name())) {
strong(type.asClassDoc().name() + typeParameters); li.addContent(type.asClassDoc().name());
li.addContent(new RawHtml(typeParameters));
} else { } else {
strong(type.asClassDoc().qualifiedName() + typeParameters); li.addContent(type.asClassDoc().qualifiedName());
li.addContent(new RawHtml(typeParameters));
} }
} else { } else {
print(getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_TREE_PARENT, Content link = new RawHtml(getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_CLASS_TREE_PARENT,
type instanceof ClassDoc ? (ClassDoc) type : type, type instanceof ClassDoc ? (ClassDoc) type : type,
configuration.getClassName(type.asClassDoc()), false))); configuration.getClassName(type.asClassDoc()), false)));
li.addContent(link);
} }
println(); return li;
return indent + 1;
} }
/** /**
* Print the class hierarchy tree for this class only. * {@inheritDoc}
*/ */
public void writeClassTree() { public void addClassTree(Content classContentTree) {
if (! classDoc.isClass()) { if (!classDoc.isClass()) {
return; return;
} }
pre(); classContentTree.addContent(getClassInheritenceTree(classDoc));
writeTreeForClassHelper(classDoc);
preEnd();
} }
/** /**
* Write the type parameter information. * {@inheritDoc}
*/ */
public void writeTypeParamInfo() { public void addTypeParamInfo(Content classInfoTree) {
if (classDoc.typeParamTags().length > 0) { if (classDoc.typeParamTags().length > 0) {
dl();
dt();
TagletOutput output = (new ParamTaglet()).getTagletOutput(classDoc, TagletOutput output = (new ParamTaglet()).getTagletOutput(classDoc,
getTagletWriterInstance(false)); getTagletWriterInstance(false));
print(output.toString()); Content typeParam = new RawHtml(output.toString());
dtEnd(); Content dl = HtmlTree.DL(typeParam);
dlEnd(); classInfoTree.addContent(dl);
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeSubClassInfo() { public void addSubClassInfo(Content classInfoTree) {
if (classDoc.isClass()) { if (classDoc.isClass()) {
if (classDoc.qualifiedName().equals("java.lang.Object") || if (classDoc.qualifiedName().equals("java.lang.Object") ||
classDoc.qualifiedName().equals("org.omg.CORBA.Object")) { classDoc.qualifiedName().equals("org.omg.CORBA.Object")) {
return; // Don't generate the list, too huge return; // Don't generate the list, too huge
} }
List<ClassDoc> subclasses = classtree.subs(classDoc, false); List<ClassDoc> subclasses = classtree.subs(classDoc, false);
if (subclasses.size() > 0) { if (subclasses.size() > 0) {
dl(); Content label = getResource(
dt(); "doclet.Subclasses");
strongText("doclet.Subclasses"); Content dt = HtmlTree.DT(label);
dtEnd(); Content dl = HtmlTree.DL(dt);
writeClassLinks(LinkInfoImpl.CONTEXT_SUBCLASSES, dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUBCLASSES,
subclasses); subclasses));
dlEnd(); classInfoTree.addContent(dl);
} }
} }
} }
@ -369,140 +406,196 @@ public class ClassWriterImpl extends SubWriterHolderWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeSubInterfacesInfo() { public void addSubInterfacesInfo(Content classInfoTree) {
if (classDoc.isInterface()) { if (classDoc.isInterface()) {
List<ClassDoc> subInterfaces = classtree.allSubs(classDoc, false); List<ClassDoc> subInterfaces = classtree.allSubs(classDoc, false);
if (subInterfaces.size() > 0) { if (subInterfaces.size() > 0) {
dl(); Content label = getResource(
dt(); "doclet.Subinterfaces");
strongText("doclet.Subinterfaces"); Content dt = HtmlTree.DT(label);
dtEnd(); Content dl = HtmlTree.DL(dt);
writeClassLinks(LinkInfoImpl.CONTEXT_SUBINTERFACES, dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUBINTERFACES,
subInterfaces); subInterfaces));
dlEnd(); classInfoTree.addContent(dl);
} }
} }
} }
/** /**
* If this is the interface which are the classes, that implement this? * {@inheritDoc}
*/ */
public void writeInterfaceUsageInfo () { public void addInterfaceUsageInfo (Content classInfoTree) {
if (! classDoc.isInterface()) { if (! classDoc.isInterface()) {
return; return;
} }
if (classDoc.qualifiedName().equals("java.lang.Cloneable") || if (classDoc.qualifiedName().equals("java.lang.Cloneable") ||
classDoc.qualifiedName().equals("java.io.Serializable")) { classDoc.qualifiedName().equals("java.io.Serializable")) {
return; // Don't generate the list, too big return; // Don't generate the list, too big
} }
List<ClassDoc> implcl = classtree.implementingclasses(classDoc); List<ClassDoc> implcl = classtree.implementingclasses(classDoc);
if (implcl.size() > 0) { if (implcl.size() > 0) {
dl(); Content label = getResource(
dt(); "doclet.Implementing_Classes");
strongText("doclet.Implementing_Classes"); Content dt = HtmlTree.DT(label);
dtEnd(); Content dl = HtmlTree.DL(dt);
writeClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_CLASSES, dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_CLASSES,
implcl); implcl));
dlEnd(); classInfoTree.addContent(dl);
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeImplementedInterfacesInfo() { public void addImplementedInterfacesInfo(Content classInfoTree) {
//NOTE: we really should be using ClassDoc.interfaceTypes() here, but //NOTE: we really should be using ClassDoc.interfaceTypes() here, but
// it doesn't walk up the tree like we want it to. // it doesn't walk up the tree like we want it to.
List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration); List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration);
if (classDoc.isClass() && interfaceArray.size() > 0) { if (classDoc.isClass() && interfaceArray.size() > 0) {
dl(); Content label = getResource(
dt(); "doclet.All_Implemented_Interfaces");
strongText("doclet.All_Implemented_Interfaces"); Content dt = HtmlTree.DT(label);
dtEnd(); Content dl = HtmlTree.DL(dt);
writeClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_INTERFACES, dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_INTERFACES,
interfaceArray); interfaceArray));
dlEnd(); classInfoTree.addContent(dl);
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeSuperInterfacesInfo() { public void addSuperInterfacesInfo(Content classInfoTree) {
//NOTE: we really should be using ClassDoc.interfaceTypes() here, but //NOTE: we really should be using ClassDoc.interfaceTypes() here, but
// it doesn't walk up the tree like we want it to. // it doesn't walk up the tree like we want it to.
List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration); List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration);
if (classDoc.isInterface() && interfaceArray.size() > 0) { if (classDoc.isInterface() && interfaceArray.size() > 0) {
dl(); Content label = getResource(
dt(); "doclet.All_Superinterfaces");
strongText("doclet.All_Superinterfaces"); Content dt = HtmlTree.DT(label);
dtEnd(); Content dl = HtmlTree.DL(dt);
writeClassLinks(LinkInfoImpl.CONTEXT_SUPER_INTERFACES, dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUPER_INTERFACES,
interfaceArray); interfaceArray));
dlEnd(); classInfoTree.addContent(dl);
} }
} }
/** /**
* Generate links to the given classes. * {@inheritDoc}
*/ */
private void writeClassLinks(int context, List<?> list) { public void addNestedClassInfo(Content classInfoTree) {
ClassDoc outerClass = classDoc.containingClass();
if (outerClass != null) {
Content label;
if (outerClass.isInterface()) {
label = getResource(
"doclet.Enclosing_Interface");
} else {
label = getResource(
"doclet.Enclosing_Class");
}
Content dt = HtmlTree.DT(label);
Content dl = HtmlTree.DL(dt);
Content dd = new HtmlTree(HtmlTag.DD);
dd.addContent(new RawHtml(getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
false))));
dl.addContent(dd);
classInfoTree.addContent(dl);
}
}
/**
* {@inheritDoc}
*/
public void addClassDeprecationInfo(Content classInfoTree) {
Content hr = new HtmlTree(HtmlTag.HR);
classInfoTree.addContent(hr);
Tag[] deprs = classDoc.tags("deprecated");
if (Util.isDeprecated(classDoc)) {
Content strong = HtmlTree.STRONG(deprecatedPhrase);
Content div = HtmlTree.DIV(HtmlStyle.block, strong);
if (deprs.length > 0) {
Tag[] commentTags = deprs[0].inlineTags();
if (commentTags.length > 0) {
div.addContent(getSpace());
addInlineDeprecatedComment(classDoc, deprs[0], div);
}
}
classInfoTree.addContent(div);
}
}
/**
* Get links to the given classes.
*
* @param context the id of the context where the link will be printed
* @param list the list of classes
* @return a content tree for the class list
*/
private Content getClassLinks(int context, List<?> list) {
Object[] typeList = list.toArray(); Object[] typeList = list.toArray();
//Sort the list to be printed. Content dd = new HtmlTree(HtmlTag.DD);
print(' ');
dd();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
if (i > 0) { if (i > 0) {
print(", "); Content separator = new StringContent(", ");
dd.addContent(separator);
} }
if (typeList[i] instanceof ClassDoc) { if (typeList[i] instanceof ClassDoc) {
printLink(new LinkInfoImpl(context, (ClassDoc)(typeList[i]))); Content link = new RawHtml(getLink(
new LinkInfoImpl(context, (ClassDoc)(typeList[i]))));
dd.addContent(link);
} else { } else {
printLink(new LinkInfoImpl(context, (Type)(typeList[i]))); Content link = new RawHtml(getLink(
new LinkInfoImpl(context, (Type)(typeList[i]))));
dd.addContent(link);
} }
} }
ddEnd(); return dd;
} }
protected void navLinkTree() { /**
navCellStart(); * {@inheritDoc}
printHyperLink("package-tree.html", "", */
configuration.getText("doclet.Tree"), true, "NavBarFont1"); protected Content getNavLinkTree() {
navCellEnd(); Content treeLinkContent = getHyperLink("package-tree.html",
"", treeLabel, "", "");
Content li = HtmlTree.LI(treeLinkContent);
return li;
} }
protected void printSummaryDetailLinks() { /**
* Add summary details to the navigation bar.
*
* @param subDiv the content tree to which the summary detail links will be added
*/
protected void addSummaryDetailLinks(Content subDiv) {
try { try {
tr(); Content div = HtmlTree.DIV(getNavSummaryLinks());
tdVAlignClass("top", "NavBarCell3"); div.addContent(getNavDetailLinks());
font("-2"); subDiv.addContent(div);
print(" ");
navSummaryLinks();
fontEnd();
tdEnd();
tdVAlignClass("top", "NavBarCell3");
font("-2");
navDetailLinks();
fontEnd();
tdEnd();
trEnd();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new DocletAbortException(); throw new DocletAbortException();
} }
} }
protected void navSummaryLinks() throws Exception { /**
printText("doclet.Summary"); * Get summary links for navigation bar.
space(); *
* @return the content tree for the navigation summary links
*/
protected Content getNavSummaryLinks() throws Exception {
Content li = HtmlTree.LI(summaryLabel);
li.addContent(getSpace());
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
configuration.getBuilderFactory().getMemberSummaryBuilder(this); configuration.getBuilderFactory().getMemberSummaryBuilder(this);
String[] navLinkLabels = new String[] { String[] navLinkLabels = new String[] {
"doclet.navNested", "doclet.navEnum", "doclet.navField", "doclet.navConstructor", "doclet.navNested", "doclet.navEnum", "doclet.navField", "doclet.navConstructor",
"doclet.navMethod" "doclet.navMethod"
}; };
for (int i = 0; i < navLinkLabels.length; i++ ) { for (int i = 0; i < navLinkLabels.length; i++ ) {
Content liNav = new HtmlTree(HtmlTag.LI);
if (i == VisibleMemberMap.ENUM_CONSTANTS && ! classDoc.isEnum()) { if (i == VisibleMemberMap.ENUM_CONSTANTS && ! classDoc.isEnum()) {
continue; continue;
} }
@ -511,38 +604,41 @@ public class ClassWriterImpl extends SubWriterHolderWriter
} }
AbstractMemberWriter writer = AbstractMemberWriter writer =
((AbstractMemberWriter) memberSummaryBuilder. ((AbstractMemberWriter) memberSummaryBuilder.
getMemberSummaryWriter(i)); getMemberSummaryWriter(i));
if (writer == null) { if (writer == null) {
printText(navLinkLabels[i]); liNav.addContent(getResource(navLinkLabels[i]));
} else { } else {
writer.navSummaryLink( writer.addNavSummaryLink(
memberSummaryBuilder.members(i), memberSummaryBuilder.members(i),
memberSummaryBuilder.getVisibleMemberMap(i)); memberSummaryBuilder.getVisibleMemberMap(i), liNav);
} }
if (i < navLinkLabels.length-1) { if (i < navLinkLabels.length-1) {
navGap(); addNavGap(liNav);
} }
ulNav.addContent(liNav);
} }
return ulNav;
} }
/** /**
* Method navDetailLinks * Get detail links for the navigation bar.
*
* @throws Exception
* *
* @return the content tree for the detail links
*/ */
protected void navDetailLinks() throws Exception { protected Content getNavDetailLinks() throws Exception {
printText("doclet.Detail"); Content li = HtmlTree.LI(detailLabel);
space(); li.addContent(getSpace());
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
configuration.getBuilderFactory().getMemberSummaryBuilder(this); configuration.getBuilderFactory().getMemberSummaryBuilder(this);
String[] navLinkLabels = new String[] { String[] navLinkLabels = new String[] {
"doclet.navNested", "doclet.navEnum", "doclet.navField", "doclet.navConstructor", "doclet.navNested", "doclet.navEnum", "doclet.navField", "doclet.navConstructor",
"doclet.navMethod" "doclet.navMethod"
}; };
for (int i = 1; i < navLinkLabels.length; i++ ) { for (int i = 1; i < navLinkLabels.length; i++ ) {
Content liNav = new HtmlTree(HtmlTag.LI);
AbstractMemberWriter writer = AbstractMemberWriter writer =
((AbstractMemberWriter) memberSummaryBuilder. ((AbstractMemberWriter) memberSummaryBuilder.
getMemberSummaryWriter(i)); getMemberSummaryWriter(i));
if (i == VisibleMemberMap.ENUM_CONSTANTS && ! classDoc.isEnum()) { if (i == VisibleMemberMap.ENUM_CONSTANTS && ! classDoc.isEnum()) {
continue; continue;
@ -551,43 +647,27 @@ public class ClassWriterImpl extends SubWriterHolderWriter
continue; continue;
} }
if (writer == null) { if (writer == null) {
printText(navLinkLabels[i]); liNav.addContent(getResource(navLinkLabels[i]));
} else { } else {
writer.navDetailLink(memberSummaryBuilder.members(i)); writer.addNavDetailLink(memberSummaryBuilder.members(i), liNav);
} }
if (i < navLinkLabels.length - 1) { if (i < navLinkLabels.length - 1) {
navGap(); addNavGap(liNav);
} }
ulNav.addContent(liNav);
} }
} return ulNav;
protected void navGap() {
space();
print('|');
space();
} }
/** /**
* If this is an inner class or interface, write the enclosing class or * Add gap between navigation bar elements.
* interface. *
* @param liNav the content tree to which the gap will be added
*/ */
public void writeNestedClassInfo() { protected void addNavGap(Content liNav) {
ClassDoc outerClass = classDoc.containingClass(); liNav.addContent(getSpace());
if (outerClass != null) { liNav.addContent("|");
dl(); liNav.addContent(getSpace());
dt();
if (outerClass.isInterface()) {
strongText("doclet.Enclosing_Interface");
} else {
strongText("doclet.Enclosing_Class");
}
dtEnd();
dd();
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass,
false));
ddEnd();
dlEnd();
}
} }
/** /**
@ -598,11 +678,4 @@ public class ClassWriterImpl extends SubWriterHolderWriter
public ClassDoc getClassDoc() { public ClassDoc getClassDoc() {
return classDoc; return classDoc;
} }
/**
* {@inheritDoc}
*/
public void completeMemberSummaryBuild() {
p();
}
} }

View file

@ -25,11 +25,12 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Write the Constants Summary Page in HTML format. * Write the Constants Summary Page in HTML format.
@ -76,67 +77,106 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeHeader() { public Content getHeader() {
printHtmlHeader(configuration.getText("doclet.Constants_Summary"), String label = configuration.getText("doclet.Constants_Summary");
null, true); Content bodyTree = getBody(true, getWindowTitle(label));
printTop(); addTop(bodyTree);
navLinks(true); addNavLinks(true, bodyTree);
hr(); return bodyTree;
center();
h1(); printText("doclet.Constants_Summary"); h1End();
centerEnd();
hr(4, "noshade");
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeFooter() { public Content getContentsHeader() {
hr(); return new HtmlTree(HtmlTag.UL);
navLinks(false);
printBottom();
printBodyHtmlEnd();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeContentsHeader() { public void addLinkToPackageContent(PackageDoc pkg, String parsedPackageName,
strong(configuration.getText("doclet.Contents")); Set<String> printedPackageHeaders, Content contentListTree) {
ul();
}
/**
* {@inheritDoc}
*/
public void writeContentsFooter() {
ulEnd();
println();
}
/**
* {@inheritDoc}
*/
public void writeLinkToPackageContent(PackageDoc pkg, String parsedPackageName, Set<String> printedPackageHeaders) {
String packageName = pkg.name(); String packageName = pkg.name();
//add link to summary //add link to summary
li(); Content link;
if (packageName.length() == 0) { if (packageName.length() == 0) {
printHyperLink("#" + DocletConstants.UNNAMED_PACKAGE_ANCHOR, link = getHyperLink("#" + DocletConstants.UNNAMED_PACKAGE_ANCHOR,
DocletConstants.DEFAULT_PACKAGE_NAME); "", defaultPackageLabel, "", "");
} else { } else {
printHyperLink("#" + parsedPackageName, parsedPackageName + ".*"); Content packageNameContent = getPackageLabel(parsedPackageName);
packageNameContent.addContent(".*");
link = getHyperLink("#" + parsedPackageName,
"", packageNameContent, "", "");
printedPackageHeaders.add(parsedPackageName); printedPackageHeaders.add(parsedPackageName);
} }
println(); contentListTree.addContent(HtmlTree.LI(link));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeConstantMembersHeader(ClassDoc cd) { public Content getContentsList(Content contentListTree) {
Content titleContent = getResource(
"doclet.Constants_Summary");
Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
HtmlStyle.title, titleContent);
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;
}
/**
* {@inheritDoc}
*/
public Content getConstantSummaries() {
HtmlTree summariesDiv = new HtmlTree(HtmlTag.DIV);
summariesDiv.addStyle(HtmlStyle.constantValuesContainer);
return summariesDiv;
}
/**
* {@inheritDoc}
*/
public void addPackageName(PackageDoc pkg, String parsedPackageName,
Content summariesTree) {
Content pkgNameContent;
if (parsedPackageName.length() == 0) {
summariesTree.addContent(getMarkerAnchor(
DocletConstants.UNNAMED_PACKAGE_ANCHOR));
pkgNameContent = defaultPackageLabel;
} else {
summariesTree.addContent(getMarkerAnchor(
parsedPackageName));
pkgNameContent = getPackageLabel(parsedPackageName);
}
Content headingContent = new StringContent(".*");
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
pkgNameContent);
heading.addContent(headingContent);
summariesTree.addContent(heading);
}
/**
* {@inheritDoc}
*/
public Content getClassConstantHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
return ul;
}
/**
* Get the table caption and header for the constant summary table
*
* @param cd classdoc to be documented
* @return constant members header content
*/
public Content getConstantMembersHeader(ClassDoc cd) {
//generate links backward only to public classes. //generate links backward only to public classes.
String classlink = (cd.isPublic() || cd.isProtected())? String classlink = (cd.isPublic() || cd.isProtected())?
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, cd, getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, cd,
@ -144,112 +184,120 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
cd.qualifiedName(); cd.qualifiedName();
String name = cd.containingPackage().name(); String name = cd.containingPackage().name();
if (name.length() > 0) { if (name.length() > 0) {
writeClassName(name + "." + classlink); return getClassName(name + "." + classlink);
} else { } else {
writeClassName(classlink); return getClassName(classlink);
} }
} }
/**
* Get the class name in the table caption and the table header.
*
* @param classStr the class name to print.
* @return the table caption and header
*/
protected Content getClassName(String classStr) {
Content table = HtmlTree.TABLE(0, 3, 0, constantsTableSummary,
getTableCaption(classStr));
table.addContent(getSummaryTableHeader(constantsTableHeader, "col"));
return table;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeConstantMembersFooter(ClassDoc cd) { public void addConstantMembers(ClassDoc cd, List<FieldDoc> fields,
tableFooter(false); Content classConstantTree) {
p();
}
/**
* Print the class name in the table heading.
* @param classStr the heading to print.
*/
protected void writeClassName(String classStr) {
table(1, 3, 0, constantsTableSummary);
tableSubCaptionStart();
write(classStr);
tableCaptionEnd();
summaryTableHeader(constantsTableHeader, "col");
}
private void tableFooter(boolean isHeader) {
fontEnd();
if (isHeader) {
thEnd();
} else {
tdEnd();
}
trEnd();
tableEnd();
p();
}
/**
* {@inheritDoc}
*/
public void writePackageName(PackageDoc pkg, String parsedPackageName) {
String pkgname;
if (parsedPackageName.length() == 0) {
anchor(DocletConstants.UNNAMED_PACKAGE_ANCHOR);
pkgname = DocletConstants.DEFAULT_PACKAGE_NAME;
} else {
anchor(parsedPackageName);
pkgname = parsedPackageName;
}
table(1, "100%", 3, 0);
trBgcolorStyle("#CCCCFF", "TableHeadingColor");
thAlign("left");
font("+2");
write(pkgname + ".*");
tableFooter(true);
}
/**
* {@inheritDoc}
*/
public void writeConstantMembers(ClassDoc cd, List<FieldDoc> fields) {
currentClassDoc = cd; currentClassDoc = cd;
Content tbody = new HtmlTree(HtmlTag.TBODY);
for (int i = 0; i < fields.size(); ++i) { for (int i = 0; i < fields.size(); ++i) {
writeConstantMember(fields.get(i)); HtmlTree tr = new HtmlTree(HtmlTag.TR);
if (i%2 == 0)
tr.addStyle(HtmlStyle.altColor);
else
tr.addStyle(HtmlStyle.rowColor);
addConstantMember(fields.get(i), tr);
tbody.addContent(tr);
} }
Content table = getConstantMembersHeader(cd);
table.addContent(tbody);
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
classConstantTree.addContent(li);
} }
private void writeConstantMember(FieldDoc member) { /**
trBgcolorStyle("white", "TableRowColor"); * Add the row for the constant summary table.
anchor(currentClassDoc.qualifiedName() + "." + member.name()); *
writeTypeColumn(member); * @param member the field to be documented.
writeNameColumn(member); * @param trTree an htmltree object for the table row
writeValue(member); */
trEnd(); private void addConstantMember(FieldDoc member, HtmlTree trTree) {
trTree.addContent(getTypeColumn(member));
trTree.addContent(getNameColumn(member));
trTree.addContent(getValue(member));
} }
private void writeTypeColumn(FieldDoc member) { /**
tdAlign("right"); * Get the type column for the constant summary table row.
font("-1"); *
code(); * @param member the field to be documented.
* @return the type column of the constant table row
*/
private Content getTypeColumn(FieldDoc member) {
Content anchor = getMarkerAnchor(currentClassDoc.qualifiedName() +
"." + member.name());
Content tdType = HtmlTree.TD(HtmlStyle.colFirst, anchor);
Content code = new HtmlTree(HtmlTag.CODE);
StringTokenizer mods = new StringTokenizer(member.modifiers()); StringTokenizer mods = new StringTokenizer(member.modifiers());
while(mods.hasMoreTokens()) { while(mods.hasMoreTokens()) {
print(mods.nextToken() + "&nbsp;"); Content modifier = new StringContent(mods.nextToken());
code.addContent(modifier);
code.addContent(getSpace());
} }
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, Content type = new RawHtml(getLink(new LinkInfoImpl(
member.type())); LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member.type())));
codeEnd(); code.addContent(type);
fontEnd(); tdType.addContent(code);
tdEnd(); return tdType;
} }
private void writeNameColumn(FieldDoc member) { /**
tdAlign("left"); * Get the name column for the constant summary table row.
code(); *
printDocLink(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member, * @param member the field to be documented.
member.name(), false); * @return the name column of the constant table row
codeEnd(); */
tdEnd(); private Content getNameColumn(FieldDoc member) {
Content nameContent = new RawHtml(getDocLink(
LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member, member.name(), false));
Content code = HtmlTree.CODE(nameContent);
return HtmlTree.TD(code);
} }
private void writeValue(FieldDoc member) { /**
tdAlign("right"); * Get the value column for the constant summary table row.
code(); *
print(Util.escapeHtmlChars(member.constantValueExpression())); * @param member the field to be documented.
codeEnd(); * @return the value column of the constant table row
tdEnd(); */
private Content getValue(FieldDoc member) {
Content valueContent = new StringContent(member.constantValueExpression());
Content code = HtmlTree.CODE(valueContent);
return HtmlTree.TD(HtmlStyle.colLast, code);
}
/**
* {@inheritDoc}
*/
public void addFooter(Content contentTree) {
addNavLinks(false, contentTree);
addBottom(contentTree);
}
/**
* {@inheritDoc}
*/
public void printDocument(Content contentTree) {
printHtmlDocument(null, true, contentTree);
} }
} }

View file

@ -29,6 +29,7 @@ import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -43,7 +44,6 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
implements ConstructorWriter, MemberSummaryWriter { implements ConstructorWriter, MemberSummaryWriter {
private boolean foundNonPubConstructor = false; private boolean foundNonPubConstructor = false;
private boolean printedSummaryHeader = false;
/** /**
* Construct a new ConstructorWriterImpl. * Construct a new ConstructorWriterImpl.
@ -75,125 +75,112 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
} }
/** /**
* Write the constructors summary header for the given class. * {@inheritDoc}
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeMemberSummaryHeader(ClassDoc classDoc) { public Content getMemberSummaryHeader(ClassDoc classDoc,
printedSummaryHeader = true; Content memberSummaryTree) {
writer.println(); memberSummaryTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_SUMMARY);
writer.println("<!-- ======== CONSTRUCTOR SUMMARY ======== -->"); Content memberTree = writer.getMemberTreeHeader();
writer.println(); writer.addSummaryHeader(this, classDoc, memberTree);
writer.printSummaryHeader(this, classDoc); return memberTree;
} }
/** /**
* Write the constructors summary footer for the given class. * {@inheritDoc}
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeMemberSummaryFooter(ClassDoc classDoc) { public Content getConstructorDetailsTreeHeader(ClassDoc classDoc,
writer.printSummaryFooter(this, classDoc); Content memberDetailsTree) {
memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS);
Content constructorDetailsTree = writer.getMemberTreeHeader();
constructorDetailsTree.addContent(writer.getMarkerAnchor("constructor_detail"));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.constructorDetailsLabel);
constructorDetailsTree.addContent(heading);
return constructorDetailsTree;
} }
/** /**
* Write the header for the constructor documentation. * {@inheritDoc}
*
* @param classDoc the class that the constructors belong to.
*/ */
public void writeHeader(ClassDoc classDoc, String header) { public Content getConstructorDocTreeHeader(ConstructorDoc constructor,
writer.println(); Content constructorDetailsTree) {
writer.println("<!-- ========= CONSTRUCTOR DETAIL ======== -->");
writer.println();
writer.anchor("constructor_detail");
writer.printTableHeadingBackground(header);
}
/**
* Write the constructor header for the given constructor.
*
* @param constructor the constructor being documented.
* @param isFirst the flag to indicate whether or not the constructor is the
* first to be documented.
*/
public void writeConstructorHeader(ConstructorDoc constructor, boolean isFirst) {
if (! isFirst) {
writer.printMemberHeader();
}
writer.println();
String erasureAnchor; String erasureAnchor;
if ((erasureAnchor = getErasureAnchor(constructor)) != null) { if ((erasureAnchor = getErasureAnchor(constructor)) != null) {
writer.anchor(erasureAnchor); constructorDetailsTree.addContent(writer.getMarkerAnchor((erasureAnchor)));
} }
writer.anchor(constructor); constructorDetailsTree.addContent(
writer.h3(); writer.getMarkerAnchor(writer.getAnchor(constructor)));
writer.print(constructor.name()); Content constructorDocTree = writer.getMemberTreeHeader();
writer.h3End(); Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
heading.addContent(constructor.name());
constructorDocTree.addContent(heading);
return constructorDocTree;
} }
/** /**
* Write the signature for the given constructor. * {@inheritDoc}
*
* @param constructor the constructor being documented.
*/ */
public void writeSignature(ConstructorDoc constructor) { public Content getSignature(ConstructorDoc constructor) {
writer.displayLength = 0; writer.displayLength = 0;
writer.pre(); Content pre = new HtmlTree(HtmlTag.PRE);
writer.writeAnnotationInfo(constructor); writer.addAnnotationInfo(constructor, pre);
printModifiers(constructor); addModifiers(constructor, pre);
//printReturnType((ConstructorDoc)constructor);
if (configuration().linksource) { if (configuration().linksource) {
writer.printSrcLink(constructor, constructor.name()); Content constructorName = new StringContent(constructor.name());
writer.addSrcLink(constructor, constructorName, pre);
} else { } else {
strong(constructor.name()); addName(constructor.name(), pre);
} }
writeParameters(constructor); addParameters(constructor, pre);
writeExceptions(constructor); addExceptions(constructor, pre);
writer.preEnd(); return pre;
assert !writer.getMemberDetailsListPrinted();
} }
/** /**
* Write the deprecated output for the given constructor. * {@inheritDoc}
*
* @param constructor the constructor being documented.
*/ */
public void writeDeprecated(ConstructorDoc constructor) { @Override
printDeprecated(constructor); public void setSummaryColumnStyle(HtmlTree tdTree) {
if (foundNonPubConstructor)
tdTree.addStyle(HtmlStyle.colLast);
else
tdTree.addStyle(HtmlStyle.colOne);
} }
/** /**
* Write the comments for the given constructor. * {@inheritDoc}
*
* @param constructor the constructor being documented.
*/ */
public void writeComments(ConstructorDoc constructor) { public void addDeprecated(ConstructorDoc constructor, Content constructorDocTree) {
printComment(constructor); addDeprecatedInfo(constructor, constructorDocTree);
} }
/** /**
* Write the tag output for the given constructor. * {@inheritDoc}
*
* @param constructor the constructor being documented.
*/ */
public void writeTags(ConstructorDoc constructor) { public void addComments(ConstructorDoc constructor, Content constructorDocTree) {
writer.printTags(constructor); addComment(constructor, constructorDocTree);
} }
/** /**
* Write the constructor footer. * {@inheritDoc}
*/ */
public void writeConstructorFooter() { public void addTags(ConstructorDoc constructor, Content constructorDocTree) {
printMemberFooter(); writer.addTagsInfo(constructor, constructorDocTree);
} }
/** /**
* Write the footer for the constructor documentation. * {@inheritDoc}
*
* @param classDoc the class that the constructors belong to.
*/ */
public void writeFooter(ClassDoc classDoc) { public Content getConstructorDetails(Content constructorDetailsTree) {
//No footer to write for constructor documentation return getMemberTree(constructorDetailsTree);
}
/**
* {@inheritDoc}
*/
public Content getConstructorDoc(Content constructorDocTree,
boolean isLastContent) {
return getMemberTree(constructorDocTree, isLastContent);
} }
/** /**
@ -212,17 +199,35 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
this.foundNonPubConstructor = foundNonPubConstructor; this.foundNonPubConstructor = foundNonPubConstructor;
} }
public void printSummaryLabel() { /**
writer.printText("doclet.Constructor_Summary"); * {@inheritDoc}
*/
public void addSummaryLabel(Content memberTree) {
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
writer.getResource("doclet.Constructor_Summary"));
memberTree.addContent(label);
} }
public void printTableSummary() { /**
writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary", * {@inheritDoc}
*/
public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Constructor_Summary"), configuration().getText("doclet.Constructor_Summary"),
configuration().getText("doclet.constructors"))); configuration().getText("doclet.constructors"));
} }
public void printSummaryTableHeader(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
public String getCaption() {
return configuration().getText("doclet.Constructors");
}
/**
* {@inheritDoc}
*/
public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header; String[] header;
if (foundNonPubConstructor) { if (foundNonPubConstructor) {
header = new String[] { header = new String[] {
@ -239,87 +244,73 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
configuration().getText("doclet.Description")) configuration().getText("doclet.Description"))
}; };
} }
writer.summaryTableHeader(header, "col"); return header;
} }
public void printSummaryAnchor(ClassDoc cd) { /**
writer.anchor("constructor_summary"); * {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
memberTree.addContent(writer.getMarkerAnchor("constructor_summary"));
} }
public void printInheritedSummaryAnchor(ClassDoc cd) { /**
} // no such * {@inheritDoc}
*/
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
}
public void printInheritedSummaryLabel(ClassDoc cd) { /**
// no such * {@inheritDoc}
*/
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
} }
public int getMemberKind() { public int getMemberKind() {
return VisibleMemberMap.CONSTRUCTORS; return VisibleMemberMap.CONSTRUCTORS;
} }
protected void navSummaryLink(List<?> members) {
printNavSummaryLink(classdoc,
members.size() > 0? true: false);
}
protected void printNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
writer.printHyperLink("", "constructor_summary",
ConfigurationImpl.getInstance().getText("doclet.navConstructor"));
} else {
writer.printText("doclet.navConstructor");
}
}
protected void printNavDetailLink(boolean link) {
if (link) {
writer.printHyperLink("", "constructor_detail",
ConfigurationImpl.getInstance().getText("doclet.navConstructor"));
} else {
writer.printText("doclet.navConstructor");
}
}
protected void printSummaryType(ProgramElementDoc member) {
if (foundNonPubConstructor) {
writer.printTypeSummaryHeader();
if (member.isProtected()) {
print("protected ");
} else if (member.isPrivate()) {
print("private ");
} else if (member.isPublic()) {
writer.space();
} else {
writer.printText("doclet.Package_private");
}
writer.printTypeSummaryFooter();
}
}
/** /**
* Write the inherited member summary header for the given class. * {@inheritDoc}
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) { protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if(! printedSummaryHeader){ if (link) {
//We don't want inherited summary to not be under heading. return writer.getHyperLink("", "constructor_summary",
writeMemberSummaryHeader(classDoc); writer.getResource("doclet.navConstructor"));
writeMemberSummaryFooter(classDoc); } else {
printedSummaryHeader = true; return writer.getResource("doclet.navConstructor");
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeInheritedMemberSummary(ClassDoc classDoc, protected void addNavDetailLink(boolean link, Content liNav) {
ProgramElementDoc member, boolean isFirst, boolean isLast) {} if (link) {
liNav.addContent(writer.getHyperLink("", "constructor_detail",
writer.getResource("doclet.navConstructor")));
} else {
liNav.addContent(writer.getResource("doclet.navConstructor"));
}
}
/** /**
* Write the inherited member summary footer for the given class. * {@inheritDoc}
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {} protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
if (foundNonPubConstructor) {
Content code = new HtmlTree(HtmlTag.CODE);
if (member.isProtected()) {
code.addContent("protected ");
} else if (member.isPrivate()) {
code.addContent("private ");
} else if (member.isPublic()) {
code.addContent(writer.getSpace());
} else {
code.addContent(
configuration().getText("doclet.Package_private"));
}
tdSummaryType.addContent(code);
}
}
} }

View file

@ -25,9 +25,11 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import java.io.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.DeprecatedAPIListBuilder; import com.sun.tools.doclets.internal.toolkit.util.DeprecatedAPIListBuilder;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import java.io.*; import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Generate File to list all the deprecated classes and class members with the * Generate File to list all the deprecated classes and class members with the
@ -125,28 +127,21 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
} }
/** /**
* Print the deprecated API list. Separately print all class kinds and * Generate the deprecated API list.
* member kinds.
* *
* @param deprapi list of deprecated API built already. * @param deprapi list of deprecated API built already.
*/ */
protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi) protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi)
throws IOException { throws IOException {
writeHeader(); Content body = getHeader();
body.addContent(getContentsList(deprapi));
strong(configuration.getText("doclet.Contents"));
ul();
for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
writeIndexLink(deprapi, i);
}
ulEnd();
println();
String memberTableSummary; String memberTableSummary;
String[] memberTableHeader = new String[1]; String[] memberTableHeader = new String[1];
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.contentContainer);
for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) { for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
if (deprapi.hasDocumentation(i)) { if (deprapi.hasDocumentation(i)) {
writeAnchor(deprapi, i); addAnchor(deprapi, i, div);
memberTableSummary = memberTableSummary =
configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Member_Table_Summary",
configuration.getText(HEADING_KEYS[i]), configuration.getText(HEADING_KEYS[i]),
@ -154,66 +149,87 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
memberTableHeader[0] = configuration.getText("doclet.0_and_1", memberTableHeader[0] = configuration.getText("doclet.0_and_1",
configuration.getText(HEADER_KEYS[i]), configuration.getText(HEADER_KEYS[i]),
configuration.getText("doclet.Description")); configuration.getText("doclet.Description"));
writers[i].printDeprecatedAPI(deprapi.getList(i), writers[i].addDeprecatedAPI(deprapi.getList(i),
HEADING_KEYS[i], memberTableSummary, memberTableHeader); HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
} }
} }
printDeprecatedFooter(); body.addContent(div);
addNavLinks(false, body);
addBottom(body);
printHtmlDocument(null, true, body);
} }
private void writeIndexLink(DeprecatedAPIListBuilder builder, /**
int type) { * Add the index link.
*
* @param builder the deprecated list builder
* @param type the type of list being documented
* @param contentTree the content tree to which the index link will be added
*/
private void addIndexLink(DeprecatedAPIListBuilder builder,
int type, Content contentTree) {
if (builder.hasDocumentation(type)) { if (builder.hasDocumentation(type)) {
li(); Content li = HtmlTree.LI(getHyperLink("#" + ANCHORS[type],
printHyperLink("#" + ANCHORS[type], getResource(HEADING_KEYS[type])));
configuration.getText(HEADING_KEYS[type])); contentTree.addContent(li);
println();
}
}
private void writeAnchor(DeprecatedAPIListBuilder builder, int type) {
if (builder.hasDocumentation(type)) {
anchor(ANCHORS[type]);
} }
} }
/** /**
* Print the navigation bar and header for the deprecated API Listing. * Get the contents list.
*
* @param deprapi the deprecated list builder
* @return a content tree for the contents list
*/ */
protected void writeHeader() { public Content getContentsList(DeprecatedAPIListBuilder deprapi) {
printHtmlHeader(configuration.getText("doclet.Window_Deprecated_List"), Content headContent = getResource("doclet.Deprecated_API");
null, true); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
printTop(); HtmlStyle.title, headContent);
navLinks(true); Content div = HtmlTree.DIV(HtmlStyle.header, heading);
hr(); Content headingContent = getResource("doclet.Contents");
center(); div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
h2(); headingContent));
strongText("doclet.Deprecated_API"); Content ul = new HtmlTree(HtmlTag.UL);
h2End(); for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
centerEnd(); addIndexLink(deprapi, i, ul);
}
hr(4, "noshade"); div.addContent(ul);
return div;
} }
/** /**
* Print the navigation bar and the footer for the deprecated API Listing. * Add the anchor.
*
* @param builder the deprecated list builder
* @param type the type of list being documented
* @param contentTree the content tree to which the anchor will be added
*/ */
protected void printDeprecatedFooter() { private void addAnchor(DeprecatedAPIListBuilder builder, int type, Content htmlTree) {
hr(); if (builder.hasDocumentation(type)) {
navLinks(false); htmlTree.addContent(getMarkerAnchor(ANCHORS[type]));
printBottom(); }
printBodyHtmlEnd();
} }
/** /**
* Highlight the word "Deprecated" in the navigation bar as this is the same * Get the header for the deprecated API Listing.
* page. *
* @return a content tree for the header
*/ */
protected void navLinkDeprecated() { public Content getHeader() {
navCellRevStart(); String title = configuration.getText("doclet.Window_Deprecated_List");
fontStyle("NavBarFont1Rev"); Content bodyTree = getBody(true, getWindowTitle(title));
strongText("doclet.navDeprecated"); addTop(bodyTree);
fontEnd(); addNavLinks(true, bodyTree);
navCellEnd(); return bodyTree;
}
/**
* Get the deprecated label.
*
* @return a content tree for the deprecated label
*/
protected Content getNavLinkDeprecated() {
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, deprecatedLabel);
return li;
} }
} }

View file

@ -28,6 +28,7 @@ package com.sun.tools.doclets.formats.html;
import java.io.*; import java.io.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -40,8 +41,6 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
public class EnumConstantWriterImpl extends AbstractMemberWriter public class EnumConstantWriterImpl extends AbstractMemberWriter
implements EnumConstantWriter, MemberSummaryWriter { implements EnumConstantWriter, MemberSummaryWriter {
private boolean printedSummaryHeader = false;
public EnumConstantWriterImpl(SubWriterHolderWriter writer, public EnumConstantWriterImpl(SubWriterHolderWriter writer,
ClassDoc classdoc) { ClassDoc classdoc) {
super(writer, classdoc); super(writer, classdoc);
@ -52,136 +51,98 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
} }
/** /**
* Write the enum constant summary header for the given class. * {@inheritDoc}
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeMemberSummaryHeader(ClassDoc classDoc) { public Content getMemberSummaryHeader(ClassDoc classDoc,
printedSummaryHeader = true; Content memberSummaryTree) {
writer.println("<!-- =========== ENUM CONSTANT SUMMARY =========== -->"); memberSummaryTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_SUMMARY);
writer.println(); Content memberTree = writer.getMemberTreeHeader();
writer.printSummaryHeader(this, classDoc); writer.addSummaryHeader(this, classDoc, memberTree);
} return memberTree;
/**
* Write the enum constant summary footer for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeMemberSummaryFooter(ClassDoc classDoc) {
writer.printSummaryFooter(this, classDoc);
}
/**
* Write the inherited enum constant summary header for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
if(! printedSummaryHeader){
//We don't want inherited summary to not be under heading.
writeMemberSummaryHeader(classDoc);
writeMemberSummaryFooter(classDoc);
printedSummaryHeader = true;
}
writer.printInheritedSummaryHeader(this, classDoc);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeInheritedMemberSummary(ClassDoc classDoc, public Content getEnumConstantsDetailsTreeHeader(ClassDoc classDoc,
ProgramElementDoc enumConstant, boolean isFirst, boolean isLast) { Content memberDetailsTree) {
writer.printInheritedSummaryMember(this, classDoc, enumConstant, isFirst); memberDetailsTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_DETAILS);
} Content enumConstantsDetailsTree = writer.getMemberTreeHeader();
enumConstantsDetailsTree.addContent(writer.getMarkerAnchor("enum_constant_detail"));
/** Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
* Write the inherited enum constant summary footer for the given class. writer.enumConstantsDetailsLabel);
* enumConstantsDetailsTree.addContent(heading);
* @param classDoc the class the summary belongs to. return enumConstantsDetailsTree;
*/
public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
writer.printInheritedSummaryFooter(this, classDoc);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeHeader(ClassDoc classDoc, String header) { public Content getEnumConstantsTreeHeader(FieldDoc enumConstant,
writer.println(); Content enumConstantsDetailsTree) {
writer.println("<!-- ============ ENUM CONSTANT DETAIL =========== -->"); enumConstantsDetailsTree.addContent(
writer.println(); writer.getMarkerAnchor(enumConstant.name()));
writer.anchor("enum_constant_detail"); Content enumConstantsTree = writer.getMemberTreeHeader();
writer.printTableHeadingBackground(header); Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
writer.println(); heading.addContent(enumConstant.name());
enumConstantsTree.addContent(heading);
return enumConstantsTree;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeEnumConstantHeader(FieldDoc enumConstant, boolean isFirst) { public Content getSignature(FieldDoc enumConstant) {
if (! isFirst) { Content pre = new HtmlTree(HtmlTag.PRE);
writer.printMemberHeader(); writer.addAnnotationInfo(enumConstant, pre);
writer.println(""); addModifiers(enumConstant, pre);
} Content enumConstantLink = new RawHtml(writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
writer.anchor(enumConstant.name()); enumConstant.type())));
writer.h3(); pre.addContent(enumConstantLink);
writer.print(enumConstant.name()); pre.addContent(" ");
writer.h3End();
}
/**
* {@inheritDoc}
*/
public void writeSignature(FieldDoc enumConstant) {
writer.pre();
writer.writeAnnotationInfo(enumConstant);
printModifiers(enumConstant);
writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
enumConstant.type()));
print(' ');
if (configuration().linksource) { if (configuration().linksource) {
writer.printSrcLink(enumConstant, enumConstant.name()); Content enumConstantName = new StringContent(enumConstant.name());
writer.addSrcLink(enumConstant, enumConstantName, pre);
} else { } else {
strong(enumConstant.name()); addName(enumConstant.name(), pre);
} }
writer.preEnd(); return pre;
assert !writer.getMemberDetailsListPrinted();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeDeprecated(FieldDoc enumConstant) { public void addDeprecated(FieldDoc enumConstant, Content enumConstantsTree) {
printDeprecated(enumConstant); addDeprecatedInfo(enumConstant, enumConstantsTree);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeComments(FieldDoc enumConstant) { public void addComments(FieldDoc enumConstant, Content enumConstantsTree) {
printComment(enumConstant); addComment(enumConstant, enumConstantsTree);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeTags(FieldDoc enumConstant) { public void addTags(FieldDoc enumConstant, Content enumConstantsTree) {
writer.printTags(enumConstant); writer.addTagsInfo(enumConstant, enumConstantsTree);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeEnumConstantFooter() { public Content getEnumConstantsDetails(Content enumConstantsDetailsTree) {
printMemberFooter(); return getMemberTree(enumConstantsDetailsTree);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeFooter(ClassDoc classDoc) { public Content getEnumConstants(Content enumConstantsTree,
//No footer to write for enum constant documentation boolean isLastContent) {
return getMemberTree(enumConstantsTree, isLastContent);
} }
/** /**
@ -195,75 +156,127 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
return VisibleMemberMap.ENUM_CONSTANTS; return VisibleMemberMap.ENUM_CONSTANTS;
} }
public void printSummaryLabel() { /**
writer.printText("doclet.Enum_Constant_Summary"); * {@inheritDoc}
*/
public void addSummaryLabel(Content memberTree) {
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
writer.getResource("doclet.Enum_Constant_Summary"));
memberTree.addContent(label);
} }
public void printTableSummary() { /**
writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary", * {@inheritDoc}
*/
public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Enum_Constant_Summary"), configuration().getText("doclet.Enum_Constant_Summary"),
configuration().getText("doclet.enum_constants"))); configuration().getText("doclet.enum_constants"));
} }
public void printSummaryTableHeader(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
public String getCaption() {
return configuration().getText("doclet.Enum_Constants");
}
/**
* {@inheritDoc}
*/
public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header = new String[] { String[] header = new String[] {
configuration().getText("doclet.0_and_1", configuration().getText("doclet.0_and_1",
configuration().getText("doclet.Enum_Constant"), configuration().getText("doclet.Enum_Constant"),
configuration().getText("doclet.Description")) configuration().getText("doclet.Description"))
}; };
writer.summaryTableHeader(header, "col"); return header;
} }
public void printSummaryAnchor(ClassDoc cd) { /**
writer.anchor("enum_constant_summary"); * {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
memberTree.addContent(writer.getMarkerAnchor("enum_constant_summary"));
} }
public void printInheritedSummaryAnchor(ClassDoc cd) { /**
} // no such * {@inheritDoc}
*/
public void printInheritedSummaryLabel(ClassDoc cd) { public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
// no such
} }
protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) { /**
writer.strong(); * {@inheritDoc}
writer.printDocLink(context, (MemberDoc) member, member.name(), false); */
writer.strongEnd(); public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
} }
protected void writeInheritedSummaryLink(ClassDoc cd, /**
ProgramElementDoc member) { * {@inheritDoc}
writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, (MemberDoc)member, */
member.name(), false); protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) {
Content strong = HtmlTree.STRONG(new RawHtml(
writer.getDocLink(context, (MemberDoc) member, member.name(), false)));
Content code = HtmlTree.CODE(strong);
tdSummary.addContent(code);
} }
protected void printSummaryType(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
@Override
public void setSummaryColumnStyle(HtmlTree tdTree) {
tdTree.addStyle(HtmlStyle.colOne);
}
/**
* {@inheritDoc}
*/
protected void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member, Content linksTree) {
}
/**
* {@inheritDoc}
*/
protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
//Not applicable. //Not applicable.
} }
protected void writeDeprecatedLink(ProgramElementDoc member) { /**
writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, * {@inheritDoc}
(MemberDoc) member, ((FieldDoc)member).qualifiedName(), false); */
protected Content getDeprecatedLink(ProgramElementDoc member) {
return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER,
(MemberDoc) member, ((FieldDoc)member).qualifiedName());
} }
protected void printNavSummaryLink(ClassDoc cd, boolean link) { /**
* {@inheritDoc}
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) { if (link) {
writer.printHyperLink("", (cd == null)? return writer.getHyperLink("", (cd == null)?
"enum_constant_summary": "enum_constant_summary":
"enum_constants_inherited_from_class_" + "enum_constants_inherited_from_class_" +
configuration().getClassName(cd), configuration().getClassName(cd),
configuration().getText("doclet.navEnum")); writer.getResource("doclet.navEnum"));
} else { } else {
writer.printText("doclet.navEnum"); return writer.getResource("doclet.navEnum");
} }
} }
protected void printNavDetailLink(boolean link) { /**
* {@inheritDoc}
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) { if (link) {
writer.printHyperLink("", "enum_constant_detail", liNav.addContent(writer.getHyperLink("", "enum_constant_detail",
configuration().getText("doclet.navEnum")); writer.getResource("doclet.navEnum")));
} else { } else {
writer.printText("doclet.navEnum"); liNav.addContent(writer.getResource("doclet.navEnum"));
} }
} }
} }

View file

@ -28,6 +28,7 @@ package com.sun.tools.doclets.formats.html;
import java.io.*; import java.io.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -42,8 +43,6 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
public class FieldWriterImpl extends AbstractMemberWriter public class FieldWriterImpl extends AbstractMemberWriter
implements FieldWriter, MemberSummaryWriter { implements FieldWriter, MemberSummaryWriter {
private boolean printedSummaryHeader = false;
public FieldWriterImpl(SubWriterHolderWriter writer, ClassDoc classdoc) { public FieldWriterImpl(SubWriterHolderWriter writer, ClassDoc classdoc) {
super(writer, classdoc); super(writer, classdoc);
} }
@ -53,177 +52,118 @@ public class FieldWriterImpl extends AbstractMemberWriter
} }
/** /**
* Write the fields summary header for the given class. * {@inheritDoc}
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeMemberSummaryHeader(ClassDoc classDoc) { public Content getMemberSummaryHeader(ClassDoc classDoc,
printedSummaryHeader = true; Content memberSummaryTree) {
writer.println("<!-- =========== FIELD SUMMARY =========== -->"); memberSummaryTree.addContent(HtmlConstants.START_OF_FIELD_SUMMARY);
writer.println(); Content memberTree = writer.getMemberTreeHeader();
writer.printSummaryHeader(this, classDoc); writer.addSummaryHeader(this, classDoc, memberTree);
} return memberTree;
/**
* Write the fields summary footer for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeMemberSummaryFooter(ClassDoc classDoc) {
writer.tableEnd();
writer.space();
}
/**
* Write the inherited fields summary header for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
if(! printedSummaryHeader){
//We don't want inherited summary to not be under heading.
writeMemberSummaryHeader(classDoc);
writeMemberSummaryFooter(classDoc);
printedSummaryHeader = true;
}
writer.printInheritedSummaryHeader(this, classDoc);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeInheritedMemberSummary(ClassDoc classDoc, public Content getFieldDetailsTreeHeader(ClassDoc classDoc,
ProgramElementDoc field, boolean isFirst, boolean isLast) { Content memberDetailsTree) {
writer.printInheritedSummaryMember(this, classDoc, field, isFirst); memberDetailsTree.addContent(HtmlConstants.START_OF_FIELD_DETAILS);
Content fieldDetailsTree = writer.getMemberTreeHeader();
fieldDetailsTree.addContent(writer.getMarkerAnchor("field_detail"));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.fieldDetailsLabel);
fieldDetailsTree.addContent(heading);
return fieldDetailsTree;
} }
/** /**
* Write the inherited fields summary footer for the given class. * {@inheritDoc}
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) { public Content getFieldDocTreeHeader(FieldDoc field,
writer.printInheritedSummaryFooter(this, classDoc); Content fieldDetailsTree) {
fieldDetailsTree.addContent(
writer.getMarkerAnchor(field.name()));
Content fieldDocTree = writer.getMemberTreeHeader();
Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
heading.addContent(field.name());
fieldDocTree.addContent(heading);
return fieldDocTree;
} }
/** /**
* Write the header for the field documentation. * {@inheritDoc}
*
* @param classDoc the class that the fields belong to.
*/ */
public void writeHeader(ClassDoc classDoc, String header) { public Content getSignature(FieldDoc field) {
writer.println(); Content pre = new HtmlTree(HtmlTag.PRE);
writer.println("<!-- ============ FIELD DETAIL =========== -->"); writer.addAnnotationInfo(field, pre);
writer.println(); addModifiers(field, pre);
writer.anchor("field_detail"); Content fieldlink = new RawHtml(writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
writer.printTableHeadingBackground(header); field.type())));
writer.println(); pre.addContent(fieldlink);
} pre.addContent(" ");
/**
* Write the field header for the given field.
*
* @param field the field being documented.
* @param isFirst the flag to indicate whether or not the field is the
* first to be documented.
*/
public void writeFieldHeader(FieldDoc field, boolean isFirst) {
if (! isFirst) {
writer.printMemberHeader();
writer.println("");
}
writer.anchor(field.name());
writer.h3();
writer.print(field.name());
writer.h3End();
}
/**
* Write the signature for the given field.
*
* @param field the field being documented.
*/
public void writeSignature(FieldDoc field) {
writer.pre();
writer.writeAnnotationInfo(field);
printModifiers(field);
writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
field.type()));
print(' ');
if (configuration().linksource) { if (configuration().linksource) {
writer.printSrcLink(field, field.name()); Content fieldName = new StringContent(field.name());
writer.addSrcLink(field, fieldName, pre);
} else { } else {
strong(field.name()); addName(field.name(), pre);
} }
writer.preEnd(); return pre;
assert !writer.getMemberDetailsListPrinted();
} }
/** /**
* Write the deprecated output for the given field. * {@inheritDoc}
*
* @param field the field being documented.
*/ */
public void writeDeprecated(FieldDoc field) { public void addDeprecated(FieldDoc field, Content fieldDocTree) {
printDeprecated(field); addDeprecatedInfo(field, fieldDocTree);
} }
/** /**
* Write the comments for the given field. * {@inheritDoc}
*
* @param field the field being documented.
*/ */
public void writeComments(FieldDoc field) { public void addComments(FieldDoc field, Content fieldDocTree) {
ClassDoc holder = field.containingClass(); ClassDoc holder = field.containingClass();
if (field.inlineTags().length > 0) { if (field.inlineTags().length > 0) {
writer.printMemberDetailsListStartTag();
if (holder.equals(classdoc) || if (holder.equals(classdoc) ||
(! (holder.isPublic() || Util.isLinkable(holder, configuration())))) { (! (holder.isPublic() || Util.isLinkable(holder, configuration())))) {
writer.dd(); writer.addInlineComment(field, fieldDocTree);
writer.printInlineComment(field);
writer.ddEnd();
} else { } else {
String classlink = writer.codeText( Content link = new RawHtml(
writer.getDocLink(LinkInfoImpl.CONTEXT_FIELD_DOC_COPY, writer.getDocLink(LinkInfoImpl.CONTEXT_FIELD_DOC_COPY,
holder, field, holder, field,
holder.isIncluded() ? holder.isIncluded() ?
holder.typeName() : holder.qualifiedTypeName(), holder.typeName() : holder.qualifiedTypeName(),
false)); false));
writer.dd(); Content codeLink = HtmlTree.CODE(link);
writer.strong(configuration().getText(holder.isClass()? Content strong = HtmlTree.STRONG(holder.isClass()?
"doclet.Description_From_Class" : writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
"doclet.Description_From_Interface", classlink)); strong.addContent(writer.getSpace());
writer.ddEnd(); strong.addContent(codeLink);
writer.dd(); fieldDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, strong));
writer.printInlineComment(field); writer.addInlineComment(field, fieldDocTree);
writer.ddEnd();
} }
} }
} }
/** /**
* Write the tag output for the given field. * {@inheritDoc}
*
* @param field the field being documented.
*/ */
public void writeTags(FieldDoc field) { public void addTags(FieldDoc field, Content fieldDocTree) {
writer.printTags(field); writer.addTagsInfo(field, fieldDocTree);
} }
/** /**
* Write the field footer. * {@inheritDoc}
*/ */
public void writeFieldFooter() { public Content getFieldDetails(Content fieldDetailsTree) {
printMemberFooter(); return getMemberTree(fieldDetailsTree);
} }
/** /**
* Write the footer for the field documentation. * {@inheritDoc}
*
* @param classDoc the class that the fields belong to.
*/ */
public void writeFooter(ClassDoc classDoc) { public Content getFieldDoc(Content fieldDocTree,
//No footer to write for field documentation boolean isLastContent) {
return getMemberTree(fieldDocTree, isLastContent);
} }
/** /**
@ -237,85 +177,136 @@ public class FieldWriterImpl extends AbstractMemberWriter
return VisibleMemberMap.FIELDS; return VisibleMemberMap.FIELDS;
} }
public void printSummaryLabel() { /**
writer.printText("doclet.Field_Summary"); * {@inheritDoc}
*/
public void addSummaryLabel(Content memberTree) {
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
writer.getResource("doclet.Field_Summary"));
memberTree.addContent(label);
} }
public void printTableSummary() { /**
writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary", * {@inheritDoc}
*/
public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Field_Summary"), configuration().getText("doclet.Field_Summary"),
configuration().getText("doclet.fields"))); configuration().getText("doclet.fields"));
} }
public void printSummaryTableHeader(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
public String getCaption() {
return configuration().getText("doclet.Fields");
}
/**
* {@inheritDoc}
*/
public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header = new String[] { String[] header = new String[] {
writer.getModifierTypeHeader(), writer.getModifierTypeHeader(),
configuration().getText("doclet.0_and_1", configuration().getText("doclet.0_and_1",
configuration().getText("doclet.Field"), configuration().getText("doclet.Field"),
configuration().getText("doclet.Description")) configuration().getText("doclet.Description"))
}; };
writer.summaryTableHeader(header, "col"); return header;
} }
public void printSummaryAnchor(ClassDoc cd) { /**
writer.anchor("field_summary"); * {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
memberTree.addContent(writer.getMarkerAnchor("field_summary"));
} }
public void printInheritedSummaryAnchor(ClassDoc cd) { /**
writer.anchor("fields_inherited_from_class_" + configuration().getClassName(cd)); * {@inheritDoc}
*/
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor(
"fields_inherited_from_class_" + configuration().getClassName(cd)));
} }
public void printInheritedSummaryLabel(ClassDoc cd) { /**
String classlink = writer.getPreQualifiedClassLink( * {@inheritDoc}
LinkInfoImpl.CONTEXT_MEMBER, cd, false); */
writer.strong(); public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
String key = cd.isClass()? Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
"doclet.Fields_Inherited_From_Class" : LinkInfoImpl.CONTEXT_MEMBER, cd, false));
"doclet.Fields_Inherited_From_Interface"; Content label = new StringContent(cd.isClass() ?
writer.printText(key, classlink); configuration().getText("doclet.Fields_Inherited_From_Class") :
writer.strongEnd(); configuration().getText("doclet.Fields_Inherited_From_Interface"));
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
label);
labelHeading.addContent(writer.getSpace());
labelHeading.addContent(classLink);
inheritedTree.addContent(labelHeading);
} }
protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) { /**
writer.strong(); * {@inheritDoc}
writer.printDocLink(context, cd , (MemberDoc) member, member.name(), false); */
writer.strongEnd(); protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) {
Content strong = HtmlTree.STRONG(new RawHtml(
writer.getDocLink(context, cd , (MemberDoc) member, member.name(), false)));
Content code = HtmlTree.CODE(strong);
tdSummary.addContent(code);
} }
protected void writeInheritedSummaryLink(ClassDoc cd, /**
ProgramElementDoc member) { * {@inheritDoc}
writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc)member, */
member.name(), false); protected void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member, Content linksTree) {
linksTree.addContent(new RawHtml(
writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc)member,
member.name(), false)));
} }
protected void printSummaryType(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
FieldDoc field = (FieldDoc)member; FieldDoc field = (FieldDoc)member;
printModifierAndType(field, field.type()); addModifierAndType(field, field.type(), tdSummaryType);
} }
protected void writeDeprecatedLink(ProgramElementDoc member) { /**
writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER, * {@inheritDoc}
(MemberDoc) member, ((FieldDoc)member).qualifiedName(), false); */
protected Content getDeprecatedLink(ProgramElementDoc member) {
return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER,
(MemberDoc) member, ((FieldDoc)member).qualifiedName());
} }
protected void printNavSummaryLink(ClassDoc cd, boolean link) { /**
* {@inheritDoc}
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) { if (link) {
writer.printHyperLink("", (cd == null)? return writer.getHyperLink("", (cd == null)?
"field_summary": "field_summary":
"fields_inherited_from_class_" + "fields_inherited_from_class_" +
configuration().getClassName(cd), configuration().getClassName(cd),
configuration().getText("doclet.navField")); writer.getResource("doclet.navField"));
} else { } else {
writer.printText("doclet.navField"); return writer.getResource("doclet.navField");
} }
} }
protected void printNavDetailLink(boolean link) { /**
* {@inheritDoc}
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) { if (link) {
writer.printHyperLink("", "field_detail", liNav.addContent(writer.getHyperLink("", "field_detail",
configuration().getText("doclet.navField")); writer.getResource("doclet.navField")));
} else { } else {
writer.printText("doclet.navField"); liNav.addContent(writer.getResource("doclet.navField"));
} }
} }
} }

View file

@ -25,8 +25,10 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.util.*;
import java.io.*; import java.io.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Generate the documentation in the Html "frame" format in the browser. The * Generate the documentation in the Html "frame" format in the browser. The
@ -47,6 +49,8 @@ public class FrameOutputWriter extends HtmlDocletWriter {
*/ */
int noOfPackages; int noOfPackages;
private final String SCROLL_YES = "yes";
/** /**
* Constructor to construct FrameOutputWriter object. * Constructor to construct FrameOutputWriter object.
* *
@ -86,82 +90,93 @@ public class FrameOutputWriter extends HtmlDocletWriter {
* as well as warning if browser is not supporting the Html frames. * as well as warning if browser is not supporting the Html frames.
*/ */
protected void generateFrameFile() { protected void generateFrameFile() {
Content frameset = getFrameDetails();
if (configuration.windowtitle.length() > 0) { if (configuration.windowtitle.length() > 0) {
printFramesetHeader(configuration.windowtitle, configuration.notimestamp); printFramesetDocument(configuration.windowtitle, configuration.notimestamp,
frameset);
} else { } else {
printFramesetHeader(configuration.getText("doclet.Generated_Docs_Untitled"), printFramesetDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
configuration.notimestamp); configuration.notimestamp, frameset);
} }
printFrameDetails();
printFrameFooter();
} }
/** /**
* Generate the code for issueing the warning for a non-frame capable web * Add the code for issueing the warning for a non-frame capable web
* client. Also provide links to the non-frame version documentation. * client. Also provide links to the non-frame version documentation.
*
* @param contentTree the content tree to which the non-frames information will be added
*/ */
protected void printFrameWarning() { protected void addFrameWarning(Content contentTree) {
noFrames(); Content noframes = new HtmlTree(HtmlTag.NOFRAMES);
h2(); Content noScript = HtmlTree.NOSCRIPT(
printText("doclet.Frame_Alert"); HtmlTree.DIV(getResource("doclet.No_Script_Message")));
h2End(); noframes.addContent(noScript);
p(); Content noframesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
printText("doclet.Frame_Warning_Message"); getResource("doclet.Frame_Alert"));
br(); noframes.addContent(noframesHead);
printText("doclet.Link_To"); Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message"));
printHyperLink(configuration.topFile, noframes.addContent(p);
configuration.getText("doclet.Non_Frame_Version")); noframes.addContent(new HtmlTree(HtmlTag.BR));
println(""); noframes.addContent(getResource("doclet.Link_To"));
noFramesEnd(); Content link = getHyperLink(configuration.topFile,
getResource("doclet.Non_Frame_Version"));
noframes.addContent(link);
contentTree.addContent(noframes);
} }
/** /**
* Print the frame sizes and their contents. * Get the frame sizes and their contents.
*
* @return a content tree for the frame details
*/ */
protected void printFrameDetails() { protected Content getFrameDetails() {
// title attribute intentionally made empty so HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame",
// 508 tests will not flag it as missing "top.loadFrames()");
frameSet("cols=\"20%,80%\" title=\"\" onLoad=\"top.loadFrames()\"");
if (noOfPackages <= 1) { if (noOfPackages <= 1) {
printAllClassesFrameTag(); addAllClassesFrameTag(frameset);
} else if (noOfPackages > 1) { } else if (noOfPackages > 1) {
frameSet("rows=\"30%,70%\" title=\"\" onLoad=\"top.loadFrames()\""); HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
printAllPackagesFrameTag(); "top.loadFrames()");
printAllClassesFrameTag(); addAllPackagesFrameTag(leftFrameset);
frameSetEnd(); addAllClassesFrameTag(leftFrameset);
frameset.addContent(leftFrameset);
} }
printClassFrameTag(); addClassFrameTag(frameset);
printFrameWarning(); addFrameWarning(frameset);
frameSetEnd(); return frameset;
} }
/** /**
* Print the FRAME tag for the frame that lists all packages * Add the FRAME tag for the frame that lists all packages.
*
* @param contentTree the content tree to which the information will be added
*/ */
private void printAllPackagesFrameTag() { private void addAllPackagesFrameTag(Content contentTree) {
frame("src=\"overview-frame.html\" name=\"packageListFrame\"" HtmlTree frame = HtmlTree.FRAME("overview-frame.html", "packageListFrame",
+ " title=\"" + configuration.getText("doclet.All_Packages") + "\""); configuration.getText("doclet.All_Packages"));
contentTree.addContent(frame);
} }
/** /**
* Print the FRAME tag for the frame that lists all classes * Add the FRAME tag for the frame that lists all classes.
*
* @param contentTree the content tree to which the information will be added
*/ */
private void printAllClassesFrameTag() { private void addAllClassesFrameTag(Content contentTree) {
frame("src=\"" + "allclasses-frame.html" + "\"" HtmlTree frame = HtmlTree.FRAME("allclasses-frame.html", "packageFrame",
+ " name=\"packageFrame\"" configuration.getText("doclet.All_classes_and_interfaces"));
+ " title=\"" + configuration.getText("doclet.All_classes_and_interfaces") contentTree.addContent(frame);
+ "\"");
} }
/** /**
* Print the FRAME tag for the frame that describes the class in detail * Add the FRAME tag for the frame that describes the class in detail.
*
* @param contentTree the content tree to which the information will be added
*/ */
private void printClassFrameTag() { private void addClassFrameTag(Content contentTree) {
frame("src=\"" + configuration.topFile + "\"" HtmlTree frame = HtmlTree.FRAME(configuration.topFile, "classFrame",
+ " name=\"classFrame\"" configuration.getText("doclet.Package_class_and_interface_descriptions"),
+ " title=\"" SCROLL_YES);
+ configuration.getText("doclet.Package_class_and_interface_descriptions") contentTree.addContent(frame);
+ "\" scrolling=\"yes\"");
} }
} }

View file

@ -25,8 +25,10 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.util.*;
import java.io.*; import java.io.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Generate the Help File for the generated API documentation. The help file * Generate the Help File for the generated API documentation. The help file
@ -72,159 +74,242 @@ public class HelpWriter extends HtmlDocletWriter {
* Generate the help file contents. * Generate the help file contents.
*/ */
protected void generateHelpFile() { protected void generateHelpFile() {
printHtmlHeader(configuration.getText("doclet.Window_Help_title"), String title = configuration.getText("doclet.Window_Help_title");
null, true); Content body = getBody(true, getWindowTitle(title));
printTop(); addTop(body);
navLinks(true); hr(); addNavLinks(true, body);
addHelpFileContents(body);
printHelpFileContents(); addNavLinks(false, body);
addBottom(body);
navLinks(false); printHtmlDocument(null, true, body);
printBottom();
printBodyHtmlEnd();
} }
/** /**
* Print the help file contents from the resource file. While generating the * Add the help file contents from the resource file to the content tree. While adding the
* help file contents it also keeps track of user options. If "-notree" * help file contents it also keeps track of user options. If "-notree"
* is used, then the "overview-tree.html" will not get generated and hence * is used, then the "overview-tree.html" will not get added and hence
* help information also will not get generated. * help information also will not get added.
*
* @param contentTree the content tree to which the help file contents will be added
*/ */
protected void printHelpFileContents() { protected void addHelpFileContents(Content contentTree) {
center(); h1(); printText("doclet.Help_line_1"); h1End(); centerEnd(); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title,
printText("doclet.Help_line_2"); getResource("doclet.Help_line_1"));
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
Content line2 = HtmlTree.P(HtmlStyle.subTitle,
getResource("doclet.Help_line_2"));
div.addContent(line2);
contentTree.addContent(div);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
if (configuration.createoverview) { if (configuration.createoverview) {
h3(); printText("doclet.Overview"); h3End(); Content overviewHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
blockquote(); p(); getResource("doclet.Overview"));
printText("doclet.Help_line_3", Content liOverview = HtmlTree.LI(HtmlStyle.blockList, overviewHeading);
getHyperLink("overview-summary.html", Content line3 = getResource("doclet.Help_line_3",
configuration.getText("doclet.Overview"))); getHyperLinkString("overview-summary.html",
blockquoteEnd(); configuration.getText("doclet.Overview")));
Content overviewPara = HtmlTree.P(line3);
liOverview.addContent(overviewPara);
ul.addContent(liOverview);
} }
h3(); printText("doclet.Package"); h3End(); Content packageHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
blockquote(); p(); printText("doclet.Help_line_4"); getResource("doclet.Package"));
ul(); Content liPackage = HtmlTree.LI(HtmlStyle.blockList, packageHead);
li(); printText("doclet.Interfaces_Italic"); Content line4 = getResource("doclet.Help_line_4");
li(); printText("doclet.Classes"); Content packagePara = HtmlTree.P(line4);
li(); printText("doclet.Enums"); liPackage.addContent(packagePara);
li(); printText("doclet.Exceptions"); HtmlTree ulPackage = new HtmlTree(HtmlTag.UL);
li(); printText("doclet.Errors"); ulPackage.addContent(HtmlTree.LI(
li(); printText("doclet.AnnotationTypes"); getResource("doclet.Interfaces_Italic")));
ulEnd(); ulPackage.addContent(HtmlTree.LI(
blockquoteEnd(); getResource("doclet.Classes")));
h3(); printText("doclet.Help_line_5"); h3End(); ulPackage.addContent(HtmlTree.LI(
blockquote(); p(); printText("doclet.Help_line_6"); getResource("doclet.Enums")));
ul(); ulPackage.addContent(HtmlTree.LI(
li(); printText("doclet.Help_line_7"); getResource("doclet.Exceptions")));
li(); printText("doclet.Help_line_8"); ulPackage.addContent(HtmlTree.LI(
li(); printText("doclet.Help_line_9"); getResource("doclet.Errors")));
li(); printText("doclet.Help_line_10"); ulPackage.addContent(HtmlTree.LI(
li(); printText("doclet.Help_line_11"); getResource("doclet.AnnotationTypes")));
li(); printText("doclet.Help_line_12"); liPackage.addContent(ulPackage);
p(); ul.addContent(liPackage);
li(); printText("doclet.Nested_Class_Summary"); Content classHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
li(); printText("doclet.Field_Summary"); getResource("doclet.Help_line_5"));
li(); printText("doclet.Constructor_Summary"); Content liClass = HtmlTree.LI(HtmlStyle.blockList, classHead);
li(); printText("doclet.Method_Summary"); Content line6 = getResource("doclet.Help_line_6");
p(); Content classPara = HtmlTree.P(line6);
li(); printText("doclet.Field_Detail"); liClass.addContent(classPara);
li(); printText("doclet.Constructor_Detail"); HtmlTree ul1 = new HtmlTree(HtmlTag.UL);
li(); printText("doclet.Method_Detail"); ul1.addContent(HtmlTree.LI(
ulEnd(); getResource("doclet.Help_line_7")));
printText("doclet.Help_line_13"); ul1.addContent(HtmlTree.LI(
blockquoteEnd(); getResource("doclet.Help_line_8")));
ul1.addContent(HtmlTree.LI(
getResource("doclet.Help_line_9")));
ul1.addContent(HtmlTree.LI(
getResource("doclet.Help_line_10")));
ul1.addContent(HtmlTree.LI(
getResource("doclet.Help_line_11")));
ul1.addContent(HtmlTree.LI(
getResource("doclet.Help_line_12")));
liClass.addContent(ul1);
HtmlTree ul2 = new HtmlTree(HtmlTag.UL);
ul2.addContent(HtmlTree.LI(
getResource("doclet.Nested_Class_Summary")));
ul2.addContent(HtmlTree.LI(
getResource("doclet.Field_Summary")));
ul2.addContent(HtmlTree.LI(
getResource("doclet.Constructor_Summary")));
ul2.addContent(HtmlTree.LI(
getResource("doclet.Method_Summary")));
liClass.addContent(ul2);
HtmlTree ul3 = new HtmlTree(HtmlTag.UL);
ul3.addContent(HtmlTree.LI(
getResource("doclet.Field_Detail")));
ul3.addContent(HtmlTree.LI(
getResource("doclet.Constructor_Detail")));
ul3.addContent(HtmlTree.LI(
getResource("doclet.Method_Detail")));
liClass.addContent(ul3);
Content line13 = getResource("doclet.Help_line_13");
Content para = HtmlTree.P(line13);
liClass.addContent(para);
ul.addContent(liClass);
//Annotation Types //Annotation Types
blockquoteEnd(); Content aHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
h3(); printText("doclet.AnnotationType"); h3End(); getResource("doclet.AnnotationType"));
blockquote(); p(); printText("doclet.Help_annotation_type_line_1"); Content liAnnotation = HtmlTree.LI(HtmlStyle.blockList, aHead);
ul(); Content aline1 = getResource("doclet.Help_annotation_type_line_1");
li(); printText("doclet.Help_annotation_type_line_2"); Content aPara = HtmlTree.P(aline1);
li(); printText("doclet.Help_annotation_type_line_3"); liAnnotation.addContent(aPara);
li(); printText("doclet.Annotation_Type_Required_Member_Summary"); HtmlTree aul = new HtmlTree(HtmlTag.UL);
li(); printText("doclet.Annotation_Type_Optional_Member_Summary"); aul.addContent(HtmlTree.LI(
li(); printText("doclet.Annotation_Type_Member_Detail"); getResource("doclet.Help_annotation_type_line_2")));
ulEnd(); aul.addContent(HtmlTree.LI(
blockquoteEnd(); getResource("doclet.Help_annotation_type_line_3")));
aul.addContent(HtmlTree.LI(
getResource("doclet.Annotation_Type_Required_Member_Summary")));
aul.addContent(HtmlTree.LI(
getResource("doclet.Annotation_Type_Optional_Member_Summary")));
aul.addContent(HtmlTree.LI(
getResource("doclet.Annotation_Type_Member_Detail")));
liAnnotation.addContent(aul);
ul.addContent(liAnnotation);
//Enums //Enums
blockquoteEnd(); Content enumHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
h3(); printText("doclet.Enum"); h3End(); getResource("doclet.Enum"));
blockquote(); p(); printText("doclet.Help_enum_line_1"); Content liEnum = HtmlTree.LI(HtmlStyle.blockList, enumHead);
ul(); Content eline1 = getResource("doclet.Help_enum_line_1");
li(); printText("doclet.Help_enum_line_2"); Content enumPara = HtmlTree.P(eline1);
li(); printText("doclet.Help_enum_line_3"); liEnum.addContent(enumPara);
li(); printText("doclet.Enum_Constant_Summary"); HtmlTree eul = new HtmlTree(HtmlTag.UL);
li(); printText("doclet.Enum_Constant_Detail"); eul.addContent(HtmlTree.LI(
ulEnd(); getResource("doclet.Help_enum_line_2")));
blockquoteEnd(); eul.addContent(HtmlTree.LI(
getResource("doclet.Help_enum_line_3")));
eul.addContent(HtmlTree.LI(
getResource("doclet.Enum_Constant_Summary")));
eul.addContent(HtmlTree.LI(
getResource("doclet.Enum_Constant_Detail")));
liEnum.addContent(eul);
ul.addContent(liEnum);
if (configuration.classuse) { if (configuration.classuse) {
h3(); printText("doclet.Help_line_14"); h3End(); Content useHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
blockquote(); getResource("doclet.Help_line_14"));
printText("doclet.Help_line_15"); Content liUse = HtmlTree.LI(HtmlStyle.blockList, useHead);
blockquoteEnd(); Content line15 = getResource("doclet.Help_line_15");
Content usePara = HtmlTree.P(line15);
liUse.addContent(usePara);
ul.addContent(liUse);
} }
if (configuration.createtree) { if (configuration.createtree) {
h3(); printText("doclet.Help_line_16"); h3End(); Content treeHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
blockquote(); getResource("doclet.Help_line_16"));
printText("doclet.Help_line_17_with_tree_link", Content liTree = HtmlTree.LI(HtmlStyle.blockList, treeHead);
getHyperLink("overview-tree.html", Content line17 = getResource("doclet.Help_line_17_with_tree_link",
configuration.getText("doclet.Class_Hierarchy"))); getHyperLinkString("overview-tree.html",
ul(); configuration.getText("doclet.Class_Hierarchy")));
li(); printText("doclet.Help_line_18"); Content treePara = HtmlTree.P(line17);
li(); printText("doclet.Help_line_19"); liTree.addContent(treePara);
ulEnd(); HtmlTree tul = new HtmlTree(HtmlTag.UL);
blockquoteEnd(); tul.addContent(HtmlTree.LI(
getResource("doclet.Help_line_18")));
tul.addContent(HtmlTree.LI(
getResource("doclet.Help_line_19")));
liTree.addContent(tul);
ul.addContent(liTree);
} }
if (!(configuration.nodeprecatedlist || if (!(configuration.nodeprecatedlist ||
configuration.nodeprecated)) { configuration.nodeprecated)) {
h3(); printText("doclet.Deprecated_API"); h3End(); Content dHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
blockquote(); getResource("doclet.Deprecated_API"));
printText("doclet.Help_line_20_with_deprecated_api_link", Content liDeprecated = HtmlTree.LI(HtmlStyle.blockList, dHead);
getHyperLink("deprecated-list.html", Content line20 = getResource("doclet.Help_line_20_with_deprecated_api_link",
configuration.getText("doclet.Deprecated_API"))); getHyperLinkString("deprecated-list.html",
blockquoteEnd(); configuration.getText("doclet.Deprecated_API")));
Content dPara = HtmlTree.P(line20);
liDeprecated.addContent(dPara);
ul.addContent(liDeprecated);
} }
if (configuration.createindex) { if (configuration.createindex) {
String indexlink; String indexlink;
if (configuration.splitindex) { if (configuration.splitindex) {
indexlink = getHyperLink("index-files/index-1.html", indexlink = getHyperLinkString("index-files/index-1.html",
configuration.getText("doclet.Index")); configuration.getText("doclet.Index"));
} else { } else {
indexlink = getHyperLink("index-all.html", indexlink = getHyperLinkString("index-all.html",
configuration.getText("doclet.Index")); configuration.getText("doclet.Index"));
} }
h3(); printText("doclet.Help_line_21"); h3End(); Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
blockquote(); getResource("doclet.Help_line_21"));
printText("doclet.Help_line_22", indexlink); Content liIndex = HtmlTree.LI(HtmlStyle.blockList, indexHead);
blockquoteEnd(); Content line22 = getResource("doclet.Help_line_22", indexlink);
Content indexPara = HtmlTree.P(line22);
liIndex.addContent(indexPara);
ul.addContent(liIndex);
} }
h3(); printText("doclet.Help_line_23"); h3End(); Content prevHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
printText("doclet.Help_line_24"); getResource("doclet.Help_line_23"));
h3(); printText("doclet.Help_line_25"); h3End(); Content liPrev = HtmlTree.LI(HtmlStyle.blockList, prevHead);
printText("doclet.Help_line_26"); p(); Content line24 = getResource("doclet.Help_line_24");
Content prevPara = HtmlTree.P(line24);
h3(); printText("doclet.Serialized_Form"); h3End(); liPrev.addContent(prevPara);
printText("doclet.Help_line_27"); p(); ul.addContent(liPrev);
Content frameHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
h3(); printText("doclet.Constants_Summary"); h3End(); getResource("doclet.Help_line_25"));
printText("doclet.Help_line_28"); p(); Content liFrame = HtmlTree.LI(HtmlStyle.blockList, frameHead);
Content line26 = getResource("doclet.Help_line_26");
font("-1"); em(); Content framePara = HtmlTree.P(line26);
printText("doclet.Help_line_29"); liFrame.addContent(framePara);
emEnd(); fontEnd(); br(); ul.addContent(liFrame);
hr(); Content sHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Serialized_Form"));
Content liSerial = HtmlTree.LI(HtmlStyle.blockList, sHead);
Content line27 = getResource("doclet.Help_line_27");
Content serialPara = HtmlTree.P(line27);
liSerial.addContent(serialPara);
ul.addContent(liSerial);
Content constHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Constants_Summary"));
Content liConst = HtmlTree.LI(HtmlStyle.blockList, constHead);
Content line28 = getResource("doclet.Help_line_28");
Content constPara = HtmlTree.P(line28);
liConst.addContent(constPara);
ul.addContent(liConst);
Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul);
Content line29 = HtmlTree.EM(getResource("doclet.Help_line_29"));
divContent.addContent(line29);
contentTree.addContent(divContent);
} }
/** /**
* Highlight the word "Help" in the navigation bar as this is the help file. * Get the help label.
*
* @return a content tree for the help label
*/ */
protected void navLinkHelp() { protected Content getNavLinkHelp() {
navCellRevStart(); Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, helpLabel);
fontStyle("NavBarFont1Rev"); return li;
strongText("doclet.Help");
fontEnd();
navCellEnd();
} }
} }

View file

@ -144,8 +144,11 @@ public class HtmlDoclet extends AbstractDoclet {
!configuration.nohelp) { !configuration.nohelp) {
HelpWriter.generate(configuration); HelpWriter.generate(configuration);
} }
// If a stylesheet file is not specified, copy the default stylesheet.
if (configuration.stylesheetfile.length() == 0) { if (configuration.stylesheetfile.length() == 0) {
StylesheetWriter.generate(configuration); Util.copyFile(configuration, "stylesheet.css", Util.RESOURCESDIR,
(configdestdir.isEmpty()) ?
System.getProperty("user.dir") : configdestdir, false);
} }
} }

View file

@ -31,6 +31,7 @@ import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.taglets.*; import com.sun.tools.doclets.internal.toolkit.taglets.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Generate serialized form for serializable fields. * Generate serialized form for serializable fields.
@ -46,8 +47,6 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
private boolean printedOverallAnchor = false; private boolean printedOverallAnchor = false;
private boolean printedFirstMember = false;
public HtmlSerialFieldWriter(SubWriterHolderWriter writer, public HtmlSerialFieldWriter(SubWriterHolderWriter writer,
ClassDoc classdoc) { ClassDoc classdoc) {
super(writer, classdoc); super(writer, classdoc);
@ -69,109 +68,143 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
} }
} }
public void writeHeader(String heading) { /**
if (! printedOverallAnchor) { * Return the header for serializable fields section.
writer.anchor("serializedForm"); *
printedOverallAnchor = true; * @return a content tree for the header
writer.printTableHeadingBackground(heading); */
writer.println(); public Content getSerializableFieldsHeader() {
if (heading.equals( HtmlTree ul = new HtmlTree(HtmlTag.UL);
configuration().getText("doclet.Serialized_Form_class"))) { ul.addStyle(HtmlStyle.blockList);
assert !writer.getMemberDetailsListPrinted(); return ul;
}
/**
* Return the header for serializable fields content section.
*
* @param isLastContent true if the cotent being documented is the last content.
* @return a content tree for the header
*/
public Content getFieldsContentHeader(boolean isLastContent) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
if (isLastContent)
li.addStyle(HtmlStyle.blockListLast);
else
li.addStyle(HtmlStyle.blockList);
return li;
}
/**
* Add serializable fields.
*
* @param heading the heading for the section
* @param serializableFieldsTree the tree to be added to the serializable fileds
* content tree
* @return a content tree for the serializable fields content
*/
public Content getSerializableFields(String heading, Content serializableFieldsTree) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addStyle(HtmlStyle.blockList);
if (serializableFieldsTree.isValid()) {
if (!printedOverallAnchor) {
li.addContent(writer.getMarkerAnchor("serializedForm"));
printedOverallAnchor = true;
} }
} else { Content headingContent = new StringContent(heading);
writer.printTableHeadingBackground(heading); Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
writer.println(); headingContent);
li.addContent(serialHeading);
li.addContent(serializableFieldsTree);
} }
return li;
} }
public void writeMemberHeader(ClassDoc fieldType, String fieldTypeStr, /**
String fieldDimensions, String fieldName) { * Add the member header.
if (printedFirstMember) { *
writer.printMemberHeader(); * @param fieldsType the class document to be listed
} * @param fieldTypeStr the string for the filed type to be documented
printedFirstMember = true; * @param fieldDimensions the dimensions of the field string to be added
writer.h3(); * @param firldName name of the field to be added
writer.print(fieldName); * @param contentTree the content tree to which the member header will be added
writer.h3End(); */
writer.pre(); public void addMemberHeader(ClassDoc fieldType, String fieldTypeStr,
String fieldDimensions, String fieldName, Content contentTree) {
Content nameContent = new RawHtml(fieldName);
Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, nameContent);
contentTree.addContent(heading);
Content pre = new HtmlTree(HtmlTag.PRE);
if (fieldType == null) { if (fieldType == null) {
writer.print(fieldTypeStr); pre.addContent(fieldTypeStr);
} else { } else {
writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIAL_MEMBER, Content fieldContent = new RawHtml(writer.getLink(new LinkInfoImpl(
fieldType)); LinkInfoImpl.CONTEXT_SERIAL_MEMBER, fieldType)));
pre.addContent(fieldContent);
} }
print(fieldDimensions + ' '); pre.addContent(fieldDimensions + " ");
strong(fieldName); pre.addContent(fieldName);
writer.preEnd(); contentTree.addContent(pre);
assert !writer.getMemberDetailsListPrinted();
} }
/** /**
* Write the deprecated information for this member. * Add the deprecated information for this member.
* *
* @param field the field to document. * @param field the field to document.
* @param contentTree the tree to which the deprecated info will be added
*/ */
public void writeMemberDeprecatedInfo(FieldDoc field) { public void addMemberDeprecatedInfo(FieldDoc field, Content contentTree) {
printDeprecated(field); addDeprecatedInfo(field, contentTree);
} }
/** /**
* Write the description text for this member. * Add the description text for this member.
* *
* @param field the field to document. * @param field the field to document.
* @param contentTree the tree to which the deprecated info will be added
*/ */
public void writeMemberDescription(FieldDoc field) { public void addMemberDescription(FieldDoc field, Content contentTree) {
if (field.inlineTags().length > 0) { if (field.inlineTags().length > 0) {
writer.printMemberDetailsListStartTag(); writer.addInlineComment(field, contentTree);
writer.dd();
writer.printInlineComment(field);
writer.ddEnd();
} }
Tag[] tags = field.tags("serial"); Tag[] tags = field.tags("serial");
if (tags.length > 0) { if (tags.length > 0) {
writer.printMemberDetailsListStartTag(); writer.addInlineComment(field, tags[0], contentTree);
writer.dd();
writer.printInlineComment(field, tags[0]);
writer.ddEnd();
} }
} }
/** /**
* Write the description text for this member represented by the tag. * Add the description text for this member represented by the tag.
* *
* @param serialFieldTag the field to document (represented by tag). * @param serialFieldTag the field to document (represented by tag)
* @param contentTree the tree to which the deprecated info will be added
*/ */
public void writeMemberDescription(SerialFieldTag serialFieldTag) { public void addMemberDescription(SerialFieldTag serialFieldTag, Content contentTree) {
String serialFieldTagDesc = serialFieldTag.description().trim(); String serialFieldTagDesc = serialFieldTag.description().trim();
if (!serialFieldTagDesc.isEmpty()) { if (!serialFieldTagDesc.isEmpty()) {
writer.dl(); Content serialFieldContent = new RawHtml(serialFieldTagDesc);
writer.dd(); Content div = HtmlTree.DIV(HtmlStyle.block, serialFieldContent);
writer.print(serialFieldTagDesc); contentTree.addContent(div);
writer.ddEnd();
writer.dlEnd();
} }
} }
/** /**
* Write the tag information for this member. * Add the tag information for this member.
* *
* @param field the field to document. * @param field the field to document.
* @param contentTree the tree to which the member tags info will be added
*/ */
public void writeMemberTags(FieldDoc field) { public void addMemberTags(FieldDoc field, Content contentTree) {
TagletOutputImpl output = new TagletOutputImpl(""); TagletOutputImpl output = new TagletOutputImpl("");
TagletWriter.genTagOuput(configuration().tagletManager, field, TagletWriter.genTagOuput(configuration().tagletManager, field,
configuration().tagletManager.getCustomTags(field), configuration().tagletManager.getCustomTags(field),
writer.getTagletWriterInstance(false), output); writer.getTagletWriterInstance(false), output);
String outputString = output.toString().trim(); String outputString = output.toString().trim();
Content dlTags = new HtmlTree(HtmlTag.DL);
if (!outputString.isEmpty()) { if (!outputString.isEmpty()) {
writer.printMemberDetailsListStartTag(); Content tagContent = new RawHtml(outputString);
writer.dd(); dlTags.addContent(tagContent);
writer.dl();
print(outputString);
writer.dlEnd();
writer.ddEnd();
} }
contentTree.addContent(dlTags);
} }
/** /**
@ -192,24 +225,4 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
return true; return true;
return false; return false;
} }
public void writeMemberFooter() {
printMemberFooter();
}
/**
* Write the footer information. If the serilization overview section was
* printed, check for definition list and close list tag.
*
* @param heading the heading that was written.
*/
public void writeFooter(String heading) {
if (printedOverallAnchor) {
if (heading.equals(
configuration().getText("doclet.Serialized_Form_class"))) {
writer.printMemberDetailsListEndTag();
assert !writer.getMemberDetailsListPrinted();
}
}
}
} }

View file

@ -28,57 +28,119 @@ package com.sun.tools.doclets.formats.html;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.taglets.*; import com.sun.tools.doclets.internal.toolkit.taglets.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Generate serialized form for Serializable/Externalizable methods. * Generate serialized form for Serializable/Externalizable methods.
* Documentation denoted by the <code>serialData</code> tag is processed. * Documentation denoted by the <code>serialData</code> tag is processed.
* *
* @author Joe Fialli * @author Joe Fialli
* @author Bhavesh Patel (Modified)
*/ */
public class HtmlSerialMethodWriter extends MethodWriterImpl implements public class HtmlSerialMethodWriter extends MethodWriterImpl implements
SerializedFormWriter.SerialMethodWriter{ SerializedFormWriter.SerialMethodWriter{
private boolean printedFirstMember = false;
public HtmlSerialMethodWriter(SubWriterHolderWriter writer, public HtmlSerialMethodWriter(SubWriterHolderWriter writer,
ClassDoc classdoc) { ClassDoc classdoc) {
super(writer, classdoc); super(writer, classdoc);
} }
public void writeHeader(String heading) { /**
writer.anchor("serialized_methods"); * Return the header for serializable methods section.
writer.printTableHeadingBackground(heading); *
writer.p(); * @return a content tree for the header
*/
public Content getSerializableMethodsHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
return ul;
} }
public void writeNoCustomizationMsg(String msg) { /**
writer.print(msg); * Return the header for serializable methods content section.
writer.p(); *
* @param isLastContent true if the cotent being documented is the last content.
* @return a content tree for the header
*/
public Content getMethodsContentHeader(boolean isLastContent) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
if (isLastContent)
li.addStyle(HtmlStyle.blockListLast);
else
li.addStyle(HtmlStyle.blockList);
return li;
} }
public void writeMemberHeader(MethodDoc member) { /**
if (printedFirstMember) { * Add serializable methods.
writer.printMemberHeader(); *
} * @param heading the heading for the section
printedFirstMember = true; * @param serializableMethodContent the tree to be added to the serializable methods
writer.anchor(member); * content tree
printHead(member); * @return a content tree for the serializable methods content
writeSignature(member); */
public Content getSerializableMethods(String heading, Content serializableMethodContent) {
Content li = HtmlTree.LI(HtmlStyle.blockList, writer.getMarkerAnchor(
"serialized_methods"));
Content headingContent = new StringContent(heading);
Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
headingContent);
li.addContent(serialHeading);
li.addContent(serializableMethodContent);
return li;
} }
public void writeMemberFooter() { /**
printMemberFooter(); * Return the no customization message.
*
* @param msg the message to be displayed
* @return no customization message content
*/
public Content getNoCustomizationMsg(String msg) {
Content noCustomizationMsg = new StringContent(msg);
return noCustomizationMsg;
} }
public void writeDeprecatedMemberInfo(MethodDoc member) { /**
printDeprecated(member); * Add the member header.
*
* @param member the method document to be listed
* @param methodsContentTree the content tree to which the member header will be added
*/
public void addMemberHeader(MethodDoc member, Content methodsContentTree) {
methodsContentTree.addContent(writer.getMarkerAnchor(
writer.getAnchor(member)));
methodsContentTree.addContent(getHead(member));
methodsContentTree.addContent(getSignature(member));
} }
public void writeMemberDescription(MethodDoc member) { /**
printComment(member); * Add the deprecated information for this member.
*
* @param member the method to document.
* @param methodsContentTree the tree to which the deprecated info will be added
*/
public void addDeprecatedMemberInfo(MethodDoc member, Content methodsContentTree) {
addDeprecatedInfo(member, methodsContentTree);
} }
public void writeMemberTags(MethodDoc member) { /**
* Add the description text for this member.
*
* @param member the method to document.
* @param methodsContentTree the tree to which the deprecated info will be added
*/
public void addMemberDescription(MethodDoc member, Content methodsContentTree) {
addComment(member, methodsContentTree);
}
/**
* Add the tag information for this member.
*
* @param member the method to document.
* @param methodsContentTree the tree to which the member tags info will be added
*/
public void addMemberTags(MethodDoc member, Content methodsContentTree) {
TagletOutputImpl output = new TagletOutputImpl(""); TagletOutputImpl output = new TagletOutputImpl("");
TagletManager tagletManager = TagletManager tagletManager =
ConfigurationImpl.getInstance().tagletManager; ConfigurationImpl.getInstance().tagletManager;
@ -86,14 +148,12 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
tagletManager.getSerializedFormTags(), tagletManager.getSerializedFormTags(),
writer.getTagletWriterInstance(false), output); writer.getTagletWriterInstance(false), output);
String outputString = output.toString().trim(); String outputString = output.toString().trim();
Content dlTags = new HtmlTree(HtmlTag.DL);
if (!outputString.isEmpty()) { if (!outputString.isEmpty()) {
writer.printMemberDetailsListStartTag(); Content tagContent = new RawHtml(outputString);
writer.dd(); dlTags.addContent(tagContent);
writer.dl();
print(outputString);
writer.dlEnd();
writer.ddEnd();
} }
methodsContentTree.addContent(dlTags);
MethodDoc method = member; MethodDoc method = member;
if (method.name().compareTo("writeExternal") == 0 if (method.name().compareTo("writeExternal") == 0
&& method.tags("serialData").length == 0) { && method.tags("serialData").length == 0) {

View file

@ -79,7 +79,7 @@ public class LinkFactoryImpl extends LinkFactory {
String filename = pathString(classLinkInfo); String filename = pathString(classLinkInfo);
if (linkInfo.linkToSelf || if (linkInfo.linkToSelf ||
!(linkInfo.classDoc.name() + ".html").equals(m_writer.filename)) { !(linkInfo.classDoc.name() + ".html").equals(m_writer.filename)) {
linkOutput.append(m_writer.getHyperLink(filename, linkOutput.append(m_writer.getHyperLinkString(filename,
classLinkInfo.where, label.toString(), classLinkInfo.where, label.toString(),
classLinkInfo.isStrong, classLinkInfo.styleName, classLinkInfo.isStrong, classLinkInfo.styleName,
title, classLinkInfo.target)); title, classLinkInfo.target));

View file

@ -28,9 +28,9 @@ package com.sun.tools.doclets.formats.html;
import java.io.*; import java.io.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.taglets.*;
/** /**
* Writes method documentation in HTML format. * Writes method documentation in HTML format.
@ -43,8 +43,6 @@ import com.sun.tools.doclets.internal.toolkit.taglets.*;
public class MethodWriterImpl extends AbstractExecutableMemberWriter public class MethodWriterImpl extends AbstractExecutableMemberWriter
implements MethodWriter, MemberSummaryWriter { implements MethodWriter, MemberSummaryWriter {
private boolean printedSummaryHeader = false;
/** /**
* Construct a new MethodWriterImpl. * Construct a new MethodWriterImpl.
* *
@ -65,184 +63,127 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
} }
/** /**
* Write the methods summary header for the given class. * {@inheritDoc}
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeMemberSummaryHeader(ClassDoc classDoc) { public Content getMemberSummaryHeader(ClassDoc classDoc,
printedSummaryHeader = true; Content memberSummaryTree) {
writer.println(); memberSummaryTree.addContent(HtmlConstants.START_OF_METHOD_SUMMARY);
writer.println("<!-- ========== METHOD SUMMARY =========== -->"); Content memberTree = writer.getMemberTreeHeader();
writer.println(); writer.addSummaryHeader(this, classDoc, memberTree);
writer.printSummaryHeader(this, classDoc); return memberTree;
}
/**
* Write the methods summary footer for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeMemberSummaryFooter(ClassDoc classDoc) {
writer.printSummaryFooter(this, classDoc);
}
/**
* Write the inherited methods summary header for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
if(! printedSummaryHeader){
//We don't want inherited summary to not be under heading.
writeMemberSummaryHeader(classDoc);
writeMemberSummaryFooter(classDoc);
printedSummaryHeader = true;
}
writer.printInheritedSummaryHeader(this, classDoc);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeInheritedMemberSummary(ClassDoc classDoc, public Content getMethodDetailsTreeHeader(ClassDoc classDoc,
ProgramElementDoc method, boolean isFirst, boolean isLast) { Content memberDetailsTree) {
writer.printInheritedSummaryMember(this, classDoc, method, isFirst); memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS);
Content methodDetailsTree = writer.getMemberTreeHeader();
methodDetailsTree.addContent(writer.getMarkerAnchor("method_detail"));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.methodDetailsLabel);
methodDetailsTree.addContent(heading);
return methodDetailsTree;
} }
/** /**
* Write the inherited methods summary footer for the given class. * {@inheritDoc}
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) { public Content getMethodDocTreeHeader(MethodDoc method,
writer.printInheritedSummaryFooter(this, classDoc); ; Content methodDetailsTree) {
}
/**
* Write the header for the method documentation.
*
* @param classDoc the class that the methods belong to.
*/
public void writeHeader(ClassDoc classDoc, String header) {
writer.println();
writer.println("<!-- ============ METHOD DETAIL ========== -->");
writer.println();
writer.anchor("method_detail");
writer.printTableHeadingBackground(header);
}
/**
* Write the method header for the given method.
*
* @param method the method being documented.
* @param isFirst the flag to indicate whether or not the method is the
* first to be documented.
*/
public void writeMethodHeader(MethodDoc method, boolean isFirst) {
if (! isFirst) {
writer.printMemberHeader();
}
writer.println();
String erasureAnchor; String erasureAnchor;
if ((erasureAnchor = getErasureAnchor(method)) != null) { if ((erasureAnchor = getErasureAnchor(method)) != null) {
writer.anchor(erasureAnchor); methodDetailsTree.addContent(writer.getMarkerAnchor((erasureAnchor)));
} }
writer.anchor(method); methodDetailsTree.addContent(
writer.h3(); writer.getMarkerAnchor(writer.getAnchor(method)));
writer.print(method.name()); Content methodDocTree = writer.getMemberTreeHeader();
writer.h3End(); Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
heading.addContent(method.name());
methodDocTree.addContent(heading);
return methodDocTree;
} }
/** /**
* Write the signature for the given method. * Get the signature for the given method.
* *
* @param method the method being documented. * @param method the method being documented.
* @return a content object for the signature
*/ */
public void writeSignature(MethodDoc method) { public Content getSignature(MethodDoc method) {
writer.displayLength = 0; writer.displayLength = 0;
writer.pre(); Content pre = new HtmlTree(HtmlTag.PRE);
writer.writeAnnotationInfo(method); writer.addAnnotationInfo(method, pre);
printModifiers(method); addModifiers(method, pre);
writeTypeParameters(method); addTypeParameters(method, pre);
printReturnType(method); addReturnType(method, pre);
if (configuration().linksource) { if (configuration().linksource) {
writer.printSrcLink(method, method.name()); Content methodName = new StringContent(method.name());
writer.addSrcLink(method, methodName, pre);
} else { } else {
strong(method.name()); addName(method.name(), pre);
} }
writeParameters(method); addParameters(method, pre);
writeExceptions(method); addExceptions(method, pre);
writer.preEnd(); return pre;
assert !writer.getMemberDetailsListPrinted();
} }
/** /**
* Write the deprecated output for the given method. * {@inheritDoc}
*
* @param method the method being documented.
*/ */
public void writeDeprecated(MethodDoc method) { public void addDeprecated(MethodDoc method, Content methodDocTree) {
printDeprecated(method); addDeprecatedInfo(method, methodDocTree);
} }
/** /**
* Write the comments for the given method. * {@inheritDoc}
*
* @param method the method being documented.
*/ */
public void writeComments(Type holder, MethodDoc method) { public void addComments(Type holder, MethodDoc method, Content methodDocTree) {
ClassDoc holderClassDoc = holder.asClassDoc(); ClassDoc holderClassDoc = holder.asClassDoc();
if (method.inlineTags().length > 0) { if (method.inlineTags().length > 0) {
writer.printMemberDetailsListStartTag();
if (holder.asClassDoc().equals(classdoc) || if (holder.asClassDoc().equals(classdoc) ||
(! (holderClassDoc.isPublic() || (! (holderClassDoc.isPublic() ||
Util.isLinkable(holderClassDoc, configuration())))) { Util.isLinkable(holderClassDoc, configuration())))) {
writer.dd(); writer.addInlineComment(method, methodDocTree);
writer.printInlineComment(method);
writer.ddEnd();
} else { } else {
String classlink = writer.codeText( Content link = new RawHtml(
writer.getDocLink(LinkInfoImpl.CONTEXT_METHOD_DOC_COPY, writer.getDocLink(LinkInfoImpl.CONTEXT_METHOD_DOC_COPY,
holder.asClassDoc(), method, holder.asClassDoc(), method,
holder.asClassDoc().isIncluded() ? holder.asClassDoc().isIncluded() ?
holder.typeName() : holder.qualifiedTypeName(), holder.typeName() : holder.qualifiedTypeName(),
false)); false));
writer.dd(); Content codelLink = HtmlTree.CODE(link);
writer.strongText(holder.asClassDoc().isClass()? Content strong = HtmlTree.STRONG(holder.asClassDoc().isClass()?
"doclet.Description_From_Class": writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
"doclet.Description_From_Interface", strong.addContent(writer.getSpace());
classlink); strong.addContent(codelLink);
writer.ddEnd(); methodDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, strong));
writer.dd(); writer.addInlineComment(method, methodDocTree);
writer.printInlineComment(method);
writer.ddEnd();
} }
} }
} }
/** /**
* Write the tag output for the given method. * {@inheritDoc}
*
* @param method the method being documented.
*/ */
public void writeTags(MethodDoc method) { public void addTags(MethodDoc method, Content methodDocTree) {
writer.printTags(method); writer.addTagsInfo(method, methodDocTree);
} }
/** /**
* Write the method footer. * {@inheritDoc}
*/ */
public void writeMethodFooter() { public Content getMethodDetails(Content methodDetailsTree) {
printMemberFooter(); return getMemberTree(methodDetailsTree);
} }
/** /**
* Write the footer for the method documentation. * {@inheritDoc}
*
* @param classDoc the class that the methods belong to.
*/ */
public void writeFooter(ClassDoc classDoc) { public Content getMethodDoc(Content methodDocTree,
//No footer to write for method documentation boolean isLastContent) {
return getMemberTree(methodDocTree, isLastContent);
} }
/** /**
@ -256,53 +197,89 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
return VisibleMemberMap.METHODS; return VisibleMemberMap.METHODS;
} }
public void printSummaryLabel() { /**
writer.printText("doclet.Method_Summary"); * {@inheritDoc}
*/
public void addSummaryLabel(Content memberTree) {
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
writer.getResource("doclet.Method_Summary"));
memberTree.addContent(label);
} }
public void printTableSummary() { /**
writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary", * {@inheritDoc}
*/
public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Method_Summary"), configuration().getText("doclet.Method_Summary"),
configuration().getText("doclet.methods"))); configuration().getText("doclet.methods"));
} }
public void printSummaryTableHeader(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
public String getCaption() {
return configuration().getText("doclet.Methods");
}
/**
* {@inheritDoc}
*/
public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header = new String[] { String[] header = new String[] {
writer.getModifierTypeHeader(), writer.getModifierTypeHeader(),
configuration().getText("doclet.0_and_1", configuration().getText("doclet.0_and_1",
configuration().getText("doclet.Method"), configuration().getText("doclet.Method"),
configuration().getText("doclet.Description")) configuration().getText("doclet.Description"))
}; };
writer.summaryTableHeader(header, "col"); return header;
} }
public void printSummaryAnchor(ClassDoc cd) { /**
writer.anchor("method_summary"); * {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
memberTree.addContent(writer.getMarkerAnchor("method_summary"));
} }
public void printInheritedSummaryAnchor(ClassDoc cd) { /**
writer.anchor("methods_inherited_from_class_" + * {@inheritDoc}
ConfigurationImpl.getInstance().getClassName(cd)); */
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor(
"methods_inherited_from_class_" +
configuration().getClassName(cd)));
} }
public void printInheritedSummaryLabel(ClassDoc cd) { /**
String classlink = writer.getPreQualifiedClassLink( * {@inheritDoc}
LinkInfoImpl.CONTEXT_MEMBER, cd, false); */
writer.strong(); public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
String key = cd.isClass()? Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
"doclet.Methods_Inherited_From_Class" : LinkInfoImpl.CONTEXT_MEMBER, cd, false));
"doclet.Methods_Inherited_From_Interface"; Content label = new StringContent(cd.isClass() ?
writer.printText(key, classlink); configuration().getText("doclet.Methods_Inherited_From_Class") :
writer.strongEnd(); configuration().getText("doclet.Methods_Inherited_From_Interface"));
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
label);
labelHeading.addContent(writer.getSpace());
labelHeading.addContent(classLink);
inheritedTree.addContent(labelHeading);
} }
protected void printSummaryType(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
MethodDoc meth = (MethodDoc)member; MethodDoc meth = (MethodDoc)member;
printModifierAndType(meth, meth.returnType()); addModifierAndType(meth, meth.returnType(), tdSummaryType);
} }
protected static void printOverridden(HtmlDocletWriter writer, /**
Type overriddenType, MethodDoc method) { * {@inheritDoc}
*/
protected static void addOverridden(HtmlDocletWriter writer,
Type overriddenType, MethodDoc method, Content dl) {
if(writer.configuration.nocomment){ if(writer.configuration.nocomment){
return; return;
} }
@ -317,31 +294,33 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
//is not visible so don't document this. //is not visible so don't document this.
return; return;
} }
String label = "doclet.Overrides"; Content label = writer.overridesLabel;
int context = LinkInfoImpl.CONTEXT_METHOD_OVERRIDES; int context = LinkInfoImpl.CONTEXT_METHOD_OVERRIDES;
if (method != null) { if (method != null) {
if(overriddenType.asClassDoc().isAbstract() && method.isAbstract()){ if(overriddenType.asClassDoc().isAbstract() && method.isAbstract()){
//Abstract method is implemented from abstract class, //Abstract method is implemented from abstract class,
//not overridden //not overridden
label = "doclet.Specified_By"; label = writer.specifiedByLabel;
context = LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY; context = LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY;
} }
String overriddenTypeLink = writer.codeText( Content dt = HtmlTree.DT(HtmlTree.STRONG(label));
writer.getLink(new LinkInfoImpl(context, overriddenType))); dl.addContent(dt);
Content overriddenTypeLink = new RawHtml(
writer.getLink(new LinkInfoImpl(context, overriddenType)));
Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink);
String name = method.name(); String name = method.name();
writer.dt(); Content methlink = new RawHtml(writer.getLink(
writer.strongText(label);
writer.dtEnd();
writer.dd();
String methLink = writer.codeText(
writer.getLink(
new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
overriddenType.asClassDoc(), overriddenType.asClassDoc(),
writer.getAnchor(method), name, false) writer.getAnchor(method), name, false)));
)); Content codeMethLink = HtmlTree.CODE(methlink);
writer.printText("doclet.in_class", methLink, overriddenTypeLink); Content dd = HtmlTree.DD(codeMethLink);
writer.ddEnd(); dd.addContent(writer.getSpace());
dd.addContent(writer.getResource("doclet.in_class"));
dd.addContent(writer.getSpace());
dd.addContent(codeOverridenTypeLink);
dl.addContent(dd);
} }
} }
@ -363,61 +342,78 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
} }
} }
protected static void printImplementsInfo(HtmlDocletWriter writer, /**
MethodDoc method) { * {@inheritDoc}
*/
protected static void addImplementsInfo(HtmlDocletWriter writer,
MethodDoc method, Content dl) {
if(writer.configuration.nocomment){ if(writer.configuration.nocomment){
return; return;
} }
ImplementedMethods implementedMethodsFinder = ImplementedMethods implementedMethodsFinder =
new ImplementedMethods(method, writer.configuration); new ImplementedMethods(method, writer.configuration);
MethodDoc[] implementedMethods = implementedMethodsFinder.build(); MethodDoc[] implementedMethods = implementedMethodsFinder.build();
for (int i = 0; i < implementedMethods.length; i++) { for (int i = 0; i < implementedMethods.length; i++) {
MethodDoc implementedMeth = implementedMethods[i]; MethodDoc implementedMeth = implementedMethods[i];
Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth); Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth);
String methlink = ""; Content intfaclink = new RawHtml(writer.getLink(new LinkInfoImpl(
String intfaclink = writer.codeText(
writer.getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac))); LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac)));
writer.dt(); Content codeIntfacLink = HtmlTree.CODE(intfaclink);
writer.strongText("doclet.Specified_By"); Content dt = HtmlTree.DT(HtmlTree.STRONG(writer.specifiedByLabel));
writer.dtEnd(); dl.addContent(dt);
writer.dd(); Content methlink = new RawHtml(writer.getDocLink(
methlink = writer.codeText(writer.getDocLink( LinkInfoImpl.CONTEXT_MEMBER, implementedMeth,
LinkInfoImpl.CONTEXT_MEMBER, implementedMeth, implementedMeth.name(), false));
implementedMeth.name(), false)); Content codeMethLink = HtmlTree.CODE(methlink);
writer.printText("doclet.in_interface", methlink, intfaclink); Content dd = HtmlTree.DD(codeMethLink);
writer.ddEnd(); dd.addContent(writer.getSpace());
dd.addContent(writer.getResource("doclet.in_interface"));
dd.addContent(writer.getSpace());
dd.addContent(codeIntfacLink);
dl.addContent(dd);
} }
} }
protected void printReturnType(MethodDoc method) { /**
* Add the return type.
*
* @param method the method being documented.
* @param htmltree the content tree to which the return type will be added
*/
protected void addReturnType(MethodDoc method, Content htmltree) {
Type type = method.returnType(); Type type = method.returnType();
if (type != null) { if (type != null) {
writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_RETURN_TYPE, Content linkContent = new RawHtml(writer.getLink(
type)); new LinkInfoImpl(LinkInfoImpl.CONTEXT_RETURN_TYPE, type)));
print(' '); htmltree.addContent(linkContent);
htmltree.addContent(writer.getSpace());
} }
} }
protected void printNavSummaryLink(ClassDoc cd, boolean link) { /**
* {@inheritDoc}
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) { if (link) {
writer.printHyperLink("", (cd == null)? return writer.getHyperLink("", (cd == null)?
"method_summary": "method_summary":
"methods_inherited_from_class_" + "methods_inherited_from_class_" +
ConfigurationImpl.getInstance().getClassName(cd), configuration().getClassName(cd),
ConfigurationImpl.getInstance().getText("doclet.navMethod")); writer.getResource("doclet.navMethod"));
} else { } else {
writer.printText("doclet.navMethod"); return writer.getResource("doclet.navMethod");
} }
} }
protected void printNavDetailLink(boolean link) { /**
* {@inheritDoc}
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) { if (link) {
writer.printHyperLink("", "method_detail", liNav.addContent(writer.getHyperLink("", "method_detail",
ConfigurationImpl.getInstance().getText("doclet.navMethod")); writer.getResource("doclet.navMethod")));
} else { } else {
writer.printText("doclet.navMethod"); liNav.addContent(writer.getResource("doclet.navMethod"));
} }
} }
} }

View file

@ -26,8 +26,10 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import java.io.*; import java.io.*;
import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -42,8 +44,6 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
public class NestedClassWriterImpl extends AbstractMemberWriter public class NestedClassWriterImpl extends AbstractMemberWriter
implements MemberSummaryWriter { implements MemberSummaryWriter {
private boolean printedSummaryHeader = false;
public NestedClassWriterImpl(SubWriterHolderWriter writer, public NestedClassWriterImpl(SubWriterHolderWriter writer,
ClassDoc classdoc) { ClassDoc classdoc) {
super(writer, classdoc); super(writer, classdoc);
@ -53,90 +53,17 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
super(writer); super(writer);
} }
/**
* Write the classes summary header for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeMemberSummaryHeader(ClassDoc classDoc) {
printedSummaryHeader = true;
writer.println("<!-- ======== NESTED CLASS SUMMARY ======== -->");
writer.println();
writer.printSummaryHeader(this, classDoc);
}
/**
* Write the classes summary footer for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeMemberSummaryFooter(ClassDoc classDoc) {
writer.printSummaryFooter(this, classDoc);
}
/**
* Write the inherited classes summary header for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
if(! printedSummaryHeader){
//We don't want inherited summary to not be under heading.
writeMemberSummaryHeader(classDoc);
writeMemberSummaryFooter(classDoc);
printedSummaryHeader = true;
}
writer.printInheritedSummaryHeader(this, classDoc);
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeInheritedMemberSummary(ClassDoc classDoc, public Content getMemberSummaryHeader(ClassDoc classDoc,
ProgramElementDoc nestedClass, boolean isFirst, boolean isLast) { Content memberSummaryTree) {
writer.printInheritedSummaryMember(this, classDoc, nestedClass, isFirst); memberSummaryTree.addContent(HtmlConstants.START_OF_NESTED_CLASS_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
writer.addSummaryHeader(this, classDoc, memberTree);
return memberTree;
} }
/**
* Write the inherited classes summary footer for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
writer.printInheritedSummaryFooter(this, classDoc);
writer.println();
}
/**
* Write the header for the nested class documentation.
*
* @param classDoc the class that the classes belong to.
*/
public void writeHeader(ClassDoc classDoc, String header) {
writer.anchor("nested class_detail");
writer.printTableHeadingBackground(header);
}
/**
* Write the nested class header for the given nested class.
*
* @param nestedClass the nested class being documented.
* @param isFirst the flag to indicate whether or not the nested class is the
* first to be documented.
*/
public void writeClassHeader(ClassDoc nestedClass, boolean isFirst) {
if (! isFirst) {
writer.printMemberHeader();
writer.println("");
}
writer.anchor(nestedClass.name());
writer.h3();
writer.print(nestedClass.name());
writer.h3End();
}
/** /**
* Close the writer. * Close the writer.
*/ */
@ -148,17 +75,35 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
return VisibleMemberMap.INNERCLASSES; return VisibleMemberMap.INNERCLASSES;
} }
public void printSummaryLabel() { /**
writer.printText("doclet.Nested_Class_Summary"); * {@inheritDoc}
*/
public void addSummaryLabel(Content memberTree) {
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
writer.getResource("doclet.Nested_Class_Summary"));
memberTree.addContent(label);
} }
public void printTableSummary() { /**
writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary", * {@inheritDoc}
*/
public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Nested_Class_Summary"), configuration().getText("doclet.Nested_Class_Summary"),
configuration().getText("doclet.nested_classes"))); configuration().getText("doclet.nested_classes"));
} }
public void printSummaryTableHeader(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
public String getCaption() {
return configuration().getText("doclet.Nested_Classes");
}
/**
* {@inheritDoc}
*/
public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header; String[] header;
if (member.isInterface()) { if (member.isInterface()) {
header = new String[] { header = new String[] {
@ -176,92 +121,95 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
configuration().getText("doclet.Description")) configuration().getText("doclet.Description"))
}; };
} }
writer.summaryTableHeader(header, "col"); return header;
} }
public void printSummaryAnchor(ClassDoc cd) { /**
writer.anchor("nested_class_summary"); * {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
memberTree.addContent(writer.getMarkerAnchor("nested_class_summary"));
} }
public void printInheritedSummaryAnchor(ClassDoc cd) { /**
writer.anchor("nested_classes_inherited_from_class_" + * {@inheritDoc}
cd.qualifiedName()); */
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor(
"nested_classes_inherited_from_class_" + cd.qualifiedName()));
} }
public void printInheritedSummaryLabel(ClassDoc cd) { /**
String clslink = writer.getPreQualifiedClassLink( * {@inheritDoc}
LinkInfoImpl.CONTEXT_MEMBER, cd, false); */
writer.strong(); public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
writer.printText(cd.isInterface() ? Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
"doclet.Nested_Classes_Interface_Inherited_From_Interface" : LinkInfoImpl.CONTEXT_MEMBER, cd, false));
"doclet.Nested_Classes_Interfaces_Inherited_From_Class", Content label = new StringContent(cd.isInterface() ?
clslink); configuration().getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") :
writer.strongEnd(); configuration().getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
label);
labelHeading.addContent(writer.getSpace());
labelHeading.addContent(classLink);
inheritedTree.addContent(labelHeading);
} }
protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) { /**
writer.strong(); * {@inheritDoc}
writer.printLink(new LinkInfoImpl(context, (ClassDoc)member, false)); */
writer.strongEnd(); protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) {
Content strong = HtmlTree.STRONG(new RawHtml(
writer.getLink(new LinkInfoImpl(context, (ClassDoc)member, false))));
Content code = HtmlTree.CODE(strong);
tdSummary.addContent(code);
} }
protected void writeInheritedSummaryLink(ClassDoc cd, /**
ProgramElementDoc member) { * {@inheritDoc}
writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, */
(ClassDoc)member, false)); protected void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member, Content linksTree) {
linksTree.addContent(new RawHtml(
writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
(ClassDoc)member, false))));
} }
protected void printSummaryType(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
protected void addSummaryType(ProgramElementDoc member,
Content tdSummaryType) {
ClassDoc cd = (ClassDoc)member; ClassDoc cd = (ClassDoc)member;
printModifierAndType(cd, null); addModifierAndType(cd, null, tdSummaryType);
} }
protected void printHeader(ClassDoc cd) { /**
// N.A. * {@inheritDoc}
*/
protected Content getDeprecatedLink(ProgramElementDoc member) {
return writer.getQualifiedClassLink(LinkInfoImpl.CONTEXT_MEMBER,
(ClassDoc)member);
} }
protected void printBodyHtmlEnd(ClassDoc cd) { /**
// N.A. * {@inheritDoc}
} */
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
protected void printMember(ProgramElementDoc member) {
// N.A.
}
protected void writeDeprecatedLink(ProgramElementDoc member) {
writer.printQualifiedClassLink(LinkInfoImpl.CONTEXT_MEMBER,
(ClassDoc)member);
}
protected void printNavSummaryLink(ClassDoc cd, boolean link) {
if (link) { if (link) {
writer.printHyperLink("", (cd == null) ? "nested_class_summary": return writer.getHyperLink("", (cd == null) ? "nested_class_summary":
"nested_classes_inherited_from_class_" + "nested_classes_inherited_from_class_" +
cd.qualifiedName(), cd.qualifiedName(),
ConfigurationImpl.getInstance().getText("doclet.navNested")); writer.getResource("doclet.navNested"));
} else { } else {
writer.printText("doclet.navNested"); return writer.getResource("doclet.navNested");
} }
} }
protected void printNavDetailLink(boolean link) { /**
} * {@inheritDoc}
*/
protected void printMemberLink(ProgramElementDoc member) { protected void addNavDetailLink(boolean link, Content liNav) {
}
protected void printMembersSummaryLink(ClassDoc cd, ClassDoc icd,
boolean link) {
if (link) {
writer.printHyperLink(cd.name() + ".html",
(cd == icd)?
"nested_class_summary":
"nested_classes_inherited_from_class_" +
icd.qualifiedName(),
ConfigurationImpl.getInstance().getText(
"doclet.Nested_Class_Summary"));
} else {
writer.printText("doclet.Nested_Class_Summary");
}
} }
} }

View file

@ -25,18 +25,20 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Class to generate file for each package contents in the left-hand bottom * Class to generate file for each package contents in the left-hand bottom
* frame. This will list all the Class Kinds in the package. A click on any * frame. This will list all the Class Kinds in the package. A click on any
* class-kind will update the right-hand frame with the clicked class-kind page. * class-kind will update the right-hand frame with the clicked class-kind page.
* *
* @author Atul M Dambalkar * @author Atul M Dambalkar
* @author Bhavesh Patel (Modified)
*/ */
public class PackageFrameWriter extends HtmlDocletWriter { public class PackageFrameWriter extends HtmlDocletWriter {
@ -85,132 +87,107 @@ public class PackageFrameWriter extends HtmlDocletWriter {
* @param packageDoc The package for which "pacakge-frame.html" is to be generated. * @param packageDoc The package for which "pacakge-frame.html" is to be generated.
*/ */
public static void generate(ConfigurationImpl configuration, public static void generate(ConfigurationImpl configuration,
PackageDoc packageDoc) { PackageDoc packageDoc) {
PackageFrameWriter packgen; PackageFrameWriter packgen;
try { try {
packgen = new PackageFrameWriter(configuration, packageDoc); packgen = new PackageFrameWriter(configuration, packageDoc);
String pkgName = Util.getPackageName(packageDoc); String pkgName = Util.getPackageName(packageDoc);
packgen.printHtmlHeader(pkgName, configuration.metakeywords.getMetaKeywords(packageDoc), false); Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
packgen.printPackageHeader(pkgName); Content pkgNameContent = new StringContent(pkgName);
packgen.generateClassListing(); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
packgen.printBodyHtmlEnd(); packgen.getTargetPackageLink(packageDoc, "classFrame", pkgNameContent));
body.addContent(heading);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.indexContainer);
packgen.addClassListing(div);
body.addContent(div);
packgen.printHtmlDocument(
configuration.metakeywords.getMetaKeywords(packageDoc), false, body);
packgen.close(); packgen.close();
} catch (IOException exc) { } catch (IOException exc) {
configuration.standardmessage.error( configuration.standardmessage.error(
"doclet.exception_encountered", "doclet.exception_encountered",
exc.toString(), OUTPUT_FILE_NAME); exc.toString(), OUTPUT_FILE_NAME);
throw new DocletAbortException(); throw new DocletAbortException();
} }
} }
/** /**
* Generate class listing for all the classes in this package. Divide class * Add class listing for all the classes in this package. Divide class
* listing as per the class kind and generate separate listing for * listing as per the class kind and generate separate listing for
* Classes, Interfaces, Exceptions and Errors. * Classes, Interfaces, Exceptions and Errors.
*
* @param contentTree the content tree to which the listing will be added
*/ */
protected void generateClassListing() { protected void addClassListing(Content contentTree) {
Configuration config = configuration(); Configuration config = configuration();
if (packageDoc.isIncluded()) { if (packageDoc.isIncluded()) {
generateClassKindListing(packageDoc.interfaces(), addClassKindListing(packageDoc.interfaces(),
configuration.getText("doclet.Interfaces")); getResource("doclet.Interfaces"), contentTree);
generateClassKindListing(packageDoc.ordinaryClasses(), addClassKindListing(packageDoc.ordinaryClasses(),
configuration.getText("doclet.Classes")); getResource("doclet.Classes"), contentTree);
generateClassKindListing(packageDoc.enums(), addClassKindListing(packageDoc.enums(),
configuration.getText("doclet.Enums")); getResource("doclet.Enums"), contentTree);
generateClassKindListing(packageDoc.exceptions(), addClassKindListing(packageDoc.exceptions(),
configuration.getText("doclet.Exceptions")); getResource("doclet.Exceptions"), contentTree);
generateClassKindListing(packageDoc.errors(), addClassKindListing(packageDoc.errors(),
configuration.getText("doclet.Errors")); getResource("doclet.Errors"), contentTree);
generateClassKindListing(packageDoc.annotationTypes(), addClassKindListing(packageDoc.annotationTypes(),
configuration.getText("doclet.AnnotationTypes")); getResource("doclet.AnnotationTypes"), contentTree);
} else { } else {
String name = Util.getPackageName(packageDoc); String name = Util.getPackageName(packageDoc);
generateClassKindListing(config.classDocCatalog.interfaces(name), addClassKindListing(config.classDocCatalog.interfaces(name),
configuration.getText("doclet.Interfaces")); getResource("doclet.Interfaces"), contentTree);
generateClassKindListing(config.classDocCatalog.ordinaryClasses(name), addClassKindListing(config.classDocCatalog.ordinaryClasses(name),
configuration.getText("doclet.Classes")); getResource("doclet.Classes"), contentTree);
generateClassKindListing(config.classDocCatalog.enums(name), addClassKindListing(config.classDocCatalog.enums(name),
configuration.getText("doclet.Enums")); getResource("doclet.Enums"), contentTree);
generateClassKindListing(config.classDocCatalog.exceptions(name), addClassKindListing(config.classDocCatalog.exceptions(name),
configuration.getText("doclet.Exceptions")); getResource("doclet.Exceptions"), contentTree);
generateClassKindListing(config.classDocCatalog.errors(name), addClassKindListing(config.classDocCatalog.errors(name),
configuration.getText("doclet.Errors")); getResource("doclet.Errors"), contentTree);
generateClassKindListing(config.classDocCatalog.annotationTypes(name), addClassKindListing(config.classDocCatalog.annotationTypes(name),
configuration.getText("doclet.AnnotationTypes")); getResource("doclet.AnnotationTypes"), contentTree);
} }
} }
/** /**
* Generate specific class kind listing. Also add label to the listing. * Add specific class kind listing. Also add label to the listing.
* *
* @param arr Array of specific class kinds, namely Class or Interface or * @param arr Array of specific class kinds, namely Class or Interface or Exception or Error
* Exception or Error. * @param labelContent content tree of the label to be added
* @param label Label for the listing * @param contentTree the content tree to which the class kind listing will be added
*/ */
protected void generateClassKindListing(ClassDoc[] arr, String label) { protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
Content contentTree) {
if(arr.length > 0) { if(arr.length > 0) {
Arrays.sort(arr); Arrays.sort(arr);
printPackageTableHeader();
fontSizeStyle("+1", "FrameHeadingFont");
boolean printedHeader = false; boolean printedHeader = false;
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addAttr(HtmlAttr.TITLE, labelContent.toString());
for (int i = 0; i < arr.length; i++) { for (int i = 0; i < arr.length; i++) {
if (documentedClasses != null && if (documentedClasses != null &&
!documentedClasses.contains(arr[i])) { !documentedClasses.contains(arr[i])) {
continue; continue;
} }
if (!Util.isCoreClass(arr[i]) || ! if (!Util.isCoreClass(arr[i]) || !
configuration.isGeneratedDoc(arr[i])) { configuration.isGeneratedDoc(arr[i])) {
continue; continue;
} }
if (!printedHeader) { if (!printedHeader) {
print(label); Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
fontEnd(); true, labelContent);
println("&nbsp;"); contentTree.addContent(heading);
fontStyle("FrameItemFont");
printedHeader = true; printedHeader = true;
} }
br(); Content link = new RawHtml (getLink(new LinkInfoImpl(
printLink(new LinkInfoImpl( LinkInfoImpl.PACKAGE_FRAME, arr[i],
LinkInfoImpl.PACKAGE_FRAME, (arr[i].isInterface() ? italicsText(arr[i].name()) :
arr[i], arr[i].name()),"classFrame")));
(arr[i].isInterface() ? Content li = HtmlTree.LI(link);
italicsText(arr[i].name()) : ul.addContent(li);
arr[i].name()),"classFrame")
);
} }
fontEnd(); contentTree.addContent(ul);
printPackageTableFooter();
println();
} }
} }
/**
* Print the package link at the top of the class kind listing. Clicking
* this link, package-summary page will appear in the right hand frame.
*
* @param heading Top Heading to be used for the class kind listing.
*/
protected void printPackageHeader(String heading) {
fontSizeStyle("+1", "FrameTitleFont");
printTargetPackageLink(packageDoc, "classFrame", heading);
fontEnd();
}
/**
* The table for the class kind listing.
*/
protected void printPackageTableHeader() {
table();
tr();
tdNowrap();
}
/**
* Closing Html tags for table of class kind listing.
*/
protected void printPackageTableFooter() {
tdEnd();
trEnd();
tableEnd();
}
} }

View file

@ -25,10 +25,11 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Generate the package index for the left-hand frame in the generated output. * Generate the package index for the left-hand frame in the generated output.
@ -58,7 +59,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
String filename = "overview-frame.html"; String filename = "overview-frame.html";
try { try {
packgen = new PackageIndexFrameWriter(configuration, filename); packgen = new PackageIndexFrameWriter(configuration, filename);
packgen.generatePackageIndexFile("doclet.Window_Overview", false); packgen.buildPackageIndexFile("doclet.Window_Overview", false);
packgen.close(); packgen.close();
} catch (IOException exc) { } catch (IOException exc) {
configuration.standardmessage.error( configuration.standardmessage.error(
@ -69,114 +70,86 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
} }
/** /**
* Print each package name on separate rows. * {@inheritDoc}
*
* @param pd PackageDoc
*/ */
protected void printIndexRow(PackageDoc pd) { protected void addPackagesList(PackageDoc[] packages, String text,
fontStyle("FrameItemFont"); String tableSummary, Content body) {
if (pd.name().length() > 0) { Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
print(getHyperLink(pathString(pd, "package-frame.html"), "", packagesLabel);
pd.name(), false, "", "", "packageFrame")); Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
} else { HtmlTree ul = new HtmlTree(HtmlTag.UL);
print(getHyperLink("package-frame.html", "", "&lt;unnamed package>", ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString());
false, "", "", "packageFrame")); for(int i = 0; i < packages.length; i++) {
if (packages[i] != null) {
ul.addContent(getPackage(packages[i]));
}
} }
fontEnd(); div.addContent(ul);
br(); body.addContent(div);
} }
/** /**
* Print the "-packagesheader" string in strong format, at top of the page, * Gets each package name as a separate link.
* if it is not the empty string. Otherwise print the "-header" string. *
* Despite the name, there is actually no navigation bar for this page. * @param pd PackageDoc
* @return content for the package link
*/ */
protected void printNavigationBarHeader() { protected Content getPackage(PackageDoc pd) {
printTableHeader(true); Content packageLinkContent;
fontSizeStyle("+1", "FrameTitleFont"); Content packageLabel;
if (configuration.packagesheader.length() > 0) { if (pd.name().length() > 0) {
strong(replaceDocRootDir(configuration.packagesheader)); packageLabel = getPackageLabel(pd.name());
packageLinkContent = getHyperLink(pathString(pd,
"package-frame.html"), "", packageLabel, "",
"packageFrame");
} else { } else {
strong(replaceDocRootDir(configuration.header)); packageLabel = new RawHtml("&lt;unnamed package&gt;");
packageLinkContent = getHyperLink("package-frame.html",
"", packageLabel, "", "packageFrame");
} }
fontEnd(); Content li = HtmlTree.LI(packageLinkContent);
printTableFooter(true); return li;
}
/**
* {@inheritDoc}
*/
protected void addNavigationBarHeader(Content body) {
Content headerContent;
if (configuration.packagesheader.length() > 0) {
headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
} else {
headerContent = new RawHtml(replaceDocRootDir(configuration.header));
}
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
HtmlStyle.bar, headerContent);
body.addContent(heading);
} }
/** /**
* Do nothing as there is no overview information in this page. * Do nothing as there is no overview information in this page.
*/ */
protected void printOverviewHeader() { protected void addOverviewHeader(Content body) {
} }
/** /**
* Print Html "table" tag for the package index format. * Adds "All Classes" link for the top of the left-hand frame page to the
* documentation tree.
* *
* @param text Text string will not be used in this method. * @param body the Content object to which the all classes link should be added
*/ */
protected void printIndexHeader(String text, String tableSummary) { protected void addAllClassesLink(Content body) {
printTableHeader(false); Content linkContent = getHyperLink("allclasses-frame.html", "",
allclassesLabel, "", "packageFrame");
Content div = HtmlTree.DIV(HtmlStyle.indexHeader, linkContent);
body.addContent(div);
} }
/** /**
* Print Html closing "table" tag at the end of the package index. * {@inheritDoc}
*/ */
protected void printIndexFooter() { protected void addNavigationBarFooter(Content body) {
printTableFooter(false); Content p = HtmlTree.P(getSpace());
} body.addContent(p);
/**
* Print "All Classes" link at the top of the left-hand frame page.
*/
protected void printAllClassesPackagesLink() {
fontStyle("FrameItemFont");
print(getHyperLink("allclasses-frame.html", "",
configuration.getText("doclet.All_Classes"), false, "", "",
"packageFrame"));
fontEnd();
p();
fontSizeStyle("+1", "FrameHeadingFont");
printText("doclet.Packages");
fontEnd();
br();
}
/**
* Just print some space, since there is no navigation bar for this page.
*/
protected void printNavigationBarFooter() {
p();
space();
}
/**
* Print Html closing tags for the table for package index.
*
* @param isHeading true if this is a table for a heading.
*/
private void printTableFooter(boolean isHeading) {
if (isHeading) {
thEnd();
} else {
tdEnd();
}
trEnd();
tableEnd();
}
/**
* Print Html tags for the table for package index.
*
* @param isHeading true if this is a table for a heading.
*/
private void printTableHeader(boolean isHeading) {
table();
tr();
if (isHeading) {
thAlignNowrap("left");
} else {
tdNowrap();
}
} }
} }

View file

@ -25,10 +25,12 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Generate the package index page "overview-summary.html" for the right-hand * Generate the package index page "overview-summary.html" for the right-hand
@ -83,7 +85,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
String filename = "overview-summary.html"; String filename = "overview-summary.html";
try { try {
packgen = new PackageIndexWriter(configuration, filename); packgen = new PackageIndexWriter(configuration, filename);
packgen.generatePackageIndexFile("doclet.Window_Overview_Summary", true); packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
packgen.close(); packgen.close();
} catch (IOException exc) { } catch (IOException exc) {
configuration.standardmessage.error( configuration.standardmessage.error(
@ -94,124 +96,140 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
} }
/** /**
* Print each package in separate rows in the index table. Generate link * Depending upon the grouping information and their titles, add
* to each package.
*
* @param pkg Package to which link is to be generated.
*/
protected void printIndexRow(PackageDoc pkg) {
if(pkg != null && pkg.name().length() > 0) {
trBgcolorStyle("white", "TableRowColor");
summaryRow(20);
strong();
printPackageLink(pkg, Util.getPackageName(pkg), false);
strongEnd();
summaryRowEnd();
summaryRow(0);
printSummaryComment(pkg);
summaryRowEnd();
trEnd();
}
}
/**
* Depending upon the grouping information and their titles, generate
* separate table indices for each package group. * separate table indices for each package group.
*
* @param body the documentation tree to which the index will be added
*/ */
protected void generateIndex() { protected void addIndex(Content body) {
for (int i = 0; i < groupList.size(); i++) { for (int i = 0; i < groupList.size(); i++) {
String groupname = groupList.get(i); String groupname = groupList.get(i);
List<PackageDoc> list = groupPackageMap.get(groupname); List<PackageDoc> list = groupPackageMap.get(groupname);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
printIndexContents(list.toArray(new PackageDoc[list.size()]), addIndexContents(list.toArray(new PackageDoc[list.size()]),
groupname, groupname, configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Member_Table_Summary", groupname, configuration.getText("doclet.packages")), body);
groupname,
configuration.getText("doclet.packages")));
} }
} }
} }
/** /**
* Print the overview summary comment for this documentation. Print one line * {@inheritDoc}
*/
protected void addPackagesList(PackageDoc[] packages, String text,
String tableSummary, Content body) {
Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
getTableCaption(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);
}
/**
* Adds list of packages in the index table. Generate link to each package.
*
* @param packages Packages to which link is to be generated
* @param tbody the documentation tree to which the list will be added
*/
protected void addPackagesList(PackageDoc[] packages, Content tbody) {
for (int i = 0; i < packages.length; i++) {
if (packages[i] != null && packages[i].name().length() > 0) {
Content packageLinkContent = getPackageLink(packages[i],
getPackageName(packages[i]));
Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
tdSummary.addStyle(HtmlStyle.colLast);
addSummaryComment(packages[i], tdSummary);
HtmlTree tr = HtmlTree.TR(tdPackage);
tr.addContent(tdSummary);
if (i%2 == 0)
tr.addStyle(HtmlStyle.altColor);
else
tr.addStyle(HtmlStyle.rowColor);
tbody.addContent(tr);
}
}
}
/**
* Adds the overview summary comment for this documentation. Add one line
* summary at the top of the page and generate a link to the description, * summary at the top of the page and generate a link to the description,
* which is generated at the end of this page. * which is added at the end of this page.
*
* @param body the documentation tree to which the overview header will be added
*/ */
protected void printOverviewHeader() { protected void addOverviewHeader(Content body) {
if (root.inlineTags().length > 0) { if (root.inlineTags().length > 0) {
printSummaryComment(root); HtmlTree p = new HtmlTree(HtmlTag.P);
p(); p.addStyle(HtmlStyle.subTitle);
strong(configuration.getText("doclet.See")); addSummaryComment(root, p);
br(); Content div = HtmlTree.DIV(HtmlStyle.header, p);
printNbsps(); Content see = seeLabel;
printHyperLink("", "overview_description", see.addContent(" ");
configuration.getText("doclet.Description"), true); Content descPara = HtmlTree.P(see);
p(); Content descLink = getHyperLink("", "overview_description",
descriptionLabel, "", "");
descPara.addContent(descLink);
div.addContent(descPara);
body.addContent(div);
} }
} }
/** /**
* Print Html tags for the table for this package index. * Adds the overview comment as provided in the file specified by the
*/
protected void printIndexHeader(String text, String tableSummary) {
tableIndexSummary(tableSummary);
tableCaptionStart();
print(text);
tableCaptionEnd();
summaryTableHeader(packageTableHeader, "col");
}
/**
* Print Html closing tags for the table for this package index.
*/
protected void printIndexFooter() {
tableEnd();
p();
space();
}
/**
* Print the overview comment as provided in the file specified by the
* "-overview" option on the command line. * "-overview" option on the command line.
*
* @param htmltree the documentation tree to which the overview comment will
* be added
*/ */
protected void printOverviewComment() { protected void addOverviewComment(Content htmltree) {
if (root.inlineTags().length > 0) { if (root.inlineTags().length > 0) {
anchor("overview_description"); htmltree.addContent(getMarkerAnchor("overview_description"));
p(); HtmlTree p = new HtmlTree(HtmlTag.P);
printInlineComment(root); p.addStyle(HtmlStyle.subTitle);
p(); addInlineComment(root, p);
htmltree.addContent(p);
} }
} }
/** /**
* Call {@link #printOverviewComment()} and then genrate the tag information * Adds the tag information as provided in the file specified by the
* as provided in the file specified by the "-overview" option on the * "-overview" option on the command line.
* command line. *
* @param body the documentation tree to which the overview will be added
*/ */
protected void printOverview() throws IOException { protected void addOverview(Content body) throws IOException {
printOverviewComment(); HtmlTree div = new HtmlTree(HtmlTag.DIV);
printTags(root); div.addStyle(HtmlStyle.footer);
addOverviewComment(div);
addTagsInfo(root, div);
body.addContent(div);
} }
/** /**
* Print the top text (from the -top option), the upper * Adds the top text (from the -top option), the upper
* navigation bar, and then the title (from the"-title" * navigation bar, and then the title (from the"-title"
* option), at the top of page. * option), at the top of page.
*
* @body the documentation tree to which the navigation bar header will be added
*/ */
protected void printNavigationBarHeader() { protected void addNavigationBarHeader(Content body) {
printTop(); addTop(body);
navLinks(true); addNavLinks(true, body);
hr(); addConfigurationTitle(body);
printConfigurationTitle();
} }
/** /**
* Print the lower navigation bar and the bottom text * Adds the lower navigation bar and the bottom text
* (from the -bottom option) at the bottom of page. * (from the -bottom option) at the bottom of page.
*
* @param the documentation tree to which the navigation bar footer will be added
*/ */
protected void printNavigationBarFooter() { protected void addNavigationBarFooter(Content body) {
hr(); addNavLinks(false, body);
navLinks(false); addBottom(body);
printBottom();
} }
} }

View file

@ -29,12 +29,15 @@ import java.io.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
* Class to generate Tree page for a package. The name of the file generated is * Class to generate Tree page for a package. The name of the file generated is
* "package-tree.html" and it is generated in the respective package directory. * "package-tree.html" and it is generated in the respective package directory.
* *
* @author Atul M Dambalkar * @author Atul M Dambalkar
* @author Bhavesh Patel (Modified)
*/ */
public class PackageTreeWriter extends AbstractTreeWriter { public class PackageTreeWriter extends AbstractTreeWriter {
@ -107,94 +110,96 @@ public class PackageTreeWriter extends AbstractTreeWriter {
* Generate a separate tree file for each package. * Generate a separate tree file for each package.
*/ */
protected void generatePackageTreeFile() throws IOException { protected void generatePackageTreeFile() throws IOException {
printHtmlHeader(packagedoc.name() + " " Content body = getPackageTreeHeader();
+ configuration.getText("doclet.Window_Class_Hierarchy"), null, true); Content headContent = getResource("doclet.Hierarchy_For_Package",
Util.getPackageName(packagedoc));
printPackageTreeHeader(); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
if (configuration.packages.length > 1) { if (configuration.packages.length > 1) {
printLinkToMainTree(); addLinkToMainTree(div);
} }
body.addContent(div);
generateTree(classtree.baseclasses(), "doclet.Class_Hierarchy"); HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
generateTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy"); divTree.addStyle(HtmlStyle.contentContainer);
generateTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy"); addTree(classtree.baseclasses(), "doclet.Class_Hierarchy", divTree);
generateTree(classtree.baseEnums(), "doclet.Enum_Hierarchy"); addTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy", divTree);
addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", divTree);
printPackageTreeFooter(); addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", divTree);
printBottom(); body.addContent(divTree);
printBodyHtmlEnd(); addNavLinks(false, body);
addBottom(body);
printHtmlDocument(null, true, body);
} }
/** /**
* Print the navigation bar header for the package tree file. * Get the package tree header.
*
* @return a content tree for the header
*/ */
protected void printPackageTreeHeader() { protected Content getPackageTreeHeader() {
printTop(); String title = packagedoc.name() + " " +
navLinks(true); configuration.getText("doclet.Window_Class_Hierarchy");
hr(); Content bodyTree = getBody(true, getWindowTitle(title));
center(); addTop(bodyTree);
h2(configuration.getText("doclet.Hierarchy_For_Package", addNavLinks(true, bodyTree);
Util.getPackageName(packagedoc))); return bodyTree;
centerEnd();
} }
/** /**
* Generate a link to the tree for all the packages. * Add a link to the tree for all the packages.
*
* @param div the content tree to which the link will be added
*/ */
protected void printLinkToMainTree() { protected void addLinkToMainTree(Content div) {
dl(); Content span = HtmlTree.SPAN(HtmlStyle.strong,
dt(); getResource("doclet.Package_Hierarchies"));
strongText("doclet.Package_Hierarchies"); div.addContent(span);
dtEnd(); HtmlTree ul = new HtmlTree (HtmlTag.UL);
dd(); ul.addStyle(HtmlStyle.horizontal);
navLinkMainTree(configuration.getText("doclet.All_Packages")); ul.addContent(getNavLinkMainTree(configuration.getText("doclet.All_Packages")));
ddEnd(); div.addContent(ul);
dlEnd();
hr();
} }
/** /**
* Print the navigation bar footer for the package tree file. * Get link for the previous package tree file.
*
* @return a content tree for the link
*/ */
protected void printPackageTreeFooter() { protected Content getNavLinkPrevious() {
hr();
navLinks(false);
}
/**
* Link for the previous package tree file.
*/
protected void navLinkPrevious() {
if (prev == null) { if (prev == null) {
navLinkPrevious(null); return getNavLinkPrevious(null);
} else { } else {
String path = DirectoryManager.getRelativePath(packagedoc.name(), String path = DirectoryManager.getRelativePath(packagedoc.name(),
prev.name()); prev.name());
navLinkPrevious(path + "package-tree.html"); return getNavLinkPrevious(path + "package-tree.html");
} }
} }
/** /**
* Link for the next package tree file. * Get link for the next package tree file.
*
* @return a content tree for the link
*/ */
protected void navLinkNext() { protected Content getNavLinkNext() {
if (next == null) { if (next == null) {
navLinkNext(null); return getNavLinkNext(null);
} else { } else {
String path = DirectoryManager.getRelativePath(packagedoc.name(), String path = DirectoryManager.getRelativePath(packagedoc.name(),
next.name()); next.name());
navLinkNext(path + "package-tree.html"); return getNavLinkNext(path + "package-tree.html");
} }
} }
/** /**
* Link to the package summary page for the package of this tree. * Get link to the package summary page for the package of this tree.
*
* @return a content tree for the package link
*/ */
protected void navLinkPackage() { protected Content getNavLinkPackage() {
navCellStart(); Content linkContent = getHyperLink("package-summary.html", "",
printHyperLink("package-summary.html", "", configuration.getText("doclet.Package"), packageLabel);
true, "NavBarFont1"); Content li = HtmlTree.LI(linkContent);
navCellEnd(); return li;
} }
} }

View file

@ -25,10 +25,12 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
* Generate package usage information. * Generate package usage information.
@ -106,49 +108,74 @@ public class PackageUseWriter extends SubWriterHolderWriter {
/** /**
* Print the class use list. * Generate the package use list.
*/ */
protected void generatePackageUseFile() throws IOException { protected void generatePackageUseFile() throws IOException {
printPackageUseHeader(); Content body = getPackageUseHeader();
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.contentContainer);
if (usingPackageToUsedClasses.isEmpty()) { if (usingPackageToUsedClasses.isEmpty()) {
printText("doclet.ClassUse_No.usage.of.0", pkgdoc.name()); div.addContent(getResource(
p(); "doclet.ClassUse_No.usage.of.0", pkgdoc.name()));
} else { } else {
generatePackageUse(); addPackageUse(div);
} }
body.addContent(div);
printPackageUseFooter(); addNavLinks(false, body);
addBottom(body);
printHtmlDocument(null, true, body);
} }
/** /**
* Print the class use list. * Add the package use information.
*
* @param contentTree the content tree to which the package use information will be added
*/ */
protected void generatePackageUse() throws IOException { protected void addPackageUse(Content contentTree) throws IOException {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
if (configuration.packages.length > 1) { if (configuration.packages.length > 1) {
generatePackageList(); addPackageList(ul);
} }
generateClassList(); addClassList(ul);
contentTree.addContent(ul);
} }
protected void generatePackageList() throws IOException { /**
tableIndexSummary(useTableSummary); * Add the list of packages that use the given package.
tableCaptionStart(); *
printText("doclet.ClassUse_Packages.that.use.0", * @param contentTree the content tree to which the package list will be added
getPackageLink(pkgdoc, Util.getPackageName(pkgdoc), false)); */
tableCaptionEnd(); protected void addPackageList(Content contentTree) throws IOException {
summaryTableHeader(packageTableHeader, "col"); Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
getTableCaption(configuration().getText(
"doclet.ClassUse_Packages.that.use.0",
getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false))));
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<String> it = usingPackageToUsedClasses.keySet().iterator(); Iterator<String> it = usingPackageToUsedClasses.keySet().iterator();
while (it.hasNext()) { for (int i = 0; it.hasNext(); i++) {
PackageDoc pkg = configuration.root.packageNamed(it.next()); PackageDoc pkg = configuration.root.packageNamed(it.next());
generatePackageUse(pkg); HtmlTree tr = new HtmlTree(HtmlTag.TR);
if (i % 2 == 0) {
tr.addStyle(HtmlStyle.altColor);
} else {
tr.addStyle(HtmlStyle.rowColor);
}
addPackageUse(pkg, tr);
tbody.addContent(tr);
} }
tableEnd(); table.addContent(tbody);
space(); Content li = HtmlTree.LI(HtmlStyle.blockList, table);
p(); contentTree.addContent(li);
} }
protected void generateClassList() throws IOException { /**
* Add the list of classes that use the given package.
*
* @param contentTree the content tree to which the class list will be added
*/
protected void addClassList(Content contentTree) throws IOException {
String[] classTableHeader = new String[] { String[] classTableHeader = new String[] {
configuration.getText("doclet.0_and_1", configuration.getText("doclet.0_and_1",
configuration.getText("doclet.Class"), configuration.getText("doclet.Class"),
@ -158,117 +185,126 @@ public class PackageUseWriter extends SubWriterHolderWriter {
while (itp.hasNext()) { while (itp.hasNext()) {
String packageName = itp.next(); String packageName = itp.next();
PackageDoc usingPackage = configuration.root.packageNamed(packageName); PackageDoc usingPackage = configuration.root.packageNamed(packageName);
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addStyle(HtmlStyle.blockList);
if (usingPackage != null) { if (usingPackage != null) {
anchor(usingPackage.name()); li.addContent(getMarkerAnchor(usingPackage.name()));
} }
tableIndexSummary(configuration.getText("doclet.Use_Table_Summary", String tableSummary = configuration.getText("doclet.Use_Table_Summary",
configuration.getText("doclet.classes"))); configuration.getText("doclet.classes"));
tableCaptionStart(); Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
printText("doclet.ClassUse_Classes.in.0.used.by.1", getTableCaption(configuration().getText(
getPackageLink(pkgdoc, Util.getPackageName(pkgdoc), false), "doclet.ClassUse_Classes.in.0.used.by.1",
getPackageLink(usingPackage,Util.getPackageName(usingPackage), false)); getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false),
tableCaptionEnd(); getPackageLinkString(usingPackage,Util.getPackageName(usingPackage), false))));
summaryTableHeader(classTableHeader, "col"); table.addContent(getSummaryTableHeader(classTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<ClassDoc> itc = Iterator<ClassDoc> itc =
usingPackageToUsedClasses.get(packageName).iterator(); usingPackageToUsedClasses.get(packageName).iterator();
while (itc.hasNext()) { for (int i = 0; itc.hasNext(); i++) {
printClassRow(itc.next(), packageName); HtmlTree tr = new HtmlTree(HtmlTag.TR);
if (i % 2 == 0) {
tr.addStyle(HtmlStyle.altColor);
} else {
tr.addStyle(HtmlStyle.rowColor);
}
addClassRow(itc.next(), packageName, tr);
tbody.addContent(tr);
} }
tableEnd(); table.addContent(tbody);
space(); li.addContent(table);
p(); contentTree.addContent(li);
} }
} }
protected void printClassRow(ClassDoc usedClass, String packageName) { /**
* Add a row for the class that uses the given package.
*
* @param usedClass the class that uses the given package
* @param packageName the name of the package to which the class belongs
* @param contentTree the content tree to which the row will be added
*/
protected void addClassRow(ClassDoc usedClass, String packageName,
Content contentTree) {
String path = pathString(usedClass, String path = pathString(usedClass,
"class-use/" + usedClass.name() + ".html"); "class-use/" + usedClass.name() + ".html");
Content td = HtmlTree.TD(HtmlStyle.colOne,
trBgcolorStyle("white", "TableRowColor"); getHyperLink(path, packageName, new StringContent(usedClass.name())));
summaryRow(0); addIndexComment(usedClass, td);
strong(); contentTree.addContent(td);
printHyperLink(path, packageName, usedClass.name(), true);
strongEnd();
println(); br();
printNbsps();
printIndexComment(usedClass);
summaryRowEnd();
trEnd();
} }
/** /**
* Print the package use list. * Add the package use information.
*
* @param pkg the package that used the given package
* @param contentTree the content tree to which the information will be added
*/ */
protected void generatePackageUse(PackageDoc pkg) throws IOException { protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
trBgcolorStyle("white", "TableRowColor"); Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
summaryRow(0); getHyperLink("", pkg.name(), new StringContent(Util.getPackageName(pkg))));
//Just want an anchor here. contentTree.addContent(tdFirst);
printHyperLink("", pkg.name(), Util.getPackageName(pkg), true); HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
summaryRowEnd(); tdLast.addStyle(HtmlStyle.colLast);
summaryRow(0); if (pkg != null)
if (pkg != null) { addSummaryComment(pkg, tdLast);
printSummaryComment(pkg); else
} tdLast.addContent(getSpace());
space(); contentTree.addContent(tdLast);
summaryRowEnd();
trEnd();
} }
/** /**
* Print the header for the class use Listing. * Get the header for the package use listing.
*
* @return a content tree representing the package use header
*/ */
protected void printPackageUseHeader() { protected Content getPackageUseHeader() {
String packageLabel = configuration.getText("doclet.Package"); String packageText = configuration.getText("doclet.Package");
String name = pkgdoc.name(); String name = pkgdoc.name();
printHtmlHeader(configuration.getText("doclet.Window_ClassUse_Header", String title = configuration.getText("doclet.Window_ClassUse_Header",
packageLabel, name), null, true); packageText, name);
printTop(); Content bodyTree = getBody(true, getWindowTitle(title));
navLinks(true); addTop(bodyTree);
hr(); addNavLinks(true, bodyTree);
center(); Content headContent = getResource("doclet.ClassUse_Title", packageText, name);
h2(); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
strongText("doclet.ClassUse_Title", packageLabel, name); HtmlStyle.title, headContent);
h2End(); Content div = HtmlTree.DIV(HtmlStyle.header, heading);
centerEnd(); bodyTree.addContent(div);
return bodyTree;
} }
/** /**
* Print the footer for the class use Listing. * Get this package link.
*
* @return a content tree for the package link
*/ */
protected void printPackageUseFooter() { protected Content getNavLinkPackage() {
hr(); Content linkContent = getHyperLink("package-summary.html", "",
navLinks(false); packageLabel);
printBottom(); Content li = HtmlTree.LI(linkContent);
printBodyHtmlEnd(); return li;
}
/**
* Print this package link
*/
protected void navLinkPackage() {
navCellStart();
printHyperLink("package-summary.html", "", configuration.getText("doclet.Package"),
true, "NavBarFont1");
navCellEnd();
} }
/** /**
* Print class use link * Get the use link.
*
* @return a content tree for the use link
*/ */
protected void navLinkClassUse() { protected Content getNavLinkClassUse() {
navCellRevStart(); Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, useLabel);
fontStyle("NavBarFont1Rev"); return li;
strongText("doclet.navClassUse");
fontEnd();
navCellEnd();
} }
protected void navLinkTree() { /**
navCellStart(); * Get the tree link.
printHyperLink("package-tree.html", "", configuration.getText("doclet.Tree"), *
true, "NavBarFont1"); * @return a content tree for the tree link
navCellEnd(); */
protected Content getNavLinkTree() {
Content linkContent = getHyperLink("package-tree.html", "",
treeLabel);
Content li = HtmlTree.LI(linkContent);
return li;
} }
} }

View file

@ -25,12 +25,12 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Class to generate file for each package contents in the right-hand * Class to generate file for each package contents in the right-hand
@ -98,189 +98,206 @@ public class PackageWriterImpl extends HtmlDocletWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeSummaryHeader() {} public Content getPackageHeader(String heading) {
String pkgName = packageDoc.name();
Content bodyTree = getBody(true, getWindowTitle(pkgName));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.header);
Content annotationContent = new HtmlTree(HtmlTag.P);
addAnnotationInfo(packageDoc, annotationContent);
div.addContent(annotationContent);
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
HtmlStyle.title, packageLabel);
tHeading.addContent(getSpace());
Content packageHead = new RawHtml(heading);
tHeading.addContent(packageHead);
div.addContent(tHeading);
if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
HtmlTree p = new HtmlTree(HtmlTag.P);
p.addStyle(HtmlStyle.subTitle);
addSummaryComment(packageDoc, p);
div.addContent(p);
Content space = getSpace();
Content descLink = getHyperLink("", "package_description",
descriptionLabel, "", "");
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
div.addContent(descPara);
}
bodyTree.addContent(div);
return bodyTree;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeSummaryFooter() {} public Content getContentHeader() {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.contentContainer);
return div;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeClassesSummary(ClassDoc[] classes, String label, String tableSummary, String[] tableHeader) { public Content getSummaryHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
return ul;
}
/**
* {@inheritDoc}
*/
public void addClassesSummary(ClassDoc[] classes, String label,
String tableSummary, String[] tableHeader, Content summaryContentTree) {
if(classes.length > 0) { if(classes.length > 0) {
Arrays.sort(classes); Arrays.sort(classes);
tableIndexSummary(tableSummary); Content caption = getTableCaption(label);
boolean printedHeading = false; Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0,
tableSummary, caption);
table.addContent(getSummaryTableHeader(tableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY);
for (int i = 0; i < classes.length; i++) { for (int i = 0; i < classes.length; i++) {
if (!printedHeading) {
printTableCaption(label);
printFirstRow(tableHeader);
printedHeading = true;
}
if (!Util.isCoreClass(classes[i]) || if (!Util.isCoreClass(classes[i]) ||
!configuration.isGeneratedDoc(classes[i])) { !configuration.isGeneratedDoc(classes[i])) {
continue; continue;
} }
trBgcolorStyle("white", "TableRowColor"); Content classContent = new RawHtml(getLink(new LinkInfoImpl(
summaryRow(15); LinkInfoImpl.CONTEXT_PACKAGE, classes[i], false)));
strong(); Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_PACKAGE, HtmlTree tr = HtmlTree.TR(tdClass);
classes[i], false)); if (i%2 == 0)
strongEnd(); tr.addStyle(HtmlStyle.altColor);
summaryRowEnd(); else
summaryRow(0); tr.addStyle(HtmlStyle.rowColor);
HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
tdClassDescription.addStyle(HtmlStyle.colLast);
if (Util.isDeprecated(classes[i])) { if (Util.isDeprecated(classes[i])) {
strongText("doclet.Deprecated"); tdClassDescription.addContent(deprecatedLabel);
if (classes[i].tags("deprecated").length > 0) { if (classes[i].tags("deprecated").length > 0) {
space(); addSummaryDeprecatedComment(classes[i],
printSummaryDeprecatedComment(classes[i], classes[i].tags("deprecated")[0], tdClassDescription);
classes[i].tags("deprecated")[0]);
} }
} else {
printSummaryComment(classes[i]);
} }
summaryRowEnd(); else
trEnd(); addSummaryComment(classes[i], tdClassDescription);
tr.addContent(tdClassDescription);
tbody.addContent(tr);
} }
tableEnd(); table.addContent(tbody);
println("&nbsp;"); Content li = HtmlTree.LI(HtmlStyle.blockList, table);
p(); summaryContentTree.addContent(li);
} }
} }
/**
* Print the table caption for the class-listing.
*
* @param label label for the Class kind listing.
*/
protected void printTableCaption(String label) {
tableCaptionStart();
print(label);
tableCaptionEnd();
}
/**
* Print the table heading for the class-listing.
*
* @param tableHeader table header string for the Class listing.
*/
protected void printFirstRow(String[] tableHeader) {
summaryTableHeader(tableHeader, "col");
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writePackageDescription() { public void addPackageDescription(Content packageContentTree) {
if (packageDoc.inlineTags().length > 0) { if (packageDoc.inlineTags().length > 0) {
anchor("package_description"); packageContentTree.addContent(getMarkerAnchor("package_description"));
h2(configuration.getText("doclet.Package_Description", packageDoc.name())); Content h2Content = new StringContent(
p(); configuration.getText("doclet.Package_Description",
printInlineComment(packageDoc); packageDoc.name()));
p(); packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
true, h2Content));
addInlineComment(packageDoc, packageContentTree);
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writePackageTags() { public void addPackageTags(Content packageContentTree) {
printTags(packageDoc); addTagsInfo(packageDoc, packageContentTree);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writePackageHeader(String heading) { public void addPackageFooter(Content contentTree) {
String pkgName = packageDoc.name(); addNavLinks(false, contentTree);
printHtmlHeader(pkgName, addBottom(contentTree);
configuration.metakeywords.getMetaKeywords(packageDoc), true);
printTop();
navLinks(true);
hr();
writeAnnotationInfo(packageDoc);
h2(configuration.getText("doclet.Package") + " " + heading);
if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
printSummaryComment(packageDoc);
p();
strong(configuration.getText("doclet.See"));
br();
printNbsps();
printHyperLink("", "package_description",
configuration.getText("doclet.Description"), true);
p();
}
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writePackageFooter() { public void printDocument(Content contentTree) {
hr(); printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc),
navLinks(false); true, contentTree);
printBottom();
printBodyHtmlEnd();
} }
/** /**
* Print "Use" link for this pacakge in the navigation bar. * Get "Use" link for this pacakge in the navigation bar.
*
* @return a content tree for the class use link
*/ */
protected void navLinkClassUse() { protected Content getNavLinkClassUse() {
navCellStart(); Content useLink = getHyperLink("package-use.html", "",
printHyperLink("package-use.html", "", configuration.getText("doclet.navClassUse"), useLabel, "", "");
true, "NavBarFont1"); Content li = HtmlTree.LI(useLink);
navCellEnd(); return li;
} }
/** /**
* Print "PREV PACKAGE" link in the navigation bar. * Get "PREV PACKAGE" link in the navigation bar.
*
* @return a content tree for the previous link
*/ */
protected void navLinkPrevious() { public Content getNavLinkPrevious() {
Content li;
if (prev == null) { if (prev == null) {
printText("doclet.Prev_Package"); li = HtmlTree.LI(prevpackageLabel);
} else { } else {
String path = DirectoryManager.getRelativePath(packageDoc.name(), String path = DirectoryManager.getRelativePath(packageDoc.name(),
prev.name()); prev.name());
printHyperLink(path + "package-summary.html", "", li = HtmlTree.LI(getHyperLink(path + "package-summary.html", "",
configuration.getText("doclet.Prev_Package"), true); prevpackageLabel, "", ""));
} }
return li;
} }
/** /**
* Print "NEXT PACKAGE" link in the navigation bar. * Get "NEXT PACKAGE" link in the navigation bar.
*
* @return a content tree for the next link
*/ */
protected void navLinkNext() { public Content getNavLinkNext() {
Content li;
if (next == null) { if (next == null) {
printText("doclet.Next_Package"); li = HtmlTree.LI(nextpackageLabel);
} else { } else {
String path = DirectoryManager.getRelativePath(packageDoc.name(), String path = DirectoryManager.getRelativePath(packageDoc.name(),
next.name()); next.name());
printHyperLink(path + "package-summary.html", "", li = HtmlTree.LI(getHyperLink(path + "package-summary.html", "",
configuration.getText("doclet.Next_Package"), true); nextpackageLabel, "", ""));
} }
return li;
} }
/** /**
* Print "Tree" link in the navigation bar. This will be link to the package * Get "Tree" link in the navigation bar. This will be link to the package
* tree file. * tree file.
*
* @return a content tree for the tree link
*/ */
protected void navLinkTree() { protected Content getNavLinkTree() {
navCellStart(); Content useLink = getHyperLink("package-tree.html", "",
printHyperLink("package-tree.html", "", configuration.getText("doclet.Tree"), treeLabel, "", "");
true, "NavBarFont1"); Content li = HtmlTree.LI(useLink);
navCellEnd(); return li;
} }
/** /**
* Highlight "Package" in the navigation bar, as this is the package page. * Highlight "Package" in the navigation bar, as this is the package page.
*
* @return a content tree for the package link
*/ */
protected void navLinkPackage() { protected Content getNavLinkPackage() {
navCellRevStart(); Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
fontStyle("NavBarFont1Rev"); return li;
strongText("doclet.Package");
fontEnd();
navCellEnd();
} }
} }

View file

@ -25,8 +25,10 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
* Generate the Serialized Form Information Page. * Generate the Serialized Form Information Page.
@ -64,76 +66,167 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
} }
/** /**
* Write the given package header. * Get the given header.
* *
* @param packageName the package header to write. * @param header the header to write
* @return the body content tree
*/ */
public void writePackageHeader(String packageName) { public Content getHeader(String header) {
hr(4, "noshade"); Content bodyTree = getBody(true, getWindowTitle(header));
tableHeader(); addTop(bodyTree);
thAlign("center"); addNavLinks(true, bodyTree);
font("+2"); Content h1Content = new StringContent(header);
strongText("doclet.Package"); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
print(' '); HtmlStyle.title, h1Content);
strong(packageName); Content div = HtmlTree.DIV(HtmlStyle.header, heading);
tableFooter(); bodyTree.addContent(div);
return bodyTree;
} }
/** /**
* Write the serial UID info. * Get the serialized form summaries header.
* *
* @param header the header that will show up before the UID. * @return the serialized form summary header tree
* @param serialUID the serial UID to print.
*/ */
public void writeSerialUIDInfo(String header, String serialUID) { public Content getSerializedSummariesHeader() {
strong(header + "&nbsp;"); HtmlTree ul = new HtmlTree(HtmlTag.UL);
println(serialUID); ul.addStyle(HtmlStyle.blockList);
p(); return ul;
} }
/** /**
* Write the footer. * Get the package serialized form header.
*
* @return the package serialized form header tree
*/ */
public void writeFooter() { public Content getPackageSerializedHeader() {
p(); HtmlTree li = new HtmlTree(HtmlTag.LI);
hr(); li.addStyle(HtmlStyle.blockList);
navLinks(false); return li;
printBottom();
printBodyHtmlEnd();
} }
/**
* Get the given package header.
*
* @param packageName the package header to write
* @return a content tree for the package header
*/
public Content getPackageHeader(String packageName) {
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
packageLabel);
heading.addContent(getSpace());
heading.addContent(packageName);
return heading;
}
/** /**
* Write the serializable class heading. * Get the serialized class header.
* *
* @param classDoc the class being processed. * @return a content tree for the serialized class header
*/ */
public void writeClassHeader(ClassDoc classDoc) { public Content getClassSerializedHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
return ul;
}
/**
* Get the serializable class heading.
*
* @param classDoc the class being processed
* @return a content tree for the class header
*/
public Content getClassHeader(ClassDoc classDoc) {
String classLink = (classDoc.isPublic() || classDoc.isProtected())? String classLink = (classDoc.isPublic() || classDoc.isProtected())?
getLink(new LinkInfoImpl(classDoc, getLink(new LinkInfoImpl(classDoc,
configuration.getClassName(classDoc))): configuration.getClassName(classDoc))):
classDoc.qualifiedName(); classDoc.qualifiedName();
p(); Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
anchor(classDoc.qualifiedName()); classDoc.qualifiedName()));
String superClassLink = String superClassLink =
classDoc.superclassType() != null ? classDoc.superclassType() != null ?
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIALIZED_FORM, getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIALIZED_FORM,
classDoc.superclassType())) : classDoc.superclassType())) :
null; null;
//Print the heading. //Print the heading.
String className = superClassLink == null ? String className = superClassLink == null ?
configuration.getText( configuration.getText(
"doclet.Class_0_implements_serializable", classLink) : "doclet.Class_0_implements_serializable", classLink) :
configuration.getText( configuration.getText(
"doclet.Class_0_extends_implements_serializable", classLink, "doclet.Class_0_extends_implements_serializable", classLink,
superClassLink); superClassLink);
tableHeader(); Content classNameContent = new RawHtml(className);
thAlignColspan("left", 2); li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
font("+2"); classNameContent));
strong(className); return li;
tableFooter(); }
p();
/**
* Get the serial UID info header.
*
* @return a content tree for the serial uid info header
*/
public Content getSerialUIDInfoHeader() {
HtmlTree dl = new HtmlTree(HtmlTag.DL);
dl.addStyle(HtmlStyle.nameValue);
return dl;
}
/**
* Adds the serial UID info.
*
* @param header the header that will show up before the UID.
* @param serialUID the serial UID to print.
* @param serialUidTree the serial UID content tree to which the serial UID
* content will be added
*/
public void addSerialUIDInfo(String header, String serialUID,
Content serialUidTree) {
Content headerContent = new StringContent(header);
serialUidTree.addContent(HtmlTree.DT(headerContent));
Content serialContent = new StringContent(serialUID);
serialUidTree.addContent(HtmlTree.DD(serialContent));
}
/**
* Get the class serialize content header.
*
* @return a content tree for the class serialize content header
*/
public Content getClassContentHeader() {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
return ul;
}
/**
* Get the serialized content tree section.
*
* @param serializedTreeContent the serialized content tree to be added
* @return a div content tree
*/
public Content getSerializedContent(Content serializedTreeContent) {
Content divContent = HtmlTree.DIV(HtmlStyle.serializedFormContainer,
serializedTreeContent);
return divContent;
}
/**
* Add the footer.
*
* @param serializedTree the serialized tree to be added
*/
public void addFooter(Content serializedTree) {
addNavLinks(false, serializedTree);
addBottom(serializedTree);
}
/**
* {@inheritDoc}
*/
public void printDocument(Content serializedTree) {
printHtmlDocument(null, true, serializedTree);
} }
private void tableHeader() { private void tableHeader() {

View file

@ -25,9 +25,10 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.util.*;
import java.io.*; import java.io.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
* Generate only one index file for all the Member Names with Indexing in * Generate only one index file for all the Member Names with Indexing in
@ -36,6 +37,7 @@ import java.io.*;
* *
* @see java.lang.Character * @see java.lang.Character
* @author Atul M Dambalkar * @author Atul M Dambalkar
* @author Bhavesh Patel (Modified)
*/ */
public class SingleIndexWriter extends AbstractIndexWriter { public class SingleIndexWriter extends AbstractIndexWriter {
@ -82,34 +84,35 @@ public class SingleIndexWriter extends AbstractIndexWriter {
* Member Field, Method and Constructor Description. * Member Field, Method and Constructor Description.
*/ */
protected void generateIndexFile() throws IOException { protected void generateIndexFile() throws IOException {
printHtmlHeader(configuration.getText("doclet.Window_Single_Index"), String title = configuration.getText("doclet.Window_Single_Index");
null, true); Content body = getBody(true, getWindowTitle(title));
printTop(); addTop(body);
navLinks(true); addNavLinks(true, body);
printLinksForIndexes(); HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
divTree.addStyle(HtmlStyle.contentContainer);
hr(); addLinksForIndexes(divTree);
for (int i = 0; i < indexbuilder.elements().length; i++) { for (int i = 0; i < indexbuilder.elements().length; i++) {
Character unicode = (Character)((indexbuilder.elements())[i]); Character unicode = (Character)((indexbuilder.elements())[i]);
generateContents(unicode, indexbuilder.getMemberList(unicode)); addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
} }
addLinksForIndexes(divTree);
printLinksForIndexes(); body.addContent(divTree);
navLinks(false); addNavLinks(false, body);
addBottom(body);
printBottom(); printHtmlDocument(null, true, body);
printBodyHtmlEnd();
} }
/** /**
* Print Links for all the Index Files per unicode character. * Add links for all the Index Files per unicode character.
*
* @param contentTree the content tree to which the links for indexes will be added
*/ */
protected void printLinksForIndexes() { protected void addLinksForIndexes(Content contentTree) {
for (int i = 0; i < indexbuilder.elements().length; i++) { for (int i = 0; i < indexbuilder.elements().length; i++) {
String unicode = (indexbuilder.elements())[i].toString(); String unicode = (indexbuilder.elements())[i].toString();
printHyperLink("#_" + unicode + "_", unicode); contentTree.addContent(
print(' '); getHyperLink("#_" + unicode + "_", new StringContent(unicode)));
contentTree.addContent(getSpace());
} }
} }
} }

View file

@ -23,14 +23,14 @@
* questions. * questions.
*/ */
package com.sun.tools.doclets.internal.toolkit.util; package com.sun.tools.doclets.formats.html;
import java.io.*; import java.io.*;
import java.util.*;
import javax.tools.FileObject; import javax.tools.FileObject;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* Converts Java Source Code to HTML. * Converts Java Source Code to HTML.
@ -40,27 +40,28 @@ import com.sun.tools.doclets.internal.toolkit.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.4 * @since 1.4
*/ */
public class SourceToHTMLConverter { public class SourceToHTMLConverter {
/**
* The background color.
*/
protected static final String BGCOLOR = "white";
/**
* The line number color.
*/
protected static final String LINE_NO_COLOR = "green";
/** /**
* The number of trailing blank lines at the end of the page. * The number of trailing blank lines at the end of the page.
* This is inserted so that anchors at the bottom of small pages * This is inserted so that anchors at the bottom of small pages
* can be reached. * can be reached.
*/ */
protected static final int NUM_BLANK_LINES = 60; private static final int NUM_BLANK_LINES = 60;
/**
* New line to be added to the documentation.
*/
private static final Content NEW_LINE = new RawHtml(DocletConstants.NL);
/**
* Relative path from the documentation root to the file that is being
* generated.
*/
private static String relativePath = "";
/** /**
* Source is converted to HTML using static methods below. * Source is converted to HTML using static methods below.
@ -69,11 +70,13 @@ public class SourceToHTMLConverter {
/** /**
* Convert the Classes in the given RootDoc to an HTML. * Convert the Classes in the given RootDoc to an HTML.
*
* @param configuration the configuration. * @param configuration the configuration.
* @param rd the RootDoc to convert. * @param rd the RootDoc to convert.
* @param outputdir the name of the directory to output to. * @param outputdir the name of the directory to output to.
*/ */
public static void convertRoot(Configuration configuration, RootDoc rd, String outputdir) { public static void convertRoot(ConfigurationImpl configuration, RootDoc rd,
String outputdir) {
if (rd == null || outputdir == null) { if (rd == null || outputdir == null) {
return; return;
} }
@ -84,17 +87,19 @@ public class SourceToHTMLConverter {
ClassDoc[] cds = rd.specifiedClasses(); ClassDoc[] cds = rd.specifiedClasses();
for (int i = 0; i < cds.length; i++) { for (int i = 0; i < cds.length; i++) {
convertClass(configuration, cds[i], convertClass(configuration, cds[i],
getPackageOutputDir(outputdir, cds[i].containingPackage())); getPackageOutputDir(outputdir, cds[i].containingPackage()));
} }
} }
/** /**
* Convert the Classes in the given Package to an HTML. * Convert the Classes in the given Package to an HTML.
*
* @param configuration the configuration. * @param configuration the configuration.
* @param pd the Package to convert. * @param pd the Package to convert.
* @param outputdir the name of the directory to output to. * @param outputdir the name of the directory to output to.
*/ */
public static void convertPackage(Configuration configuration, PackageDoc pd, String outputdir) { public static void convertPackage(ConfigurationImpl configuration, PackageDoc pd,
String outputdir) {
if (pd == null || outputdir == null) { if (pd == null || outputdir == null) {
return; return;
} }
@ -107,8 +112,10 @@ public class SourceToHTMLConverter {
/** /**
* Return the directory write output to for the given package. * Return the directory write output to for the given package.
*
* @param outputDir the directory to output to. * @param outputDir the directory to output to.
* @param pd the Package to generate output for. * @param pd the Package to generate output for.
* @return the package output directory as a String.
*/ */
private static String getPackageOutputDir(String outputDir, PackageDoc pd) { private static String getPackageOutputDir(String outputDir, PackageDoc pd) {
return outputDir + File.separator + return outputDir + File.separator +
@ -117,11 +124,13 @@ public class SourceToHTMLConverter {
/** /**
* Convert the given Class to an HTML. * Convert the given Class to an HTML.
*
* @param configuration the configuration. * @param configuration the configuration.
* @param cd the class to convert. * @param cd the class to convert.
* @param outputdir the name of the directory to output to. * @param outputdir the name of the directory to output to.
*/ */
public static void convertClass(Configuration configuration, ClassDoc cd, String outputdir) { public static void convertClass(ConfigurationImpl configuration, ClassDoc cd,
String outputdir) {
if (cd == null || outputdir == null) { if (cd == null || outputdir == null) {
return; return;
} }
@ -145,19 +154,23 @@ public class SourceToHTMLConverter {
LineNumberReader reader = new LineNumberReader(r); LineNumberReader reader = new LineNumberReader(r);
int lineno = 1; int lineno = 1;
String line; String line;
StringBuffer output = new StringBuffer(); relativePath = DirectoryManager.getRelativePath(DocletConstants.SOURCE_OUTPUT_DIR_NAME) +
DirectoryManager.getRelativePath(cd.containingPackage());
Content body = getHeader();
Content pre = new HtmlTree(HtmlTag.PRE);
try { try {
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
output.append(formatLine(line, configuration.sourcetab, lineno)); addLineNo(pre, lineno);
addLine(pre, line, configuration.sourcetab, lineno);
lineno++; lineno++;
} }
} finally { } finally {
reader.close(); reader.close();
} }
output = addLineNumbers(output.toString()); addBlankLines(pre);
output.insert(0, getHeader(configuration)); Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
output.append(getFooter()); body.addContent(div);
writeToFile(output.toString(), outputdir, cd.name(), configuration); writeToFile(body, outputdir, cd.name(), configuration);
} catch (Exception e){ } catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }
@ -165,135 +178,117 @@ public class SourceToHTMLConverter {
/** /**
* Write the output to the file. * Write the output to the file.
* @param output the string to output. *
* @param body the documentation content to be written to the file.
* @param outputDir the directory to output to. * @param outputDir the directory to output to.
* @param className the name of the class that I am converting to HTML. * @param className the name of the class that I am converting to HTML.
* @param configuration the Doclet configuration to pass notices to. * @param configuration the Doclet configuration to pass notices to.
*/ */
private static void writeToFile(String output, String outputDir, String className, Configuration configuration) throws IOException { private static void writeToFile(Content body, String outputDir,
String className, ConfigurationImpl configuration) throws IOException {
Content htmlDocType = DocType.Transitional();
Content head = new HtmlTree(HtmlTag.HEAD);
head.addContent(HtmlTree.TITLE(new StringContent(
configuration.getText("doclet.Window_Source_title"))));
head.addContent(getStyleSheetProperties(configuration));
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
head, body);
Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
File dir = new File(outputDir); File dir = new File(outputDir);
dir.mkdirs(); dir.mkdirs();
File newFile = new File(dir, className + ".html"); File newFile = new File(dir, className + ".html");
configuration.message.notice("doclet.Generating_0", newFile.getPath()); configuration.message.notice("doclet.Generating_0", newFile.getPath());
FileOutputStream fout = new FileOutputStream(newFile); FileOutputStream fout = new FileOutputStream(newFile);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fout)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fout));
bw.write(output); bw.write(htmlDocument.toString());
bw.close(); bw.close();
fout.close(); fout.close();
} }
/** /**
* Given a <code>String</code>, add line numbers. * Returns a link to the stylesheet file.
* @param s the text to add line numbers to.
* *
* @return the string buffer with the line numbering for each line. * @param configuration the doclet configuration for the current run of javadoc
* @return an HtmlTree for the lINK tag which provides the stylesheet location
*/ */
private static StringBuffer addLineNumbers(String s) { public static HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
StringBuffer sb = new StringBuffer(); String filename = configuration.stylesheetfile;
StringTokenizer st = new StringTokenizer(s, "\n", true); if (filename.length() > 0) {
int lineno = 1; File stylefile = new File(filename);
String current; String parent = stylefile.getParent();
while(st.hasMoreTokens()){ filename = (parent == null)?
current = st.nextToken(); filename:
sb.append(current.equals("\n") ? filename.substring(parent.length() + 1);
getHTMLLineNo(lineno) + current : } else {
getHTMLLineNo(lineno) + current + st.nextToken()); filename = "stylesheet.css";
lineno++;
} }
return sb; filename = relativePath + filename;
HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", filename, "Style");
return link;
} }
/** /**
* Get the header. * Get the header.
* @param configuration the Doclet configuration *
* @return the header to the output file * @return the header content for the HTML file
*/ */
protected static String getHeader(Configuration configuration) { private static Content getHeader() {
StringBuffer result = new StringBuffer("<HTML lang=\"" + configuration.getLocale().getLanguage() + "\">" + DocletConstants.NL); return new HtmlTree(HtmlTag.BODY);
result.append("<BODY BGCOLOR=\""+ BGCOLOR + "\">" + DocletConstants.NL);
result.append("<PRE>" + DocletConstants.NL);
return result.toString();
} }
/** /**
* Get the footer * Add the line numbers for the source code.
* @return the footer to the output file *
*/ * @param pre the content tree to which the line number will be added
protected static String getFooter() {
StringBuffer footer = new StringBuffer();
for (int i = 0; i < NUM_BLANK_LINES; i++) {
footer.append(DocletConstants.NL);
}
footer.append("</PRE>" + DocletConstants.NL + "</BODY>" +
DocletConstants.NL + "</HTML>" + DocletConstants.NL);
return footer.toString();
}
/**
* Get the HTML for the lines.
* @param lineno The line number * @param lineno The line number
* @return the HTML code for the line
*/ */
protected static String getHTMLLineNo(int lineno) { private static void addLineNo(Content pre, int lineno) {
StringBuffer result = new StringBuffer("<FONT color=\"" + LINE_NO_COLOR HtmlTree span = new HtmlTree(HtmlTag.SPAN);
+ "\">"); span.addStyle(HtmlStyle.sourceLineNo);
if (lineno < 10) { if (lineno < 10) {
result.append("00" + ((new Integer(lineno)).toString())); span.addContent("00" + Integer.toString(lineno));
} else if (lineno < 100) { } else if (lineno < 100) {
result.append("0" + ((new Integer(lineno)).toString())); span.addContent("0" + Integer.toString(lineno));
} else { } else {
result.append((new Integer(lineno)).toString()); span.addContent(Integer.toString(lineno));
} }
result.append("</FONT> "); pre.addContent(span);
return result.toString();
} }
/** /**
* Format a given line of source. <br> * Add a line from source to the HTML file that is generated.
* Note: In the future, we will add special colors for constructs in the *
* language. * @param pre the content tree to which the line will be added.
* @param line the string to format. * @param line the string to format.
* @param tabLength the number of spaces for each tab. * @param tabLength the number of spaces for each tab.
* @param currentLineNo the current number. * @param currentLineNo the current number.
*/ */
protected static String formatLine(String line, int tabLength, int currentLineNo) { private static void addLine(Content pre, String line, int tabLength,
if (line == null) { int currentLineNo) {
return null; if (line != null) {
} StringBuffer lineBuffer = new StringBuffer(Util.escapeHtmlChars(line));
StringBuffer lineBuffer = new StringBuffer(Util.escapeHtmlChars(line)); Util.replaceTabs(tabLength, lineBuffer);
//Insert an anchor for the line pre.addContent(new RawHtml(lineBuffer.toString()));
lineBuffer.append("<a name=\"line." + Integer.toString(currentLineNo) + "\"></a>"); Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
lineBuffer.append(DocletConstants.NL); pre.addContent(anchor);
Util.replaceTabs(tabLength, lineBuffer); pre.addContent(NEW_LINE);
return lineBuffer.toString();
}
/**
* Given an array of <code>Doc</code>s, add to the given <code>HashMap</code> the
* line numbers and anchors that should be inserted in the output at those lines.
* @param docs the array of <code>Doc</code>s to add anchors for.
* @param hash the <code>HashMap</code> to add to.
*/
protected static void addToHash(Doc[] docs, HashMap<Integer,String> hash) {
if(docs == null) {
return;
}
for(int i = 0; i < docs.length; i++) {
hash.put(docs[i].position().line(), getAnchor(docs[i]));
} }
} }
/** /**
* Given a <code>Doc</code>, return an anchor for it. * Add trailing blank lines at the end of the page.
* @param d the <code>Doc</code> to check. *
* @return an anchor of the form &lt;a name="my_name">&lt;/a> * @param pre the content tree to which the blank lines will be added.
*/ */
protected static String getAnchor(Doc d) { private static void addBlankLines(Content pre) {
return " <a name=\"" + getAnchorName(d) + "\"></a>"; for (int i = 0; i < NUM_BLANK_LINES; i++) {
pre.addContent(NEW_LINE);
}
} }
/** /**
* Given a <code>Doc</code>, return an anchor name for it. * Given a <code>Doc</code>, return an anchor name for it.
*
* @param d the <code>Doc</code> to check. * @param d the <code>Doc</code> to check.
* @return the name of the anchor. * @return the name of the anchor.
*/ */

View file

@ -25,9 +25,10 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.tools.doclets.internal.toolkit.util.*;
import java.io.*; import java.io.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
* Generate Separate Index Files for all the member names with Indexing in * Generate Separate Index Files for all the member names with Indexing in
@ -36,6 +37,7 @@ import java.io.*;
* *
* @see java.lang.Character * @see java.lang.Character
* @author Atul M Dambalkar * @author Atul M Dambalkar
* @author Bhavesh Patel (Modified)
*/ */
public class SplitIndexWriter extends AbstractIndexWriter { public class SplitIndexWriter extends AbstractIndexWriter {
@ -109,56 +111,68 @@ public class SplitIndexWriter extends AbstractIndexWriter {
* index. * index.
*/ */
protected void generateIndexFile(Character unicode) throws IOException { protected void generateIndexFile(Character unicode) throws IOException {
printHtmlHeader(configuration.getText("doclet.Window_Split_Index", String title = configuration.getText("doclet.Window_Split_Index",
unicode.toString()), null, true); unicode.toString());
printTop(); Content body = getBody(true, getWindowTitle(title));
navLinks(true); addTop(body);
printLinksForIndexes(); addNavLinks(true, body);
HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
hr(); divTree.addStyle(HtmlStyle.contentContainer);
addLinksForIndexes(divTree);
generateContents(unicode, indexbuilder.getMemberList(unicode)); addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
addLinksForIndexes(divTree);
navLinks(false); body.addContent(divTree);
printLinksForIndexes(); addNavLinks(false, body);
addBottom(body);
printBottom(); printHtmlDocument(null, true, body);
printBodyHtmlEnd();
} }
/** /**
* Print Links for all the Index Files per unicode character. * Add links for all the Index Files per unicode character.
*
* @param contentTree the content tree to which the links for indexes will be added
*/ */
protected void printLinksForIndexes() { protected void addLinksForIndexes(Content contentTree) {
for (int i = 0; i < indexbuilder.elements().length; i++) { Object[] unicodeChars = indexbuilder.elements();
for (int i = 0; i < unicodeChars.length; i++) {
int j = i + 1; int j = i + 1;
printHyperLink("index-" + j + ".html", contentTree.addContent(getHyperLink("index-" + j + ".html",
indexbuilder.elements()[i].toString()); new StringContent(unicodeChars[i].toString())));
print(' '); contentTree.addContent(getSpace());
} }
} }
/** /**
* Print the previous unicode character index link. * Get link to the previous unicode character.
*
* @return a content tree for the link
*/ */
protected void navLinkPrevious() { public Content getNavLinkPrevious() {
Content prevletterLabel = getResource("doclet.Prev_Letter");
if (prev == -1) { if (prev == -1) {
printText("doclet.Prev_Letter"); return HtmlTree.LI(prevletterLabel);
} else { }
printHyperLink("index-" + prev + ".html", "", else {
configuration.getText("doclet.Prev_Letter"), true); Content prevLink = getHyperLink("index-" + prev + ".html", "",
prevletterLabel);
return HtmlTree.LI(prevLink);
} }
} }
/** /**
* Print the next unicode character index link. * Get link to the next unicode character.
*
* @return a content tree for the link
*/ */
protected void navLinkNext() { public Content getNavLinkNext() {
Content nextletterLabel = getResource("doclet.Next_Letter");
if (next == -1) { if (next == -1) {
printText("doclet.Next_Letter"); return HtmlTree.LI(nextletterLabel);
} else { }
printHyperLink("index-" + next + ".html","", else {
configuration.getText("doclet.Next_Letter"), true); Content nextLink = getHyperLink("index-" + next + ".html","",
nextletterLabel);
return HtmlTree.LI(nextLink);
} }
} }
} }

View file

@ -1,130 +0,0 @@
/*
* Copyright (c) 1998, 2005, 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;
import com.sun.tools.doclets.internal.toolkit.util.*;
import java.io.*;
/**
* Writes the style sheet for the doclet output.
*
* @author Atul M Dambalkar
* @author Bhavesh Patel (Modified)
*/
public class StylesheetWriter extends HtmlDocletWriter {
/**
* Constructor.
*/
public StylesheetWriter(ConfigurationImpl configuration,
String filename) throws IOException {
super(configuration, filename);
}
/**
* Generate the style file contents.
* @throws DocletAbortException
*/
public static void generate(ConfigurationImpl configuration) {
StylesheetWriter stylegen;
String filename = "";
try {
filename = "stylesheet.css";
stylegen = new StylesheetWriter(configuration, filename);
stylegen.generateStyleFile();
stylegen.close();
} catch (IOException exc) {
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
throw new DocletAbortException();
}
}
/**
* Generate the style file contents.
*/
protected void generateStyleFile() {
print("/* "); printText("doclet.Style_line_1"); println(" */");
println("");
print("/* "); printText("doclet.Style_line_2"); println(" */");
println("");
print("/* "); printText("doclet.Style_line_3"); println(" */");
println("body { background-color: #FFFFFF; color:#000000 }");
println("");
print("/* "); printText("doclet.Style_Headings"); println(" */");
println("h1 { font-size: 145% }");
println("");
print("/* "); printText("doclet.Style_line_4"); println(" */");
print(".TableHeadingColor { background: #CCCCFF; color:#000000 }");
print(" /* "); printText("doclet.Style_line_5"); println(" */");
print(".TableSubHeadingColor { background: #EEEEFF; color:#000000 }");
print(" /* "); printText("doclet.Style_line_6"); println(" */");
print(".TableRowColor { background: #FFFFFF; color:#000000 }");
print(" /* "); printText("doclet.Style_line_7"); println(" */");
println("");
print("/* "); printText("doclet.Style_line_8"); println(" */");
println(".FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
println(".FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
println(".FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
println("");
// Removed doclet.Style_line_9 as no longer needed
print("/* "); printText("doclet.Style_line_10"); println(" */");
print(".NavBarCell1 { background-color:#EEEEFF; color:#000000}");
print(" /* "); printText("doclet.Style_line_6"); println(" */");
print(".NavBarCell1Rev { background-color:#00008B; color:#FFFFFF}");
print(" /* "); printText("doclet.Style_line_11"); println(" */");
print(".NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;");
println("color:#000000;}");
print(".NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;");
println("color:#FFFFFF;}");
println("");
print(".NavBarCell2 { font-family: Arial, Helvetica, sans-serif; ");
println("background-color:#FFFFFF; color:#000000}");
print(".NavBarCell3 { font-family: Arial, Helvetica, sans-serif; ");
println("background-color:#FFFFFF; color:#000000}");
print("/* "); printText("doclet.Style_line_12"); println(" */");
print(".TableCaption { background: #CCCCFF; color:#000000; text-align: left; font-size: 150%; font-weight: bold; border-left: 2px ridge; border-right: 2px ridge; border-top: 2px ridge; padding-left: 5px; }");
print(" /* "); printText("doclet.Style_line_5"); println(" */");
print(".TableSubCaption { background: #EEEEFF; color:#000000; text-align: left; font-weight: bold; border-left: 2px ridge; border-right: 2px ridge; border-top: 2px ridge; padding-left: 5px; }");
print(" /* "); printText("doclet.Style_line_6"); println(" */");
print(".TableHeader { text-align: center; font-size: 80%; font-weight: bold; }");
println("");
}
}

View file

@ -25,10 +25,11 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import java.io.*; import java.io.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
/** /**
* This abstract class exists to provide functionality needed in the * This abstract class exists to provide functionality needed in the
@ -71,13 +72,31 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
tdEnd(); tdEnd();
} }
public void printSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) { /**
mw.printSummaryAnchor(cd); * Add the summary header.
mw.printTableSummary(); *
tableCaptionStart(); * @param mw the writer for the member being documented
mw.printSummaryLabel(); * @param cd the classdoc to be documented
tableCaptionEnd(); * @param memberTree the content tree to which the summary header will be added
mw.printSummaryTableHeader(cd); */
public void addSummaryHeader(AbstractMemberWriter mw, ClassDoc cd,
Content memberTree) {
mw.addSummaryAnchor(cd, memberTree);
mw.addSummaryLabel(memberTree);
}
/**
* Get the summary table.
*
* @param mw the writer for the member being documented
* @param cd the classdoc to be documented
* @return the content tree for the summary table
*/
public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd) {
Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0,
mw.getTableSummary(), getTableCaption(mw.getCaption()));
table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col"));
return table;
} }
public void printTableHeadingBackground(String str) { public void printTableHeadingBackground(String str) {
@ -88,15 +107,17 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
tableEnd(); tableEnd();
} }
public void printInheritedSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) { /**
mw.printInheritedSummaryAnchor(cd); * Add the inherited summary header.
tableIndexSummary(); *
tableInheritedHeaderStart("#EEEEFF"); * @param mw the writer for the member being documented
mw.printInheritedSummaryLabel(cd); * @param cd the classdoc to be documented
tableInheritedHeaderEnd(); * @param inheritedTree the content tree to which the inherited summary header will be added
trBgcolorStyle("white", "TableRowColor"); */
summaryRow(0); public void addInheritedSummaryHeader(AbstractMemberWriter mw, ClassDoc cd,
code(); Content inheritedTree) {
mw.addInheritedSummaryAnchor(cd, inheritedTree);
mw.addInheritedSummaryLabel(cd, inheritedTree);
} }
public void printSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) { public void printSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
@ -112,8 +133,14 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
space(); space();
} }
protected void printIndexComment(Doc member) { /**
printIndexComment(member, member.firstSentenceTags()); * Add the index comment.
*
* @param member the member being documented
* @param contentTree the content tree to which the comment will be added
*/
protected void addIndexComment(Doc member, Content contentTree) {
addIndexComment(member, member.firstSentenceTags(), contentTree);
} }
protected void printIndexComment(Doc member, Tag[] firstSentenceTags) { protected void printIndexComment(Doc member, Tag[] firstSentenceTags) {
@ -134,17 +161,60 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
printSummaryComment(member, firstSentenceTags); printSummaryComment(member, firstSentenceTags);
} }
public void printSummaryLinkType(AbstractMemberWriter mw, /**
ProgramElementDoc member) { * Add the index comment.
trBgcolorStyle("white", "TableRowColor"); *
mw.printSummaryType(member); * @param member the member being documented
summaryRow(0); * @param firstSentenceTags the first sentence tags for the member to be documented
code(); * @param tdSummary the content tree to which the comment will be added
*/
protected void addIndexComment(Doc member, Tag[] firstSentenceTags,
Content tdSummary) {
Tag[] deprs = member.tags("deprecated");
Content div;
if (Util.isDeprecated((ProgramElementDoc) member)) {
Content strong = HtmlTree.STRONG(deprecatedPhrase);
div = HtmlTree.DIV(HtmlStyle.block, strong);
div.addContent(getSpace());
if (deprs.length > 0) {
addInlineDeprecatedComment(member, deprs[0], div);
}
tdSummary.addContent(div);
return;
} else {
ClassDoc cd = ((ProgramElementDoc)member).containingClass();
if (cd != null && Util.isDeprecated(cd)) {
Content strong = HtmlTree.STRONG(deprecatedPhrase);
div = HtmlTree.DIV(HtmlStyle.block, strong);
div.addContent(getSpace());
tdSummary.addContent(div);
}
}
addSummaryComment(member, firstSentenceTags, tdSummary);
} }
public void printSummaryLinkComment(AbstractMemberWriter mw, /**
ProgramElementDoc member) { * Add the summary type for the member.
printSummaryLinkComment(mw, member, member.firstSentenceTags()); *
* @param mw the writer for the member being documented
* @param member the member to be documented
* @param tdSummaryType the content tree to which the type will be added
*/
public void addSummaryType(AbstractMemberWriter mw, ProgramElementDoc member,
Content tdSummaryType) {
mw.addSummaryType(member, tdSummaryType);
}
/**
* Add the summary link for the member.
*
* @param mw the writer for the member being documented
* @param member the member to be documented
* @param contentTree the content tree to which the link will be added
*/
public void addSummaryLinkComment(AbstractMemberWriter mw,
ProgramElementDoc member, Content contentTree) {
addSummaryLinkComment(mw, member, member.firstSentenceTags(), contentTree);
} }
public void printSummaryLinkComment(AbstractMemberWriter mw, public void printSummaryLinkComment(AbstractMemberWriter mw,
@ -159,12 +229,34 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
trEnd(); trEnd();
} }
public void printInheritedSummaryMember(AbstractMemberWriter mw, ClassDoc cd, /**
ProgramElementDoc member, boolean isFirst) { * Add the summary link comment.
*
* @param mw the writer for the member being documented
* @param member the member being documented
* @param firstSentenceTags the first sentence tags for the member to be documented
* @param tdSummary the content tree to which the comment will be added
*/
public void addSummaryLinkComment(AbstractMemberWriter mw,
ProgramElementDoc member, Tag[] firstSentenceTags, Content tdSummary) {
addIndexComment(member, firstSentenceTags, tdSummary);
}
/**
* Add the inherited member summary.
*
* @param mw the writer for the member being documented
* @param cd the class being documented
* @param member the member being documented
* @param isFirst true if its the first link being documented
* @param linksTree the content tree to which the summary will be added
*/
public void addInheritedMemberSummary(AbstractMemberWriter mw, ClassDoc cd,
ProgramElementDoc member, boolean isFirst, Content linksTree) {
if (! isFirst) { if (! isFirst) {
mw.print(", "); linksTree.addContent(", ");
} }
mw.writeInheritedSummaryLink(cd, member); mw.addInheritedSummaryLink(cd, member, linksTree);
} }
public void printMemberHeader() { public void printMemberHeader() {
@ -174,4 +266,67 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
public void printMemberFooter() { public void printMemberFooter() {
} }
/**
* Get the document content header tree
*
* @return a content tree the document content header
*/
public Content getContentHeader() {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.contentContainer);
return div;
}
/**
* Get the member header tree
*
* @return a content tree the member header
*/
public Content getMemberTreeHeader() {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addStyle(HtmlStyle.blockList);
return li;
}
/**
* Get the member tree
*
* @param contentTree the tree used to generate the complete member tree
* @return a content tree for the member
*/
public Content getMemberTree(Content contentTree) {
Content ul = HtmlTree.UL(HtmlStyle.blockList, contentTree);
return ul;
}
/**
* Get the member summary tree
*
* @param contentTree the tree used to generate the member summary tree
* @return a content tree for the member summary
*/
public Content getMemberSummaryTree(Content contentTree) {
return getMemberTree(HtmlStyle.summary, contentTree);
}
/**
* Get the member details tree
*
* @param contentTree the tree used to generate the member details tree
* @return a content tree for the member details
*/
public Content getMemberDetailsTree(Content contentTree) {
return getMemberTree(HtmlStyle.details, contentTree);
}
/**
* Get the member tree
*
* @param style the style class to be added to the content tree
* @param contentTree the tree used to generate the complete member tree
*/
public Content getMemberTree(HtmlStyle style, Content contentTree) {
Content div = HtmlTree.DIV(style, getMemberTree(contentTree));
return div;
}
} }

View file

@ -70,9 +70,9 @@ public class TagletWriterImpl extends TagletWriter {
Tag[] deprs = doc.tags("deprecated"); Tag[] deprs = doc.tags("deprecated");
if (doc instanceof ClassDoc) { if (doc instanceof ClassDoc) {
if (Util.isDeprecated((ProgramElementDoc) doc)) { if (Util.isDeprecated((ProgramElementDoc) doc)) {
output.append("<STRONG>" + output.append("<span class=\"strong\">" +
ConfigurationImpl.getInstance(). ConfigurationImpl.getInstance().
getText("doclet.Deprecated") + "</STRONG>&nbsp;"); getText("doclet.Deprecated") + "</span>&nbsp;");
if (deprs.length > 0) { if (deprs.length > 0) {
Tag[] commentTags = deprs[0].inlineTags(); Tag[] commentTags = deprs[0].inlineTags();
if (commentTags.length > 0) { if (commentTags.length > 0) {
@ -82,30 +82,24 @@ public class TagletWriterImpl extends TagletWriter {
); );
} }
} }
output.append("<p>");
} }
} else { } else {
MemberDoc member = (MemberDoc) doc; MemberDoc member = (MemberDoc) doc;
if (Util.isDeprecated((ProgramElementDoc) doc)) { if (Util.isDeprecated((ProgramElementDoc) doc)) {
output.append("<DD><STRONG>" + output.append("<span class=\"strong\">" +
ConfigurationImpl.getInstance(). ConfigurationImpl.getInstance().
getText("doclet.Deprecated") + "</STRONG>&nbsp;"); getText("doclet.Deprecated") + "</span>&nbsp;");
if (deprs.length > 0) { if (deprs.length > 0) {
output.append("<I>"); output.append("<i>");
output.append(commentTagsToOutput(null, doc, output.append(commentTagsToOutput(null, doc,
deprs[0].inlineTags(), false).toString()); deprs[0].inlineTags(), false).toString());
output.append("</I>"); output.append("</i>");
} }
if (member instanceof ExecutableMemberDoc) {
output.append(DocletConstants.NL + "<P>" +
DocletConstants.NL);
}
output.append("</DD>");
} else { } else {
if (Util.isDeprecated(member.containingClass())) { if (Util.isDeprecated(member.containingClass())) {
output.append("<DD><STRONG>" + output.append("<span class=\"strong\">" +
ConfigurationImpl.getInstance(). ConfigurationImpl.getInstance().
getText("doclet.Deprecated") + "</STRONG>&nbsp;</DD>"); getText("doclet.Deprecated") + "</span>&nbsp;");
} }
} }
} }
@ -124,8 +118,8 @@ public class TagletWriterImpl extends TagletWriter {
*/ */
public TagletOutput getParamHeader(String header) { public TagletOutput getParamHeader(String header) {
StringBuffer result = new StringBuffer(); StringBuffer result = new StringBuffer();
result.append("<DT>"); result.append("<dt>");
result.append("<STRONG>" + header + "</STRONG></DT>"); result.append("<span class=\"strong\">" + header + "</span></dt>");
return new TagletOutputImpl(result.toString()); return new TagletOutputImpl(result.toString());
} }
@ -133,8 +127,8 @@ public class TagletWriterImpl extends TagletWriter {
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) { public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) {
TagletOutput result = new TagletOutputImpl("<DD><CODE>" + paramName + "</CODE>" TagletOutput result = new TagletOutputImpl("<dd><code>" + paramName + "</code>"
+ " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false) + "</DD>"); + " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false) + "</dd>");
return result; return result;
} }
@ -142,11 +136,11 @@ public class TagletWriterImpl extends TagletWriter {
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput returnTagOutput(Tag returnTag) { public TagletOutput returnTagOutput(Tag returnTag) {
TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<DT>" + TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<dt>" +
"<STRONG>" + htmlWriter.configuration.getText("doclet.Returns") + "<span class=\"strong\">" + htmlWriter.configuration.getText("doclet.Returns") +
"</STRONG>" + "</DT>" + "<DD>" + "</span>" + "</dt>" + "<dd>" +
htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(), htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(),
false) + "</DD>"); false) + "</dd>");
return result; return result;
} }
@ -168,7 +162,7 @@ public class TagletWriterImpl extends TagletWriter {
htmlWriter instanceof ClassWriterImpl) { htmlWriter instanceof ClassWriterImpl) {
//Automatically add link to constant values page for constant fields. //Automatically add link to constant values page for constant fields.
result = addSeeHeader(result); result = addSeeHeader(result);
result += htmlWriter.getHyperLink(htmlWriter.relativePath + result += htmlWriter.getHyperLinkString(htmlWriter.relativePath +
ConfigurationImpl.CONSTANTS_FILE_NAME ConfigurationImpl.CONSTANTS_FILE_NAME
+ "#" + ((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName() + "#" + ((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName()
+ "." + ((FieldDoc) holder).name(), + "." + ((FieldDoc) holder).name(),
@ -179,18 +173,19 @@ public class TagletWriterImpl extends TagletWriter {
if ((SerializedFormBuilder.serialInclude(holder) && if ((SerializedFormBuilder.serialInclude(holder) &&
SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) { SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) {
result = addSeeHeader(result); result = addSeeHeader(result);
result += htmlWriter.getHyperLink(htmlWriter.relativePath + "serialized-form.html", result += htmlWriter.getHyperLinkString(htmlWriter.relativePath + "serialized-form.html",
((ClassDoc)holder).qualifiedName(), htmlWriter.configuration.getText("doclet.Serialized_Form"), false); ((ClassDoc)holder).qualifiedName(), htmlWriter.configuration.getText("doclet.Serialized_Form"), false);
} }
} }
return result.equals("") ? null : new TagletOutputImpl(result + "</DD>"); return result.equals("") ? null : new TagletOutputImpl(result + "</dd>");
} }
private String addSeeHeader(String result) { private String addSeeHeader(String result) {
if (result != null && result.length() > 0) { if (result != null && result.length() > 0) {
return result + ", " + DocletConstants.NL; return result + ", " + DocletConstants.NL;
} else { } else {
return "<DT><STRONG>" + htmlWriter.configuration().getText("doclet.See_Also") + "</STRONG></DT><DD>"; return "<dt><span class=\"strong\">" +
htmlWriter.configuration().getText("doclet.See_Also") + "</span></dt><dd>";
} }
} }
@ -198,15 +193,15 @@ public class TagletWriterImpl extends TagletWriter {
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) { public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) {
String result = "<DT><STRONG>" + header + "</STRONG></DT>" + DocletConstants.NL + String result = "<dt><span class=\"strong\">" + header + "</span></dt>" + DocletConstants.NL +
" <DD>"; " <dd>";
for (int i = 0; i < simpleTags.length; i++) { for (int i = 0; i < simpleTags.length; i++) {
if (i > 0) { if (i > 0) {
result += ", "; result += ", ";
} }
result += htmlWriter.commentTagsToString(simpleTags[i], null, simpleTags[i].inlineTags(), false); result += htmlWriter.commentTagsToString(simpleTags[i], null, simpleTags[i].inlineTags(), false);
} }
result += "</DD>" + DocletConstants.NL; result += "</dd>" + DocletConstants.NL;
return new TagletOutputImpl(result); return new TagletOutputImpl(result);
} }
@ -214,24 +209,24 @@ public class TagletWriterImpl extends TagletWriter {
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput simpleTagOutput(Tag simpleTag, String header) { public TagletOutput simpleTagOutput(Tag simpleTag, String header) {
return new TagletOutputImpl("<DT><STRONG>" + header + "</STRONG></DT>" + " <DD>" return new TagletOutputImpl("<dt><span class=\"strong\">" + header + "</span></dt>" + " <dd>"
+ htmlWriter.commentTagsToString(simpleTag, null, simpleTag.inlineTags(), false) + htmlWriter.commentTagsToString(simpleTag, null, simpleTag.inlineTags(), false)
+ "</DD>" + DocletConstants.NL); + "</dd>" + DocletConstants.NL);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput getThrowsHeader() { public TagletOutput getThrowsHeader() {
return new TagletOutputImpl(DocletConstants.NL + "<DT>" + "<STRONG>" + return new TagletOutputImpl(DocletConstants.NL + "<dt>" + "<span class=\"strong\">" +
htmlWriter.configuration().getText("doclet.Throws") + "</STRONG></DT>"); htmlWriter.configuration().getText("doclet.Throws") + "</span></dt>");
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput throwsTagOutput(ThrowsTag throwsTag) { public TagletOutput throwsTagOutput(ThrowsTag throwsTag) {
String result = DocletConstants.NL + "<DD>"; String result = DocletConstants.NL + "<dd>";
result += throwsTag.exceptionType() == null ? result += throwsTag.exceptionType() == null ?
htmlWriter.codeText(throwsTag.exceptionName()) : htmlWriter.codeText(throwsTag.exceptionName()) :
htmlWriter.codeText( htmlWriter.codeText(
@ -243,7 +238,7 @@ public class TagletWriterImpl extends TagletWriter {
if (text != null && text.toString().length() > 0) { if (text != null && text.toString().length() > 0) {
result += " - " + text; result += " - " + text;
} }
result += "</DD>"; result += "</dd>";
return new TagletOutputImpl(result); return new TagletOutputImpl(result);
} }
@ -251,9 +246,9 @@ public class TagletWriterImpl extends TagletWriter {
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput throwsTagOutput(Type throwsType) { public TagletOutput throwsTagOutput(Type throwsType) {
return new TagletOutputImpl(DocletConstants.NL + "<DD>" + return new TagletOutputImpl(DocletConstants.NL + "<dd>" +
htmlWriter.codeText(htmlWriter.getLink( htmlWriter.codeText(htmlWriter.getLink(
new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, throwsType))) + "</DD>"); new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, throwsType))) + "</dd>");
} }
/** /**

View file

@ -29,6 +29,8 @@ import java.io.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
* Generate Class Hierarchy page for all the Classes in this run. Use * Generate Class Hierarchy page for all the Classes in this run. Use
@ -37,6 +39,7 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
* current or the destination directory. * current or the destination directory.
* *
* @author Atul M Dambalkar * @author Atul M Dambalkar
* @author Bhavesh Patel (Modified)
*/ */
public class TreeWriter extends AbstractTreeWriter { public class TreeWriter extends AbstractTreeWriter {
@ -90,86 +93,70 @@ public class TreeWriter extends AbstractTreeWriter {
} }
/** /**
* Print the interface hierarchy and class hierarchy in the file. * Generate the interface hierarchy and class hierarchy.
*/ */
public void generateTreeFile() throws IOException { public void generateTreeFile() throws IOException {
printHtmlHeader(configuration.getText("doclet.Window_Class_Hierarchy"), Content body = getTreeHeader();
null, true); Content headContent = getResource("doclet.Hierarchy_For_All_Packages");
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
printTreeHeader(); HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
printPageHeading(); addPackageTreeLinks(div);
body.addContent(div);
printPackageTreeLinks(); HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
divTree.addStyle(HtmlStyle.contentContainer);
generateTree(classtree.baseclasses(), "doclet.Class_Hierarchy"); addTree(classtree.baseclasses(), "doclet.Class_Hierarchy", divTree);
generateTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy"); addTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy", divTree);
generateTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy"); addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", divTree);
generateTree(classtree.baseEnums(), "doclet.Enum_Hierarchy"); addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", divTree);
body.addContent(divTree);
printTreeFooter(); addNavLinks(false, body);
addBottom(body);
printHtmlDocument(null, true, body);
} }
/** /**
* Generate the links to all the package tree files. * Add the links to all the package tree files.
*
* @param contentTree the content tree to which the links will be added
*/ */
protected void printPackageTreeLinks() { protected void addPackageTreeLinks(Content contentTree) {
//Do nothing if only unnamed package is used //Do nothing if only unnamed package is used
if (packages.length == 1 && packages[0].name().length() == 0) { if (packages.length == 1 && packages[0].name().length() == 0) {
return; return;
} }
if (!classesonly) { if (!classesonly) {
dl(); Content span = HtmlTree.SPAN(HtmlStyle.strong,
dt(); getResource("doclet.Package_Hierarchies"));
strongText("doclet.Package_Hierarchies"); contentTree.addContent(span);
dtEnd(); HtmlTree ul = new HtmlTree(HtmlTag.UL);
dd(); ul.addStyle(HtmlStyle.horizontal);
for (int i = 0; i < packages.length; i++) { for (int i = 0; i < packages.length; i++) {
if (packages[i].name().length() == 0) { if (packages[i].name().length() == 0) {
continue; continue;
} }
String filename = pathString(packages[i], "package-tree.html"); String link = pathString(packages[i], "package-tree.html");
printHyperLink(filename, "", packages[i].name()); Content li = HtmlTree.LI(getHyperLink(
link, "", new StringContent(packages[i].name())));
if (i < packages.length - 1) { if (i < packages.length - 1) {
print(", "); li.addContent(", ");
} }
ul.addContent(li);
} }
ddEnd(); contentTree.addContent(ul);
dlEnd();
hr();
} }
} }
/** /**
* Print the top text (from the -top option) and * Get the tree header.
* navigation bar at the top of page. *
* @return a content tree for the tree header
*/ */
protected void printTreeHeader() { protected Content getTreeHeader() {
printTop(); String title = configuration.getText("doclet.Window_Class_Hierarchy");
navLinks(true); Content bodyTree = getBody(true, getWindowTitle(title));
hr(); addTop(bodyTree);
} addNavLinks(true, bodyTree);
return bodyTree;
/**
* Print the navigation bar and bottom text (from the -bottom option)
* at the bottom of page.
*/
protected void printTreeFooter() {
hr();
navLinks(false);
printBottom();
printBodyHtmlEnd();
}
/**
* Print the page title "Hierarchy For All Packages" at the top of the tree
* page.
*/
protected void printPageHeading() {
center();
h2();
printText("doclet.Hierarchy_For_All_Packages");
h2End();
centerEnd();
} }
} }

View file

@ -0,0 +1,90 @@
/*
* Copyright (c) 2010, 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;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.util.*;
/**
* Class for generating a comment for HTML pages of javadoc output.
*
* @author Bhavesh Patel
*/
public class Comment extends Content{
private String commentText;
/**
* Constructor to construct a Comment object.
*
* @param comment comment text for the comment
*/
public Comment(String comment) {
commentText = nullCheck(comment);
}
/**
* This method is not supported by the class.
*
* @param content content that needs to be added
* @throws DocletAbortException this method will always throw a
* DocletAbortException because it
* is not supported.
*/
public void addContent(Content content) {
throw new DocletAbortException();
}
/**
* This method is not supported by the class.
*
* @param stringContent string content that needs to be added
* @throws DocletAbortException this method will always throw a
* DocletAbortException because it
* is not supported.
*/
public void addContent(String stringContent) {
throw new DocletAbortException();
}
/**
* {@inheritDoc}
*/
public boolean isEmpty() {
return commentText.isEmpty();
}
/**
* {@inheritDoc}
*/
public void write(StringBuilder contentBuilder) {
if (!endsWithNewLine(contentBuilder))
contentBuilder.append("\n");
contentBuilder.append("<!-- ");
contentBuilder.append(commentText);
contentBuilder.append(" -->\n");
}
}

View file

@ -0,0 +1,113 @@
/*
* Copyright (c) 2010, 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;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.util.*;
/**
* Class for generating document type for HTML pages of javadoc output.
*
* @author Bhavesh Patel
*/
public class DocType extends Content{
private String docType;
private static DocType transitional;
private static DocType frameset;
/**
* Constructor to construct a DocType object.
*
* @param type the doctype to be added
*/
private DocType(String type, String dtd) {
docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " + type +
"//EN\" \"" + dtd + "\">\n";
}
/**
* Construct and return a HTML 4.01 transitional DocType content
*
* @return a content tree for transitional DocType
*/
public static DocType Transitional() {
if (transitional == null)
transitional = new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd");
return transitional;
}
/**
* Construct and return a HTML 4.01 frameset DocType content
*
* @return a content tree for frameset DocType
*/
public static DocType Frameset() {
if (frameset == null)
frameset = new DocType("Frameset", "http://www.w3.org/TR/html4/frameset.dtd");
return frameset;
}
/**
* This method is not supported by the class.
*
* @param content content that needs to be added
* @throws DocletAbortException this method will always throw a
* DocletAbortException because it
* is not supported.
*/
public void addContent(Content content) {
throw new DocletAbortException();
}
/**
* This method is not supported by the class.
*
* @param stringContent string content that needs to be added
* @throws DocletAbortException this method will always throw a
* DocletAbortException because it
* is not supported.
*/
public void addContent(String stringContent) {
throw new DocletAbortException();
}
/**
* {@inheritDoc}
*/
public boolean isEmpty() {
return (docType.length() == 0);
}
/**
* {@inheritDoc}
*/
public void write(StringBuilder contentBuilder) {
contentBuilder.append(docType);
}
}

View file

@ -0,0 +1,73 @@
/*
* Copyright (c) 2010, 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 HTML tag attributes.
*
* @author Bhavesh Patel
*/
public enum HtmlAttr {
ALT,
BORDER,
CELLPADDING,
CELLSPACING,
CHARSET,
CLASS,
CLEAR,
COLS,
CONTENT,
HREF,
HTTP_EQUIV("http-equiv"),
ID,
LANG,
NAME,
ONLOAD,
REL,
ROWS,
SCOPE,
SCROLLING,
SRC,
SUMMARY,
TARGET,
TITLE,
TYPE,
WIDTH;
private final String value;
HtmlAttr() {
this.value = name().toLowerCase();
}
HtmlAttr(String name) {
this.value = name;
}
public String toString() {
return value;
}
}

View file

@ -0,0 +1,189 @@
/*
* Copyright (c) 2010, 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;
import com.sun.tools.doclets.internal.toolkit.Content;
/**
* Stores constants for Html Doclet.
*
* @author Bhavesh Patel
*/
public class HtmlConstants {
/**
* Marker to identify start of top navigation bar.
*/
public static final Content START_OF_TOP_NAVBAR =
new Comment("========= START OF TOP NAVBAR =======");
/**
* Marker to identify start of bottom navigation bar.
*/
public static final Content START_OF_BOTTOM_NAVBAR =
new Comment("======= START OF BOTTOM NAVBAR ======");
/**
* Marker to identify end of top navigation bar.
*/
public static final Content END_OF_TOP_NAVBAR =
new Comment("========= END OF TOP NAVBAR =========");
/**
* Marker to identify end of bottom navigation bar.
*/
public static final Content END_OF_BOTTOM_NAVBAR =
new Comment("======== END OF BOTTOM NAVBAR =======");
/**
* Marker to identify start of class data.
*/
public static final Content START_OF_CLASS_DATA =
new Comment("======== START OF CLASS DATA ========");
/**
* Marker to identify end of class data.
*/
public static final Content END_OF_CLASS_DATA =
new Comment("========= END OF CLASS DATA =========");
/**
* Marker to identify start of nested class summary.
*/
public static final Content START_OF_NESTED_CLASS_SUMMARY =
new Comment("======== NESTED CLASS SUMMARY ========");
/**
* Marker to identify start of annotation type optional member summary.
*/
public static final Content START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY =
new Comment("=========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY ===========");
/**
* Marker to identify start of annotation type required member summary.
*/
public static final Content START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY =
new Comment("=========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY ===========");
/**
* Marker to identify start of constructor summary.
*/
public static final Content START_OF_CONSTRUCTOR_SUMMARY =
new Comment("======== CONSTRUCTOR SUMMARY ========");
/**
* Marker to identify start of enum constants summary.
*/
public static final Content START_OF_ENUM_CONSTANT_SUMMARY =
new Comment("=========== ENUM CONSTANT SUMMARY ===========");
/**
* Marker to identify start of field summary.
*/
public static final Content START_OF_FIELD_SUMMARY =
new Comment("=========== FIELD SUMMARY ===========");
/**
* Marker to identify start of method summary.
*/
public static final Content START_OF_METHOD_SUMMARY =
new Comment("========== METHOD SUMMARY ===========");
/**
* Marker to identify start of annotation type details.
*/
public static final Content START_OF_ANNOTATION_TYPE_DETAILS =
new Comment("============ ANNOTATION TYPE MEMBER DETAIL ===========");
/**
* Marker to identify start of method details.
*/
public static final Content START_OF_METHOD_DETAILS =
new Comment("============ METHOD DETAIL ==========");
/**
* Marker to identify start of field details.
*/
public static final Content START_OF_FIELD_DETAILS =
new Comment("============ FIELD DETAIL ===========");
/**
* Marker to identify start of constructor details.
*/
public static final Content START_OF_CONSTRUCTOR_DETAILS =
new Comment("========= CONSTRUCTOR DETAIL ========");
/**
* Marker to identify start of enum constants details.
*/
public static final Content START_OF_ENUM_CONSTANT_DETAILS =
new Comment("============ ENUM CONSTANT DETAIL ===========");
/**
* Html tag for the page title heading.
*/
public static final HtmlTag TITLE_HEADING = HtmlTag.H1;
/**
* Html tag for the class page title heading.
*/
public static final HtmlTag CLASS_PAGE_HEADING = HtmlTag.H2;
/**
* Html tag for the content heading.
*/
public static final HtmlTag CONTENT_HEADING = HtmlTag.H2;
/**
* Html tag for the package name heading.
*/
public static final HtmlTag PACKAGE_HEADING = HtmlTag.H2;
/**
* Html tag for the member summary heading.
*/
public static final HtmlTag SUMMARY_HEADING = HtmlTag.H3;
/**
* Html tag for the inherited member summary heading.
*/
public static final HtmlTag INHERITED_SUMMARY_HEADING = HtmlTag.H3;
/**
* Html tag for the member details heading.
*/
public static final HtmlTag DETAILS_HEADING = HtmlTag.H3;
/**
* Html tag for the serialized member heading.
*/
public static final HtmlTag SERIALIZED_MEMBER_HEADING = HtmlTag.H3;
/**
* Html tag for the member heading.
*/
public static final HtmlTag MEMBER_HEADING = HtmlTag.H4;
}

View file

@ -87,7 +87,7 @@ public abstract class HtmlDocWriter extends HtmlWriter {
*/ */
public void printHyperLink(String link, String where, public void printHyperLink(String link, String where,
String label, boolean strong) { String label, boolean strong) {
print(getHyperLink(link, where, label, strong, "", "", "")); print(getHyperLinkString(link, where, label, strong, "", "", ""));
} }
/** /**
@ -115,7 +115,7 @@ public abstract class HtmlDocWriter extends HtmlWriter {
public void printHyperLink(String link, String where, public void printHyperLink(String link, String where,
String label, boolean strong, String label, boolean strong,
String stylename) { String stylename) {
print(getHyperLink(link, where, label, strong, stylename, "", "")); print(getHyperLinkString(link, where, label, strong, stylename, "", ""));
} }
/** /**
@ -128,9 +128,9 @@ public abstract class HtmlDocWriter extends HtmlWriter {
* @param strong Boolean that sets label to strong. * @param strong Boolean that sets label to strong.
* @return String Hyper Link. * @return String Hyper Link.
*/ */
public String getHyperLink(String link, String where, public String getHyperLinkString(String link, String where,
String label, boolean strong) { String label, boolean strong) {
return getHyperLink(link, where, label, strong, "", "", ""); return getHyperLinkString(link, where, label, strong, "", "", "");
} }
/** /**
@ -144,10 +144,24 @@ public abstract class HtmlDocWriter extends HtmlWriter {
* @param stylename String style of text defined in style sheet. * @param stylename String style of text defined in style sheet.
* @return String Hyper Link. * @return String Hyper Link.
*/ */
public String getHyperLink(String link, String where, public String getHyperLinkString(String link, String where,
String label, boolean strong, String label, boolean strong,
String stylename) { String stylename) {
return getHyperLink(link, where, label, strong, stylename, "", ""); return getHyperLinkString(link, where, label, strong, stylename, "", "");
}
/**
* Get Html Hyper Link string.
*
* @param link String name of the file.
* @param where Position of the link in the file. Character '#' is not
* needed.
* @param label Tag for the link.
* @return a content tree for the hyper link
*/
public Content getHyperLink(String link, String where,
Content label) {
return getHyperLink(link, where, label, "", "");
} }
/** /**
@ -163,11 +177,11 @@ public abstract class HtmlDocWriter extends HtmlWriter {
* @param target Target frame. * @param target Target frame.
* @return String Hyper Link. * @return String Hyper Link.
*/ */
public String getHyperLink(String link, String where, public String getHyperLinkString(String link, String where,
String label, boolean strong, String label, boolean strong,
String stylename, String title, String target) { String stylename, String title, String target) {
StringBuffer retlink = new StringBuffer(); StringBuffer retlink = new StringBuffer();
retlink.append("<A HREF=\""); retlink.append("<a href=\"");
retlink.append(link); retlink.append(link);
if (where != null && where.length() != 0) { if (where != null && where.length() != 0) {
retlink.append("#"); retlink.append("#");
@ -187,27 +201,54 @@ public abstract class HtmlDocWriter extends HtmlWriter {
retlink.append("\">"); retlink.append("\">");
} }
if (strong) { if (strong) {
retlink.append("<STRONG>"); retlink.append("<span class=\"strong\">");
} }
retlink.append(label); retlink.append(label);
if (strong) { if (strong) {
retlink.append("</STRONG>"); retlink.append("</span>");
} }
if (stylename != null && stylename.length() != 0) { if (stylename != null && stylename.length() != 0) {
retlink.append("</FONT>"); retlink.append("</FONT>");
} }
retlink.append("</A>"); retlink.append("</a>");
return retlink.toString(); return retlink.toString();
} }
/** /**
* Print link without positioning in the file. * Get Html Hyper Link.
* *
* @param link String name of the file. * @param link String name of the file.
* @param where Position of the link in the file. Character '#' is not
* needed.
* @param label Tag for the link. * @param label Tag for the link.
* @param title String that describes the link's content for accessibility.
* @param target Target frame.
* @return a content tree for the hyper link.
*/ */
public void printHyperLink(String link, String label) { public Content getHyperLink(String link, String where,
print(getHyperLink(link, "", label, false)); Content label, String title, String target) {
if (where != null && where.length() != 0) {
link += "#" + where;
}
HtmlTree anchor = HtmlTree.A(link, label);
if (title != null && title.length() != 0) {
anchor.addAttr(HtmlAttr.TITLE, title);
}
if (target != null && target.length() != 0) {
anchor.addAttr(HtmlAttr.TARGET, target);
}
return anchor;
}
/**
* Get a hyperlink to a file.
*
* @param link String name of the file
* @param label Label for the link
* @return a content for the hyperlink to the file
*/
public Content getHyperLink(String link, Content label) {
return getHyperLink(link, "", label);
} }
/** /**
@ -217,8 +258,8 @@ public abstract class HtmlDocWriter extends HtmlWriter {
* @param label Tag for the link. * @param label Tag for the link.
* @return Strign Hyper link. * @return Strign Hyper link.
*/ */
public String getHyperLink(String link, String label) { public String getHyperLinkString(String link, String label) {
return getHyperLink(link, "", label, false); return getHyperLinkString(link, "", label, false);
} }
/** /**
@ -273,54 +314,32 @@ public abstract class HtmlDocWriter extends HtmlWriter {
* Print the frameset version of the Html file header. * Print the frameset version of the Html file header.
* Called only when generating an HTML frameset file. * Called only when generating an HTML frameset file.
* *
* @param title Title of this HTML document. * @param title Title of this HTML document
* @param noTimeStamp If true, don't print time stamp in header
* @param frameset the frameset to be added to the HTML document
*/ */
public void printFramesetHeader(String title) { public void printFramesetDocument(String title, boolean noTimeStamp,
printFramesetHeader(title, false); Content frameset) {
} Content htmlDocType = DocType.Frameset();
Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
/** Content head = new HtmlTree(HtmlTag.HEAD);
* Print the frameset version of the Html file header.
* Called only when generating an HTML frameset file.
*
* @param title Title of this HTML document.
* @param noTimeStamp If true, don't print time stamp in header.
*/
public void printFramesetHeader(String title, boolean noTimeStamp) {
println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " +
"Frameset//EN\" " +
"\"http://www.w3.org/TR/html4/frameset.dtd\">");
println("<!--NewPage-->");
html();
head();
if (! noTimeStamp) { if (! noTimeStamp) {
print("<!-- Generated by javadoc on "); Content headComment = new Comment("Generated by javadoc on " + today());
print(today()); head.addContent(headComment);
println("-->");
} }
if (configuration.charset.length() > 0) { if (configuration.charset.length() > 0) {
println("<META http-equiv=\"Content-Type\" content=\"text/html; " Content meta = HtmlTree.META("Content-Type", "text/html",
+ "charset=" + configuration.charset + "\">"); configuration.charset);
head.addContent(meta);
} }
title(); Content windowTitle = HtmlTree.TITLE(new StringContent(title));
println(title); head.addContent(windowTitle);
titleEnd(); head.addContent(getFramesetJavaScript());
//Script to set the classFrame if necessary. Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
script(); head, frameset);
println(" targetPage = \"\" + window.location.search;"); Content htmlDocument = new HtmlDocument(htmlDocType,
println(" if (targetPage != \"\" && targetPage != \"undefined\")"); htmlComment, htmlTree);
println(" targetPage = targetPage.substring(1);"); print(htmlDocument.toString());
println(" if (targetPage.indexOf(\":\") != -1)");
println(" targetPage = \"undefined\";");
println(" function loadFrames() {");
println(" if (targetPage != \"\" && targetPage != \"undefined\")");
println(" top.classFrame.location = top.targetPage;");
println(" }");
scriptEnd();
noScript();
noScriptEnd();
headEnd();
} }
/** /**

View file

@ -0,0 +1,103 @@
/*
* Copyright (c) 2010, 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;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.util.*;
/**
* Class for generating an HTML document for javadoc output.
*
* @author Bhavesh Patel
*/
public class HtmlDocument extends Content {
private List<Content> docContent = Collections.<Content>emptyList();
/**
* Constructor to construct an HTML document.
*
* @param docType document type for the HTML document
* @param docComment comment for the document
* @param htmlTree HTML tree of the document
*/
public HtmlDocument(Content docType, Content docComment, Content htmlTree) {
docContent = new ArrayList<Content>();
addContent(nullCheck(docType));
addContent(nullCheck(docComment));
addContent(nullCheck(htmlTree));
}
/**
* Constructor to construct an HTML document.
*
* @param docType document type for the HTML document
* @param htmlTree HTML tree of the document
*/
public HtmlDocument(Content docType, Content htmlTree) {
docContent = new ArrayList<Content>();
addContent(nullCheck(docType));
addContent(nullCheck(htmlTree));
}
/**
* Adds content for the HTML document.
*
* @param htmlContent html content to be added
*/
public void addContent(Content htmlContent) {
if (htmlContent.isValid())
docContent.add(htmlContent);
}
/**
* This method is not supported by the class.
*
* @param stringContent string content that needs to be added
* @throws DocletAbortException this method will always throw a
* DocletAbortException because it
* is not supported.
*/
public void addContent(String stringContent) {
throw new DocletAbortException();
}
/**
* {@inheritDoc}
*/
public boolean isEmpty() {
return (docContent.isEmpty());
}
/**
* {@inheritDoc}
*/
public void write(StringBuilder contentBuilder) {
for (Content c : docContent)
c.write(contentBuilder);
}
}

View file

@ -0,0 +1,73 @@
/*
* Copyright (c) 2010, 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 HTML styles. The name map to values in the CSS file.
*
* @author Bhavesh Patel
*/
public enum HtmlStyle {
aboutLanguage,
altColor,
bar,
block,
blockList,
blockListLast,
bottomNav,
classUseContainer,
colFirst,
colLast,
colOne,
constantValuesContainer,
contentContainer,
description,
details,
header,
horizontal,
footer,
indexContainer,
indexHeader,
inheritance,
legalCopy,
nameValue,
navBarCell1Rev,
navList,
overviewSummary,
packageSummary,
rowColor,
serializedFormContainer,
sourceContainer,
sourceLineNo,
strong,
subNav,
subNavList,
subTitle,
summary,
tabEnd,
title,
topNav;
}

View file

@ -0,0 +1,126 @@
/*
* Copyright (c) 2010, 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 HTML tags.
*
* @author Bhavesh Patel
*/
public enum HtmlTag {
A(BlockType.INLINE, EndTag.END),
BLOCKQUOTE,
BODY(BlockType.OTHER, EndTag.END),
BR(BlockType.INLINE, EndTag.NOEND),
CAPTION,
CENTER,
CODE(BlockType.INLINE, EndTag.END),
DD,
DIV,
DL,
DT,
EM(BlockType.INLINE, EndTag.END),
FONT(BlockType.INLINE, EndTag.END),
FRAME(BlockType.OTHER, EndTag.NOEND),
FRAMESET(BlockType.OTHER, EndTag.END),
H1,
H2,
H3,
H4,
H5,
H6,
HEAD(BlockType.OTHER, EndTag.END),
HR(BlockType.BLOCK, EndTag.NOEND),
HTML(BlockType.OTHER, EndTag.END),
I(BlockType.INLINE, EndTag.END),
IMG(BlockType.INLINE, EndTag.NOEND),
LI,
LINK(BlockType.OTHER, EndTag.NOEND),
MENU,
META(BlockType.OTHER, EndTag.NOEND),
NOFRAMES(BlockType.OTHER, EndTag.END),
NOSCRIPT(BlockType.OTHER, EndTag.END),
OL,
P,
PRE,
SCRIPT(BlockType.OTHER, EndTag.END),
SMALL(BlockType.INLINE, EndTag.END),
SPAN(BlockType.INLINE, EndTag.END),
STRONG(BlockType.INLINE, EndTag.END),
TABLE,
TBODY,
TD,
TH,
TITLE(BlockType.OTHER, EndTag.END),
TR,
TT(BlockType.INLINE, EndTag.END),
UL;
protected final BlockType blockType;
protected final EndTag endTag;
private final String value;
/**
* Enum representing the type of HTML element.
*/
protected static enum BlockType {
BLOCK,
INLINE,
OTHER;
}
/**
* Enum representing HTML end tag requirement.
*/
protected static enum EndTag {
END,
NOEND;
}
HtmlTag() {
this(BlockType.BLOCK, EndTag.END);
}
HtmlTag(BlockType blockType, EndTag endTag ) {
this.blockType = blockType;
this.endTag = endTag;
this.value = name().toLowerCase();
}
/**
* Returns true if the end tag is required. This is specific to the standard
* doclet and does not exactly resemble the W3C specifications.
*
* @return true if end tag needs to be displayed else return false
*/
public boolean endTagRequired() {
return (endTag == EndTag.END);
}
public String toString() {
return value;
}
}

View file

@ -0,0 +1,777 @@
/*
* Copyright (c) 2010, 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;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.util.*;
/**
* Class for generating HTML tree for javadoc output.
*
* @author Bhavesh Patel
*/
public class HtmlTree extends Content {
private HtmlTag htmlTag;
private Map<HtmlAttr,String> attrs = Collections.<HtmlAttr,String>emptyMap();
private List<Content> content = Collections.<Content>emptyList();
public static final Content EMPTY = new StringContent("");
/**
* Constructor to construct HtmlTree object.
*
* @param tag HTML tag for the HtmlTree object
*/
public HtmlTree(HtmlTag tag) {
htmlTag = nullCheck(tag);
}
/**
* Constructor to construct HtmlTree object.
*
* @param tag HTML tag for the HtmlTree object
* @param contents contents to be added to the tree
*/
public HtmlTree(HtmlTag tag, Content... contents) {
this(tag);
for (Content content: contents)
addContent(content);
}
/**
* Adds an attribute for the HTML tag.
*
* @param attrName name of the attribute
* @param attrValue value of the attribute
*/
public void addAttr(HtmlAttr attrName, String attrValue) {
if (attrs.isEmpty())
attrs = new LinkedHashMap<HtmlAttr,String>();
attrs.put(nullCheck(attrName), nullCheck(attrValue));
}
/**
* Adds a style for the HTML tag.
*
* @param style style to be added
*/
public void addStyle(HtmlStyle style) {
addAttr(HtmlAttr.CLASS, style.toString());
}
/**
* Adds content for the HTML tag.
*
* @param tagContent tag content to be added
*/
public void addContent(Content tagContent) {
if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
if (content.isEmpty())
content = new ArrayList<Content>();
content.add(tagContent);
}
}
/**
* This method adds a string content to the htmltree. If the last content member
* added is a StringContent, append the string to that StringContent or else
* create a new StringContent and add it to the html tree.
*
* @param stringContent string content that needs to be added
*/
public void addContent(String stringContent) {
if (!content.isEmpty()) {
Content lastContent = content.get(content.size() - 1);
if (lastContent instanceof StringContent)
lastContent.addContent(stringContent);
else
addContent(new StringContent(stringContent));
}
else
addContent(new StringContent(stringContent));
}
/**
* Generates an HTML anchor tag.
*
* @param ref reference url for the anchor tag
* @param body content for the anchor tag
* @return an HtmlTree object
*/
public static HtmlTree A(String ref, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body));
htmltree.addAttr(HtmlAttr.HREF, nullCheck(ref));
return htmltree;
}
/**
* Generates an HTML anchor tag with name attribute and content.
*
* @param name name 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) {
HtmlTree htmltree = new HtmlTree(HtmlTag.A);
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
return htmltree;
}
/**
* Generates a CAPTION tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the CAPTION tag
*/
public static HtmlTree CAPTION(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.CAPTION, nullCheck(body));
return htmltree;
}
/**
* Generates a CODE tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the CODE tag
*/
public static HtmlTree CODE(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.CODE, nullCheck(body));
return htmltree;
}
/**
* Generates a DD tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the DD tag
*/
public static HtmlTree DD(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.DD, nullCheck(body));
return htmltree;
}
/**
* Generates a DL tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the DL tag
*/
public static HtmlTree DL(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.DL, nullCheck(body));
return htmltree;
}
/**
* Generates a DIV tag with the style class attributes. It also encloses
* a content.
*
* @param styleClass stylesheet class for the tag
* @param body content for the tag
* @return an HtmlTree object for the DIV tag
*/
public static HtmlTree DIV(HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.DIV, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
return htmltree;
}
/**
* Generates a DIV tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the DIV tag
*/
public static HtmlTree DIV(Content body) {
return DIV(null, body);
}
/**
* Generates a DT tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the DT tag
*/
public static HtmlTree DT(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.DT, nullCheck(body));
return htmltree;
}
/**
* Generates a EM tag with some content.
*
* @param body content to be added to the tag
* @return an HtmlTree object for the EM tag
*/
public static HtmlTree EM(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.EM, nullCheck(body));
return htmltree;
}
/**
* Generates a FRAME 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
* @param scrolling specifies whether to display scrollbars in the frame
* @return an HtmlTree object for the FRAME tag
*/
public static HtmlTree FRAME(String src, String name, String title, String scrolling) {
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAME);
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
if (scrolling != null)
htmltree.addAttr(HtmlAttr.SCROLLING, scrolling);
return htmltree;
}
/**
* Generates a Frame 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 SPAN tag
*/
public static HtmlTree FRAME(String src, String name, String title) {
return FRAME(src, name, title, null);
}
/**
* Generates a FRAMESET tag.
*
* @param cols the size of columns in the frameset
* @param rows the size of rows in the frameset
* @param title the title for the frameset
* @param onload the script to run when the document loads
* @return an HtmlTree object for the FRAMESET tag
*/
public static HtmlTree FRAMESET(String cols, String rows, String title, String onload) {
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAMESET);
if (cols != null)
htmltree.addAttr(HtmlAttr.COLS, cols);
if (rows != null)
htmltree.addAttr(HtmlAttr.ROWS, rows);
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
htmltree.addAttr(HtmlAttr.ONLOAD, nullCheck(onload));
return htmltree;
}
/**
* Generates a heading tag (h1 to h6) with the title and style class attributes. It also encloses
* a content.
*
* @param headingTag the heading tag to be generated
* @param printTitle true if title for the tag needs to be printed else false
* @param styleClass stylesheet class for the tag
* @param body content for the tag
* @return an HtmlTree object for the tag
*/
public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle,
HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body));
if (printTitle)
htmltree.addAttr(HtmlAttr.TITLE, Util.stripHtml(body.toString()));
if (styleClass != null)
htmltree.addStyle(styleClass);
return htmltree;
}
/**
* Generates a heading tag (h1 to h6) with style class attribute. It also encloses
* a content.
*
* @param headingTag the heading tag to be generated
* @param styleClass stylesheet class for the tag
* @param body content for the tag
* @return an HtmlTree object for the tag
*/
public static HtmlTree HEADING(HtmlTag headingTag, HtmlStyle styleClass, Content body) {
return HEADING(headingTag, false, styleClass, body);
}
/**
* Generates a heading tag (h1 to h6) with the title attribute. It also encloses
* a content.
*
* @param headingTag the heading tag to be generated
* @param printTitle true if the title for the tag needs to be printed else false
* @param body content for the tag
* @return an HtmlTree object for the tag
*/
public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle, Content body) {
return HEADING(headingTag, printTitle, null, body);
}
/**
* Generates a heading tag (h1 to h6) with some content.
*
* @param headingTag the heading tag to be generated
* @param body content for the tag
* @return an HtmlTree object for the tag
*/
public static HtmlTree HEADING(HtmlTag headingTag, Content body) {
return HEADING(headingTag, false, null, body);
}
/**
* Generates an HTML tag with lang attribute. It also adds head and body
* content to the HTML tree.
*
* @param lang language for the HTML document
* @param head head for the HTML tag
* @param body body for the HTML tag
* @return an HtmlTree object for the HTML tag
*/
public static HtmlTree HTML(String lang, Content head, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.HTML, nullCheck(head), nullCheck(body));
htmltree.addAttr(HtmlAttr.LANG, nullCheck(lang));
return htmltree;
}
/**
* Generates a I tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the I tag
*/
public static HtmlTree I(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.I, nullCheck(body));
return htmltree;
}
/**
* Generates a LI tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the LI tag
*/
public static HtmlTree LI(Content body) {
return LI(null, body);
}
/**
* Generates a LI tag with some content.
*
* @param styleClass style for the tag
* @param body content for the tag
* @return an HtmlTree object for the LI tag
*/
public static HtmlTree LI(HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.LI, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
return htmltree;
}
/**
* Generates a LINK tag with the rel, type, href and title attributes.
*
* @param rel relevance of the link
* @param type type of link
* @param href the path for the link
* @param title title for the link
* @return an HtmlTree object for the LINK tag
*/
public static HtmlTree LINK(String rel, String type, String href, String title) {
HtmlTree htmltree = new HtmlTree(HtmlTag.LINK);
htmltree.addAttr(HtmlAttr.REL, nullCheck(rel));
htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
htmltree.addAttr(HtmlAttr.HREF, nullCheck(href));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
return htmltree;
}
/**
* Generates a META tag with the http-equiv, content and charset attributes.
*
* @param http-equiv http equiv attribute for the META tag
* @param content type of content
* @param charset character set used
* @return an HtmlTree object for the META tag
*/
public static HtmlTree META(String httpEquiv, String content, String charSet) {
HtmlTree htmltree = new HtmlTree(HtmlTag.META);
htmltree.addAttr(HtmlAttr.HTTP_EQUIV, nullCheck(httpEquiv));
htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content));
htmltree.addAttr(HtmlAttr.CHARSET, nullCheck(charSet));
return htmltree;
}
/**
* Generates a META tag with the name and content attributes.
*
* @param name name attribute
* @param content type of content
* @return an HtmlTree object for the META tag
*/
public static HtmlTree META(String name, String content) {
HtmlTree htmltree = new HtmlTree(HtmlTag.META);
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content));
return htmltree;
}
/**
* Generates a NOSCRIPT tag with some content.
*
* @param body content of the noscript tag
* @return an HtmlTree object for the NOSCRIPT tag
*/
public static HtmlTree NOSCRIPT(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.NOSCRIPT, nullCheck(body));
return htmltree;
}
/**
* Generates a P tag with some content.
*
* @param body content of the Paragraph tag
* @return an HtmlTree object for the P tag
*/
public static HtmlTree P(Content body) {
return P(null, body);
}
/**
* Generates a P tag with some content.
*
* @param styleClass style of the Paragraph tag
* @param body content of the Paragraph tag
* @return an HtmlTree object for the P tag
*/
public static HtmlTree P(HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.P, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
return htmltree;
}
/**
* Generates a SMALL tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the SMALL tag
*/
public static HtmlTree SMALL(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.SMALL, nullCheck(body));
return htmltree;
}
/**
* Generates a STRONG tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the STRONG tag
*/
public static HtmlTree STRONG(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.STRONG, nullCheck(body));
return htmltree;
}
/**
* Generates a SPAN tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the SPAN tag
*/
public static HtmlTree SPAN(Content body) {
return SPAN(null, body);
}
/**
* Generates a SPAN tag with style class attribute and some content.
*
* @param styleClass style class for the tag
* @param body content for the tag
* @return an HtmlTree object for the SPAN tag
*/
public static HtmlTree SPAN(HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
return htmltree;
}
/**
* Generates a Table tag with border, width and summary attributes and
* some content.
*
* @param border border for the table
* @param width width of 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(int border, int width, String summary,
Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border));
htmltree.addAttr(HtmlAttr.WIDTH, Integer.toString(width));
htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
return htmltree;
}
/**
* Generates a Table tag with style class, border, cell padding,
* cellspacing 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) {
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 border, cell padding,
* cellspacing and summary attributes and some content.
*
* @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(int border, int cellPadding,
int cellSpacing, String summary, Content body) {
return TABLE(null, border, cellPadding, cellSpacing, summary, body);
}
/**
* Generates a TD tag with style class attribute and some content.
*
* @param styleClass style for the tag
* @param body content for the tag
* @return an HtmlTree object for the TD tag
*/
public static HtmlTree TD(HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TD, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
return htmltree;
}
/**
* Generates a TD tag for an HTML table with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the TD tag
*/
public static HtmlTree TD(Content body) {
return TD(null, body);
}
/**
* Generates a TH tag with style class and scope attributes and some content.
*
* @param styleClass style for the tag
* @param scope scope of the tag
* @param body content for the tag
* @return an HtmlTree object for the TH tag
*/
public static HtmlTree TH(HtmlStyle styleClass, String scope, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TH, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
htmltree.addAttr(HtmlAttr.SCOPE, nullCheck(scope));
return htmltree;
}
/**
* Generates a TH tag with scope attribute and some content.
*
* @param scope scope of the tag
* @param body content for the tag
* @return an HtmlTree object for the TH tag
*/
public static HtmlTree TH(String scope, Content body) {
return TH(null, scope, body);
}
/**
* Generates a TITLE tag with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the TITLE tag
*/
public static HtmlTree TITLE(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TITLE, nullCheck(body));
return htmltree;
}
/**
* Generates a TR tag for an HTML table with some content.
*
* @param body content for the tag
* @return an HtmlTree object for the TR tag
*/
public static HtmlTree TR(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TR, nullCheck(body));
return htmltree;
}
/**
* Generates a UL tag with the style class attribute and some content.
*
* @param styleClass style for the tag
* @param body content for the tag
* @return an HtmlTree object for the UL tag
*/
public static HtmlTree UL(HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.UL, nullCheck(body));
htmltree.addStyle(nullCheck(styleClass));
return htmltree;
}
/**
* {@inheritDoc}
*/
public boolean isEmpty() {
return (!hasContent() && !hasAttrs());
}
/**
* Returns true if the HTML tree has content.
*
* @return true if the HTML tree has content else return false
*/
public boolean hasContent() {
return (!content.isEmpty());
}
/**
* Returns true if the HTML tree has attributes.
*
* @return true if the HTML tree has attributes else return false
*/
public boolean hasAttrs() {
return (!attrs.isEmpty());
}
/**
* Returns true if the HTML tree has a specific attribute.
*
* @param attrName name of the attribute to check within the HTML tree
* @return true if the HTML tree has the specified attribute else return false
*/
public boolean hasAttr(HtmlAttr attrName) {
return (attrs.containsKey(attrName));
}
/**
* Returns true if the HTML tree is valid. This check is more specific to
* standard doclet and not exactly similar to W3C specifications. But it
* ensures HTML validation.
*
* @return true if the HTML tree is valid
*/
public boolean isValid() {
switch (htmlTag) {
case A :
return (hasAttr(HtmlAttr.NAME) || (hasAttr(HtmlAttr.HREF) && hasContent()));
case BR :
return (!hasContent() && (!hasAttrs() || hasAttr(HtmlAttr.CLEAR)));
case FRAME :
return (hasAttr(HtmlAttr.SRC) && !hasContent());
case HR :
return (!hasContent());
case IMG :
return (hasAttr(HtmlAttr.SRC) && hasAttr(HtmlAttr.ALT) && !hasContent());
case LINK :
return (hasAttr(HtmlAttr.HREF) && !hasContent());
case META :
return (hasAttr(HtmlAttr.CONTENT) && !hasContent());
default :
return hasContent();
}
}
/**
* Returns true if the element is an inline element.
*
* @return true if the HTML tag is an inline element
*/
public boolean isInline() {
return (htmlTag.blockType == HtmlTag.BlockType.INLINE);
}
/**
* {@inheritDoc}
*/
public void write(StringBuilder contentBuilder) {
if (!isInline() && !endsWithNewLine(contentBuilder))
contentBuilder.append("\n");
String tagString = htmlTag.toString();
contentBuilder.append("<" + tagString);
Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
HtmlAttr key;
String value = "";
while (iterator.hasNext()) {
key = iterator.next();
value = attrs.get(key);
contentBuilder.append(" " + key.toString());
if (!value.isEmpty())
contentBuilder.append("=\"" + value + "\"");
}
contentBuilder.append(">");
for (Content c : content)
c.write(contentBuilder);
if (htmlTag.endTagRequired())
contentBuilder.append("</" + tagString + ">");
if (!isInline())
contentBuilder.append("\n");
}
}

View file

@ -55,7 +55,7 @@ public class HtmlWriter extends PrintWriter {
* URL file separator string("/"). * URL file separator string("/").
*/ */
public static final String fileseparator = public static final String fileseparator =
DirectoryManager.URL_FILE_SEPERATOR; DirectoryManager.URL_FILE_SEPARATOR;
/** /**
* The configuration * The configuration
@ -82,6 +82,72 @@ public class HtmlWriter extends PrintWriter {
*/ */
protected final String modifierTypeHeader; protected final String modifierTypeHeader;
public final Content overviewLabel;
public final Content defaultPackageLabel;
public final Content packageLabel;
public final Content useLabel;
public final Content prevLabel;
public final Content nextLabel;
public final Content prevclassLabel;
public final Content nextclassLabel;
public final Content summaryLabel;
public final Content detailLabel;
public final Content framesLabel;
public final Content noframesLabel;
public final Content treeLabel;
public final Content classLabel;
public final Content deprecatedLabel;
public final Content deprecatedPhrase;
public final Content allclassesLabel;
public final Content indexLabel;
public final Content helpLabel;
public final Content seeLabel;
public final Content descriptionLabel;
public final Content prevpackageLabel;
public final Content nextpackageLabel;
public final Content packagesLabel;
public final Content methodDetailsLabel;
public final Content annotationTypeDetailsLabel;
public final Content fieldDetailsLabel;
public final Content constructorDetailsLabel;
public final Content enumConstantsDetailsLabel;
public final Content specifiedByLabel;
public final Content overridesLabel;
public final Content descfrmClassLabel;
public final Content descfrmInterfaceLabel;
/** /**
* Constructor. * Constructor.
* *
@ -111,6 +177,73 @@ public class HtmlWriter extends PrintWriter {
modifierTypeHeader = configuration.getText("doclet.0_and_1", modifierTypeHeader = configuration.getText("doclet.0_and_1",
configuration.getText("doclet.Modifier"), configuration.getText("doclet.Modifier"),
configuration.getText("doclet.Type")); configuration.getText("doclet.Type"));
overviewLabel = getResource("doclet.Overview");
defaultPackageLabel = new RawHtml(
DocletConstants.DEFAULT_PACKAGE_NAME);
packageLabel = getResource("doclet.Package");
useLabel = getResource("doclet.navClassUse");
prevLabel = getResource("doclet.Prev");
nextLabel = getResource("doclet.Next");
prevclassLabel = getResource("doclet.Prev_Class");
nextclassLabel = getResource("doclet.Next_Class");
summaryLabel = getResource("doclet.Summary");
detailLabel = getResource("doclet.Detail");
framesLabel = getResource("doclet.FRAMES");
noframesLabel = getResource("doclet.NO_FRAMES");
treeLabel = getResource("doclet.Tree");
classLabel = getResource("doclet.Class");
deprecatedLabel = getResource("doclet.navDeprecated");
deprecatedPhrase = getResource("doclet.Deprecated");
allclassesLabel = getResource("doclet.All_Classes");
indexLabel = getResource("doclet.Index");
helpLabel = getResource("doclet.Help");
seeLabel = getResource("doclet.See");
descriptionLabel = getResource("doclet.Description");
prevpackageLabel = getResource("doclet.Prev_Package");
nextpackageLabel = getResource("doclet.Next_Package");
packagesLabel = getResource("doclet.Packages");
methodDetailsLabel = getResource("doclet.Method_Detail");
annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
fieldDetailsLabel = getResource("doclet.Field_Detail");
constructorDetailsLabel = getResource("doclet.Constructor_Detail");
enumConstantsDetailsLabel = getResource("doclet.Enum_Constant_Detail");
specifiedByLabel = getResource("doclet.Specified_By");
overridesLabel = getResource("doclet.Overrides");
descfrmClassLabel = getResource("doclet.Description_From_Class");
descfrmInterfaceLabel = getResource("doclet.Description_From_Interface");
}
/**
* Get the configuration string as a content.
*
* @param key the key to look for in the configuration file
* @return a content tree for the text
*/
public Content getResource(String key) {
return new StringContent(configuration.getText(key));
}
/**
* Get the configuration string as a content.
*
* @param key the key to look for in the configuration file
* @param a1 string argument added to configuration text
* @return a content tree for the text
*/
public Content getResource(String key, String a1) {
return new RawHtml(configuration.getText(key, a1));
}
/**
* Get the configuration string as a content.
*
* @param key the key to look for in the configuration file
* @param a1 string argument added to configuration text
* @param a2 string argument added to configuration text
* @return a content tree for the text
*/
public Content getResource(String key, String a1, String a2) {
return new RawHtml(configuration.getText(key, a1, a2));
} }
/** /**
@ -145,6 +278,48 @@ public class HtmlWriter extends PrintWriter {
} }
} }
/**
* Returns an HtmlTree for the SCRIPT tag.
*
* @return an HtmlTree for the SCRIPT tag
*/
protected HtmlTree getWinTitleScript(){
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
if(winTitle != null && winTitle.length() > 0) {
script.addAttr(HtmlAttr.TYPE, "text/javascript");
String scriptCode = "<!--\n" +
" if (location.href.indexOf('is-external=true') == -1) {\n" +
" parent.document.title=\"" + winTitle + "\";\n" +
" }\n" +
"//-->\n";
RawHtml scriptContent = new RawHtml(scriptCode);
script.addContent(scriptContent);
}
return script;
}
/**
* Returns a content tree for the SCRIPT tag for the main page(index.html).
*
* @return a content for the SCRIPT tag
*/
protected Content getFramesetJavaScript(){
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
script.addAttr(HtmlAttr.TYPE, "text/javascript");
String scriptCode = "\n targetPage = \"\" + window.location.search;\n" +
" if (targetPage != \"\" && targetPage != \"undefined\")\n" +
" targetPage = targetPage.substring(1);\n" +
" if (targetPage.indexOf(\":\") != -1)\n" +
" targetPage = \"undefined\";\n" +
" function loadFrames() {\n" +
" if (targetPage != \"\" && targetPage != \"undefined\")\n" +
" top.classFrame.location = top.targetPage;\n" +
" }\n";
RawHtml scriptContent = new RawHtml(scriptCode);
script.addContent(scriptContent);
return script;
}
/** /**
* Print the Javascript &lt;SCRIPT&gt; start tag with its type * Print the Javascript &lt;SCRIPT&gt; start tag with its type
* attribute. * attribute.
@ -203,6 +378,28 @@ public class HtmlWriter extends PrintWriter {
println(">"); println(">");
} }
/**
* Returns an HtmlTree for the BODY tag.
*
* @param includeScript set true if printing windowtitle script
* @param title title for the window
* @return an HtmlTree for the BODY tag
*/
public HtmlTree getBody(boolean includeScript, String title) {
HtmlTree body = new HtmlTree(HtmlTag.BODY);
// Set window title string which is later printed
this.winTitle = title;
// Don't print windowtitle script for overview-frame, allclasses-frame
// and package-frame
if (includeScript) {
body.addContent(getWinTitleScript());
Content noScript = HtmlTree.NOSCRIPT(
HtmlTree.DIV(getResource("doclet.No_Script_Message")));
body.addContent(noScript);
}
return body;
}
/** /**
* Print &lt;/BODY&gt; tag. Add a newline character at the end. * Print &lt;/BODY&gt; tag. Add a newline character at the end.
*/ */
@ -228,6 +425,15 @@ public class HtmlWriter extends PrintWriter {
title(); title();
} }
/**
* Returns an HtmlTree for the TITLE tag.
*
* @return an HtmlTree for the TITLE tag
*/
public HtmlTree getTitle() {
HtmlTree title = HtmlTree.TITLE(new StringContent(winTitle));
return title;
}
/** /**
* Print &lt;/TITLE&gt; tag. Add a newline character at the end. * Print &lt;/TITLE&gt; tag. Add a newline character at the end.
@ -519,17 +725,17 @@ public class HtmlWriter extends PrintWriter {
} }
/** /**
* Return, text passed, with Italics &lt;I&gt; and &lt;/I&gt; tags, surrounding it. * Return, text passed, with Italics &lt;i&gt; and &lt;/i&gt; tags, surrounding it.
* So if the text passed is "Hi", then string returned will be "&lt;I&gt;Hi&lt;/I&gt;". * So if the text passed is "Hi", then string returned will be "&lt;i&gt;Hi&lt;/i&gt;".
* *
* @param text String to be printed in between &lt;I&gt; and &lt;/I&gt; tags. * @param text String to be printed in between &lt;I&gt; and &lt;/I&gt; tags.
*/ */
public String italicsText(String text) { public String italicsText(String text) {
return "<I>" + text + "</I>"; return "<i>" + text + "</i>";
} }
public String codeText(String text) { public String codeText(String text) {
return "<CODE>" + text + "</CODE>"; return "<code>" + text + "</code>";
} }
/** /**
@ -539,6 +745,13 @@ public class HtmlWriter extends PrintWriter {
print("&nbsp;"); print("&nbsp;");
} }
/**
* Return "&#38;nbsp;", non-breaking space.
*/
public Content getSpace() {
return RawHtml.nbsp;
}
/** /**
* Print &lt;DL&gt; tag. Add a newline character at the end. * Print &lt;DL&gt; tag. Add a newline character at the end.
*/ */
@ -1182,21 +1395,21 @@ public class HtmlWriter extends PrintWriter {
} }
/** /**
* Get the "&lt;CODE&gt;" string. * Get the "&lt;code&gt;" string.
* *
* @return String Return String "&lt;CODE>"; * @return String Return String "&lt;code&gt;";
*/ */
public String getCode() { public String getCode() {
return "<CODE>"; return "<code>";
} }
/** /**
* Get the "&lt;/CODE&gt;" string. * Get the "&lt;/code&gt;" string.
* *
* @return String Return String "&lt;/CODE&gt;"; * @return String Return String "&lt;/code&gt;";
*/ */
public String getCodeEnd() { public String getCodeEnd() {
return "</CODE>"; return "</code>";
} }
/** /**

View file

@ -0,0 +1,88 @@
/*
* Copyright (c) 2010, 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;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.util.*;
/**
* Class for generating raw HTML content to be added to HTML pages of javadoc output.
*
* @author Bhavesh Patel
*/
public class RawHtml extends Content{
private String rawHtmlContent;
public static final Content nbsp = new RawHtml("&nbsp;");
/**
* Constructor to construct a RawHtml object.
*
* @param rawHtml raw HTML text to be added
*/
public RawHtml(String rawHtml) {
rawHtmlContent = nullCheck(rawHtml);
}
/**
* This method is not supported by the class.
*
* @param content content that needs to be added
* @throws DocletAbortException this method will always throw a
* DocletAbortException because it
* is not supported.
*/
public void addContent(Content content) {
throw new DocletAbortException();
}
/**
* This method is not supported by the class.
*
* @param stringContent string content that needs to be added
* @throws DocletAbortException this method will always throw a
* DocletAbortException because it
* is not supported.
*/
public void addContent(String stringContent) {
throw new DocletAbortException();
}
/**
* {@inheritDoc}
*/
public boolean isEmpty() {
return rawHtmlContent.isEmpty();
}
/**
* {@inheritDoc}
*/
public void write(StringBuilder contentBuilder) {
contentBuilder.append(rawHtmlContent);
}
}

View file

@ -0,0 +1,99 @@
/*
* Copyright (c) 2010, 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;
import com.sun.tools.doclets.internal.toolkit.Content;
import com.sun.tools.doclets.internal.toolkit.util.*;
/**
* Class for generating string content for HTML tags of javadoc output.
*
* @author Bhavesh Patel
*/
public class StringContent extends Content{
private StringBuilder stringContent;
/**
* Constructor to construct StringContent object.
*/
public StringContent() {
stringContent = new StringBuilder();
}
/**
* Constructor to construct StringContent object with some initial content.
*
* @param initialContent initial content for the object
*/
public StringContent(String initialContent) {
stringContent = new StringBuilder(
Util.escapeHtmlChars(nullCheck(initialContent)));
}
/**
* This method is not supported by the class.
*
* @param content content that needs to be added
* @throws DocletAbortException this method will always throw a
* DocletAbortException because it
* is not supported.
*/
public void addContent(Content content) {
throw new DocletAbortException();
}
/**
* Adds content for the StringContent object. The method escapes
* HTML characters for the string content that is added.
*
* @param strContent string content to be added
*/
public void addContent(String strContent) {
stringContent.append(Util.escapeHtmlChars(nullCheck(strContent)));
}
/**
* {@inheritDoc}
*/
public boolean isEmpty() {
return (stringContent.length() == 0);
}
/**
* {@inheritDoc}
*/
public String toString() {
return stringContent.toString();
}
/**
* {@inheritDoc}
*/
public void write(StringBuilder contentBuilder) {
contentBuilder.append(stringContent);
}
}

View file

@ -43,6 +43,7 @@ doclet.Window_Single_Index=Index
doclet.Window_Split_Index={0}-Index doclet.Window_Split_Index={0}-Index
doclet.Help=Help doclet.Help=Help
doclet.Skip_navigation_links=Skip navigation links doclet.Skip_navigation_links=Skip navigation links
doclet.New_Page=NewPage
doclet.None=None doclet.None=None
doclet.CLASSES=CLASSES doclet.CLASSES=CLASSES
doclet.MEMBERS=MEMBERS doclet.MEMBERS=MEMBERS
@ -53,7 +54,7 @@ doclet.Deprecated_List=Deprecated List
doclet.Window_Deprecated_List=Deprecated List doclet.Window_Deprecated_List=Deprecated List
doclet.Note_0_is_deprecated=Note: {0} is deprecated. doclet.Note_0_is_deprecated=Note: {0} is deprecated.
doclet.Overrides=Overrides: doclet.Overrides=Overrides:
doclet.in_class={0} in class {1} doclet.in_class=in class
doclet.0_Fields_and_Methods=&quot;{0}&quot; Fields and Methods doclet.0_Fields_and_Methods=&quot;{0}&quot; Fields and Methods
doclet.Index_of_Fields_and_Methods=Index of Fields and Methods doclet.Index_of_Fields_and_Methods=Index of Fields and Methods
doclet.Static_variable_in=Static variable in {0} doclet.Static_variable_in=Static variable in {0}
@ -103,7 +104,7 @@ doclet.Other_Packages=Other Packages
doclet.Package_Description=Package {0} Description doclet.Package_Description=Package {0} Description
doclet.Description=Description doclet.Description=Description
doclet.Specified_By=Specified by: doclet.Specified_By=Specified by:
doclet.in_interface={0} in interface {1} doclet.in_interface=in interface
doclet.Subclasses=Direct Known Subclasses: doclet.Subclasses=Direct Known Subclasses:
doclet.Subinterfaces=All Known Subinterfaces: doclet.Subinterfaces=All Known Subinterfaces:
doclet.Implementing_Classes=All Known Implementing Classes: doclet.Implementing_Classes=All Known Implementing Classes:
@ -121,18 +122,20 @@ doclet.Cannot_handle_no_packages=Cannot handle no packages.
doclet.Frame_Alert=Frame Alert doclet.Frame_Alert=Frame Alert
doclet.Overview-Member-Frame=Overview Member Frame doclet.Overview-Member-Frame=Overview Member Frame
doclet.Frame_Warning_Message=This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. doclet.Frame_Warning_Message=This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
doclet.No_Script_Message=JavaScript is disabled on your browser.
doclet.Non_Frame_Version=Non-frame version. doclet.Non_Frame_Version=Non-frame version.
doclet.Frame_Version=Frame version doclet.Frame_Version=Frame version
doclet.Link_To=Link to doclet.Link_To=Link to
doclet.Following_From_Class=Following copied from class: {0} doclet.Following_From_Class=Following copied from class: {0}
doclet.Following_From_Interface=Following copied from interface: {0} doclet.Following_From_Interface=Following copied from interface: {0}
doclet.Description_From_Interface=Description copied from interface: {0} doclet.Description_From_Interface=Description copied from interface:
doclet.Description_From_Class=Description copied from class: {0} doclet.Description_From_Class=Description copied from class:
doclet.Standard_doclet_invoked=Standard doclet invoked... doclet.Standard_doclet_invoked=Standard doclet invoked...
doclet.No_Non_Deprecated_Classes_To_Document=No non-deprecated classes found to document. doclet.No_Non_Deprecated_Classes_To_Document=No non-deprecated classes found to document.
doclet.Interfaces_Italic=Interfaces (italic) doclet.Interfaces_Italic=Interfaces (italic)
doclet.Enclosing_Class=Enclosing class: doclet.Enclosing_Class=Enclosing class:
doclet.Enclosing_Interface=Enclosing interface: doclet.Enclosing_Interface=Enclosing interface:
doclet.Window_Source_title=Source code
doclet.Help_title=API Help doclet.Help_title=API Help
doclet.Window_Help_title=API Help doclet.Window_Help_title=API Help
doclet.Help_line_1=How This API Document Is Organized doclet.Help_line_1=How This API Document Is Organized

View file

@ -35,14 +35,18 @@ import com.sun.javadoc.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public interface AnnotationTypeOptionalMemberWriter extends public interface AnnotationTypeOptionalMemberWriter extends
AnnotationTypeRequiredMemberWriter { AnnotationTypeRequiredMemberWriter {
/** /**
* Write the default value documentation. * Add the the default value documentation.
*
* @param member the member being documented
* @param annotationDocTree content tree to which the default value will be added
*/ */
public void writeDefaultValueInfo(MemberDoc member); public void addDefaultValueInfo(MemberDoc member, Content annotationDocTree);
} }

View file

@ -36,67 +36,79 @@ import com.sun.javadoc.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public interface AnnotationTypeRequiredMemberWriter { public interface AnnotationTypeRequiredMemberWriter {
/** /**
* Write the header for the member documentation. * Add the annotation type details tree header.
* *
* @param classDoc the annotation type that the members belong to. * @param classDoc the annotation type being documented
* @param header the header to write. * @param memberDetailsTree the content tree representing member details
*/ */
public void writeHeader(ClassDoc classDoc, String header); public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
Content memberDetailsTree);
/** /**
* Write the member header for the given member. * Get the annotation type documentation tree header.
* *
* @param member the member being documented. * @param member the annotation type being documented
* @param isFirst the flag to indicate whether or not the member is * @param annotationDetailsTree the content tree representing annotation type details
* the first to be documented. * @return content tree for the annotation type documentation header
*/ */
public void writeMemberHeader(MemberDoc member, boolean isFirst); public Content getAnnotationDocTreeHeader(MemberDoc member,
Content annotationDetailsTree);
/** /**
* Write the signature for the given member. * Get the annotation type details tree.
* *
* @param member the member being documented. * @param annotationDetailsTree the content tree representing annotation type details
* @return content tree for the annotation type details
*/ */
public void writeSignature(MemberDoc member); public Content getAnnotationDetails(Content annotationDetailsTree);
/** /**
* Write the deprecated output for the given member. * Get the annotation type documentation.
* *
* @param member the member being documented. * @param annotationDocTree the content tree representing annotation type documentation
* @param isLastContent true if the content to be added is the last content
* @return content tree for the annotation type documentation
*/ */
public void writeDeprecated(MemberDoc member); public Content getAnnotationDoc(Content annotationDocTree, boolean isLastContent);
/** /**
* Write the comments for the given member. * Get the signature for the given member.
* *
* @param member the member being documented. * @param member the member being documented
* @return content tree for the annotation type signature
*/ */
public void writeComments(MemberDoc member); public Content getSignature(MemberDoc member);
/** /**
* Write the tag output for the given member. * Add the deprecated output for the given member.
* *
* @param member the member being documented. * @param member the member being documented
* @param annotationDocTree content tree to which the deprecated information will be added
*/ */
public void writeTags(MemberDoc member); public void addDeprecated(MemberDoc member, Content annotationDocTree);
/** /**
* Write the member footer. * Add the comments for the given member.
*
* @param member the member being documented
* @param annotationDocTree the content tree to which the comments will be added
*/ */
public void writeMemberFooter(); public void addComments(MemberDoc member, Content annotationDocTree);
/** /**
* Write the footer for the member documentation. * Add the tags for the given member.
* *
* @param classDoc the class that the member belong to. * @param member the member being documented
* @param annotationDocTree the content tree to which the tags will be added
*/ */
public void writeFooter(ClassDoc classDoc); public void addTags(MemberDoc member, Content annotationDocTree);
/** /**
* Close the writer. * Close the writer.

View file

@ -37,43 +37,122 @@ import com.sun.javadoc.*;
* Do not use it as an API. * Do not use it as an API.
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public interface AnnotationTypeWriter { public interface AnnotationTypeWriter {
/** /**
* Write the header of the page. * Get the header of the page.
* @param header the header to write. *
* @param header the header string to write
* @return a content tree for the header documentation
*/ */
public void writeHeader(String header); public Content getHeader(String header);
/** /**
* Write the signature of the current annotation type. * Get the annotation content header.
* *
* @param modifiers the modifiers for the signature. * @return annotation content header that needs to be added to the documentation
*/ */
public void writeAnnotationTypeSignature(String modifiers); public Content getAnnotationContentHeader();
/**
* Get the annotation information tree header.
*
* @return annotation information tree header that needs to be added to the documentation
*/
public Content getAnnotationInfoTreeHeader();
/**
* Get the annotation information.
*
* @param annotationInfoTree content tree containing the annotation information
* @return a content tree for the annotation
*/
public Content getAnnotationInfo(Content annotationInfoTree);
/**
* Add the signature of the current annotation type.
*
* @param modifiers the modifiers for the signature
* @param annotationInfoTree the annotation content tree to which the signature will be added
*/
public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree);
/** /**
* Build the annotation type description. * Build the annotation type description.
*
* @param annotationInfoTree content tree to which the description will be added
*/ */
public void writeAnnotationTypeDescription(); public void addAnnotationTypeDescription(Content annotationInfoTree);
/** /**
* Write the tag information for the current annotation type. * Add the tag information for the current annotation type.
*
* @param annotationInfoTree content tree to which the tag information will be added
*/ */
public void writeAnnotationTypeTagInfo(); public void addAnnotationTypeTagInfo(Content annotationInfoTree);
/** /**
* If this annotation type is deprecated, write the appropriate information. * If this annotation is deprecated, add the appropriate information.
*
* @param annotationInfoTree content tree to which the deprecated information will be added
*/ */
public void writeAnnotationTypeDeprecationInfo(); public void addAnnotationTypeDeprecationInfo (Content annotationInfoTree);
/** /**
* Write the footer of the page. * Add the annotation type details marker.
*
* @param memberDetails the content tree representing member details marker
*/ */
public void writeFooter(); public void addAnnotationDetailsMarker(Content memberDetails);
/**
* Get the member tree header for the annotation type.
*
* @return a content tree for the member tree header
*/
public Content getMemberTreeHeader();
/**
* Get the member tree.
*
* @param memberTree the content tree that will be modified and returned
* @return a content tree for the member
*/
public Content getMemberTree(Content memberTree);
/**
* Get the member summary tree.
*
* @param memberTree the content tree that will be used to build the summary tree
* @return a content tree for the member summary
*/
public Content getMemberSummaryTree(Content memberTree);
/**
* Get the member details tree.
*
* @param memberTree the content tree that will be used to build the details tree
* @return a content tree for the member details
*/
public Content getMemberDetailsTree(Content memberTree);
/**
* Add the footer of the page.
*
* @param contentTree content tree to which the footer will be added
*/
public void addFooter(Content contentTree);
/**
* Print the document.
*
* @param contentTree content tree that will be printed as a document
*/
public void printDocument(Content contentTree);
/** /**
* Close the writer. * Close the writer.
@ -86,10 +165,4 @@ public interface AnnotationTypeWriter {
* @return the AnnotationTypeDoc being documented. * @return the AnnotationTypeDoc being documented.
*/ */
public AnnotationTypeDoc getAnnotationTypeDoc(); public AnnotationTypeDoc getAnnotationTypeDoc();
/**
* Perform any operations that are necessary when the member summary
* finished building.
*/
public void completeMemberSummaryBuild();
} }

View file

@ -37,85 +37,149 @@ import com.sun.javadoc.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public interface ClassWriter { public interface ClassWriter {
/** /**
* Write the header of the page. * Get the header of the page.
* @param header the header to write.
*/
public void writeHeader(String header);
/**
* Write the class tree documentation.
*/
public void writeClassTree();
/**
* Write all implemented interfaces if this is a class.
*/
public void writeImplementedInterfacesInfo();
/**
* Write all super interfaces if this is an interface.
*/
public void writeSuperInterfacesInfo();
/**
* Write the type parameter information.
*/
public void writeTypeParamInfo();
/**
* Write all the classes that extend this one.
*/
public void writeSubClassInfo();
/**
* Write all the interfaces that extend this one.
*/
public void writeSubInterfacesInfo();
/**
* If this is an interface, write all classes that implement this
* interface.
*/
public void writeInterfaceUsageInfo ();
/**
* If this is an inner class or interface, write the enclosing class or
* interface.
*/
public void writeNestedClassInfo ();
/**
* If this class is deprecated, write the appropriate information.
*/
public void writeClassDeprecationInfo ();
/**
* Write the signature of the current class.
* *
* @param modifiers the modifiers for the signature. * @param header the header string to write
* @return header content that needs to be added to the documentation
*/ */
public void writeClassSignature(String modifiers); public Content getHeader(String header);
/**
* Get the class content header.
*
* @return class content header that needs to be added to the documentation
*/
public Content getClassContentHeader();
/**
* Add the class tree documentation.
*
* @param classContentTree class content tree to which the documentation will be added
*/
public void addClassTree(Content classContentTree);
/**
* Get the class information tree header.
*
* @return class informaion tree header that needs to be added to the documentation
*/
public Content getClassInfoTreeHeader();
/**
* Add the type parameter information.
*
* @param classInfoTree content tree to which the documentation will be added
*/
public void addTypeParamInfo(Content classInfoTree);
/**
* Add all super interfaces if this is an interface.
*
* @param classInfoTree content tree to which the documentation will be added
*/
public void addSuperInterfacesInfo(Content classInfoTree);
/**
* Add all implemented interfaces if this is a class.
*
* @param classInfoTree content tree to which the documentation will be added
*/
public void addImplementedInterfacesInfo(Content classInfoTree);
/**
* Add all the classes that extend this one.
*
* @param classInfoTree content tree to which the documentation will be added
*/
public void addSubClassInfo(Content classInfoTree);
/**
* Add all the interfaces that extend this one.
*
* @param classInfoTree content tree to which the documentation will be added
*/
public void addSubInterfacesInfo(Content classInfoTree);
/**
* If this is an interface, add all classes that implement this
* interface.
*
* @param classInfoTree content tree to which the documentation will be added
*/
public void addInterfaceUsageInfo(Content classInfoTree);
/**
* If this is an inner class or interface, add the enclosing class or
* interface.
*
* @param classInfoTree content tree to which the documentation will be added
*/
public void addNestedClassInfo (Content classInfoTree);
/**
* Get the class information.
*
* @param classInfoTree content tree conatining the class information
* @return a content tree for the class
*/
public Content getClassInfo(Content classInfoTree);
/**
* If this class is deprecated, add the appropriate information.
*
* @param classInfoTree content tree to which the documentation will be added
*/
public void addClassDeprecationInfo (Content classInfoTree);
/**
* Add the signature of the current class content tree.
*
* @param modifiers the modifiers for the signature
* @param classInfoTree the class content tree to which the signature will be added
*/
public void addClassSignature(String modifiers, Content classInfoTree);
/** /**
* Build the class description. * Build the class description.
*
* @param classInfoTree content tree to which the documentation will be added
*/ */
public void writeClassDescription(); public void addClassDescription(Content classInfoTree);
/** /**
* Write the tag information for the current class. * Add the tag information for the current class.
*
* @param classInfoTree content tree to which the tag information will be added
*/ */
public void writeClassTagInfo(); public void addClassTagInfo(Content classInfoTree);
/** /**
* Write the footer of the page. * Get the member tree header for the class.
*
* @return a content tree for the member tree header
*/ */
public void writeFooter(); public Content getMemberTreeHeader();
/**
* Add the footer of the page.
*
* @param contentTree content tree to which the footer will be added
*/
public void addFooter(Content contentTree);
/**
* Print the document.
*
* @param contentTree content tree that will be printed as a document
*/
public void printDocument(Content contentTree);
/** /**
* Close the writer. * Close the writer.
@ -130,8 +194,18 @@ public interface ClassWriter {
public ClassDoc getClassDoc(); public ClassDoc getClassDoc();
/** /**
* Perform any operations that are necessary when the member summary * Get the member summary tree.
* finished building. *
* @param memberTree the content tree used to build the summary tree
* @return a content tree for the member summary
*/ */
public void completeMemberSummaryBuild(); public Content getMemberSummaryTree(Content memberTree);
/**
* Get the member details tree.
*
* @param memberTree the content tree used to build the details tree
* @return a content tree for the member details
*/
public Content getMemberDetailsTree(Content memberTree);
} }

View file

@ -25,9 +25,9 @@
package com.sun.tools.doclets.internal.toolkit; package com.sun.tools.doclets.internal.toolkit;
import com.sun.javadoc.*;
import java.util.*; import java.util.*;
import java.io.*; import java.io.*;
import com.sun.javadoc.*;
/** /**
* The interface for writing constants summary output. * The interface for writing constants summary output.
@ -37,38 +37,34 @@ import java.io.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public interface ConstantsSummaryWriter { public interface ConstantsSummaryWriter {
/**
* Write the header for the summary.
*/
public abstract void writeHeader();
/**
* Write the footer for the summary.
*/
public abstract void writeFooter();
/** /**
* Close the writer. * Close the writer.
*/ */
public abstract void close() throws IOException; public abstract void close() throws IOException;
/** /**
* Write the header for the index. * Get the header for the constant summary documentation.
*
* @return header that needs to be added to the documentation
*/ */
public abstract void writeContentsHeader(); public abstract Content getHeader();
/** /**
* Write the footer for the index. * Get the header for the constant content list.
*
* @return content header that needs to be added to the documentation
*/ */
public abstract void writeContentsFooter(); public abstract Content getContentsHeader();
/** /**
* Add the given package name to the index. * Adds the given package name link to the constant content list tree.
*
* @param pkg the {@link PackageDoc} to index. * @param pkg the {@link PackageDoc} to index.
* @param parsedPackageName the parsed package name. We only Write the * @param parsedPackageName the parsed package name. We only Write the
* first 2 directory levels of the package * first 2 directory levels of the package
@ -77,38 +73,70 @@ public interface ConstantsSummaryWriter {
* @param WriteedPackageHeaders the set of package headers that have already * @param WriteedPackageHeaders the set of package headers that have already
* been indexed. We don't want to index * been indexed. We don't want to index
* something more than once. * something more than once.
* @param contentListTree the content tree to which the link will be added
*/ */
public abstract void writeLinkToPackageContent(PackageDoc pkg, String parsedPackageName, public abstract void addLinkToPackageContent(PackageDoc pkg, String parsedPackageName,
Set<String> WriteedPackageHeaders); Set<String> WriteedPackageHeaders, Content contentListTree);
/** /**
* Write the given package name. * Get the content list to be added to the documentation tree.
* @param pkg the {@link PackageDoc} to index. *
* @param parsedPackageName the parsed package name. We only Write the * @param contentListTree the content that will be added to the list
* first 2 directory levels of the package * @return content list that will be added to the documentation tree
* name. For example, java.lang.ref would be
* indexed as java.lang.*.
*/ */
public abstract void writePackageName(PackageDoc pkg, public abstract Content getContentsList(Content contentListTree);
String parsedPackageName);
/** /**
* Write the heading for the current table of constants for a given class. * Get the constant summaries for the document.
* @param cd the class whose constants are being documented. *
* @return constant summaries header to be added to the documentation tree
*/ */
public abstract void writeConstantMembersHeader(ClassDoc cd); public abstract Content getConstantSummaries();
/** /**
* Document the given constants. * 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
* be written
*/
public abstract void addPackageName(PackageDoc pkg,
String parsedPackageName, Content summariesTree);
/**
* Get the class summary header for the constants summary.
*
* @return the header content for the class constants summary
*/
public abstract Content getClassConstantHeader();
/**
* Adds the constant member table to the documentation tree.
*
* @param cd the class whose constants are being documented. * @param cd the class whose constants are being documented.
* @param fields the constants being documented. * @param fields the constants being documented.
* @param classConstantTree the documentation tree to which theconstant member
* table content will be added
*/ */
public abstract void writeConstantMembers(ClassDoc cd, List<FieldDoc> fields); public abstract void addConstantMembers(ClassDoc cd, List<FieldDoc> fields,
Content classConstantTree);
/** /**
* Document the given constants. * Adds the footer for the summary documentation.
* @param cd the class whose constants are being documented. *
* @param contentTree content tree to which the footer will be added
*/ */
public abstract void writeConstantMembersFooter(ClassDoc cd); public abstract void addFooter(Content contentTree);
/**
* Print the constants summary document.
*
* @param contentTree content tree which should be printed
*/
public abstract void printDocument(Content contentTree);
} }

View file

@ -36,67 +36,80 @@ import com.sun.javadoc.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public interface ConstructorWriter { public interface ConstructorWriter {
/** /**
* Write the header for the constructor documentation. * Get the constructor details tree header.
* *
* @param classDoc the class that the constructors belong to. * @param classDoc the class being documented
* @param header the header to write. * @param memberDetailsTree the content tree representing member details
* @return content tree for the constructor details header
*/ */
public void writeHeader(ClassDoc classDoc, String header); public Content getConstructorDetailsTreeHeader(ClassDoc classDoc,
Content memberDetailsTree);
/** /**
* Write the constructor header for the given constructor. * Get the constructor documentation tree header.
* *
* @param constructor the constructor being documented. * @param constructor the constructor being documented
* @param isFirst the flag to indicate whether or not the constructor is the * @param constructorDetailsTree the content tree representing constructor details
* first to be documented. * @return content tree for the constructor documentation header
*/ */
public void writeConstructorHeader(ConstructorDoc constructor, boolean isFirst); public Content getConstructorDocTreeHeader(ConstructorDoc constructor,
Content constructorDetailsTree);
/** /**
* Write the signature for the given constructor. * Get the signature for the given constructor.
* *
* @param constructor the constructor being documented. * @param constructor the constructor being documented
* @return content tree for the constructor signature
*/ */
public void writeSignature(ConstructorDoc constructor); public Content getSignature(ConstructorDoc constructor);
/** /**
* Write the deprecated output for the given constructor. * Add the deprecated output for the given constructor.
* *
* @param constructor the constructor being documented. * @param constructor the constructor being documented
* @param constructorDocTree content tree to which the deprecated information will be added
*/ */
public void writeDeprecated(ConstructorDoc constructor); public void addDeprecated(ConstructorDoc constructor, Content constructorDocTree);
/** /**
* Write the comments for the given constructor. * Add the comments for the given constructor.
* *
* @param constructor the constructor being documented. * @param constructor the constructor being documented
* @param constructorDocTree the content tree to which the comments will be added
*/ */
public void writeComments(ConstructorDoc constructor); public void addComments(ConstructorDoc constructor, Content constructorDocTree);
/** /**
* Write the tag output for the given constructor. * Add the tags for the given constructor.
* *
* @param constructor the constructor being documented. * @param constructor the constructor being documented
* @param constructorDocTree the content tree to which the tags will be added
*/ */
public void writeTags(ConstructorDoc constructor); public void addTags(ConstructorDoc constructor, Content constructorDocTree);
/** /**
* Write the constructor footer. * Get the constructor details tree.
*
* @param memberDetailsTree the content tree representing member details
* @return content tree for the constructor details
*/ */
public void writeConstructorFooter(); public Content getConstructorDetails(Content memberDetailsTree);
/** /**
* Write the footer for the constructor documentation. * Get the constructor documentation.
* *
* @param classDoc the class that the constructors belong to. * @param constructorDocTree the content tree representing constructor documentation
* @param isLastContent true if the content to be added is the last content
* @return content tree for the constructor documentation
*/ */
public void writeFooter(ClassDoc classDoc); public Content getConstructorDoc(Content constructorDocTree, boolean isLastContent);
/** /**
* Let the writer know whether a non public constructor was found. * Let the writer know whether a non public constructor was found.

View file

@ -0,0 +1,106 @@
/*
* Copyright (c) 2010, 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.internal.toolkit;
import com.sun.tools.doclets.internal.toolkit.util.*;
/**
* A class to create content for javadoc output pages.
*
* @author Bhavesh Patel
*/
public abstract class Content {
/**
* Returns a string representation of the content.
*
* @return string representation of the content
*/
public String toString() {
StringBuilder contentBuilder = new StringBuilder();
write(contentBuilder);
return contentBuilder.toString();
}
/**
* Adds content to the existing content.
*
* @param content content that needs to be added
*/
public abstract void addContent(Content content);
/**
* Adds a string content to the existing content.
*
* @param stringContent the string content to be added
*/
public abstract void addContent(String stringContent);
/**
* Writes content to a StringBuilder.
*
*/
public abstract void write(StringBuilder contentBuilder);
/**
* Returns true if the content is empty.
*
* @return true if no content to be displayed else return false
*/
public abstract boolean isEmpty();
/**
* Returns true if the content is valid.
*
* @return true if the content is valid else return false
*/
public boolean isValid() {
return !isEmpty();
}
/**
* Checks for null values.
*
* @param t reference type to check for null values
* @return the reference type if not null or else throws a null pointer exception
*/
protected static <T> T nullCheck(T t) {
t.getClass();
return t;
}
/**
* Returns true if the content ends with a newline character. Empty content
* is considered as ending with new line.
*
* @param contentBuilder content to test for newline character at the end
* @return true if the content ends with newline.
*/
public boolean endsWithNewLine(StringBuilder contentBuilder) {
return ((contentBuilder.length() == 0) ||
(contentBuilder.substring(contentBuilder.length() - 1).equals("\n")));
}
}

View file

@ -36,67 +36,80 @@ import com.sun.javadoc.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public interface EnumConstantWriter { public interface EnumConstantWriter {
/** /**
* Write the header for the enum constant documentation. * Get the enum constants details tree header.
* *
* @param classDoc the class that the enum constants belong to. * @param classDoc the class being documented
* @param header the header to write. * @param memberDetailsTree the content tree representing member details
* @return content tree for the enum constants details header
*/ */
public void writeHeader(ClassDoc classDoc, String header); public Content getEnumConstantsDetailsTreeHeader(ClassDoc classDoc,
Content memberDetailsTree);
/** /**
* Write the enum constant header for the given enum constant. * Get the enum constants documentation tree header.
* *
* @param enumConstant the enum constant being documented. * @param enumConstant the enum constant being documented
* @param isFirst the flag to indicate whether or not the enum constant is * @param enumConstantDetailsTree the content tree representing enum constant details
* the first to be documented. * @return content tree for the enum constant documentation header
*/ */
public void writeEnumConstantHeader(FieldDoc enumConstant, boolean isFirst); public Content getEnumConstantsTreeHeader(FieldDoc enumConstant,
Content enumConstantsDetailsTree);
/** /**
* Write the signature for the given enum constant. * Get the signature for the given enum constant.
* *
* @param enumConstant the enum constant being documented. * @param enumConstant the enum constant being documented
* @return content tree for the enum constant signature
*/ */
public void writeSignature(FieldDoc enumConstant); public Content getSignature(FieldDoc enumConstant);
/** /**
* Write the deprecated output for the given enum constant. * Add the deprecated output for the given enum constant.
* *
* @param enumConstant the enum constant being documented. * @param enumConstant the enum constant being documented
* @param enumConstantsTree content tree to which the deprecated information will be added
*/ */
public void writeDeprecated(FieldDoc enumConstant); public void addDeprecated(FieldDoc enumConstant, Content enumConstantsTree);
/** /**
* Write the comments for the given enum constant. * Add the comments for the given enum constant.
* *
* @param enumConstant the enum constant being documented. * @param enumConstant the enum constant being documented
* @param enumConstantsTree the content tree to which the comments will be added
*/ */
public void writeComments(FieldDoc enumConstant); public void addComments(FieldDoc enumConstant, Content enumConstantsTree);
/** /**
* Write the tag output for the given enum constant. * Add the tags for the given enum constant.
* *
* @param enumConstant the enum constant being documented. * @param enumConstant the enum constant being documented
* @param enumConstantsTree the content tree to which the tags will be added
*/ */
public void writeTags(FieldDoc enumConstant); public void addTags(FieldDoc enumConstant, Content enumConstantsTree);
/** /**
* Write the enum constant footer. * Get the enum constants details tree.
*
* @param memberDetailsTree the content tree representing member details
* @return content tree for the enum constant details
*/ */
public void writeEnumConstantFooter(); public Content getEnumConstantsDetails(Content memberDetailsTree);
/** /**
* Write the footer for the enum constant documentation. * Get the enum constants documentation.
* *
* @param classDoc the class that the enum constant belong to. * @param enumConstantsTree the content tree representing enum constants documentation
* @param isLastContent true if the content to be added is the last content
* @return content tree for the enum constants documentation
*/ */
public void writeFooter(ClassDoc classDoc); public Content getEnumConstants(Content enumConstantsTree, boolean isLastContent);
/** /**
* Close the writer. * Close the writer.

View file

@ -36,67 +36,80 @@ import com.sun.javadoc.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public interface FieldWriter { public interface FieldWriter {
/** /**
* Write the header for the field documentation. * Get the field details tree header.
* *
* @param classDoc the class that the fields belong to. * @param classDoc the class being documented
* @param header the header to write. * @param memberDetailsTree the content tree representing member details
* @return content tree for the field details header
*/ */
public void writeHeader(ClassDoc classDoc, String header); public Content getFieldDetailsTreeHeader(ClassDoc classDoc,
Content memberDetailsTree);
/** /**
* Write the field header for the given field. * Get the field documentation tree header.
* *
* @param field the field being documented. * @param field the constructor being documented
* @param isFirst the flag to indicate whether or not the field is the * @param fieldDetailsTree the content tree representing field details
* first to be documented. * @return content tree for the field documentation header
*/ */
public void writeFieldHeader(FieldDoc field, boolean isFirst); public Content getFieldDocTreeHeader(FieldDoc field,
Content fieldDetailsTree);
/** /**
* Write the signature for the given field. * Get the signature for the given field.
* *
* @param field the field being documented. * @param field the field being documented
* @return content tree for the field signature
*/ */
public void writeSignature(FieldDoc field); public Content getSignature(FieldDoc field);
/** /**
* Write the deprecated output for the given field. * Add the deprecated output for the given field.
* *
* @param field the field being documented. * @param field the field being documented
* @param fieldDocTree content tree to which the deprecated information will be added
*/ */
public void writeDeprecated(FieldDoc field); public void addDeprecated(FieldDoc field, Content fieldDocTree);
/** /**
* Write the comments for the given field. * Add the comments for the given field.
* *
* @param field the field being documented. * @param field the field being documented
* @param fieldDocTree the content tree to which the comments will be added
*/ */
public void writeComments(FieldDoc field); public void addComments(FieldDoc field, Content fieldDocTree);
/** /**
* Write the tag output for the given field. * Add the tags for the given field.
* *
* @param field the field being documented. * @param field the field being documented
* @param fieldDocTree the content tree to which the tags will be added
*/ */
public void writeTags(FieldDoc field); public void addTags(FieldDoc field, Content fieldDocTree);
/** /**
* Write the field footer. * Get the field details tree.
*
* @param memberDetailsTree the content tree representing member details
* @return content tree for the field details
*/ */
public void writeFieldFooter(); public Content getFieldDetails(Content memberDetailsTree);
/** /**
* Write the footer for the field documentation. * Get the field documentation.
* *
* @param classDoc the class that the fields belong to. * @param fieldDocTree the content tree representing field documentation
* @param isLastContent true if the content to be added is the last content
* @return content tree for the field documentation
*/ */
public void writeFooter(ClassDoc classDoc); public Content getFieldDoc(Content fieldDocTree, boolean isLastContent);
/** /**
* Close the writer. * Close the writer.

View file

@ -26,6 +26,7 @@
package com.sun.tools.doclets.internal.toolkit; package com.sun.tools.doclets.internal.toolkit;
import java.io.*; import java.io.*;
import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
/** /**
@ -36,61 +37,77 @@ import com.sun.javadoc.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public interface MemberSummaryWriter { public interface MemberSummaryWriter {
/** /**
* Write the member summary header for the given class. * Get the member summary header for the given class.
* *
* @param classDoc the class the summary belongs to. * @param classDoc the class the summary belongs to
* @param memberSummaryTree the content tree to which the member summary will be added
* @return a content tree for the member summary header
*/ */
public void writeMemberSummaryHeader(ClassDoc classDoc); public Content getMemberSummaryHeader(ClassDoc classDoc,
Content memberSummaryTree);
/** /**
* Write the member summary for the given class and member. * Get the summary table for the given class.
* *
* @param classDoc the class the summary belongs to. * @param classDoc the class the summary table belongs to
* @param member the member that I am summarizing. * @return a content tree for the member summary table
* @param firstSentenceTags the tags for the sentence being documented.
* @param isFirst true if this is the first member in the list.
* @param isLast true if this the last member being documented.
*/ */
public void writeMemberSummary(ClassDoc classDoc, ProgramElementDoc member, public Content getSummaryTableTree(ClassDoc classDoc);
Tag[] firstSentenceTags, boolean isFirst, boolean isLast);
/** /**
* Write the member summary footer for the given class. * Add the member summary for the given class and member.
* *
* @param classDoc the class the summary belongs to. * @param classDoc the class the summary belongs to
* @param member the member that is documented
* @param firstSentenceTags the tags for the sentence being documented
* @param tableTree the content treeto which the information will be added
* @param counter the counter for determing style for the table row
*/ */
public void writeMemberSummaryFooter(ClassDoc classDoc); public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
Tag[] firstSentenceTags, Content tableTree, int counter);
/** /**
* Write the inherited member summary header for the given class. * Get the inherited member summary header for the given class.
* *
* @param classDoc the class the summary belongs to. * @param classDoc the class the summary belongs to
* @return a content tree containing the inherited summary header
*/ */
public void writeInheritedMemberSummaryHeader(ClassDoc classDoc); public Content getInheritedSummaryHeader(ClassDoc classDoc);
/** /**
* Write the inherited member summary for the given class and member. * Add the inherited member summary for the given class and member.
* *
* @param classDoc the class the inherited member belongs to. * @param classDoc the class the inherited member belongs to
* @param member the inherited member that I am summarizing. * @param member the inherited member that is being documented
* @param isFirst true if this is the first member in the list. * @param isFirst true if this is the first member in the list
* @param isLast true if this is the last member in the list. * @param isLast true if this is the last member in the list
* @param linksTree the content tree to which the links will be added
*/ */
public void writeInheritedMemberSummary(ClassDoc classDoc, public void addInheritedMemberSummary(ClassDoc classDoc,
ProgramElementDoc member, boolean isFirst, boolean isLast); ProgramElementDoc member, boolean isFirst, boolean isLast,
Content linksTree);
/** /**
* Write the inherited member summary footer for the given class. * Get inherited summary links.
* *
* @param classDoc the class the summary belongs to. * @return a content tree conatining the inherited summary links
*/ */
public void writeInheritedMemberSummaryFooter(ClassDoc classDoc); public Content getInheritedSummaryLinksTree();
/**
* Get the member tree.
*
* @param memberTree the content tree representating the member
* @return a content tree for the member
*/
public Content getMemberTree(Content memberTree);
/** /**
* Close the writer. * Close the writer.

View file

@ -36,68 +36,81 @@ import com.sun.javadoc.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public interface MethodWriter { public interface MethodWriter {
/** /**
* Write the header for the method documentation. * Get the method details tree header.
* *
* @param classDoc the class that the methods belong to. * @param classDoc the class being documented
* @param header the header to write. * @param memberDetailsTree the content tree representing member details
* @return content tree for the method details header
*/ */
public void writeHeader(ClassDoc classDoc, String header); public Content getMethodDetailsTreeHeader(ClassDoc classDoc,
Content memberDetailsTree);
/** /**
* Write the method header for the given method. * Get the method documentation tree header.
* *
* @param method the method being documented. * @param method the method being documented
* @param isFirst the flag to indicate whether or not the method is the * @param methodDetailsTree the content tree representing method details
* first to be documented. * @return content tree for the method documentation header
*/ */
public void writeMethodHeader(MethodDoc method, boolean isFirst); public Content getMethodDocTreeHeader(MethodDoc method,
Content methodDetailsTree);
/** /**
* Write the signature for the given method. * Get the signature for the given method.
* *
* @param method the method being documented. * @param method the method being documented
* @return content tree for the method signature
*/ */
public void writeSignature(MethodDoc method); public Content getSignature(MethodDoc method);
/** /**
* Write the deprecated output for the given method. * Add the deprecated output for the given method.
* *
* @param method the method being documented. * @param method the method being documented
* @param methodDocTree content tree to which the deprecated information will be added
*/ */
public void writeDeprecated(MethodDoc method); public void addDeprecated(MethodDoc method, Content methodDocTree);
/** /**
* Write the comments for the given method. * Add the comments for the given method.
* *
* @param holder the holder type (not erasure) of the method. * @param holder the holder type (not erasure) of the method
* @param method the method being documented. * @param method the method being documented
* @param methodDocTree the content tree to which the comments will be added
*/ */
public void writeComments(Type holder, MethodDoc method); public void addComments(Type holder, MethodDoc method, Content methodDocTree);
/** /**
* Write the tag output for the given method. * Add the tags for the given method.
* *
* @param method the method being documented. * @param method the method being documented
* @param methodDocTree the content tree to which the tags will be added
*/ */
public void writeTags(MethodDoc method); public void addTags(MethodDoc method, Content methodDocTree);
/** /**
* Write the method footer. * Get the method details tree.
*
* @param methodDetailsTree the content tree representing method details
* @return content tree for the method details
*/ */
public void writeMethodFooter(); public Content getMethodDetails(Content methodDetailsTree);
/** /**
* Write the footer for the method documentation. * Get the method documentation.
* *
* @param classDoc the class that the methods belong to. * @param methodDocTree the content tree representing method documentation
* @param isLastContent true if the content to be added is the last content
* @return content tree for the method documentation
*/ */
public void writeFooter(ClassDoc classDoc); public Content getMethodDoc(Content methodDocTree, boolean isLastContent);
/** /**
* Close the writer. * Close the writer.

View file

@ -26,7 +26,6 @@
package com.sun.tools.doclets.internal.toolkit; package com.sun.tools.doclets.internal.toolkit;
import java.io.*; import java.io.*;
import com.sun.javadoc.*;
/** /**
* The interface for writing class output. * The interface for writing class output.
@ -36,58 +35,12 @@ import com.sun.javadoc.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public interface NestedClassWriter { public interface NestedClassWriter {
/**
* Write the classes summary header for the given class.
*
* @param nestedClass the class the summary belongs to.
*/
public void writeNestedClassSummaryHeader(ClassDoc nestedClass);
/**
* Write the class summary for the given class and class.
*
* @param classDoc the class the summary belongs to.
* @param nestedClass the nested class that I am summarizing.
*/
public void writeNestedClassSummary(ClassDoc classDoc, ClassDoc nestedClass);
/**
* Write the classes summary footer for the given class.
*
* @param nestedClass the class the summary belongs to.
*/
public void writeNestedClassSummaryFooter(ClassDoc nestedClass);
/**
* Write the inherited classes summary header for the given class.
*
* @param nestedClass the class the summary belongs to.
*/
public void writeInheritedNestedClassSummaryHeader(ClassDoc nestedClass);
/**
* Write the inherited nested class summary for the given class and nested
* class.
*
* @param classDoc the class the inherited nested class belongs to.
* @param nestedClass the inherited nested class that I am summarizing.
* @param isFirst true if this is the first member in the list.
*/
public void writeInheritedNestedClassSummary(ClassDoc classDoc,
ClassDoc nestedClass, boolean isFirst);
/**
* Write the inherited classes summary footer for the given class.
*
* @param nestedClass the class the summary belongs to.
*/
public void writeInheritedNestedClassSummaryFooter(ClassDoc nestedClass);
/** /**
* Close the writer. * Close the writer.
*/ */

View file

@ -36,6 +36,7 @@ import java.io.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
@ -49,45 +50,70 @@ public interface PackageSummaryWriter {
public abstract String getOutputFileName(); public abstract String getOutputFileName();
/** /**
* Write the header for the package summary. * Get the header for the summary.
*
* @param heading Package name.
* @return the header to be added to the content tree
*/ */
public abstract void writeSummaryHeader(); public abstract Content getPackageHeader(String heading);
/** /**
* Write the footer for the package summary. * Get the header for the package content.
*
* @return a content tree for the package content header
*/ */
public abstract void writeSummaryFooter(); public abstract Content getContentHeader();
/** /**
* Write the table of classes in this package. * Get the header for the package summary.
*
* @return a content tree with the package summary header
*/
public abstract Content getSummaryHeader();
/**
* Adds the table of classes to the documentation tree.
* *
* @param classes the array of classes to document. * @param classes the array of classes to document.
* @param label the label for this table. * @param label the label for this table.
* @param tableSummary the summary string for the table
* @param tableHeader array of table headers
* @param summaryContentTree the content tree to which the summaries will be added
*/ */
public abstract void writeClassesSummary(ClassDoc[] classes, String label, String tableSummary, String[] tableHeader); public abstract void addClassesSummary(ClassDoc[] classes, String label,
String tableSummary, String[] tableHeader, Content summaryContentTree);
/** /**
* Write the header for the summary. * Adds the package description from the "packages.html" file to the documentation
* tree.
* *
* @param heading Package name. * @param packageContentTree the content tree to which the package description
* will be added
*/ */
public abstract void writePackageHeader(String heading); public abstract void addPackageDescription(Content packageContentTree);
/** /**
* Print the package description from the "packages.html" file. * Adds the tag information from the "packages.html" file to the documentation
*/ * tree.
public abstract void writePackageDescription();
/**
* Print the tag information from the "packages.html" file.
*/
public abstract void writePackageTags();
/**
* Write the footer for the summary.
* *
* @param packageContentTree the content tree to which the package tags will
* be added
*/ */
public abstract void writePackageFooter(); public abstract void addPackageTags(Content packageContentTree);
/**
* Adds the footer to the documentation tree.
*
* @param contentTree the tree to which the footer will be added
*/
public abstract void addPackageFooter(Content contentTree);
/**
* Print the package summary document.
*
* @param contentTree the content tree that will be printed
*/
public abstract void printDocument(Content contentTree);
/** /**
* Close the writer. * Close the writer.

View file

@ -43,33 +43,73 @@ import com.sun.javadoc.*;
public interface SerializedFormWriter { public interface SerializedFormWriter {
/** /**
* Write the given header. * Get the header.
* *
* @param header the header to write. * @param header the header to write.
* @return the header content tree
*/ */
public void writeHeader(String header); public Content getHeader(String header);
/** /**
* Write the given package header. * Get the serialized form summaries header.
* *
* @param packageName the package header to write. * @return the serialized form summary header tree
*/ */
public void writePackageHeader(String packageName); public Content getSerializedSummariesHeader();
/** /**
* Write the heading for the serializable class. * Get the package serialized form header.
* *
* @param classDoc the class being processed. * @return the package serialized form header tree
*/ */
public void writeClassHeader(ClassDoc classDoc); public Content getPackageSerializedHeader();
/** /**
* Write the serial UID info. * Get the given package header.
*
* @param packageName the package header to write
* @return a content tree for the package header
*/
public Content getPackageHeader(String packageName);
/**
* Get the serialized class header.
*
* @return a content tree for the serialized class header
*/
public Content getClassSerializedHeader();
/**
* Get the heading for the serializable class.
*
* @param classDoc the class being processed
* @return a content tree for the class heading
*/
public Content getClassHeader(ClassDoc classDoc);
/**
* Get the serial UID info header.
*
* @return a content tree for the serial uid info header
*/
public Content getSerialUIDInfoHeader();
/**
* Adds the serial UID info.
* *
* @param header the header that will show up before the UID. * @param header the header that will show up before the UID.
* @param serialUID the serial UID to print. * @param serialUID the serial UID to print.
* @param serialUidTree the serial UID tree to which the content will be added.
*/ */
public void writeSerialUIDInfo(String header, String serialUID); public void addSerialUIDInfo(String header, String serialUID,
Content serialUidTree);
/**
* Get the class serialize content header.
*
* @return a content tree for the class serialize content header
*/
public Content getClassContentHeader();
/** /**
* Return an instance of a SerialFieldWriter. * Return an instance of a SerialFieldWriter.
@ -91,9 +131,26 @@ public interface SerializedFormWriter {
public abstract void close() throws IOException; public abstract void close() throws IOException;
/** /**
* Write the footer. * Get the serialized content.
*
* @param serializedTreeContent content for serialized data
* @return a content tree for serialized information
*/ */
public void writeFooter(); public Content getSerializedContent(Content serializedTreeContent);
/**
* Add the footer.
*
* @param serializedTree the serialized tree to be added
*/
public void addFooter(Content serializedTree);
/**
* Print the serialized form document.
*
* @param serializedTree the content tree that will be printed
*/
public abstract void printDocument(Content serializedTree);
/** /**
* Write the serialized form for a given field. * Write the serialized form for a given field.
@ -101,56 +158,73 @@ public interface SerializedFormWriter {
public interface SerialFieldWriter { public interface SerialFieldWriter {
/** /**
* Write the given heading. * Get the serializable field header.
*
* @return serialized fields header content tree
*/
public Content getSerializableFieldsHeader();
/**
* Get the field content header.
*
* @param isLastContent true if this is the last content to be documented
* @return fields header content tree
*/
public Content getFieldsContentHeader(boolean isLastContent);
/**
* Get the fields content.
* *
* @param heading the heading to write. * @param heading the heading to write.
* @param contentTree content tree to which the heading will be added
* @return serializable fields content tree
*/ */
public void writeHeader(String heading); public Content getSerializableFields(String heading, Content contentTree);
/** /**
* Write the deprecated information for this member. * Adds the deprecated information for this member.
* *
* @param field the field to document. * @param field the field to document.
* @param contentTree content tree to which the deprecated information will be added
*/ */
public void writeMemberDeprecatedInfo(FieldDoc field); public void addMemberDeprecatedInfo(FieldDoc field, Content contentTree);
/** /**
* Write the description text for this member. * Adds the description text for this member.
* *
* @param field the field to document. * @param field the field to document.
* @param contentTree content tree to which the member description will be added
*/ */
public void writeMemberDescription(FieldDoc field); public void addMemberDescription(FieldDoc field, Content contentTree);
/** /**
* Write the description text for this member represented by the tag. * Adds the description text for this member represented by the tag.
* *
* @param serialFieldTag the field to document (represented by tag). * @param serialFieldTag the field to document (represented by tag).
* @param contentTree content tree to which the member description will be added
*/ */
public void writeMemberDescription(SerialFieldTag serialFieldTag); public void addMemberDescription(SerialFieldTag serialFieldTag, Content contentTree);
/** /**
* Write the tag information for this member. * Adds the tag information for this member.
* *
* @param field the field to document. * @param field the field to document.
* @param contentTree content tree to which the member tags will be added
*/ */
public void writeMemberTags(FieldDoc field); public void addMemberTags(FieldDoc field, Content contentTree);
/** /**
* Write the member header. * Adds the member header.
* *
* @param fieldType the type of the field. * @param fieldType the type of the field.
* @param fieldTypeStr the type of the field in string format. We will * @param fieldTypeStr the type of the field in string format. We will
* print this out if we can't link to the type. * print this out if we can't link to the type.
* @param fieldDimensions the dimensions of the field. * @param fieldDimensions the dimensions of the field.
* @param fieldName the name of the field. * @param fieldName the name of the field.
* @param contentTree content tree to which the member header will be added
*/ */
public void writeMemberHeader(ClassDoc fieldType, String fieldTypeStr, public void addMemberHeader(ClassDoc fieldType, String fieldTypeStr,
String fieldDimensions, String fieldName); String fieldDimensions, String fieldName, Content contentTree);
/**
* Write the member footer.
*/
public void writeMemberFooter();
/** /**
* Check to see if overview details should be printed. If * Check to see if overview details should be printed. If
@ -162,13 +236,6 @@ public interface SerializedFormWriter {
* @return true if overview details need to be printed * @return true if overview details need to be printed
*/ */
public boolean shouldPrintOverview(FieldDoc field); public boolean shouldPrintOverview(FieldDoc field);
/**
* Write the footer.
*
* @param heading the heading that was written.
*/
public void writeFooter (String heading);
} }
/** /**
@ -176,45 +243,71 @@ public interface SerializedFormWriter {
*/ */
public interface SerialMethodWriter { public interface SerialMethodWriter {
/**
* Get the serializable method header.
*
* @return serializable methods content tree
*/
public Content getSerializableMethodsHeader();
/**
* Get the method content header.
*
* @param isLastContent true if this is the last content to be documented
* @return methods content tree
*/
public Content getMethodsContentHeader(boolean isLastContent);
/** /**
* Write the given heading. * Write the given heading.
* *
* @param heading the heading to write. * @param heading the heading to write
* @param serializableMethodTree content tree which will be added
* @return serializable methods content tree
*/ */
public void writeHeader(String heading); public Content getSerializableMethods(String heading, Content serializableMethodTree);
/** /**
* Write a warning that no serializable methods exist. * Write a warning that no serializable methods exist.
* *
* @param msg the warning to print. * @param msg the warning to print
* @return no customization message tree
*/ */
public void writeNoCustomizationMsg(String msg); public Content getNoCustomizationMsg(String msg);
/** /**
* Write the header. * Adds the header.
* *
* @param member the member to write the header for. * @param member the member to write the header for
* @param methodsContentTree content tree to which the header will be added
*/ */
public void writeMemberHeader(MethodDoc member); public void addMemberHeader(MethodDoc member, Content methodsContentTree);
/** /**
* Write the footer. * Adds the deprecated information for this member.
*
* @param member the member to write the deprecated information for
* @param methodsContentTree content tree to which the deprecated
* information will be added
*/ */
public void writeMemberFooter(); public void addDeprecatedMemberInfo(MethodDoc member, Content methodsContentTree);
/** /**
* Write the deprecated information for this member. * Adds the description for this member.
*
* @param member the member to write the information for
* @param methodsContentTree content tree to which the member
* information will be added
*/ */
public void writeDeprecatedMemberInfo(MethodDoc member); public void addMemberDescription(MethodDoc member, Content methodsContentTree);
/** /**
* Write the description for this member. * Adds the tag information for this member.
*
* @param member the member to write the tags information for
* @param methodsContentTree content tree to which the tags
* information will be added
*/ */
public void writeMemberDescription(MethodDoc member); public void addMemberTags(MethodDoc member, Content methodsContentTree);
/**
* Write the tag information for this member.
*/
public void writeMemberTags(MethodDoc member);
} }
} }

View file

@ -95,13 +95,14 @@ public abstract class AbstractBuilder {
* Build the documentation, as specified by the given XML element. * Build the documentation, as specified by the given XML element.
* *
* @param node the XML element that specifies which component to document. * @param node the XML element that specifies which component to document.
* @param contentTree content tree to which the documentation will be added
*/ */
protected void build(XMLNode node) { protected void build(XMLNode node, Content contentTree) {
String component = node.name; String component = node.name;
try { try {
invokeMethod("build" + component, invokeMethod("build" + component,
new Class<?>[] { XMLNode.class }, new Class<?>[]{XMLNode.class, Content.class},
new Object[] { node }); new Object[]{node, contentTree});
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
e.printStackTrace(); e.printStackTrace();
configuration.root.printError("Unknown element: " + component); configuration.root.printError("Unknown element: " + component);
@ -111,8 +112,8 @@ public abstract class AbstractBuilder {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
configuration.root.printError("Exception " + configuration.root.printError("Exception " +
e.getClass().getName() + e.getClass().getName() +
" thrown while processing element: " + component); " thrown while processing element: " + component);
throw new DocletAbortException(); throw new DocletAbortException();
} }
} }
@ -121,10 +122,11 @@ public abstract class AbstractBuilder {
* Build the documentation, as specified by the children of the given XML element. * Build the documentation, as specified by the children of the given XML element.
* *
* @param node the XML element that specifies which components to document. * @param node the XML element that specifies which components to document.
* @param contentTree content tree to which the documentation will be added
*/ */
protected void buildChildren(XMLNode node) { protected void buildChildren(XMLNode node, Content contentTree) {
for (XMLNode child: node.children) for (XMLNode child : node.children)
build(child); build(child, contentTree);
} }
/** /**
@ -140,8 +142,7 @@ public abstract class AbstractBuilder {
Object[] params) Object[] params)
throws Exception { throws Exception {
if (DEBUG) { if (DEBUG) {
configuration.root.printError("DEBUG: " + this.getClass().getName() configuration.root.printError("DEBUG: " + this.getClass().getName() + "." + methodName);
+ "." + methodName);
} }
Method method = this.getClass().getMethod(methodName, paramClasses); Method method = this.getClass().getMethod(methodName, paramClasses);
method.invoke(this, params); method.invoke(this, params);

View file

@ -27,6 +27,7 @@ package com.sun.tools.doclets.internal.toolkit.builders;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import java.util.*;
/** /**
* The superclass for all member builders. Member builders are only executed * The superclass for all member builders. Member builders are only executed
@ -66,12 +67,13 @@ public abstract class AbstractMemberBuilder extends AbstractBuilder {
/** /**
* Build the sub component if there is anything to document. * Build the sub component if there is anything to document.
* *
* @param elements {@inheritDoc} * @param node the XML element that specifies which components to document.
* @param contentTree content tree to which the documentation will be added
*/ */
@Override @Override
public void build(XMLNode node) { public void build(XMLNode node, Content contentTree) {
if (hasMembersToDocument()) { if (hasMembersToDocument()) {
super.build(node); super.build(node, contentTree);
} }
} }

View file

@ -25,11 +25,11 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.io.*;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import java.io.*;
import java.util.*;
/** /**
* Builds the summary for a given annotation type. * Builds the summary for a given annotation type.
@ -39,6 +39,7 @@ import java.util.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public class AnnotationTypeBuilder extends AbstractBuilder { public class AnnotationTypeBuilder extends AbstractBuilder {
@ -58,6 +59,11 @@ public class AnnotationTypeBuilder extends AbstractBuilder {
*/ */
private AnnotationTypeWriter writer; private AnnotationTypeWriter writer;
/**
* The content tree for the annotation documentation.
*/
private Content contentTree;
/** /**
* Construct a new ClassBuilder. * Construct a new ClassBuilder.
* *
@ -92,7 +98,7 @@ public class AnnotationTypeBuilder extends AbstractBuilder {
* {@inheritDoc} * {@inheritDoc}
*/ */
public void build() throws IOException { public void build() throws IOException {
build(LayoutParser.getInstance(configuration).parseXML(ROOT)); build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
} }
/** /**
@ -102,18 +108,24 @@ public class AnnotationTypeBuilder extends AbstractBuilder {
return ROOT; return ROOT;
} }
/** /**
* Handles the &lt;AnnotationTypeDoc> tag. * Build the annotation type documentation.
* *
* @param elements the XML elements that specify how to document a class. * @param node the XML element that specifies which components to document
* @param contentTree the content tree to which the documentation will be added
*/ */
public void buildAnnotationTypeDoc(XMLNode node) throws Exception { public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception {
buildChildren(node); contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
writer.close(); " " + annotationTypeDoc.name());
copyDocFiles(); Content annotationContentTree = writer.getAnnotationContentHeader();
buildChildren(node, annotationContentTree);
contentTree.addContent(annotationContentTree);
writer.addFooter(contentTree);
writer.printDocument(contentTree);
writer.close();
copyDocFiles();
} }
/** /**
* Copy the doc files for the current ClassDoc if necessary. * Copy the doc files for the current ClassDoc if necessary.
*/ */
@ -137,86 +149,112 @@ public class AnnotationTypeBuilder extends AbstractBuilder {
} }
/** /**
* Build the header of the page. * Build the annotation information tree documentation.
*
* @param node the XML element that specifies which components to document
* @param annotationContentTree the content tree to which the documentation will be added
*/ */
public void buildAnnotationTypeHeader(XMLNode node) { public void buildAnnotationTypeInfo(XMLNode node, Content annotationContentTree) {
writer.writeHeader(configuration.getText("doclet.AnnotationType") + Content annotationInfoTree = writer.getAnnotationInfoTreeHeader();
" " + annotationTypeDoc.name()); buildChildren(node, annotationInfoTree);
annotationContentTree.addContent(writer.getAnnotationInfo(annotationInfoTree));
} }
/** /**
* If this class is deprecated, print the appropriate information. * If this annotation is deprecated, build the appropriate information.
*
* @param node the XML element that specifies which components to document
* @param annotationInfoTree the content tree to which the documentation will be added
*/ */
public void buildDeprecationInfo (XMLNode node) { public void buildDeprecationInfo (XMLNode node, Content annotationInfoTree) {
writer.writeAnnotationTypeDeprecationInfo(); writer.addAnnotationTypeDeprecationInfo(annotationInfoTree);
} }
/** /**
* Build the signature of the current annotation type. * Build the signature of the current annotation type.
*/
public void buildAnnotationTypeSignature(XMLNode node) {
StringBuffer modifiers = new StringBuffer(
annotationTypeDoc.modifiers() + " ");
writer.writeAnnotationTypeSignature(
Util.replaceText(
modifiers.toString(), "interface", "@interface"));
}
/**
* Build the class description.
*/
public void buildAnnotationTypeDescription(XMLNode node) {
writer.writeAnnotationTypeDescription();
}
/**
* Build the tag information for the current class.
*/
public void buildAnnotationTypeTagInfo(XMLNode node) {
writer.writeAnnotationTypeTagInfo();
}
/**
* Build the contents of the page.
* *
* @param elements the XML elements that specify how a member summary is * @param node the XML element that specifies which components to document
* documented. * @param annotationInfoTree the content tree to which the documentation will be added
*/ */
public void buildMemberSummary(XMLNode node) throws Exception { public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) {
StringBuffer modifiers = new StringBuffer(
annotationTypeDoc.modifiers() + " ");
writer.addAnnotationTypeSignature(Util.replaceText(
modifiers.toString(), "interface", "@interface"), annotationInfoTree);
}
/**
* Build the annotation type description.
*
* @param node the XML element that specifies which components to document
* @param annotationInfoTree the content tree to which the documentation will be added
*/
public void buildAnnotationTypeDescription(XMLNode node, Content annotationInfoTree) {
writer.addAnnotationTypeDescription(annotationInfoTree);
}
/**
* Build the tag information for the current annotation type.
*
* @param node the XML element that specifies which components to document
* @param annotationInfoTree the content tree to which the documentation will be added
*/
public void buildAnnotationTypeTagInfo(XMLNode node, Content annotationInfoTree) {
writer.addAnnotationTypeTagInfo(annotationInfoTree);
}
/**
* Build the member summary contents of the page.
*
* @param node the XML element that specifies which components to document
* @param annotationContentTree the content tree to which the documentation will be added
*/
public void buildMemberSummary(XMLNode node, Content annotationContentTree)
throws Exception {
Content memberSummaryTree = writer.getMemberTreeHeader();
configuration.getBuilderFactory(). configuration.getBuilderFactory().
getMemberSummaryBuilder(writer).buildChildren(node); getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
writer.completeMemberSummaryBuild(); annotationContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
}
/**
* Build the member details contents of the page.
*
* @param node the XML element that specifies which components to document
* @param annotationContentTree the content tree to which the documentation will be added
*/
public void buildAnnotationTypeMemberDetails(XMLNode node, Content annotationContentTree) {
Content memberDetailsTree = writer.getMemberTreeHeader();
buildChildren(node, memberDetailsTree);
if (memberDetailsTree.isValid()) {
Content memberDetails = writer.getMemberTreeHeader();
writer.addAnnotationDetailsMarker(memberDetails);
memberDetails.addContent(writer.getMemberTree(memberDetailsTree));
annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetails));
}
} }
/** /**
* Build the annotation type optional member documentation. * Build the annotation type optional member documentation.
* *
* @param elements the XML elements that specify how a annotation type * @param node the XML element that specifies which components to document
* members are documented. * @param memberDetailsTree the content tree to which the documentation will be added
*/ */
public void buildAnnotationTypeOptionalMemberDetails(XMLNode node) public void buildAnnotationTypeOptionalMemberDetails(XMLNode node, Content memberDetailsTree)
throws Exception { throws Exception {
configuration.getBuilderFactory(). configuration.getBuilderFactory().
getAnnotationTypeOptionalMemberBuilder(writer).buildChildren(node); getAnnotationTypeOptionalMemberBuilder(writer).buildChildren(node, memberDetailsTree);
} }
/** /**
* Build the annotation type required member documentation. * Build the annotation type required member documentation.
* *
* @param elements the XML elements that specify how a annotation type * @param node the XML element that specifies which components to document
* members are documented. * @param memberDetailsTree the content tree to which the documentation will be added
*/ */
public void buildAnnotationTypeRequiredMemberDetails(XMLNode node) public void buildAnnotationTypeRequiredMemberDetails(XMLNode node, Content memberDetailsTree)
throws Exception { throws Exception {
configuration.getBuilderFactory(). configuration.getBuilderFactory().
getAnnotationTypeRequiredMemberBuilder(writer).buildChildren(node); getAnnotationTypeRequiredMemberBuilder(writer).buildChildren(node, memberDetailsTree);
}
/**
* Build the footer of the page.
*/
public void buildAnnotationTypeFooter(XMLNode node) {
writer.writeFooter();
} }
} }

View file

@ -25,11 +25,10 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import java.util.*;
/** /**
* Builds documentation for optional annotation type members. * Builds documentation for optional annotation type members.
@ -39,6 +38,7 @@ import java.util.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public class AnnotationTypeOptionalMemberBuilder extends public class AnnotationTypeOptionalMemberBuilder extends
@ -90,27 +90,25 @@ public class AnnotationTypeOptionalMemberBuilder extends
} }
/** /**
* Build the member documentation. * Build the annotation type optional member documentation.
* *
* @param elements the XML elements that specify how to construct this * @param node the XML element that specifies which components to document
* documentation. * @param memberDetailsTree the content tree to which the documentation will be added
*/ */
public void buildAnnotationTypeOptionalMember(XMLNode node) { public void buildAnnotationTypeOptionalMember(XMLNode node, Content memberDetailsTree) {
if (writer == null) { buildAnnotationTypeMember(node, memberDetailsTree);
return;
}
for (currentMemberIndex = 0; currentMemberIndex < members.size();
currentMemberIndex++) {
buildChildren(node);
}
} }
/** /**
* Document the default value for this optional member. * Build the default value for this optional member.
*
* @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/ */
public void buildDefaultValueInfo(XMLNode node) { public void buildDefaultValueInfo(XMLNode node, Content annotationDocTree) {
((AnnotationTypeOptionalMemberWriter) writer).writeDefaultValueInfo( ((AnnotationTypeOptionalMemberWriter) writer).addDefaultValueInfo(
(MemberDoc) members.get(currentMemberIndex)); (MemberDoc) members.get(currentMemberIndex),
annotationDocTree);
} }
/** /**

View file

@ -25,11 +25,10 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import java.util.*;
/** /**
* Builds documentation for required annotation type members. * Builds documentation for required annotation type members.
@ -39,6 +38,7 @@ import java.util.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder { public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
@ -140,82 +140,87 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
return members.size() > 0; return members.size() > 0;
} }
/**
* Build the annotation type required member documentation.
*
* @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
*/
public void buildAnnotationTypeRequiredMember(XMLNode node, Content memberDetailsTree) {
buildAnnotationTypeMember(node, memberDetailsTree);
}
/** /**
* Build the member documentation. * Build the member documentation.
* *
* @param elements the XML elements that specify how to construct this * @param node the XML element that specifies which components to document
* documentation. * @param memberDetailsTree the content tree to which the documentation will be added
*/ */
public void buildAnnotationTypeRequiredMember(XMLNode node) { public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) {
if (writer == null) { if (writer == null) {
return; return;
} }
for (currentMemberIndex = 0; currentMemberIndex < members.size(); int size = members.size();
if (size > 0) {
writer.addAnnotationDetailsTreeHeader(
classDoc, memberDetailsTree);
for (currentMemberIndex = 0; currentMemberIndex < size;
currentMemberIndex++) { currentMemberIndex++) {
buildChildren(node); Content annotationDocTree = writer.getAnnotationDocTreeHeader(
(MemberDoc) members.get(currentMemberIndex),
memberDetailsTree);
buildChildren(node, annotationDocTree);
memberDetailsTree.addContent(writer.getAnnotationDoc(
annotationDocTree, (currentMemberIndex == size - 1)));
}
} }
} }
/**
* Build the overall header.
*/
public void buildHeader(XMLNode node) {
writer.writeHeader(classDoc,
configuration.getText("doclet.Annotation_Type_Member_Detail"));
}
/**
* Build the header for the individual members.
*/
public void buildMemberHeader(XMLNode node) {
writer.writeMemberHeader((MemberDoc) members.get(
currentMemberIndex),
currentMemberIndex == 0);
}
/** /**
* Build the signature. * Build the signature.
*
* @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/ */
public void buildSignature(XMLNode node) { public void buildSignature(XMLNode node, Content annotationDocTree) {
writer.writeSignature((MemberDoc) members.get(currentMemberIndex)); annotationDocTree.addContent(
writer.getSignature((MemberDoc) members.get(currentMemberIndex)));
} }
/** /**
* Build the deprecation information. * Build the deprecation information.
*
* @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/ */
public void buildDeprecationInfo(XMLNode node) { public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) {
writer.writeDeprecated((MemberDoc) members.get(currentMemberIndex)); writer.addDeprecated((MemberDoc) members.get(currentMemberIndex),
annotationDocTree);
} }
/** /**
* Build the comments for the member. Do nothing if * Build the comments for the member. Do nothing if
* {@link Configuration#nocomment} is set to true. * {@link Configuration#nocomment} is set to true.
*
* @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/ */
public void buildMemberComments(XMLNode node) { public void buildMemberComments(XMLNode node, Content annotationDocTree) {
if(! configuration.nocomment){ if(! configuration.nocomment){
writer.writeComments((MemberDoc) members.get(currentMemberIndex)); writer.addComments((MemberDoc) members.get(currentMemberIndex),
annotationDocTree);
} }
} }
/** /**
* Build the tag information. * Build the tag information.
*
* @param node the XML element that specifies which components to document
* @param annotationDocTree the content tree to which the documentation will be added
*/ */
public void buildTagInfo(XMLNode node) { public void buildTagInfo(XMLNode node, Content annotationDocTree) {
writer.writeTags((MemberDoc) members.get(currentMemberIndex)); writer.addTags((MemberDoc) members.get(currentMemberIndex),
} annotationDocTree);
/**
* Build the footer for the individual member.
*/
public void buildMemberFooter(XMLNode node) {
writer.writeMemberFooter();
}
/**
* Build the overall footer.
*/
public void buildFooter(XMLNode node) {
writer.writeFooter(classDoc);
} }
/** /**

View file

@ -25,11 +25,11 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.io.*;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import java.io.*;
import java.util.*;
/** /**
* Builds the summary for a given class. * Builds the summary for a given class.
@ -39,6 +39,7 @@ import java.util.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public class ClassBuilder extends AbstractBuilder { public class ClassBuilder extends AbstractBuilder {
@ -68,6 +69,11 @@ public class ClassBuilder extends AbstractBuilder {
*/ */
private boolean isEnum = false; private boolean isEnum = false;
/**
* The content tree for the class documentation.
*/
private Content contentTree;
/** /**
* Construct a new ClassBuilder. * Construct a new ClassBuilder.
* *
@ -108,7 +114,7 @@ public class ClassBuilder extends AbstractBuilder {
* {@inheritDoc} * {@inheritDoc}
*/ */
public void build() throws IOException { public void build() throws IOException {
build(LayoutParser.getInstance(configuration).parseXML(ROOT)); build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
} }
/** /**
@ -121,121 +127,159 @@ public class ClassBuilder extends AbstractBuilder {
/** /**
* Handles the &lt;ClassDoc> tag. * Handles the &lt;ClassDoc> tag.
* *
* @param elements the XML elements that specify how to document a class. * @param node the XML element that specifies which components to document
* @param contentTree the content tree to which the documentation will be added
*/ */
public void buildClassDoc(XMLNode node) throws Exception { public void buildClassDoc(XMLNode node, Content contentTree) throws Exception {
buildChildren(node); String key;
writer.close(); if (isInterface) {
copyDocFiles(); key = "doclet.Interface";
} else if (isEnum) {
key = "doclet.Enum";
} else {
key = "doclet.Class";
}
contentTree = writer.getHeader(configuration.getText(key) + " " +
classDoc.name());
Content classContentTree = writer.getClassContentHeader();
buildChildren(node, classContentTree);
contentTree.addContent(classContentTree);
writer.addFooter(contentTree);
writer.printDocument(contentTree);
writer.close();
copyDocFiles();
} }
/** /**
* Copy the doc files for the current ClassDoc if necessary. * Build the class tree documentation.
*
* @param node the XML element that specifies which components to document
* @param classContentTree the content tree to which the documentation will be added
*/ */
public void buildClassTree(XMLNode node, Content classContentTree) {
writer.addClassTree(classContentTree);
}
/**
* Build the class information tree documentation.
*
* @param node the XML element that specifies which components to document
* @param classContentTree the content tree to which the documentation will be added
*/
public void buildClassInfo(XMLNode node, Content classContentTree) {
Content classInfoTree = writer.getClassInfoTreeHeader();
buildChildren(node, classInfoTree);
classContentTree.addContent(writer.getClassInfo(classInfoTree));
}
/**
* Build the typeparameters of this class.
*
* @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
public void buildTypeParamInfo(XMLNode node, Content classInfoTree) {
writer.addTypeParamInfo(classInfoTree);
}
/**
* If this is an interface, list all super interfaces.
*
* @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
public void buildSuperInterfacesInfo(XMLNode node, Content classInfoTree) {
writer.addSuperInterfacesInfo(classInfoTree);
}
/**
* If this is a class, list all interfaces implemented by this class.
*
* @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
public void buildImplementedInterfacesInfo(XMLNode node, Content classInfoTree) {
writer.addImplementedInterfacesInfo(classInfoTree);
}
/**
* List all the classes extend this one.
*
* @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
public void buildSubClassInfo(XMLNode node, Content classInfoTree) {
writer.addSubClassInfo(classInfoTree);
}
/**
* List all the interfaces that extend this one.
*
* @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
public void buildSubInterfacesInfo(XMLNode node, Content classInfoTree) {
writer.addSubInterfacesInfo(classInfoTree);
}
/**
* If this is an interface, list all classes that implement this interface.
*
* @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
public void buildInterfaceUsageInfo(XMLNode node, Content classInfoTree) {
writer.addInterfaceUsageInfo(classInfoTree);
}
/**
* If this class is deprecated, build the appropriate information.
*
* @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
public void buildDeprecationInfo (XMLNode node, Content classInfoTree) {
writer.addClassDeprecationInfo(classInfoTree);
}
/**
* If this is an inner class or interface, list the enclosing class or interface.
*
* @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/
public void buildNestedClassInfo (XMLNode node, Content classInfoTree) {
writer.addNestedClassInfo(classInfoTree);
}
/**
* Copy the doc files for the current ClassDoc if necessary.
*/
private void copyDocFiles() { private void copyDocFiles() {
PackageDoc containingPackage = classDoc.containingPackage(); PackageDoc containingPackage = classDoc.containingPackage();
if((configuration.packages == null || if((configuration.packages == null ||
Arrays.binarySearch(configuration.packages, Arrays.binarySearch(configuration.packages,
containingPackage) < 0) && containingPackage) < 0) &&
! containingPackagesSeen.contains(containingPackage.name())){ ! containingPackagesSeen.contains(containingPackage.name())){
//Only copy doc files dir if the containing package is not //Only copy doc files dir if the containing package is not
//documented AND if we have not documented a class from the same //documented AND if we have not documented a class from the same
//package already. Otherwise, we are making duplicate copies. //package already. Otherwise, we are making duplicate copies.
Util.copyDocFiles(configuration, Util.copyDocFiles(configuration,
Util.getPackageSourcePath(configuration, Util.getPackageSourcePath(configuration,
classDoc.containingPackage()) + classDoc.containingPackage()) +
DirectoryManager.getDirectoryPath(classDoc.containingPackage()) DirectoryManager.getDirectoryPath(classDoc.containingPackage())
+ File.separator, DocletConstants.DOC_FILES_DIR_NAME, true); + File.separator, DocletConstants.DOC_FILES_DIR_NAME, true);
containingPackagesSeen.add(containingPackage.name()); containingPackagesSeen.add(containingPackage.name());
} }
} }
/**
* Build the header of the page.
*/
public void buildClassHeader(XMLNode node) {
String key;
if (isInterface) {
key = "doclet.Interface";
} else if (isEnum) {
key = "doclet.Enum";
} else {
key = "doclet.Class";
}
writer.writeHeader(configuration.getText(key) + " " + classDoc.name());
}
/**
* Build the class tree documentation.
*/
public void buildClassTree(XMLNode node) {
writer.writeClassTree();
}
/**
* If this is a class, list all interfaces
* implemented by this class.
*/
public void buildImplementedInterfacesInfo(XMLNode node) {
writer.writeImplementedInterfacesInfo();
}
/**
* If this is an interface, list all super interfaces.
*/
public void buildSuperInterfacesInfo(XMLNode node) {
writer.writeSuperInterfacesInfo();
}
/**
* List the parameters of this class.
*/
public void buildTypeParamInfo(XMLNode node) {
writer.writeTypeParamInfo();
}
/**
* List all the classes extend this one.
*/
public void buildSubClassInfo(XMLNode node) {
writer.writeSubClassInfo();
}
/**
* List all the interfaces that extend this one.
*/
public void buildSubInterfacesInfo(XMLNode node) {
writer.writeSubInterfacesInfo();
}
/**
* If this is an interface, list all classes that implement this interface.
*/
public void buildInterfaceUsageInfo (XMLNode node) {
writer.writeInterfaceUsageInfo();
}
/**
* If this is an inner class or interface, list the enclosing class or
* interface.
*/
public void buildNestedClassInfo (XMLNode node) {
writer.writeNestedClassInfo();
}
/**
* If this class is deprecated, print the appropriate information.
*/
public void buildDeprecationInfo (XMLNode node) {
writer.writeClassDeprecationInfo();
}
/** /**
* Build the signature of the current class. * Build the signature of the current class.
*
* @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/ */
public void buildClassSignature(XMLNode node) { public void buildClassSignature(XMLNode node, Content classInfoTree) {
StringBuffer modifiers = new StringBuffer(classDoc.modifiers() + " "); StringBuffer modifiers = new StringBuffer(classDoc.modifiers() + " ");
if (isEnum) { if (isEnum) {
modifiers.append("enum "); modifiers.append("enum ");
@ -243,93 +287,111 @@ public class ClassBuilder extends AbstractBuilder {
if ((index = modifiers.indexOf("abstract")) >= 0) { if ((index = modifiers.indexOf("abstract")) >= 0) {
modifiers.delete(index, index + (new String("abstract")).length()); modifiers.delete(index, index + (new String("abstract")).length());
modifiers = new StringBuffer( modifiers = new StringBuffer(
Util.replaceText(modifiers.toString(), " ", " ")); Util.replaceText(modifiers.toString(), " ", " "));
} }
if ((index = modifiers.indexOf("final")) >= 0) { if ((index = modifiers.indexOf("final")) >= 0) {
modifiers.delete(index, index + (new String("final")).length()); modifiers.delete(index, index + (new String("final")).length());
modifiers = new StringBuffer( modifiers = new StringBuffer(
Util.replaceText(modifiers.toString(), " ", " ")); Util.replaceText(modifiers.toString(), " ", " "));
} }
//} else if (classDoc.isAnnotationType()) { //} else if (classDoc.isAnnotationType()) {
//modifiers.append("@interface "); //modifiers.append("@interface ");
} else if (! isInterface) { } else if (! isInterface) {
modifiers.append("class "); modifiers.append("class ");
} }
writer.writeClassSignature(modifiers.toString()); writer.addClassSignature(modifiers.toString(), classInfoTree);
} }
/** /**
* Build the class description. * Build the class description.
*
* @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/ */
public void buildClassDescription(XMLNode node) { public void buildClassDescription(XMLNode node, Content classInfoTree) {
writer.writeClassDescription(); writer.addClassDescription(classInfoTree);
} }
/** /**
* Build the tag information for the current class. * Build the tag information for the current class.
*
* @param node the XML element that specifies which components to document
* @param classInfoTree the content tree to which the documentation will be added
*/ */
public void buildClassTagInfo(XMLNode node) { public void buildClassTagInfo(XMLNode node, Content classInfoTree) {
writer.writeClassTagInfo(); writer.addClassTagInfo(classInfoTree);
} }
/** /**
* Build the contents of the page. * Build the member summary contents of the page.
* *
* @param elements the XML elements that specify how a member summary is * @param node the XML element that specifies which components to document
* documented. * @param classContentTree the content tree to which the documentation will be added
*/ */
public void buildMemberSummary(XMLNode node) throws Exception { public void buildMemberSummary(XMLNode node, Content classContentTree) throws Exception {
Content memberSummaryTree = writer.getMemberTreeHeader();
configuration.getBuilderFactory(). configuration.getBuilderFactory().
getMemberSummaryBuilder(writer).buildChildren(node); getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
writer.completeMemberSummaryBuild(); classContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
}
/**
* Build the member details contents of the page.
*
* @param node the XML element that specifies which components to document
* @param classContentTree the content tree to which the documentation will be added
*/
public void buildMemberDetails(XMLNode node, Content classContentTree) {
Content memberDetailsTree = writer.getMemberTreeHeader();
buildChildren(node, memberDetailsTree);
classContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
} }
/** /**
* Build the enum constants documentation. * Build the enum constants documentation.
* *
* @param elements the XML elements that specify how a enum constants are * @param node the XML element that specifies which components to document
* documented. * @param memberDetailsTree the content tree to which the documentation will be added
*/ */
public void buildEnumConstantsDetails(XMLNode node) throws Exception { public void buildEnumConstantsDetails(XMLNode node,
Content memberDetailsTree) throws Exception {
configuration.getBuilderFactory(). configuration.getBuilderFactory().
getEnumConstantsBuilder(writer).buildChildren(node); getEnumConstantsBuilder(writer).buildChildren(node, memberDetailsTree);
} }
/** /**
* Build the field documentation. * Build the field documentation.
* *
* @param elements the XML elements that specify how a field is documented. * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
*/ */
public void buildFieldDetails(XMLNode node) throws Exception { public void buildFieldDetails(XMLNode node,
Content memberDetailsTree) throws Exception {
configuration.getBuilderFactory(). configuration.getBuilderFactory().
getFieldBuilder(writer).buildChildren(node); getFieldBuilder(writer).buildChildren(node, memberDetailsTree);
} }
/** /**
* Build the constructor documentation. * Build the constructor documentation.
* *
* @param elements the XML elements that specify how to document a * @param node the XML element that specifies which components to document
* constructor. * @param memberDetailsTree the content tree to which the documentation will be added
*/ */
public void buildConstructorDetails(XMLNode node) throws Exception { public void buildConstructorDetails(XMLNode node,
Content memberDetailsTree) throws Exception {
configuration.getBuilderFactory(). configuration.getBuilderFactory().
getConstructorBuilder(writer).buildChildren(node); getConstructorBuilder(writer).buildChildren(node, memberDetailsTree);
} }
/** /**
* Build the method documentation. * Build the method documentation.
* *
* @param elements the XML elements that specify how a method is documented. * @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
*/ */
public void buildMethodDetails(XMLNode node) throws Exception { public void buildMethodDetails(XMLNode node,
Content memberDetailsTree) throws Exception {
configuration.getBuilderFactory(). configuration.getBuilderFactory().
getMethodBuilder(writer).buildChildren(node); getMethodBuilder(writer).buildChildren(node, memberDetailsTree);
}
/**
* Build the footer of the page.
*/
public void buildClassFooter(XMLNode node) {
writer.writeFooter();
} }
} }

View file

@ -25,11 +25,11 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*;
/** /**
* Builds the Constants Summary Page. * Builds the Constants Summary Page.
@ -39,6 +39,7 @@ import java.util.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public class ConstantsSummaryBuilder extends AbstractBuilder { public class ConstantsSummaryBuilder extends AbstractBuilder {
@ -79,6 +80,11 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
*/ */
private ClassDoc currentClass; private ClassDoc currentClass;
/**
* The content tree for the constant summary documentation.
*/
private Content contentTree;
/** /**
* Construct a new ConstantsSummaryBuilder. * Construct a new ConstantsSummaryBuilder.
* *
@ -113,7 +119,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
//Doclet does not support this output. //Doclet does not support this output.
return; return;
} }
build(LayoutParser.getInstance(configuration).parseXML(ROOT)); build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
} }
/** /**
@ -126,85 +132,85 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
/** /**
* Build the constant summary. * Build the constant summary.
* *
* @param elements the list of elements describing constant summary * @param node the XML element that specifies which components to document
* documentation. * @param contentTree the content tree to which the documentation will be added
*/ */
public void buildConstantSummary(XMLNode node) throws Exception { public void buildConstantSummary(XMLNode node, Content contentTree) throws Exception {
buildChildren(node); contentTree = writer.getHeader();
buildChildren(node, contentTree);
writer.addFooter(contentTree);
writer.printDocument(contentTree);
writer.close(); writer.close();
} }
/** /**
* Build the header. * Build the list of packages.
*
* @param node the XML element that specifies which components to document
* @param contentTree the content tree to which the content list will be added
*/ */
public void buildHeader(XMLNode node) { public void buildContents(XMLNode node, Content contentTree) {
writer.writeHeader(); Content contentListTree = writer.getContentsHeader();
}
/**
* Build the footer.
*/
public void buildFooter(XMLNode node) {
writer.writeFooter();
}
/**
* Build the table of contents.
*/
public void buildContents(XMLNode node) {
writer.writeContentsHeader();
PackageDoc[] packages = configuration.packages; PackageDoc[] packages = configuration.packages;
printedPackageHeaders = new HashSet<String>(); printedPackageHeaders = new HashSet<String>();
for (int i = 0; i < packages.length; i++) { for (int i = 0; i < packages.length; i++) {
if (hasConstantField(packages[i]) && ! hasPrintedPackageIndex(packages[i].name())) { if (hasConstantField(packages[i]) && ! hasPrintedPackageIndex(packages[i].name())) {
writer.writeLinkToPackageContent(packages[i], writer.addLinkToPackageContent(packages[i],
parsePackageName(packages[i].name()), parsePackageName(packages[i].name()),
printedPackageHeaders); printedPackageHeaders, contentListTree);
} }
} }
writer.writeContentsFooter(); contentTree.addContent(writer.getContentsList(contentListTree));
} }
/** /**
* Build the summary for each documented package. * Build the summary for each documented package.
* *
* @param elements the XML elements that represent the components * @param node the XML element that specifies which components to document
* of documentation for each package. * @param contentTree the tree to which the summaries will be added
*/ */
public void buildConstantSummaries(XMLNode node) { public void buildConstantSummaries(XMLNode node, Content contentTree) {
PackageDoc[] packages = configuration.packages; PackageDoc[] packages = configuration.packages;
printedPackageHeaders = new HashSet<String>(); printedPackageHeaders = new HashSet<String>();
Content summariesTree = writer.getConstantSummaries();
for (int i = 0; i < packages.length; i++) { for (int i = 0; i < packages.length; i++) {
if (hasConstantField(packages[i])) { if (hasConstantField(packages[i])) {
currentPackage = packages[i]; currentPackage = packages[i];
//Build the documentation for the current package. //Build the documentation for the current package.
buildChildren(node); buildChildren(node, summariesTree);
} }
} }
contentTree.addContent(summariesTree);
} }
/** /**
* Build the summary for the current package. * Build the header for the given package.
* *
* @param elements the list of XML elements that make up package * @param node the XML element that specifies which components to document
* documentation. * @param summariesTree the tree to which the package header will be added
*/ */
public void buildPackageConstantSummary(XMLNode node) { public void buildPackageHeader(XMLNode node, Content summariesTree) {
buildChildren(node); String parsedPackageName = parsePackageName(currentPackage.name());
if (! printedPackageHeaders.contains(parsedPackageName)) {
writer.addPackageName(currentPackage,
parsePackageName(currentPackage.name()), summariesTree);
printedPackageHeaders.add(parsedPackageName);
}
} }
/** /**
* Build the summary for the current class. * Build the summary for the current class.
* *
* @param elements the list of XML elements that make up the class * @param node the XML element that specifies which components to document
* constant summary. * @param summariesTree the tree to which the class constant summary will be added
*/ */
public void buildClassConstantSummary(XMLNode node) { public void buildClassConstantSummary(XMLNode node, Content summariesTree) {
ClassDoc[] classes = currentPackage.name().length() > 0 ? ClassDoc[] classes = currentPackage.name().length() > 0 ?
currentPackage.allClasses() : currentPackage.allClasses() :
configuration.classDocCatalog.allClasses( configuration.classDocCatalog.allClasses(
DocletConstants.DEFAULT_PACKAGE_NAME); DocletConstants.DEFAULT_PACKAGE_NAME);
Arrays.sort(classes); Arrays.sort(classes);
Content classConstantTree = writer.getClassConstantHeader();
for (int i = 0; i < classes.length; i++) { for (int i = 0; i < classes.length; i++) {
if (! classDocsWithConstFields.contains(classes[i]) || if (! classDocsWithConstFields.contains(classes[i]) ||
! classes[i].isIncluded()) { ! classes[i].isIncluded()) {
@ -212,42 +218,20 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
} }
currentClass = classes[i]; currentClass = classes[i];
//Build the documentation for the current class. //Build the documentation for the current class.
buildChildren(node); buildChildren(node, classConstantTree);
} }
summariesTree.addContent(classConstantTree);
} }
/** /**
* Build the header for the given class. * Build the summary of constant members in the class.
*
* @param node the XML element that specifies which components to document
* @param classConstantTree the tree to which the constant members table
* will be added
*/ */
public void buildPackageHeader(XMLNode node) { public void buildConstantMembers(XMLNode node, Content classConstantTree) {
String parsedPackageName = parsePackageName(currentPackage.name()); new ConstantFieldBuilder(currentClass).buildMembersSummary(node, classConstantTree);
if (! printedPackageHeaders.contains(parsedPackageName)) {
writer.writePackageName(currentPackage,
parsePackageName(currentPackage.name()));
printedPackageHeaders.add(parsedPackageName);
}
}
/**
* Build the header for the given class.
*/
public void buildClassHeader(XMLNode node) {
writer.writeConstantMembersHeader(currentClass);
}
/**
* Print summary of constant members in the
* class.
*/
public void buildConstantMembers(XMLNode node) {
new ConstantFieldBuilder(currentClass).buildMembersSummary(node);
}
/**
* Build the footer for the given class.
*/
public void buildClassFooter(XMLNode node) {
writer.writeConstantMembersFooter(currentClass);
} }
/** /**
@ -346,12 +330,16 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
/** /**
* Builds the table of constants for a given class. * Builds the table of constants for a given class.
*
* @param node the XML element that specifies which components to document
* @param classConstantTree the tree to which the class constants table
* will be added
*/ */
protected void buildMembersSummary(XMLNode node) { protected void buildMembersSummary(XMLNode node, Content classConstantTree) {
List<FieldDoc> members = new ArrayList<FieldDoc>(members()); List<FieldDoc> members = new ArrayList<FieldDoc>(members());
if (members.size() > 0) { if (members.size() > 0) {
Collections.sort(members); Collections.sort(members);
writer.writeConstantMembers(classdoc, members); writer.addConstantMembers(classdoc, members, classConstantTree);
} }
} }

View file

@ -25,10 +25,10 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import java.util.*;
/** /**
* Builds documentation for a constructor. * Builds documentation for a constructor.
@ -38,200 +38,195 @@ import java.util.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public class ConstructorBuilder extends AbstractMemberBuilder { public class ConstructorBuilder extends AbstractMemberBuilder {
/** /**
* The name of this builder. * The name of this builder.
*/ */
public static final String NAME = "ConstructorDetails"; public static final String NAME = "ConstructorDetails";
/** /**
* The index of the current field that is being documented at this point * The index of the current field that is being documented at this point
* in time. * in time.
*/ */
private int currentMethodIndex; private int currentConstructorIndex;
/** /**
* The class whose constructors are being documented. * The class whose constructors are being documented.
*/ */
private ClassDoc classDoc; private ClassDoc classDoc;
/** /**
* The visible constructors for the given class. * The visible constructors for the given class.
*/ */
private VisibleMemberMap visibleMemberMap; private VisibleMemberMap visibleMemberMap;
/** /**
* The writer to output the constructor documentation. * The writer to output the constructor documentation.
*/ */
private ConstructorWriter writer; private ConstructorWriter writer;
/** /**
* The constructors being documented. * The constructors being documented.
*/ */
private List<ProgramElementDoc> constructors; private List<ProgramElementDoc> constructors;
/** /**
* Construct a new ConstructorBuilder. * Construct a new ConstructorBuilder.
* *
* @param configuration the current configuration of the * @param configuration the current configuration of the
* doclet. * doclet.
*/ */
private ConstructorBuilder(Configuration configuration) { private ConstructorBuilder(Configuration configuration) {
super(configuration); super(configuration);
}
/**
* Construct a new ConstructorBuilder.
*
* @param configuration the current configuration of the doclet.
* @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer.
*/
public static ConstructorBuilder getInstance(
Configuration configuration,
ClassDoc classDoc,
ConstructorWriter writer) {
ConstructorBuilder builder = new ConstructorBuilder(configuration);
builder.classDoc = classDoc;
builder.writer = writer;
builder.visibleMemberMap =
new VisibleMemberMap(
classDoc,
VisibleMemberMap.CONSTRUCTORS,
configuration.nodeprecated);
builder.constructors =
new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getMembersFor(classDoc));
for (int i = 0; i < builder.constructors.size(); i++) {
if (builder.constructors.get(i).isProtected()
|| builder.constructors.get(i).isPrivate()) {
writer.setFoundNonPubConstructor(true);
}
} }
if (configuration.getMemberComparator() != null) {
/** Collections.sort(
* Construct a new ConstructorBuilder. builder.constructors,
* configuration.getMemberComparator());
* @param configuration the current configuration of the doclet.
* @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer.
*/
public static ConstructorBuilder getInstance(
Configuration configuration,
ClassDoc classDoc,
ConstructorWriter writer) {
ConstructorBuilder builder = new ConstructorBuilder(configuration);
builder.classDoc = classDoc;
builder.writer = writer;
builder.visibleMemberMap =
new VisibleMemberMap(
classDoc,
VisibleMemberMap.CONSTRUCTORS,
configuration.nodeprecated);
builder.constructors =
new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getMembersFor(classDoc));
for (int i = 0; i < builder.constructors.size(); i++) {
if (builder.constructors.get(i).isProtected()
|| builder.constructors.get(i).isPrivate()) {
writer.setFoundNonPubConstructor(true);
}
}
if (configuration.getMemberComparator() != null) {
Collections.sort(
builder.constructors,
configuration.getMemberComparator());
}
return builder;
} }
return builder;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getName() { public String getName() {
return NAME; return NAME;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public boolean hasMembersToDocument() { public boolean hasMembersToDocument() {
return constructors.size() > 0; return constructors.size() > 0;
} }
/** /**
* Returns a list of constructors that will be documented for the given class. * Returns a list of constructors that will be documented for the given class.
* This information can be used for doclet specific documentation * This information can be used for doclet specific documentation
* generation. * generation.
* *
* @return a list of constructors that will be documented. * @return a list of constructors that will be documented.
*/ */
public List<ProgramElementDoc> members(ClassDoc classDoc) { public List<ProgramElementDoc> members(ClassDoc classDoc) {
return visibleMemberMap.getMembersFor(classDoc); return visibleMemberMap.getMembersFor(classDoc);
} }
/** /**
* Return the constructor writer for this builder. * Return the constructor writer for this builder.
* *
* @return the constructor writer for this builder. * @return the constructor writer for this builder.
*/ */
public ConstructorWriter getWriter() { public ConstructorWriter getWriter() {
return writer; return writer;
} }
/** /**
* Build the constructor documentation. * Build the constructor documentation.
* *
* @param elements the XML elements that specify how to construct this * @param node the XML element that specifies which components to document
* documentation. * @param memberDetailsTree the content tree to which the documentation will be added
*/ */
public void buildConstructorDoc(XMLNode node) { public void buildConstructorDoc(XMLNode node, Content memberDetailsTree) {
if (writer == null) { if (writer == null) {
return; return;
}
for (currentMethodIndex = 0;
currentMethodIndex < constructors.size();
currentMethodIndex++) {
buildChildren(node);
}
} }
int size = constructors.size();
if (size > 0) {
Content constructorDetailsTree = writer.getConstructorDetailsTreeHeader(
classDoc, memberDetailsTree);
for (currentConstructorIndex = 0; currentConstructorIndex < size;
currentConstructorIndex++) {
Content constructorDocTree = writer.getConstructorDocTreeHeader(
(ConstructorDoc) constructors.get(currentConstructorIndex),
constructorDetailsTree);
buildChildren(node, constructorDocTree);
constructorDetailsTree.addContent(writer.getConstructorDoc(
constructorDocTree, (currentConstructorIndex == size - 1)));
}
memberDetailsTree.addContent(
writer.getConstructorDetails(constructorDetailsTree));
}
}
/** /**
* Build the overall header. * Build the signature.
*/ *
public void buildHeader(XMLNode node) { * @param node the XML element that specifies which components to document
writer.writeHeader( * @param constructorDocTree the content tree to which the documentation will be added
classDoc, */
configuration.getText("doclet.Constructor_Detail")); public void buildSignature(XMLNode node, Content constructorDocTree) {
} constructorDocTree.addContent(
writer.getSignature(
(ConstructorDoc) constructors.get(currentConstructorIndex)));
}
/** /**
* Build the header for the individual constructor. * Build the deprecation information.
*/ *
public void buildConstructorHeader(XMLNode node) { * @param node the XML element that specifies which components to document
writer.writeConstructorHeader( * @param constructorDocTree the content tree to which the documentation will be added
(ConstructorDoc) constructors.get(currentMethodIndex), */
currentMethodIndex == 0); public void buildDeprecationInfo(XMLNode node, Content constructorDocTree) {
} writer.addDeprecated(
(ConstructorDoc) constructors.get(currentConstructorIndex), constructorDocTree);
}
/** /**
* Build the signature. * Build the comments for the constructor. Do nothing if
*/ * {@link Configuration#nocomment} is set to true.
public void buildSignature(XMLNode node) { *
writer.writeSignature( * @param node the XML element that specifies which components to document
(ConstructorDoc) constructors.get(currentMethodIndex)); * @param constructorDocTree the content tree to which the documentation will be added
*/
public void buildConstructorComments(XMLNode node, Content constructorDocTree) {
if (!configuration.nocomment) {
writer.addComments(
(ConstructorDoc) constructors.get(currentConstructorIndex),
constructorDocTree);
} }
}
/** /**
* Build the deprecation information. * Build the tag information.
*/ *
public void buildDeprecationInfo(XMLNode node) { * @param node the XML element that specifies which components to document
writer.writeDeprecated( * @param constructorDocTree the content tree to which the documentation will be added
(ConstructorDoc) constructors.get(currentMethodIndex)); */
} public void buildTagInfo(XMLNode node, Content constructorDocTree) {
writer.addTags((ConstructorDoc) constructors.get(currentConstructorIndex),
/** constructorDocTree);
* Build the comments for the constructor. Do nothing if }
* {@link Configuration#nocomment} is set to true.
*/
public void buildConstructorComments(XMLNode node) {
if (!configuration.nocomment) {
writer.writeComments(
(ConstructorDoc) constructors.get(currentMethodIndex));
}
}
/**
* Build the tag information.
*/
public void buildTagInfo(XMLNode node) {
writer.writeTags((ConstructorDoc) constructors.get(currentMethodIndex));
}
/**
* Build the footer for the individual constructor.
*/
public void buildConstructorFooter(XMLNode node) {
writer.writeConstructorFooter();
}
/**
* Build the overall footer.
*/
public void buildFooter(XMLNode node) {
writer.writeFooter(classDoc);
}
} }

View file

@ -25,10 +25,10 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import java.util.*;
/** /**
* Builds documentation for a enum constants. * Builds documentation for a enum constants.
@ -38,200 +38,195 @@ import java.util.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public class EnumConstantBuilder extends AbstractMemberBuilder { public class EnumConstantBuilder extends AbstractMemberBuilder {
/** /**
* The class whose enum constants are being documented. * The class whose enum constants are being documented.
*/ */
private ClassDoc classDoc; private ClassDoc classDoc;
/** /**
* The visible enum constantss for the given class. * The visible enum constantss for the given class.
*/ */
private VisibleMemberMap visibleMemberMap; private VisibleMemberMap visibleMemberMap;
/** /**
* The writer to output the enum constants documentation. * The writer to output the enum constants documentation.
*/ */
private EnumConstantWriter writer; private EnumConstantWriter writer;
/** /**
* The list of enum constants being documented. * The list of enum constants being documented.
*/ */
private List<ProgramElementDoc> enumConstants; private List<ProgramElementDoc> enumConstants;
/** /**
* The index of the current enum constant that is being documented at this point * The index of the current enum constant that is being documented at this point
* in time. * in time.
*/ */
private int currentEnumConstantsIndex; private int currentEnumConstantsIndex;
/** /**
* Construct a new EnumConstantsBuilder. * Construct a new EnumConstantsBuilder.
* *
* @param configuration the current configuration of the * @param configuration the current configuration of the
* doclet. * doclet.
*/ */
private EnumConstantBuilder(Configuration configuration) { private EnumConstantBuilder(Configuration configuration) {
super(configuration); super(configuration);
}
/**
* Construct a new EnumConstantsBuilder.
*
* @param configuration the current configuration of the doclet.
* @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer.
*/
public static EnumConstantBuilder getInstance(
Configuration configuration,
ClassDoc classDoc,
EnumConstantWriter writer) {
EnumConstantBuilder builder = new EnumConstantBuilder(configuration);
builder.classDoc = classDoc;
builder.writer = writer;
builder.visibleMemberMap =
new VisibleMemberMap(
classDoc,
VisibleMemberMap.ENUM_CONSTANTS,
configuration.nodeprecated);
builder.enumConstants =
new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getMembersFor(classDoc));
if (configuration.getMemberComparator() != null) {
Collections.sort(
builder.enumConstants,
configuration.getMemberComparator());
} }
return builder;
}
/** /**
* Construct a new EnumConstantsBuilder. * {@inheritDoc}
* */
* @param configuration the current configuration of the doclet. public String getName() {
* @param classDoc the class whoses members are being documented. return "EnumConstantDetails";
* @param writer the doclet specific writer. }
*/
public static EnumConstantBuilder getInstance( /**
Configuration configuration, * Returns a list of enum constants that will be documented for the given class.
ClassDoc classDoc, * This information can be used for doclet specific documentation
EnumConstantWriter writer) { * generation.
EnumConstantBuilder builder = new EnumConstantBuilder(configuration); *
builder.classDoc = classDoc; * @param classDoc the {@link ClassDoc} we want to check.
builder.writer = writer; * @return a list of enum constants that will be documented.
builder.visibleMemberMap = */
new VisibleMemberMap( public List<ProgramElementDoc> members(ClassDoc classDoc) {
classDoc, return visibleMemberMap.getMembersFor(classDoc);
VisibleMemberMap.ENUM_CONSTANTS, }
configuration.nodeprecated);
builder.enumConstants = /**
new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getMembersFor(classDoc)); * Returns the visible member map for the enum constants of this class.
if (configuration.getMemberComparator() != null) { *
Collections.sort( * @return the visible member map for the enum constants of this class.
builder.enumConstants, */
configuration.getMemberComparator()); public VisibleMemberMap getVisibleMemberMap() {
} return visibleMemberMap;
return builder; }
/**
* summaryOrder.size()
*/
public boolean hasMembersToDocument() {
return enumConstants.size() > 0;
}
/**
* Build the enum constant documentation.
*
* @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
*/
public void buildEnumConstant(XMLNode node, Content memberDetailsTree) {
if (writer == null) {
return;
} }
int size = enumConstants.size();
/** if (size > 0) {
* {@inheritDoc} Content enumConstantsDetailsTree = writer.getEnumConstantsDetailsTreeHeader(
*/ classDoc, memberDetailsTree);
public String getName() { for (currentEnumConstantsIndex = 0; currentEnumConstantsIndex < size;
return "EnumConstantDetails"; currentEnumConstantsIndex++) {
} Content enumConstantsTree = writer.getEnumConstantsTreeHeader(
/**
* Returns a list of enum constants that will be documented for the given class.
* This information can be used for doclet specific documentation
* generation.
*
* @param classDoc the {@link ClassDoc} we want to check.
* @return a list of enum constants that will be documented.
*/
public List<ProgramElementDoc> members(ClassDoc classDoc) {
return visibleMemberMap.getMembersFor(classDoc);
}
/**
* Returns the visible member map for the enum constants of this class.
*
* @return the visible member map for the enum constants of this class.
*/
public VisibleMemberMap getVisibleMemberMap() {
return visibleMemberMap;
}
/**
* summaryOrder.size()
*/
public boolean hasMembersToDocument() {
return enumConstants.size() > 0;
}
/**
* Build the enum constant documentation.
*
* @param elements the XML elements that specify how to construct this
* documentation.
*/
public void buildEnumConstant(XMLNode node) {
if (writer == null) {
return;
}
for (currentEnumConstantsIndex = 0;
currentEnumConstantsIndex < enumConstants.size();
currentEnumConstantsIndex++) {
buildChildren(node);
}
}
/**
* Build the overall header.
*/
public void buildHeader(XMLNode node) {
writer.writeHeader(
classDoc,
configuration.getText("doclet.Enum_Constant_Detail"));
}
/**
* Build the header for the individual enum constants.
*/
public void buildEnumConstantHeader(XMLNode node) {
writer.writeEnumConstantHeader(
(FieldDoc) enumConstants.get(currentEnumConstantsIndex), (FieldDoc) enumConstants.get(currentEnumConstantsIndex),
currentEnumConstantsIndex == 0); enumConstantsDetailsTree);
buildChildren(node, enumConstantsTree);
enumConstantsDetailsTree.addContent(writer.getEnumConstants(
enumConstantsTree, (currentEnumConstantsIndex == size - 1)));
}
memberDetailsTree.addContent(
writer.getEnumConstantsDetails(enumConstantsDetailsTree));
} }
}
/** /**
* Build the signature. * Build the signature.
*/ *
public void buildSignature(XMLNode node) { * @param node the XML element that specifies which components to document
writer.writeSignature( * @param enumConstantsTree the content tree to which the documentation will be added
(FieldDoc) enumConstants.get(currentEnumConstantsIndex)); */
} public void buildSignature(XMLNode node, Content enumConstantsTree) {
enumConstantsTree.addContent(writer.getSignature(
(FieldDoc) enumConstants.get(currentEnumConstantsIndex)));
}
/** /**
* Build the deprecation information. * Build the deprecation information.
*/ *
public void buildDeprecationInfo(XMLNode node) { * @param node the XML element that specifies which components to document
writer.writeDeprecated( * @param enumConstantsTree the content tree to which the documentation will be added
(FieldDoc) enumConstants.get(currentEnumConstantsIndex)); */
} public void buildDeprecationInfo(XMLNode node, Content enumConstantsTree) {
writer.addDeprecated(
(FieldDoc) enumConstants.get(currentEnumConstantsIndex),
enumConstantsTree);
}
/** /**
* Build the comments for the enum constant. Do nothing if * Build the comments for the enum constant. Do nothing if
* {@link Configuration#nocomment} is set to true. * {@link Configuration#nocomment} is set to true.
*/ *
public void buildEnumConstantComments(XMLNode node) { * @param node the XML element that specifies which components to document
if (!configuration.nocomment) { * @param enumConstantsTree the content tree to which the documentation will be added
writer.writeComments( */
(FieldDoc) enumConstants.get(currentEnumConstantsIndex)); public void buildEnumConstantComments(XMLNode node, Content enumConstantsTree) {
} if (!configuration.nocomment) {
writer.addComments(
(FieldDoc) enumConstants.get(currentEnumConstantsIndex),
enumConstantsTree);
} }
}
/** /**
* Build the tag information. * Build the tag information.
*/ *
public void buildTagInfo(XMLNode node) { * @param node the XML element that specifies which components to document
writer.writeTags( * @param enumConstantsTree the content tree to which the documentation will be added
(FieldDoc) enumConstants.get(currentEnumConstantsIndex)); */
} public void buildTagInfo(XMLNode node, Content enumConstantsTree) {
writer.addTags(
(FieldDoc) enumConstants.get(currentEnumConstantsIndex),
enumConstantsTree);
}
/** /**
* Build the footer for the individual enum constants. * Return the enum constant writer for this builder.
*/ *
public void buildEnumConstantFooter(XMLNode node) { * @return the enum constant writer for this builder.
writer.writeEnumConstantFooter(); */
} public EnumConstantWriter getWriter() {
return writer;
/** }
* Build the overall footer.
*/
public void buildFooter(XMLNode node) {
writer.writeFooter(classDoc);
}
/**
* Return the enum constant writer for this builder.
*
* @return the enum constant writer for this builder.
*/
public EnumConstantWriter getWriter() {
return writer;
}
} }

View file

@ -25,10 +25,10 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import java.util.*;
/** /**
* Builds documentation for a field. * Builds documentation for a field.
@ -38,197 +38,191 @@ import java.util.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public class FieldBuilder extends AbstractMemberBuilder { public class FieldBuilder extends AbstractMemberBuilder {
/** /**
* The class whose fields are being documented. * The class whose fields are being documented.
*/ */
private ClassDoc classDoc; private ClassDoc classDoc;
/** /**
* The visible fields for the given class. * The visible fields for the given class.
*/ */
private VisibleMemberMap visibleMemberMap; private VisibleMemberMap visibleMemberMap;
/** /**
* The writer to output the field documentation. * The writer to output the field documentation.
*/ */
private FieldWriter writer; private FieldWriter writer;
/** /**
* The list of fields being documented. * The list of fields being documented.
*/ */
private List<ProgramElementDoc> fields; private List<ProgramElementDoc> fields;
/** /**
* The index of the current field that is being documented at this point * The index of the current field that is being documented at this point
* in time. * in time.
*/ */
private int currentFieldIndex; private int currentFieldIndex;
/** /**
* Construct a new FieldBuilder. * Construct a new FieldBuilder.
* *
* @param configuration the current configuration of the * @param configuration the current configuration of the
* doclet. * doclet.
*/ */
private FieldBuilder(Configuration configuration) { private FieldBuilder(Configuration configuration) {
super(configuration); super(configuration);
}
/**
* Construct a new FieldBuilder.
*
* @param configuration the current configuration of the doclet.
* @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer.
*/
public static FieldBuilder getInstance(
Configuration configuration,
ClassDoc classDoc,
FieldWriter writer) {
FieldBuilder builder = new FieldBuilder(configuration);
builder.classDoc = classDoc;
builder.writer = writer;
builder.visibleMemberMap =
new VisibleMemberMap(
classDoc,
VisibleMemberMap.FIELDS,
configuration.nodeprecated);
builder.fields =
new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getLeafClassMembers(
configuration));
if (configuration.getMemberComparator() != null) {
Collections.sort(
builder.fields,
configuration.getMemberComparator());
} }
return builder;
}
/** /**
* Construct a new FieldBuilder. * {@inheritDoc}
* */
* @param configuration the current configuration of the doclet. public String getName() {
* @param classDoc the class whoses members are being documented. return "FieldDetails";
* @param writer the doclet specific writer. }
*/
public static FieldBuilder getInstance( /**
Configuration configuration, * Returns a list of fields that will be documented for the given class.
ClassDoc classDoc, * This information can be used for doclet specific documentation
FieldWriter writer) { * generation.
FieldBuilder builder = new FieldBuilder(configuration); *
builder.classDoc = classDoc; * @param classDoc the {@link ClassDoc} we want to check.
builder.writer = writer; * @return a list of fields that will be documented.
builder.visibleMemberMap = */
new VisibleMemberMap( public List<ProgramElementDoc> members(ClassDoc classDoc) {
classDoc, return visibleMemberMap.getMembersFor(classDoc);
VisibleMemberMap.FIELDS, }
configuration.nodeprecated);
builder.fields = /**
new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getLeafClassMembers( * Returns the visible member map for the fields of this class.
configuration)); *
if (configuration.getMemberComparator() != null) { * @return the visible member map for the fields of this class.
Collections.sort( */
builder.fields, public VisibleMemberMap getVisibleMemberMap() {
configuration.getMemberComparator()); return visibleMemberMap;
} }
return builder;
/**
* summaryOrder.size()
*/
public boolean hasMembersToDocument() {
return fields.size() > 0;
}
/**
* Build the field documentation.
*
* @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
*/
public void buildFieldDoc(XMLNode node, Content memberDetailsTree) {
if (writer == null) {
return;
} }
int size = fields.size();
/** if (size > 0) {
* {@inheritDoc} Content fieldDetailsTree = writer.getFieldDetailsTreeHeader(
*/ classDoc, memberDetailsTree);
public String getName() { for (currentFieldIndex = 0; currentFieldIndex < size;
return "FieldDetails"; currentFieldIndex++) {
} Content fieldDocTree = writer.getFieldDocTreeHeader(
/**
* Returns a list of fields that will be documented for the given class.
* This information can be used for doclet specific documentation
* generation.
*
* @param classDoc the {@link ClassDoc} we want to check.
* @return a list of fields that will be documented.
*/
public List<ProgramElementDoc> members(ClassDoc classDoc) {
return visibleMemberMap.getMembersFor(classDoc);
}
/**
* Returns the visible member map for the fields of this class.
*
* @return the visible member map for the fields of this class.
*/
public VisibleMemberMap getVisibleMemberMap() {
return visibleMemberMap;
}
/**
* summaryOrder.size()
*/
public boolean hasMembersToDocument() {
return fields.size() > 0;
}
/**
* Build the field documentation.
*
* @param elements the XML elements that specify how to construct this
* documentation.
*/
public void buildFieldDoc(XMLNode node) {
if (writer == null) {
return;
}
for (currentFieldIndex = 0;
currentFieldIndex < fields.size();
currentFieldIndex++) {
buildChildren(node);
}
}
/**
* Build the overall header.
*/
public void buildHeader(XMLNode node) {
writer.writeHeader(
classDoc,
configuration.getText("doclet.Field_Detail"));
}
/**
* Build the header for the individual field.
*/
public void buildFieldHeader(XMLNode node) {
writer.writeFieldHeader(
(FieldDoc) fields.get(currentFieldIndex), (FieldDoc) fields.get(currentFieldIndex),
currentFieldIndex == 0); fieldDetailsTree);
buildChildren(node, fieldDocTree);
fieldDetailsTree.addContent(writer.getFieldDoc(
fieldDocTree, (currentFieldIndex == size - 1)));
}
memberDetailsTree.addContent(
writer.getFieldDetails(fieldDetailsTree));
} }
}
/** /**
* Build the signature. * Build the signature.
*/ *
public void buildSignature(XMLNode node) { * @param node the XML element that specifies which components to document
writer.writeSignature((FieldDoc) fields.get(currentFieldIndex)); * @param fieldDocTree the content tree to which the documentation will be added
} */
public void buildSignature(XMLNode node, Content fieldDocTree) {
fieldDocTree.addContent(
writer.getSignature((FieldDoc) fields.get(currentFieldIndex)));
}
/** /**
* Build the deprecation information. * Build the deprecation information.
*/ *
public void buildDeprecationInfo(XMLNode node) { * @param node the XML element that specifies which components to document
writer.writeDeprecated((FieldDoc) fields.get(currentFieldIndex)); * @param fieldDocTree the content tree to which the documentation will be added
} */
public void buildDeprecationInfo(XMLNode node, Content fieldDocTree) {
writer.addDeprecated(
(FieldDoc) fields.get(currentFieldIndex), fieldDocTree);
}
/** /**
* Build the comments for the field. Do nothing if * Build the comments for the field. Do nothing if
* {@link Configuration#nocomment} is set to true. * {@link Configuration#nocomment} is set to true.
*/ *
public void buildFieldComments(XMLNode node) { * @param node the XML element that specifies which components to document
if (!configuration.nocomment) { * @param fieldDocTree the content tree to which the documentation will be added
writer.writeComments((FieldDoc) fields.get(currentFieldIndex)); */
} public void buildFieldComments(XMLNode node, Content fieldDocTree) {
if (!configuration.nocomment) {
writer.addComments((FieldDoc) fields.get(currentFieldIndex), fieldDocTree);
} }
}
/** /**
* Build the tag information. * Build the tag information.
*/ *
public void buildTagInfo(XMLNode node) { * @param node the XML element that specifies which components to document
writer.writeTags((FieldDoc) fields.get(currentFieldIndex)); * @param fieldDocTree the content tree to which the documentation will be added
} */
public void buildTagInfo(XMLNode node, Content fieldDocTree) {
writer.addTags((FieldDoc) fields.get(currentFieldIndex), fieldDocTree);
}
/** /**
* Build the footer for the individual field. * Return the field writer for this builder.
*/ *
public void buildFieldFooter(XMLNode node) { * @return the field writer for this builder.
writer.writeFieldFooter(); */
} public FieldWriter getWriter() {
return writer;
/** }
* Build the overall footer.
*/
public void buildFooter(XMLNode node) {
writer.writeFooter(classDoc);
}
/**
* Return the field writer for this builder.
*
* @return the field writer for this builder.
*/
public FieldWriter getWriter() {
return writer;
}
} }

View file

@ -76,7 +76,7 @@ public class LayoutParser extends DefaultHandler {
/** /**
* Parse the XML specifying the layout of the documentation. * Parse the XML specifying the layout of the documentation.
* *
* @return List the list of XML elements parsed. * @return the list of XML elements parsed.
*/ */
public XMLNode parseXML(String root) { public XMLNode parseXML(String root) {
if (xmlElementsMap.containsKey(root)) { if (xmlElementsMap.containsKey(root)) {

View file

@ -25,10 +25,10 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import java.util.*;
/** /**
* Builds the member summary. * Builds the member summary.
@ -38,49 +38,50 @@ import java.util.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public class MemberSummaryBuilder extends AbstractMemberBuilder { public class MemberSummaryBuilder extends AbstractMemberBuilder {
/** /**
* The XML root for this builder. * The XML root for this builder.
*/ */
public static final String NAME = "MemberSummary"; public static final String NAME = "MemberSummary";
/** /**
* The visible members for the given class. * The visible members for the given class.
*/ */
private VisibleMemberMap[] visibleMemberMaps; private VisibleMemberMap[] visibleMemberMaps;
/** /**
* The member summary writers for the given class. * The member summary writers for the given class.
*/ */
private MemberSummaryWriter[] memberSummaryWriters; private MemberSummaryWriter[] memberSummaryWriters;
/** /**
* The type being documented. * The type being documented.
*/ */
private ClassDoc classDoc; private ClassDoc classDoc;
private MemberSummaryBuilder(Configuration configuration) { private MemberSummaryBuilder(Configuration configuration) {
super(configuration); super(configuration);
} }
/** /**
* Construct a new MemberSummaryBuilder. * Construct a new MemberSummaryBuilder.
* *
* @param classWriter the writer for the class whose members are being * @param classWriter the writer for the class whose members are being
* summarized. * summarized.
* @param configuration the current configuration of the doclet. * @param configuration the current configuration of the doclet.
*/ */
public static MemberSummaryBuilder getInstance( public static MemberSummaryBuilder getInstance(
ClassWriter classWriter, Configuration configuration) ClassWriter classWriter, Configuration configuration)
throws Exception { throws Exception {
MemberSummaryBuilder builder = new MemberSummaryBuilder(configuration); MemberSummaryBuilder builder = new MemberSummaryBuilder(configuration);
builder.classDoc = classWriter.getClassDoc(); builder.classDoc = classWriter.getClassDoc();
builder.init(classWriter); builder.init(classWriter);
return builder; return builder;
} }
/** /**
* Construct a new MemberSummaryBuilder. * Construct a new MemberSummaryBuilder.
@ -90,8 +91,8 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
* @param configuration the current configuration of the doclet. * @param configuration the current configuration of the doclet.
*/ */
public static MemberSummaryBuilder getInstance( public static MemberSummaryBuilder getInstance(
AnnotationTypeWriter annotationTypeWriter, Configuration configuration) AnnotationTypeWriter annotationTypeWriter, Configuration configuration)
throws Exception { throws Exception {
MemberSummaryBuilder builder = new MemberSummaryBuilder(configuration); MemberSummaryBuilder builder = new MemberSummaryBuilder(configuration);
builder.classDoc = annotationTypeWriter.getAnnotationTypeDoc(); builder.classDoc = annotationTypeWriter.getAnnotationTypeDoc();
builder.init(annotationTypeWriter); builder.init(annotationTypeWriter);
@ -100,200 +101,209 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
private void init(Object writer) throws Exception { private void init(Object writer) throws Exception {
visibleMemberMaps = visibleMemberMaps =
new VisibleMemberMap[VisibleMemberMap.NUM_MEMBER_TYPES]; new VisibleMemberMap[VisibleMemberMap.NUM_MEMBER_TYPES];
for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) { for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
visibleMemberMaps[i] = visibleMemberMaps[i] =
new VisibleMemberMap( new VisibleMemberMap(
classDoc, classDoc,
i, i,
configuration.nodeprecated); configuration.nodeprecated);
} }
memberSummaryWriters = memberSummaryWriters =
new MemberSummaryWriter[VisibleMemberMap.NUM_MEMBER_TYPES]; new MemberSummaryWriter[VisibleMemberMap.NUM_MEMBER_TYPES];
for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) { for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
if (classDoc.isAnnotationType()) { if (classDoc.isAnnotationType()) {
memberSummaryWriters[i] = memberSummaryWriters[i] =
visibleMemberMaps[i].noVisibleMembers()? visibleMemberMaps[i].noVisibleMembers()?
null : null :
configuration.getWriterFactory().getMemberSummaryWriter( configuration.getWriterFactory().getMemberSummaryWriter(
(AnnotationTypeWriter) writer, i); (AnnotationTypeWriter) writer, i);
} else { } else {
memberSummaryWriters[i] = memberSummaryWriters[i] =
visibleMemberMaps[i].noVisibleMembers()? visibleMemberMaps[i].noVisibleMembers()?
null : null :
configuration.getWriterFactory().getMemberSummaryWriter( configuration.getWriterFactory().getMemberSummaryWriter(
(ClassWriter) writer, i); (ClassWriter) writer, i);
} }
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getName() { public String getName() {
return NAME; return NAME;
} }
/** /**
* Return the specified visible member map. * Return the specified visible member map.
* *
* @param type the type of visible member map to return. * @param type the type of visible member map to return.
* @return the specified visible member map. * @return the specified visible member map.
* @throws ArrayIndexOutOfBoundsException when the type is invalid. * @throws ArrayIndexOutOfBoundsException when the type is invalid.
* @see VisibleMemberMap * @see VisibleMemberMap
*/ */
public VisibleMemberMap getVisibleMemberMap(int type) { public VisibleMemberMap getVisibleMemberMap(int type) {
return visibleMemberMaps[type]; return visibleMemberMaps[type];
} }
/** /**
* Return the specified member summary writer. * Return the specified member summary writer.
* *
* @param type the type of member summary writer to return. * @param type the type of member summary writer to return.
* @return the specified member summary writer. * @return the specified member summary writer.
* @throws ArrayIndexOutOfBoundsException when the type is invalid. * @throws ArrayIndexOutOfBoundsException when the type is invalid.
* @see VisibleMemberMap * @see VisibleMemberMap
*/ */
public MemberSummaryWriter getMemberSummaryWriter(int type) { public MemberSummaryWriter getMemberSummaryWriter(int type) {
return memberSummaryWriters[type]; return memberSummaryWriters[type];
} }
/** /**
* Returns a list of methods that will be documented for the given class. * Returns a list of methods that will be documented for the given class.
* This information can be used for doclet specific documentation * This information can be used for doclet specific documentation
* generation. * generation.
* *
* @param classDoc the {@link ClassDoc} we want to check. * @param classDoc the {@link ClassDoc} we want to check.
* @param type the type of members to return. * @param type the type of members to return.
* @return a list of methods that will be documented. * @return a list of methods that will be documented.
* @see VisibleMemberMap * @see VisibleMemberMap
*/ */
public List<ProgramElementDoc> members(int type) { public List<ProgramElementDoc> members(int type) {
return visibleMemberMaps[type].getLeafClassMembers(configuration); return visibleMemberMaps[type].getLeafClassMembers(configuration);
} }
/** /**
* Return true it there are any members to summarize. * Return true it there are any members to summarize.
* *
* @return true if there are any members to summarize. * @return true if there are any members to summarize.
*/ */
public boolean hasMembersToDocument() { public boolean hasMembersToDocument() {
if (classDoc instanceof AnnotationTypeDoc) { if (classDoc instanceof AnnotationTypeDoc) {
return ((AnnotationTypeDoc) classDoc).elements().length > 0; return ((AnnotationTypeDoc) classDoc).elements().length > 0;
} }
for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) { for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
VisibleMemberMap members = visibleMemberMaps[i]; VisibleMemberMap members = visibleMemberMaps[i];
if (!members.noVisibleMembers()) { if (!members.noVisibleMembers()) {
return true; return true;
} }
}
return false;
}
/**
* Build the summary for the enum constants.
*/
public void buildEnumConstantsSummary(XMLNode node) {
buildSummary(
memberSummaryWriters[VisibleMemberMap.ENUM_CONSTANTS],
visibleMemberMaps[VisibleMemberMap.ENUM_CONSTANTS]);
} }
return false;
}
/** /**
* Build the summary for the optional members. * Build the summary for the enum constants.
*
* @param node the XML element that specifies which components to document
* @param memberSummaryTree the content tree to which the documentation will be added
*/ */
public void buildAnnotationTypeOptionalMemberSummary(XMLNode node) { public void buildEnumConstantsSummary(XMLNode node, Content memberSummaryTree) {
buildSummary( MemberSummaryWriter writer =
memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL], memberSummaryWriters[VisibleMemberMap.ENUM_CONSTANTS];
visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL]); VisibleMemberMap visibleMemberMap =
visibleMemberMaps[VisibleMemberMap.ENUM_CONSTANTS];
addSummary(writer, visibleMemberMap, false, memberSummaryTree);
} }
/** /**
* Build the summary for the optional members. * Build the summary for the optional members.
*
* @param node the XML element that specifies which components to document
* @param memberSummaryTree the content tree to which the documentation will be added
*/ */
public void buildAnnotationTypeRequiredMemberSummary(XMLNode node) { public void buildAnnotationTypeOptionalMemberSummary(XMLNode node, Content memberSummaryTree) {
buildSummary( MemberSummaryWriter writer =
memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED], memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL];
visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED]); VisibleMemberMap visibleMemberMap =
visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL];
addSummary(writer, visibleMemberMap, false, memberSummaryTree);
} }
/** /**
* Build the summary for the fields. * Build the summary for the optional members.
*/ *
public void buildFieldsSummary(XMLNode node) { * @param node the XML element that specifies which components to document
buildSummary( * @param memberSummaryTree the content tree to which the documentation will be added
memberSummaryWriters[VisibleMemberMap.FIELDS], */
visibleMemberMaps[VisibleMemberMap.FIELDS]); public void buildAnnotationTypeRequiredMemberSummary(XMLNode node, Content memberSummaryTree) {
} MemberSummaryWriter writer =
memberSummaryWriters[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED];
VisibleMemberMap visibleMemberMap =
visibleMemberMaps[VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED];
addSummary(writer, visibleMemberMap, false, memberSummaryTree);
}
/** /**
* Build the inherited summary for the fields. * Build the summary for the fields.
*/ *
public void buildFieldsInheritedSummary(XMLNode node) { * @param node the XML element that specifies which components to document
buildInheritedSummary( * @param memberSummaryTree the content tree to which the documentation will be added
memberSummaryWriters[VisibleMemberMap.FIELDS], */
visibleMemberMaps[VisibleMemberMap.FIELDS]); public void buildFieldsSummary(XMLNode node, Content memberSummaryTree) {
} MemberSummaryWriter writer =
memberSummaryWriters[VisibleMemberMap.FIELDS];
VisibleMemberMap visibleMemberMap =
visibleMemberMaps[VisibleMemberMap.FIELDS];
addSummary(writer, visibleMemberMap, true, memberSummaryTree);
}
/** /**
* Build the summary for the nested classes. * Build the summary for the nested classes.
*/ *
public void buildNestedClassesSummary(XMLNode node) { * @param node the XML element that specifies which components to document
buildSummary( * @param memberSummaryTree the content tree to which the documentation will be added
memberSummaryWriters[VisibleMemberMap.INNERCLASSES], */
visibleMemberMaps[VisibleMemberMap.INNERCLASSES]); public void buildNestedClassesSummary(XMLNode node, Content memberSummaryTree) {
} MemberSummaryWriter writer =
memberSummaryWriters[VisibleMemberMap.INNERCLASSES];
VisibleMemberMap visibleMemberMap =
visibleMemberMaps[VisibleMemberMap.INNERCLASSES];
addSummary(writer, visibleMemberMap, true, memberSummaryTree);
}
/** /**
* Build the inherited summary for the nested classes. * Build the method summary.
*/ *
public void buildNestedClassesInheritedSummary(XMLNode node) { * @param node the XML element that specifies which components to document
buildInheritedSummary( * @param memberSummaryTree the content tree to which the documentation will be added
memberSummaryWriters[VisibleMemberMap.INNERCLASSES], */
visibleMemberMaps[VisibleMemberMap.INNERCLASSES]); public void buildMethodsSummary(XMLNode node, Content memberSummaryTree) {
} MemberSummaryWriter writer =
memberSummaryWriters[VisibleMemberMap.METHODS];
VisibleMemberMap visibleMemberMap =
visibleMemberMaps[VisibleMemberMap.METHODS];
addSummary(writer, visibleMemberMap, true, memberSummaryTree);
}
/** /**
* Build the method summary. * Build the constructor summary.
*/ *
public void buildMethodsSummary(XMLNode node) { * @param node the XML element that specifies which components to document
buildSummary( * @param memberSummaryTree the content tree to which the documentation will be added
memberSummaryWriters[VisibleMemberMap.METHODS], */
visibleMemberMaps[VisibleMemberMap.METHODS]); public void buildConstructorsSummary(XMLNode node, Content memberSummaryTree) {
} MemberSummaryWriter writer =
memberSummaryWriters[VisibleMemberMap.CONSTRUCTORS];
VisibleMemberMap visibleMemberMap =
visibleMemberMaps[VisibleMemberMap.CONSTRUCTORS];
addSummary(writer, visibleMemberMap, false, memberSummaryTree);
}
/** /**
* Build the inherited method summary. * Build the member summary for the given members.
*/ *
public void buildMethodsInheritedSummary(XMLNode node) { * @param writer the summary writer to write the output.
buildInheritedSummary( * @param visibleMemberMap the given members to summarize.
memberSummaryWriters[VisibleMemberMap.METHODS], * @param summaryTreeList list of content trees to which the documentation will be added
visibleMemberMaps[VisibleMemberMap.METHODS]); */
} private void buildSummary(MemberSummaryWriter writer,
VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
/**
* Build the constructor summary.
*/
public void buildConstructorsSummary(XMLNode node) {
buildSummary(
memberSummaryWriters[VisibleMemberMap.CONSTRUCTORS],
visibleMemberMaps[VisibleMemberMap.CONSTRUCTORS]);
}
/**
* Build the member summary for the given members.
*
* @param writer the summary writer to write the output.
* @param visibleMemberMap the given members to summarize.
*/
private void buildSummary(MemberSummaryWriter writer,
VisibleMemberMap visibleMemberMap) {
List<ProgramElementDoc> members = new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers( List<ProgramElementDoc> members = new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
configuration)); configuration));
if (members.size() > 0) { if (members.size() > 0) {
Collections.sort(members); Collections.sort(members);
writer.writeMemberSummaryHeader(classDoc); Content tableTree = writer.getSummaryTableTree(classDoc);
for (int i = 0; i < members.size(); i++) { for (int i = 0; i < members.size(); i++) {
ProgramElementDoc member = members.get(i); ProgramElementDoc member = members.get(i);
Tag[] firstSentenceTags = member.firstSentenceTags(); Tag[] firstSentenceTags = member.firstSentenceTags();
@ -301,32 +311,32 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
//Inherit comments from overriden or implemented method if //Inherit comments from overriden or implemented method if
//necessary. //necessary.
DocFinder.Output inheritedDoc = DocFinder.Output inheritedDoc =
DocFinder.search(new DocFinder.Input((MethodDoc) member)); DocFinder.search(new DocFinder.Input((MethodDoc) member));
if (inheritedDoc.holder != null && if (inheritedDoc.holder != null &&
inheritedDoc.holder.firstSentenceTags().length > 0) { inheritedDoc.holder.firstSentenceTags().length > 0) {
firstSentenceTags = inheritedDoc.holder.firstSentenceTags(); firstSentenceTags = inheritedDoc.holder.firstSentenceTags();
} }
} }
writer.writeMemberSummary(classDoc, member, firstSentenceTags, writer.addMemberSummary(classDoc, member, firstSentenceTags, tableTree, i);
i == 0, i == members.size() - 1);
} }
writer.writeMemberSummaryFooter(classDoc); summaryTreeList.add(tableTree);
}
} }
}
/** /**
* Build the inherited member summary for the given methods. * Build the inherited member summary for the given methods.
* *
* @param writer the writer for this member summary. * @param writer the writer for this member summary.
* @param visibleMemberMap the map for the members to document. * @param visibleMemberMap the map for the members to document.
* @param summaryTreeList list of content trees to which the documentation will be added
*/ */
private void buildInheritedSummary(MemberSummaryWriter writer, private void buildInheritedSummary(MemberSummaryWriter writer,
VisibleMemberMap visibleMemberMap) { VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
for (Iterator<ClassDoc> iter = visibleMemberMap.getVisibleClassesList().iterator(); for (Iterator<ClassDoc> iter = visibleMemberMap.getVisibleClassesList().iterator();
iter.hasNext();) { iter.hasNext();) {
ClassDoc inhclass = iter.next(); ClassDoc inhclass = iter.next();
if (! (inhclass.isPublic() || if (! (inhclass.isPublic() ||
Util.isLinkable(inhclass, configuration))) { Util.isLinkable(inhclass, configuration))) {
continue; continue;
} }
if (inhclass == classDoc) { if (inhclass == classDoc) {
@ -335,18 +345,45 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
List<ProgramElementDoc> inhmembers = visibleMemberMap.getMembersFor(inhclass); List<ProgramElementDoc> inhmembers = visibleMemberMap.getMembersFor(inhclass);
if (inhmembers.size() > 0) { if (inhmembers.size() > 0) {
Collections.sort(inhmembers); Collections.sort(inhmembers);
writer.writeInheritedMemberSummaryHeader(inhclass); Content inheritedTree = writer.getInheritedSummaryHeader(inhclass);
Content linksTree = writer.getInheritedSummaryLinksTree();
for (int j = 0; j < inhmembers.size(); ++j) { for (int j = 0; j < inhmembers.size(); ++j) {
writer.writeInheritedMemberSummary( writer.addInheritedMemberSummary(
inhclass.isPackagePrivate() && inhclass.isPackagePrivate() &&
! Util.isLinkable(inhclass, configuration) ? ! Util.isLinkable(inhclass, configuration) ?
classDoc : inhclass, classDoc : inhclass,
inhmembers.get(j), inhmembers.get(j),
j == 0, j == 0,
j == inhmembers.size() - 1); j == inhmembers.size() - 1, linksTree);
} }
writer.writeInheritedMemberSummaryFooter(inhclass); inheritedTree.addContent(linksTree);
summaryTreeList.add(writer.getMemberTree(inheritedTree));
} }
} }
} }
/**
* Add the summary for the documentation.
*
* @param writer the writer for this member summary.
* @param visibleMemberMap the map for the members to document.
* @param showInheritedSummary true if inherited summary should be documented
* @param memberSummaryTree the content tree to which the documentation will be added
*/
private void addSummary(MemberSummaryWriter writer,
VisibleMemberMap visibleMemberMap, boolean showInheritedSummary,
Content memberSummaryTree) {
LinkedList<Content> summaryTreeList = new LinkedList<Content>();
buildSummary(writer, visibleMemberMap, summaryTreeList);
if (showInheritedSummary)
buildInheritedSummary(writer, visibleMemberMap, summaryTreeList);
if (!summaryTreeList.isEmpty()) {
Content memberTree = writer.getMemberSummaryHeader(
classDoc, memberSummaryTree);
for (int i = 0; i < summaryTreeList.size(); i++) {
memberTree.addContent(summaryTreeList.get(i));
}
memberSummaryTree.addContent(writer.getMemberTree(memberTree));
}
}
} }

View file

@ -25,10 +25,10 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import java.util.*;
/** /**
* Builds documentation for a method. * Builds documentation for a method.
@ -38,204 +38,199 @@ import java.util.*;
* Do not use it as an API * Do not use it as an API
* *
* @author Jamie Ho * @author Jamie Ho
* @author Bhavesh Patel (Modified)
* @since 1.5 * @since 1.5
*/ */
public class MethodBuilder extends AbstractMemberBuilder { public class MethodBuilder extends AbstractMemberBuilder {
/** /**
* The index of the current field that is being documented at this point * The index of the current field that is being documented at this point
* in time. * in time.
*/ */
private int currentMethodIndex; private int currentMethodIndex;
/** /**
* The class whose methods are being documented. * The class whose methods are being documented.
*/ */
private ClassDoc classDoc; private ClassDoc classDoc;
/** /**
* The visible methods for the given class. * The visible methods for the given class.
*/ */
private VisibleMemberMap visibleMemberMap; private VisibleMemberMap visibleMemberMap;
/** /**
* The writer to output the method documentation. * The writer to output the method documentation.
*/ */
private MethodWriter writer; private MethodWriter writer;
/** /**
* The methods being documented. * The methods being documented.
*/ */
private List<ProgramElementDoc> methods; private List<ProgramElementDoc> methods;
private MethodBuilder(Configuration configuration) { private MethodBuilder(Configuration configuration) {
super(configuration); super(configuration);
} }
/** /**
* Construct a new MethodBuilder. * Construct a new MethodBuilder.
* *
* @param configuration the current configuration of the doclet. * @param configuration the current configuration of the doclet.
* @param classDoc the class whoses members are being documented. * @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer. * @param writer the doclet specific writer.
* *
* @return an instance of a MethodBuilder. * @return an instance of a MethodBuilder.
*/ */
public static MethodBuilder getInstance( public static MethodBuilder getInstance(
Configuration configuration, Configuration configuration,
ClassDoc classDoc, ClassDoc classDoc,
MethodWriter writer) { MethodWriter writer) {
MethodBuilder builder = new MethodBuilder(configuration); MethodBuilder builder = new MethodBuilder(configuration);
builder.classDoc = classDoc; builder.classDoc = classDoc;
builder.writer = writer; builder.writer = writer;
builder.visibleMemberMap = builder.visibleMemberMap =
new VisibleMemberMap( new VisibleMemberMap(
classDoc, classDoc,
VisibleMemberMap.METHODS, VisibleMemberMap.METHODS,
configuration.nodeprecated); configuration.nodeprecated);
builder.methods = builder.methods =
new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getLeafClassMembers( new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getLeafClassMembers(
configuration)); configuration));
if (configuration.getMemberComparator() != null) { if (configuration.getMemberComparator() != null) {
Collections.sort( Collections.sort(
builder.methods, builder.methods,
configuration.getMemberComparator()); configuration.getMemberComparator());
}
return builder;
} }
return builder;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getName() { public String getName() {
return "MethodDetails"; return "MethodDetails";
}
/**
* Returns a list of methods that will be documented for the given class.
* This information can be used for doclet specific documentation
* generation.
*
* @param classDoc the {@link ClassDoc} we want to check.
* @return a list of methods that will be documented.
*/
public List<ProgramElementDoc> members(ClassDoc classDoc) {
return visibleMemberMap.getMembersFor(classDoc);
}
/**
* Returns the visible member map for the methods of this class.
*
* @return the visible member map for the methods of this class.
*/
public VisibleMemberMap getVisibleMemberMap() {
return visibleMemberMap;
}
/**
* {@inheritDoc}
*/
public boolean hasMembersToDocument() {
return methods.size() > 0;
}
/**
* Build the method documentation.
*
* @param node the XML element that specifies which components to document
* @param memberDetailsTree the content tree to which the documentation will be added
*/
public void buildMethodDoc(XMLNode node, Content memberDetailsTree) {
if (writer == null) {
return;
} }
int size = methods.size();
/** if (size > 0) {
* Returns a list of methods that will be documented for the given class. Content methodDetailsTree = writer.getMethodDetailsTreeHeader(
* This information can be used for doclet specific documentation classDoc, memberDetailsTree);
* generation. for (currentMethodIndex = 0; currentMethodIndex < size;
* currentMethodIndex++) {
* @param classDoc the {@link ClassDoc} we want to check. Content methodDocTree = writer.getMethodDocTreeHeader(
* @return a list of methods that will be documented.
*/
public List<ProgramElementDoc> members(ClassDoc classDoc) {
return visibleMemberMap.getMembersFor(classDoc);
}
/**
* Returns the visible member map for the methods of this class.
*
* @return the visible member map for the methods of this class.
*/
public VisibleMemberMap getVisibleMemberMap() {
return visibleMemberMap;
}
/**
* {@inheritDoc}
*/
public boolean hasMembersToDocument() {
return methods.size() > 0;
}
/**
* Build the method documentation.
*/
public void buildMethodDoc(XMLNode node) {
if (writer == null) {
return;
}
for (currentMethodIndex = 0;
currentMethodIndex < methods.size();
currentMethodIndex++) {
buildChildren(node);
}
}
/**
* Build the overall header.
*/
public void buildHeader(XMLNode node) {
writer.writeHeader(
classDoc,
configuration.getText("doclet.Method_Detail"));
}
/**
* Build the header for the individual method.
*/
public void buildMethodHeader(XMLNode node) {
writer.writeMethodHeader(
(MethodDoc) methods.get(currentMethodIndex), (MethodDoc) methods.get(currentMethodIndex),
currentMethodIndex == 0); methodDetailsTree);
buildChildren(node, methodDocTree);
methodDetailsTree.addContent(writer.getMethodDoc(
methodDocTree, (currentMethodIndex == size - 1)));
}
memberDetailsTree.addContent(
writer.getMethodDetails(methodDetailsTree));
} }
}
/** /**
* Build the signature. * Build the signature.
*/ *
public void buildSignature(XMLNode node) { * @param node the XML element that specifies which components to document
writer.writeSignature((MethodDoc) methods.get(currentMethodIndex)); * @param methodDocTree the content tree to which the documentation will be added
} */
public void buildSignature(XMLNode node, Content methodDocTree) {
methodDocTree.addContent(
writer.getSignature((MethodDoc) methods.get(currentMethodIndex)));
}
/** /**
* Build the deprecation information. * Build the deprecation information.
*/ *
public void buildDeprecationInfo(XMLNode node) { * @param node the XML element that specifies which components to document
writer.writeDeprecated((MethodDoc) methods.get(currentMethodIndex)); * @param methodDocTree the content tree to which the documentation will be added
} */
public void buildDeprecationInfo(XMLNode node, Content methodDocTree) {
writer.addDeprecated(
(MethodDoc) methods.get(currentMethodIndex), methodDocTree);
}
/** /**
* Build the comments for the method. Do nothing if * Build the comments for the method. Do nothing if
* {@link Configuration#nocomment} is set to true. If this method * {@link Configuration#nocomment} is set to true.
*/ *
public void buildMethodComments(XMLNode node) { * @param node the XML element that specifies which components to document
if (!configuration.nocomment) { * @param methodDocTree the content tree to which the documentation will be added
*/
public void buildMethodComments(XMLNode node, Content methodDocTree) {
if (!configuration.nocomment) {
MethodDoc method = (MethodDoc) methods.get(currentMethodIndex); MethodDoc method = (MethodDoc) methods.get(currentMethodIndex);
if (method.inlineTags().length == 0) { if (method.inlineTags().length == 0) {
DocFinder.Output docs = DocFinder.search( DocFinder.Output docs = DocFinder.search(
new DocFinder.Input(method)); new DocFinder.Input(method));
method = docs.inlineTags != null && docs.inlineTags.length > 0 ? method = docs.inlineTags != null && docs.inlineTags.length > 0 ?
(MethodDoc) docs.holder : method; (MethodDoc) docs.holder : method;
} }
//NOTE: When we fix the bug where ClassDoc.interfaceTypes() does //NOTE: When we fix the bug where ClassDoc.interfaceTypes() does
// not pass all implemented interfaces, holder will be the // not pass all implemented interfaces, holder will be the
// interface type. For now, it is really the erasure. // interface type. For now, it is really the erasure.
writer.writeComments(method.containingClass(), method); writer.addComments(method.containingClass(), method, methodDocTree);
}
} }
}
/**
* Build the tag information.
*
* @param node the XML element that specifies which components to document
* @param methodDocTree the content tree to which the documentation will be added
*/
public void buildTagInfo(XMLNode node, Content methodDocTree) {
writer.addTags((MethodDoc) methods.get(currentMethodIndex),
methodDocTree);
}
/**
/** * Return the method writer for this builder.
* Build the tag information. *
*/ * @return the method writer for this builder.
public void buildTagInfo(XMLNode node) { */
writer.writeTags((MethodDoc) methods.get(currentMethodIndex)); public MethodWriter getWriter() {
} return writer;
}
/**
* Build the footer of the method.
*/
public void buildMethodFooter(XMLNode node) {
writer.writeMethodFooter();
}
/**
* Build the overall footer.
*/
public void buildFooter(XMLNode node) {
writer.writeFooter(classDoc);
}
/**
* Return the method writer for this builder.
*
* @return the method writer for this builder.
*/
public MethodWriter getWriter() {
return writer;
}
} }

View file

@ -25,10 +25,10 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.io.*;
import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.javadoc.*;
import java.io.*;
/** /**
* Builds the summary for a given package. * Builds the summary for a given package.
@ -42,281 +42,315 @@ import java.io.*;
* @since 1.5 * @since 1.5
*/ */
public class PackageSummaryBuilder extends AbstractBuilder { public class PackageSummaryBuilder extends AbstractBuilder {
/**
* The root element of the package summary XML is {@value}.
*/
public static final String ROOT = "PackageDoc";
/** /**
* The root element of the package summary XML is {@value}. * The package being documented.
*/ */
public static final String ROOT = "PackageDoc"; private PackageDoc packageDoc;
/** /**
* The package being documented. * The doclet specific writer that will output the result.
*/ */
private PackageDoc packageDoc; private PackageSummaryWriter packageWriter;
/** /**
* The doclet specific writer that will output the result. * The content that will be added to the package summary documentation tree.
*/ */
private PackageSummaryWriter packageWriter; private Content contentTree;
private PackageSummaryBuilder(Configuration configuration) { private PackageSummaryBuilder(Configuration configuration) {
super(configuration); super(configuration);
}
/**
* Construct a new PackageSummaryBuilder.
* @param configuration the current configuration of the doclet.
* @param pkg the package being documented.
* @param packageWriter the doclet specific writer that will output the
* result.
*
* @return an instance of a PackageSummaryBuilder.
*/
public static PackageSummaryBuilder getInstance(
Configuration configuration,
PackageDoc pkg,
PackageSummaryWriter packageWriter) {
PackageSummaryBuilder builder =
new PackageSummaryBuilder(configuration);
builder.packageDoc = pkg;
builder.packageWriter = packageWriter;
return builder;
}
/**
* Build the package summary.
*/
public void build() throws IOException {
if (packageWriter == null) {
//Doclet does not support this output.
return;
} }
build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree);
}
/** /**
* Construct a new PackageSummaryBuilder. * {@inheritDoc}
* @param configuration the current configuration of the doclet. */
* @param pkg the package being documented. public String getName() {
* @param packageWriter the doclet specific writer that will output the return ROOT;
* result. }
*
* @return an instance of a PackageSummaryBuilder.
*/
public static PackageSummaryBuilder getInstance(
Configuration configuration,
PackageDoc pkg,
PackageSummaryWriter packageWriter) {
PackageSummaryBuilder builder =
new PackageSummaryBuilder(configuration);
builder.packageDoc = pkg;
builder.packageWriter = packageWriter;
return builder;
}
/** /**
* Build the package summary. * Build the package documentation.
*/ *
public void build() throws IOException { * @param node the XML element that specifies which components to document
if (packageWriter == null) { * @param contentTree the content tree to which the documentation will be added
//Doclet does not support this output. */
return; public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
} contentTree = packageWriter.getPackageHeader(
build(LayoutParser.getInstance(configuration).parseXML(ROOT)); Util.getPackageName(packageDoc));
} buildChildren(node, contentTree);
packageWriter.addPackageFooter(contentTree);
packageWriter.printDocument(contentTree);
packageWriter.close();
Util.copyDocFiles(
configuration,
Util.getPackageSourcePath(configuration, packageDoc),
DirectoryManager.getDirectoryPath(packageDoc)
+ File.separator
+ DocletConstants.DOC_FILES_DIR_NAME,
true);
}
/** /**
* {@inheritDoc} * Build the content for the package doc.
*/ *
public String getName() { * @param node the XML element that specifies which components to document
return ROOT; * @param contentTree the content tree to which the package contents
} * will be added
*/
public void buildContent(XMLNode node, Content contentTree) {
Content packageContentTree = packageWriter.getContentHeader();
buildChildren(node, packageContentTree);
contentTree.addContent(packageContentTree);
}
/** /**
* Build the package documentation. * Build the package summary.
*/ *
public void buildPackageDoc(XMLNode node) throws Exception { * @param node the XML element that specifies which components to document
buildChildren(node); * @param packageContentTree the package content tree to which the summaries will
packageWriter.close(); * be added
Util.copyDocFiles( */
configuration, public void buildSummary(XMLNode node, Content packageContentTree) {
Util.getPackageSourcePath(configuration, packageDoc), Content summaryContentTree = packageWriter.getSummaryHeader();
DirectoryManager.getDirectoryPath(packageDoc) buildChildren(node, summaryContentTree);
+ File.separator packageContentTree.addContent(summaryContentTree);
+ DocletConstants.DOC_FILES_DIR_NAME, }
true);
}
/** /**
* Build the header of the summary. * Build the summary for the interfaces in this package.
*/ *
public void buildPackageHeader(XMLNode node) { * @param node the XML element that specifies which components to document
packageWriter.writePackageHeader(Util.getPackageName(packageDoc)); * @param summaryContentTree the summary tree to which the interface summary
} * will be added
*/
/** public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
* Build the description of the summary. String interfaceTableSummary =
*/ configuration.getText("doclet.Member_Table_Summary",
public void buildPackageDescription(XMLNode node) { configuration.getText("doclet.Interface_Summary"),
if (configuration.nocomment) { configuration.getText("doclet.interfaces"));
return; String[] interfaceTableHeader = new String[] {
} configuration.getText("doclet.Interface"),
packageWriter.writePackageDescription(); configuration.getText("doclet.Description")
} };
ClassDoc[] interfaces =
/** packageDoc.isIncluded()
* Build the tags of the summary. ? packageDoc.interfaces()
*/ : configuration.classDocCatalog.interfaces(
public void buildPackageTags(XMLNode node) { Util.getPackageName(packageDoc));
if (configuration.nocomment) { if (interfaces.length > 0) {
return; packageWriter.addClassesSummary(
} interfaces,
packageWriter.writePackageTags();
}
/**
* Build the package summary.
*/
public void buildSummary(XMLNode node) {
buildChildren(node);
}
/**
* Build the overall header.
*/
public void buildSummaryHeader(XMLNode node) {
packageWriter.writeSummaryHeader();
}
/**
* Build the overall footer.
*/
public void buildSummaryFooter(XMLNode node) {
packageWriter.writeSummaryFooter();
}
/**
* Build the summary for the classes in this package.
*/
public void buildClassSummary(XMLNode node) {
String classTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Class_Summary"),
configuration.getText("doclet.classes"));
String[] classTableHeader = new String[] {
configuration.getText("doclet.Class"),
configuration.getText("doclet.Description")
};
ClassDoc[] classes =
packageDoc.isIncluded()
? packageDoc.ordinaryClasses()
: configuration.classDocCatalog.ordinaryClasses(
Util.getPackageName(packageDoc));
if (classes.length > 0) {
packageWriter.writeClassesSummary(
classes,
configuration.getText("doclet.Class_Summary"),
classTableSummary, classTableHeader);
}
}
/**
* Build the summary for the interfaces in this package.
*/
public void buildInterfaceSummary(XMLNode node) {
String interfaceTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Interface_Summary"), configuration.getText("doclet.Interface_Summary"),
configuration.getText("doclet.interfaces")); interfaceTableSummary, interfaceTableHeader, summaryContentTree);
String[] interfaceTableHeader = new String[] {
configuration.getText("doclet.Interface"),
configuration.getText("doclet.Description")
};
ClassDoc[] interfaces =
packageDoc.isIncluded()
? packageDoc.interfaces()
: configuration.classDocCatalog.interfaces(
Util.getPackageName(packageDoc));
if (interfaces.length > 0) {
packageWriter.writeClassesSummary(
interfaces,
configuration.getText("doclet.Interface_Summary"),
interfaceTableSummary, interfaceTableHeader);
}
} }
}
/** /**
* Build the summary for the enums in this package. * Build the summary for the classes in this package.
*/ *
public void buildAnnotationTypeSummary(XMLNode node) { * @param node the XML element that specifies which components to document
String annotationtypeTableSummary = * @param summaryContentTree the summary tree to which the class summary will
configuration.getText("doclet.Member_Table_Summary", * be added
configuration.getText("doclet.Annotation_Types_Summary"), */
configuration.getText("doclet.annotationtypes")); public void buildClassSummary(XMLNode node, Content summaryContentTree) {
String[] annotationtypeTableHeader = new String[] { String classTableSummary =
configuration.getText("doclet.AnnotationType"), configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Description") configuration.getText("doclet.Class_Summary"),
}; configuration.getText("doclet.classes"));
ClassDoc[] annotationTypes = String[] classTableHeader = new String[] {
packageDoc.isIncluded() configuration.getText("doclet.Class"),
? packageDoc.annotationTypes() configuration.getText("doclet.Description")
: configuration.classDocCatalog.annotationTypes( };
Util.getPackageName(packageDoc)); ClassDoc[] classes =
if (annotationTypes.length > 0) { packageDoc.isIncluded()
packageWriter.writeClassesSummary( ? packageDoc.ordinaryClasses()
annotationTypes, : configuration.classDocCatalog.ordinaryClasses(
configuration.getText("doclet.Annotation_Types_Summary"), Util.getPackageName(packageDoc));
annotationtypeTableSummary, annotationtypeTableHeader); if (classes.length > 0) {
} packageWriter.addClassesSummary(
classes,
configuration.getText("doclet.Class_Summary"),
classTableSummary, classTableHeader, summaryContentTree);
} }
}
/** /**
* Build the summary for the enums in this package. * Build the summary for the enums in this package.
*/ *
public void buildEnumSummary(XMLNode node) { * @param node the XML element that specifies which components to document
String enumTableSummary = * @param summaryContentTree the summary tree to which the enum summary will
configuration.getText("doclet.Member_Table_Summary", * be added
*/
public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
String enumTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Enum_Summary"),
configuration.getText("doclet.enums"));
String[] enumTableHeader = new String[] {
configuration.getText("doclet.Enum"),
configuration.getText("doclet.Description")
};
ClassDoc[] enums =
packageDoc.isIncluded()
? packageDoc.enums()
: configuration.classDocCatalog.enums(
Util.getPackageName(packageDoc));
if (enums.length > 0) {
packageWriter.addClassesSummary(
enums,
configuration.getText("doclet.Enum_Summary"), configuration.getText("doclet.Enum_Summary"),
configuration.getText("doclet.enums")); enumTableSummary, enumTableHeader, summaryContentTree);
String[] enumTableHeader = new String[] {
configuration.getText("doclet.Enum"),
configuration.getText("doclet.Description")
};
ClassDoc[] enums =
packageDoc.isIncluded()
? packageDoc.enums()
: configuration.classDocCatalog.enums(
Util.getPackageName(packageDoc));
if (enums.length > 0) {
packageWriter.writeClassesSummary(
enums,
configuration.getText("doclet.Enum_Summary"),
enumTableSummary, enumTableHeader);
}
} }
}
/** /**
* Build the summary for the exceptions in this package. * Build the summary for the exceptions in this package.
*/ *
public void buildExceptionSummary(XMLNode node) { * @param node the XML element that specifies which components to document
String exceptionTableSummary = * @param summaryContentTree the summary tree to which the exception summary will
configuration.getText("doclet.Member_Table_Summary", * be added
*/
public void buildExceptionSummary(XMLNode node, Content summaryContentTree) {
String exceptionTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Exception_Summary"),
configuration.getText("doclet.exceptions"));
String[] exceptionTableHeader = new String[] {
configuration.getText("doclet.Exception"),
configuration.getText("doclet.Description")
};
ClassDoc[] exceptions =
packageDoc.isIncluded()
? packageDoc.exceptions()
: configuration.classDocCatalog.exceptions(
Util.getPackageName(packageDoc));
if (exceptions.length > 0) {
packageWriter.addClassesSummary(
exceptions,
configuration.getText("doclet.Exception_Summary"), configuration.getText("doclet.Exception_Summary"),
configuration.getText("doclet.exceptions")); exceptionTableSummary, exceptionTableHeader, summaryContentTree);
String[] exceptionTableHeader = new String[] {
configuration.getText("doclet.Exception"),
configuration.getText("doclet.Description")
};
ClassDoc[] exceptions =
packageDoc.isIncluded()
? packageDoc.exceptions()
: configuration.classDocCatalog.exceptions(
Util.getPackageName(packageDoc));
if (exceptions.length > 0) {
packageWriter.writeClassesSummary(
exceptions,
configuration.getText("doclet.Exception_Summary"),
exceptionTableSummary, exceptionTableHeader);
}
} }
}
/** /**
* Build the summary for the errors in this package. * Build the summary for the errors in this package.
*/ *
public void buildErrorSummary(XMLNode node) { * @param node the XML element that specifies which components to document
String errorTableSummary = * @param summaryContentTree the summary tree to which the error summary will
configuration.getText("doclet.Member_Table_Summary", * be added
*/
public void buildErrorSummary(XMLNode node, Content summaryContentTree) {
String errorTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Error_Summary"),
configuration.getText("doclet.errors"));
String[] errorTableHeader = new String[] {
configuration.getText("doclet.Error"),
configuration.getText("doclet.Description")
};
ClassDoc[] errors =
packageDoc.isIncluded()
? packageDoc.errors()
: configuration.classDocCatalog.errors(
Util.getPackageName(packageDoc));
if (errors.length > 0) {
packageWriter.addClassesSummary(
errors,
configuration.getText("doclet.Error_Summary"), configuration.getText("doclet.Error_Summary"),
configuration.getText("doclet.errors")); errorTableSummary, errorTableHeader, summaryContentTree);
String[] errorTableHeader = new String[] {
configuration.getText("doclet.Error"),
configuration.getText("doclet.Description")
};
ClassDoc[] errors =
packageDoc.isIncluded()
? packageDoc.errors()
: configuration.classDocCatalog.errors(
Util.getPackageName(packageDoc));
if (errors.length > 0) {
packageWriter.writeClassesSummary(
errors,
configuration.getText("doclet.Error_Summary"),
errorTableSummary, errorTableHeader);
}
} }
}
/** /**
* Build the footer of the summary. * Build the summary for the annotation type in this package.
*/ *
public void buildPackageFooter(XMLNode node) { * @param node the XML element that specifies which components to document
packageWriter.writePackageFooter(); * @param summaryContentTree the summary tree to which the annotation type
* summary will be added
*/
public void buildAnnotationTypeSummary(XMLNode node, Content summaryContentTree) {
String annotationtypeTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Annotation_Types_Summary"),
configuration.getText("doclet.annotationtypes"));
String[] annotationtypeTableHeader = new String[] {
configuration.getText("doclet.AnnotationType"),
configuration.getText("doclet.Description")
};
ClassDoc[] annotationTypes =
packageDoc.isIncluded()
? packageDoc.annotationTypes()
: configuration.classDocCatalog.annotationTypes(
Util.getPackageName(packageDoc));
if (annotationTypes.length > 0) {
packageWriter.addClassesSummary(
annotationTypes,
configuration.getText("doclet.Annotation_Types_Summary"),
annotationtypeTableSummary, annotationtypeTableHeader,
summaryContentTree);
} }
}
/**
* Build the description of the summary.
*
* @param node the XML element that specifies which components to document
* @param packageContentTree the tree to which the package description will
* be added
*/
public void buildPackageDescription(XMLNode node, Content packageContentTree) {
if (configuration.nocomment) {
return;
}
packageWriter.addPackageDescription(packageContentTree);
}
/**
* Build the tags of the summary.
*
* @param node the XML element that specifies which components to document
* @param packageContentTree the tree to which the package tags will be added
*/
public void buildPackageTags(XMLNode node, Content packageContentTree) {
if (configuration.nocomment) {
return;
}
packageWriter.addPackageTags(packageContentTree);
}
} }

View file

@ -27,7 +27,6 @@ package com.sun.tools.doclets.internal.toolkit.builders;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
@ -87,6 +86,11 @@ public class SerializedFormBuilder extends AbstractBuilder {
*/ */
protected MemberDoc currentMember; protected MemberDoc currentMember;
/**
* The content that will be added to the serialized form documentation tree.
*/
private Content contentTree;
private SerializedFormBuilder(Configuration configuration) { private SerializedFormBuilder(Configuration configuration) {
super(configuration); super(configuration);
} }
@ -117,7 +121,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
} catch (Exception e) { } catch (Exception e) {
throw new DocletAbortException(); throw new DocletAbortException();
} }
build(LayoutParser.getInstance(configuration).parseXML(NAME)); build(LayoutParser.getInstance(configuration).parseXML(NAME), contentTree);
writer.close(); writer.close();
} }
@ -130,34 +134,44 @@ public class SerializedFormBuilder extends AbstractBuilder {
/** /**
* Build the serialized form. * Build the serialized form.
*
* @param node the XML element that specifies which components to document
* @param serializedTree content tree to which the documentation will be added
*/ */
public void buildSerializedForm(XMLNode node) throws Exception { public void buildSerializedForm(XMLNode node, Content serializedTree) throws Exception {
buildChildren(node); serializedTree = writer.getHeader(configuration.getText(
"doclet.Serialized_Form"));
buildChildren(node, serializedTree);
writer.addFooter(serializedTree);
writer.printDocument(serializedTree);
writer.close(); writer.close();
} }
/** /**
* Build the header. * Build the serialized form summaries.
*
* @param node the XML element that specifies which components to document
* @param serializedTree content tree to which the documentation will be added
*/ */
public void buildHeader(XMLNode node) { public void buildSerializedFormSummaries(XMLNode node, Content serializedTree) {
writer.writeHeader(configuration.getText("doclet.Serialized_Form")); Content serializedSummariesTree = writer.getSerializedSummariesHeader();
}
/**
* Build the contents.
*/
public void buildSerializedFormSummaries(XMLNode node) {
PackageDoc[] packages = configuration.packages; PackageDoc[] packages = configuration.packages;
for (int i = 0; i < packages.length; i++) { for (int i = 0; i < packages.length; i++) {
currentPackage = packages[i]; currentPackage = packages[i];
buildChildren(node); buildChildren(node, serializedSummariesTree);
} }
serializedTree.addContent(writer.getSerializedContent(
serializedSummariesTree));
} }
/** /**
* Build the package serialized for for the current package being processed. * Build the package serialized form for the current package being processed.
*
* @param node the XML element that specifies which components to document
* @param serializedSummariesTree content tree to which the documentation will be added
*/ */
public void buildPackageSerializedForm(XMLNode node) { public void buildPackageSerializedForm(XMLNode node, Content serializedSummariesTree) {
Content packageSerializedTree = writer.getPackageSerializedHeader();
String foo = currentPackage.name(); String foo = currentPackage.name();
ClassDoc[] classes = currentPackage.allClasses(false); ClassDoc[] classes = currentPackage.allClasses(false);
if (classes == null || classes.length == 0) { if (classes == null || classes.length == 0) {
@ -169,14 +183,29 @@ public class SerializedFormBuilder extends AbstractBuilder {
if (!serialClassFoundToDocument(classes)) { if (!serialClassFoundToDocument(classes)) {
return; return;
} }
buildChildren(node); buildChildren(node, packageSerializedTree);
serializedSummariesTree.addContent(packageSerializedTree);
} }
public void buildPackageHeader(XMLNode node) { /**
writer.writePackageHeader(Util.getPackageName(currentPackage)); * Build the package header.
*
* @param node the XML element that specifies which components to document
* @param packageSerializedTree content tree to which the documentation will be added
*/
public void buildPackageHeader(XMLNode node, Content packageSerializedTree) {
packageSerializedTree.addContent(writer.getPackageHeader(
Util.getPackageName(currentPackage)));
} }
public void buildClassSerializedForm(XMLNode node) { /**
* Build the class serialized form.
*
* @param node the XML element that specifies which components to document
* @param packageSerializedTree content tree to which the documentation will be added
*/
public void buildClassSerializedForm(XMLNode node, Content packageSerializedTree) {
Content classSerializedTree = writer.getClassSerializedHeader();
ClassDoc[] classes = currentPackage.allClasses(false); ClassDoc[] classes = currentPackage.allClasses(false);
Arrays.sort(classes); Arrays.sort(classes);
for (int j = 0; j < classes.length; j++) { for (int j = 0; j < classes.length; j++) {
@ -187,35 +216,293 @@ public class SerializedFormBuilder extends AbstractBuilder {
if(!serialClassInclude(currentClass)) { if(!serialClassInclude(currentClass)) {
continue; continue;
} }
buildChildren(node); Content classTree = writer.getClassHeader(currentClass);
buildChildren(node, classTree);
classSerializedTree.addContent(classTree);
} }
} }
} packageSerializedTree.addContent(classSerializedTree);
public void buildClassHeader(XMLNode node) {
writer.writeClassHeader(currentClass);
} }
/** /**
* Build the serial UID information for the given class. * Build the serial UID information for the given class.
*
* @param node the XML element that specifies which components to document
* @param classTree content tree to which the serial UID information will be added
*/ */
public void buildSerialUIDInfo(XMLNode node) { public void buildSerialUIDInfo(XMLNode node, Content classTree) {
Content serialUidTree = writer.getSerialUIDInfoHeader();
FieldDoc[] fields = currentClass.fields(false); FieldDoc[] fields = currentClass.fields(false);
for (int i = 0; i < fields.length; i++) { for (int i = 0; i < fields.length; i++) {
if (fields[i].name().equals("serialVersionUID") && if (fields[i].name().equals("serialVersionUID") &&
fields[i].constantValueExpression() != null) { fields[i].constantValueExpression() != null) {
writer.writeSerialUIDInfo(SERIAL_VERSION_UID_HEADER, writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER,
fields[i].constantValueExpression()); fields[i].constantValueExpression(), serialUidTree);
return; break;
}
}
classTree.addContent(serialUidTree);
}
/**
* Build the summaries for the methods and fields.
*
* @param node the XML element that specifies which components to document
* @param classTree content tree to which the documentation will be added
*/
public void buildClassContent(XMLNode node, Content classTree) {
Content classContentTree = writer.getClassContentHeader();
buildChildren(node, classContentTree);
classTree.addContent(classContentTree);
}
/**
* Build the summaries for the methods that belong to the given
* class.
*
* @param node the XML element that specifies which components to document
* @param classContentTree content tree to which the documentation will be added
*/
public void buildSerializableMethods(XMLNode node, Content classContentTree) {
Content serializableMethodTree = methodWriter.getSerializableMethodsHeader();
MemberDoc[] members = currentClass.serializationMethods();
int membersLength = members.length;
if (membersLength > 0) {
for (int i = 0; i < membersLength; i++) {
currentMember = members[i];
Content methodsContentTree = methodWriter.getMethodsContentHeader(
(i == membersLength - 1));
buildChildren(node, methodsContentTree);
serializableMethodTree.addContent(methodsContentTree);
}
}
if (currentClass.serializationMethods().length > 0) {
classContentTree.addContent(methodWriter.getSerializableMethods(
configuration.getText("doclet.Serialized_Form_methods"),
serializableMethodTree));
if (currentClass.isSerializable() && !currentClass.isExternalizable()) {
if (currentClass.serializationMethods().length == 0) {
Content noCustomizationMsg = methodWriter.getNoCustomizationMsg(
configuration.getText(
"doclet.Serializable_no_customization"));
classContentTree.addContent(methodWriter.getSerializableMethods(
configuration.getText("doclet.Serialized_Form_methods"),
noCustomizationMsg));
}
} }
} }
} }
/** /**
* Build the footer. * Build the method sub header.
*
* @param node the XML element that specifies which components to document
* @param methodsContentTree content tree to which the documentation will be added
*/ */
public void buildFooter(XMLNode node) { public void buildMethodSubHeader(XMLNode node, Content methodsContentTree) {
writer.writeFooter(); methodWriter.addMemberHeader((MethodDoc)currentMember, methodsContentTree);
}
/**
* Build the deprecated method description.
*
* @param node the XML element that specifies which components to document
* @param methodsContentTree content tree to which the documentation will be added
*/
public void buildDeprecatedMethodInfo(XMLNode node, Content methodsContentTree) {
methodWriter.addDeprecatedMemberInfo((MethodDoc) currentMember, methodsContentTree);
}
/**
* Build the information for the method.
*
* @param node the XML element that specifies which components to document
* @param methodsContentTree content tree to which the documentation will be added
*/
public void buildMethodInfo(XMLNode node, Content methodsContentTree) {
if(configuration.nocomment){
return;
}
buildChildren(node, methodsContentTree);
}
/**
* Build method description.
*
* @param node the XML element that specifies which components to document
* @param methodsContentTree content tree to which the documentation will be added
*/
public void buildMethodDescription(XMLNode node, Content methodsContentTree) {
methodWriter.addMemberDescription((MethodDoc) currentMember, methodsContentTree);
}
/**
* Build the method tags.
*
* @param node the XML element that specifies which components to document
* @param methodsContentTree content tree to which the documentation will be added
*/
public void buildMethodTags(XMLNode node, Content methodsContentTree) {
methodWriter.addMemberTags((MethodDoc) currentMember, methodsContentTree);
MethodDoc method = (MethodDoc)currentMember;
if (method.name().compareTo("writeExternal") == 0
&& method.tags("serialData").length == 0) {
if (configuration.serialwarn) {
configuration.getDocletSpecificMsg().warning(
currentMember.position(), "doclet.MissingSerialDataTag",
method.containingClass().qualifiedName(), method.name());
}
}
}
/**
* Build the field header.
*
* @param node the XML element that specifies which components to document
* @param classContentTree content tree to which the documentation will be added
*/
public void buildFieldHeader(XMLNode node, Content classContentTree) {
if (currentClass.serializableFields().length > 0) {
buildFieldSerializationOverview(currentClass, classContentTree);
}
}
/**
* Build the serialization overview for the given class.
*
* @param classDoc the class to print the overview for.
* @param classContentTree content tree to which the documentation will be added
*/
public void buildFieldSerializationOverview(ClassDoc classDoc, Content classContentTree) {
if (classDoc.definesSerializableFields()) {
FieldDoc serialPersistentField =
Util.asList(classDoc.serializableFields()).get(0);
// Check to see if there are inline comments, tags or deprecation
// information to be printed.
if (fieldWriter.shouldPrintOverview(serialPersistentField)) {
Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader();
Content fieldsOverviewContentTree = fieldWriter.getFieldsContentHeader(true);
fieldWriter.addMemberDeprecatedInfo(serialPersistentField,
fieldsOverviewContentTree);
if (!configuration.nocomment) {
fieldWriter.addMemberDescription(serialPersistentField,
fieldsOverviewContentTree);
fieldWriter.addMemberTags(serialPersistentField,
fieldsOverviewContentTree);
}
serializableFieldsTree.addContent(fieldsOverviewContentTree);
classContentTree.addContent(fieldWriter.getSerializableFields(
configuration.getText("doclet.Serialized_Form_class"),
serializableFieldsTree));
}
}
}
/**
* Build the summaries for the fields that belong to the given class.
*
* @param node the XML element that specifies which components to document
* @param classContentTree content tree to which the documentation will be added
*/
public void buildSerializableFields(XMLNode node, Content classContentTree) {
MemberDoc[] members = currentClass.serializableFields();
int membersLength = members.length;
if (membersLength > 0) {
Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader();
for (int i = 0; i < membersLength; i++) {
currentMember = members[i];
if (!currentClass.definesSerializableFields()) {
Content fieldsContentTree = fieldWriter.getFieldsContentHeader(
(i == membersLength - 1));
buildChildren(node, fieldsContentTree);
serializableFieldsTree.addContent(fieldsContentTree);
}
else {
buildSerialFieldTagsInfo(serializableFieldsTree);
}
}
classContentTree.addContent(fieldWriter.getSerializableFields(
configuration.getText("doclet.Serialized_Form_fields"),
serializableFieldsTree));
}
}
/**
* Build the field sub header.
*
* @param node the XML element that specifies which components to document
* @param fieldsContentTree content tree to which the documentation will be added
*/
public void buildFieldSubHeader(XMLNode node, Content fieldsContentTree) {
if (!currentClass.definesSerializableFields()) {
FieldDoc field = (FieldDoc) currentMember;
fieldWriter.addMemberHeader(field.type().asClassDoc(),
field.type().typeName(), field.type().dimension(), field.name(),
fieldsContentTree);
}
}
/**
* Build the field deprecation information.
*
* @param node the XML element that specifies which components to document
* @param fieldsContentTree content tree to which the documentation will be added
*/
public void buildFieldDeprecationInfo(XMLNode node, Content fieldsContentTree) {
if (!currentClass.definesSerializableFields()) {
FieldDoc field = (FieldDoc)currentMember;
fieldWriter.addMemberDeprecatedInfo(field, fieldsContentTree);
}
}
/**
* Build the serial field tags information.
*
* @param serializableFieldsTree content tree to which the documentation will be added
*/
public void buildSerialFieldTagsInfo(Content serializableFieldsTree) {
if(configuration.nocomment){
return;
}
FieldDoc field = (FieldDoc)currentMember;
// Process Serializable Fields specified as array of
// ObjectStreamFields. Print a member for each serialField tag.
// (There should be one serialField tag per ObjectStreamField
// element.)
SerialFieldTag[] tags = field.serialFieldTags();
Arrays.sort(tags);
int tagsLength = tags.length;
for (int i = 0; i < tagsLength; i++) {
Content fieldsContentTree = fieldWriter.getFieldsContentHeader(
(i == tagsLength - 1));
fieldWriter.addMemberHeader(tags[i].fieldTypeDoc(),
tags[i].fieldType(), "", tags[i].fieldName(), fieldsContentTree);
fieldWriter.addMemberDescription(tags[i], fieldsContentTree);
serializableFieldsTree.addContent(fieldsContentTree);
}
}
/**
* Build the field information.
*
* @param node the XML element that specifies which components to document
* @param fieldsContentTree content tree to which the documentation will be added
*/
public void buildFieldInfo(XMLNode node, Content fieldsContentTree) {
if(configuration.nocomment){
return;
}
FieldDoc field = (FieldDoc)currentMember;
ClassDoc cd = field.containingClass();
// Process default Serializable field.
if ((field.tags("serial").length == 0) && ! field.isSynthetic()
&& configuration.serialwarn) {
configuration.message.warning(field.position(),
"doclet.MissingSerialTag", cd.qualifiedName(),
field.name());
}
fieldWriter.addMemberDescription(field, fieldsContentTree);
fieldWriter.addMemberTags(field, fieldsContentTree);
} }
/** /**
@ -297,208 +584,4 @@ public class SerializedFormBuilder extends AbstractBuilder {
} }
return false; return false;
} }
/**
* Build the method header.
*/
public void buildMethodHeader(XMLNode node) {
if (currentClass.serializationMethods().length > 0) {
methodWriter.writeHeader(
configuration.getText("doclet.Serialized_Form_methods"));
if (currentClass.isSerializable() && !currentClass.isExternalizable()) {
if (currentClass.serializationMethods().length == 0) {
methodWriter.writeNoCustomizationMsg(
configuration.getText(
"doclet.Serializable_no_customization"));
}
}
}
}
/**
* Build the method sub header.
*/
public void buildMethodSubHeader(XMLNode node) {
methodWriter.writeMemberHeader((MethodDoc) currentMember);
}
/**
* Build the deprecated method description.
*/
public void buildDeprecatedMethodInfo(XMLNode node) {
methodWriter.writeDeprecatedMemberInfo((MethodDoc) currentMember);
}
/**
* Build method tags.
*/
public void buildMethodDescription(XMLNode node) {
methodWriter.writeMemberDescription((MethodDoc) currentMember);
}
/**
* Build the method tags.
*/
public void buildMethodTags(XMLNode node) {
methodWriter.writeMemberTags((MethodDoc) currentMember);
MethodDoc method = (MethodDoc)currentMember;
if (method.name().compareTo("writeExternal") == 0
&& method.tags("serialData").length == 0) {
if (configuration.serialwarn) {
configuration.getDocletSpecificMsg().warning(
currentMember.position(), "doclet.MissingSerialDataTag",
method.containingClass().qualifiedName(), method.name());
}
}
}
/**
* build the information for the method.
*/
public void buildMethodInfo(XMLNode node) {
if(configuration.nocomment){
return;
}
buildChildren(node);
}
/**
* Build the method footer.
*/
public void buildMethodFooter(XMLNode node) {
methodWriter.writeMemberFooter();
}
/**
* Build the field header.
*/
public void buildFieldHeader(XMLNode node) {
if (currentClass.serializableFields().length > 0) {
buildFieldSerializationOverview(currentClass);
fieldWriter.writeHeader(configuration.getText(
"doclet.Serialized_Form_fields"));
}
}
/**
* If possible, build the serialization overview for the given
* class.
*
* @param classDoc the class to print the overview for.
*/
public void buildFieldSerializationOverview(ClassDoc classDoc) {
if (classDoc.definesSerializableFields()) {
FieldDoc serialPersistentField =
Util.asList(classDoc.serializableFields()).get(0);
// Check to see if there are inline comments, tags or deprecation
// information to be printed.
if (fieldWriter.shouldPrintOverview(serialPersistentField)) {
fieldWriter.writeHeader(
configuration.getText("doclet.Serialized_Form_class"));
fieldWriter.writeMemberDeprecatedInfo(serialPersistentField);
if (!configuration.nocomment) {
fieldWriter.writeMemberDescription(serialPersistentField);
fieldWriter.writeMemberTags(serialPersistentField);
}
// Footer required to close the definition list tag
// for serialization overview.
fieldWriter.writeFooter(
configuration.getText("doclet.Serialized_Form_class"));
}
}
}
/**
* Build the field sub header.
*/
public void buildFieldSubHeader(XMLNode node) {
if (! currentClass.definesSerializableFields() ){
FieldDoc field = (FieldDoc) currentMember;
fieldWriter.writeMemberHeader(field.type().asClassDoc(),
field.type().typeName(), field.type().dimension(), field.name());
}
}
/**
* Build the field deprecation information.
*/
public void buildFieldDeprecationInfo(XMLNode node) {
if (!currentClass.definesSerializableFields()) {
FieldDoc field = (FieldDoc)currentMember;
fieldWriter.writeMemberDeprecatedInfo(field);
}
}
/**
* Build the field information.
*/
public void buildFieldInfo(XMLNode node) {
if(configuration.nocomment){
return;
}
FieldDoc field = (FieldDoc)currentMember;
ClassDoc cd = field.containingClass();
if (cd.definesSerializableFields()) {
// Process Serializable Fields specified as array of
// ObjectStreamFields. Print a member for each serialField tag.
// (There should be one serialField tag per ObjectStreamField
// element.)
SerialFieldTag[] tags = field.serialFieldTags();
Arrays.sort(tags);
for (int i = 0; i < tags.length; i++) {
fieldWriter.writeMemberHeader(tags[i].fieldTypeDoc(),
tags[i].fieldType(), "", tags[i].fieldName());
fieldWriter.writeMemberDescription(tags[i]);
}
} else {
// Process default Serializable field.
if ((field.tags("serial").length == 0) && ! field.isSynthetic()
&& configuration.serialwarn) {
configuration.message.warning(field.position(),
"doclet.MissingSerialTag", cd.qualifiedName(),
field.name());
}
fieldWriter.writeMemberDescription(field);
fieldWriter.writeMemberTags(field);
}
}
/**
* Build the field sub footer.
*/
public void buildFieldSubFooter(XMLNode node) {
if (! currentClass.definesSerializableFields()) {
fieldWriter.writeMemberFooter();
}
}
/**
* Build the summaries for the methods that belong to the given
* class.
*/
public void buildSerializableMethods(XMLNode node) {
MemberDoc[] members = currentClass.serializationMethods();
if (members.length > 0) {
for (int i = 0; i < members.length; i++) {
currentMember = members[i];
buildChildren(node);
}
}
}
/**
* Build the summaries for the fields that belong to the given
* class.
*/
public void buildSerializableFields(XMLNode node) {
MemberDoc[] members = currentClass.serializableFields();
if (members.length > 0) {
for (int i = 0; i < members.length; i++) {
currentMember = members[i];
buildChildren(node);
}
}
}
} }

View file

@ -29,177 +29,144 @@
<Doclet> <Doclet>
<PackageDoc> <PackageDoc>
<PackageHeader/> <Content>
<Summary> <Summary>
<SummaryHeader/> <InterfaceSummary/>
<InterfaceSummary/> <ClassSummary/>
<ClassSummary/> <EnumSummary/>
<EnumSummary/> <ExceptionSummary/>
<ExceptionSummary/> <ErrorSummary/>
<ErrorSummary/> <AnnotationTypeSummary/>
<AnnotationTypeSummary/> </Summary>
<SummaryFooter/> <PackageDescription/>
</Summary> <PackageTags/>
<PackageDescription/> </Content>
<PackageTags/>
<PackageFooter/>
</PackageDoc> </PackageDoc>
<AnnotationTypeDoc> <AnnotationTypeDoc>
<AnnotationTypeHeader/> <AnnotationTypeInfo>
<DeprecationInfo/> <DeprecationInfo/>
<AnnotationTypeSignature/> <AnnotationTypeSignature/>
<AnnotationTypeDescription/> <AnnotationTypeDescription/>
<AnnotationTypeTagInfo/> <AnnotationTypeTagInfo/>
</AnnotationTypeInfo>
<MemberSummary> <MemberSummary>
<AnnotationTypeRequiredMemberSummary/> <AnnotationTypeRequiredMemberSummary/>
<AnnotationTypeOptionalMemberSummary/> <AnnotationTypeOptionalMemberSummary/>
</MemberSummary> </MemberSummary>
<AnnotationTypeRequiredMemberDetails> <AnnotationTypeMemberDetails>
<Header/> <AnnotationTypeRequiredMemberDetails>
<AnnotationTypeRequiredMember> <AnnotationTypeRequiredMember>
<MemberHeader/> <Signature/>
<Signature/> <DeprecationInfo/>
<DeprecationInfo/> <MemberComments/>
<MemberComments/> <TagInfo/>
<TagInfo/> </AnnotationTypeRequiredMember>
<MemberFooter/> </AnnotationTypeRequiredMemberDetails>
</AnnotationTypeRequiredMember> <AnnotationTypeOptionalMemberDetails>
</AnnotationTypeRequiredMemberDetails> <AnnotationTypeOptionalMember>
<AnnotationTypeOptionalMemberDetails> <Signature/>
<AnnotationTypeOptionalMember> <DeprecationInfo/>
<MemberHeader/> <MemberComments/>
<Signature/> <TagInfo/>
<DeprecationInfo/> <DefaultValueInfo/>
<MemberComments/> </AnnotationTypeOptionalMember>
<TagInfo/> </AnnotationTypeOptionalMemberDetails>
<DefaultValueInfo/> </AnnotationTypeMemberDetails>
<MemberFooter/>
</AnnotationTypeOptionalMember>
<Footer/>
</AnnotationTypeOptionalMemberDetails>
<AnnotationTypeFooter/>
</AnnotationTypeDoc> </AnnotationTypeDoc>
<ClassDoc> <ClassDoc>
<ClassHeader/>
<ClassTree/> <ClassTree/>
<TypeParamInfo/> <ClassInfo>
<SuperInterfacesInfo/> <TypeParamInfo/>
<ImplementedInterfacesInfo/> <SuperInterfacesInfo/>
<SubClassInfo/> <ImplementedInterfacesInfo/>
<SubInterfacesInfo/> <SubClassInfo/>
<InterfaceUsageInfo/> <SubInterfacesInfo/>
<NestedClassInfo/> <InterfaceUsageInfo/>
<DeprecationInfo/> <NestedClassInfo/>
<ClassSignature/> <DeprecationInfo/>
<ClassDescription/> <ClassSignature/>
<ClassTagInfo/> <ClassDescription/>
<ClassTagInfo/>
</ClassInfo>
<MemberSummary> <MemberSummary>
<NestedClassesSummary/> <NestedClassesSummary/>
<NestedClassesInheritedSummary/>
<EnumConstantsSummary/> <EnumConstantsSummary/>
<FieldsSummary/> <FieldsSummary/>
<FieldsInheritedSummary/>
<ConstructorsSummary/> <ConstructorsSummary/>
<MethodsSummary/> <MethodsSummary/>
<MethodsInheritedSummary/>
</MemberSummary> </MemberSummary>
<EnumConstantsDetails> <MemberDetails>
<Header/> <EnumConstantsDetails>
<EnumConstant> <EnumConstant>
<EnumConstantHeader/> <Signature/>
<Signature/> <DeprecationInfo/>
<DeprecationInfo/> <EnumConstantComments/>
<EnumConstantComments/> <TagInfo/>
<TagInfo/> </EnumConstant>
<EnumConstantFooter/> </EnumConstantsDetails>
</EnumConstant> <FieldDetails>
<Footer/> <FieldDoc>
</EnumConstantsDetails> <Signature/>
<FieldDetails> <DeprecationInfo/>
<Header/> <FieldComments/>
<FieldDoc> <TagInfo/>
<FieldHeader/> </FieldDoc>
<Signature/> </FieldDetails>
<DeprecationInfo/> <ConstructorDetails>
<FieldComments/> <ConstructorDoc>
<TagInfo/> <Signature/>
<FieldFooter/> <DeprecationInfo/>
</FieldDoc> <ConstructorComments/>
<Footer/> <TagInfo/>
</FieldDetails> </ConstructorDoc>
<ConstructorDetails> </ConstructorDetails>
<Header/> <MethodDetails>
<ConstructorDoc> <MethodDoc>
<ConstructorHeader/> <Signature/>
<Signature/> <DeprecationInfo/>
<DeprecationInfo/> <MethodComments/>
<ConstructorComments/> <TagInfo/>
<TagInfo/> </MethodDoc>
<ConstructorFooter/> </MethodDetails>
</ConstructorDoc> </MemberDetails>
<Footer/>
</ConstructorDetails>
<MethodDetails>
<Header/>
<MethodDoc>
<MethodHeader/>
<Signature/>
<DeprecationInfo/>
<MethodComments/>
<TagInfo/>
<MethodFooter/>
</MethodDoc>
<Footer/>
</MethodDetails>
<ClassFooter/>
</ClassDoc> </ClassDoc>
<ConstantSummary> <ConstantSummary>
<Header/>
<Contents/> <Contents/>
<ConstantSummaries> <ConstantSummaries>
<PackageConstantSummary> <PackageHeader/>
<PackageHeader/> <ClassConstantSummary>
<ClassConstantSummary> <ConstantMembers/>
<ClassHeader/> </ClassConstantSummary>
<ConstantMembers/>
<ClassFooter/>
</ClassConstantSummary>
</PackageConstantSummary>
</ConstantSummaries> </ConstantSummaries>
<Footer/>
</ConstantSummary> </ConstantSummary>
<SerializedForm> <SerializedForm>
<Header/>
<SerializedFormSummaries> <SerializedFormSummaries>
<PackageSerializedForm> <PackageSerializedForm>
<PackageHeader/> <PackageHeader/>
<ClassSerializedForm> <ClassSerializedForm>
<ClassHeader/>
<SerialUIDInfo/> <SerialUIDInfo/>
<MethodHeader/> <ClassContent>
<SerializableMethods> <SerializableMethods>
<MethodSubHeader/> <MethodSubHeader/>
<DeprecatedMethodInfo/> <DeprecatedMethodInfo/>
<MethodInfo> <MethodInfo>
<MethodDescription/> <MethodDescription/>
<MethodTags/> <MethodTags/>
</MethodInfo> </MethodInfo>
<MethodFooter/> </SerializableMethods>
</SerializableMethods> <FieldHeader/>
<FieldHeader/> <SerializableFields>
<SerializableFields> <FieldSubHeader/>
<FieldSubHeader/> <FieldDeprecationInfo/>
<FieldDeprecationInfo/> <FieldInfo/>
<FieldInfo/> </SerializableFields>
<FieldSubFooter/> </ClassContent>
</SerializableFields>
</ClassSerializedForm> </ClassSerializedForm>
</PackageSerializedForm> </PackageSerializedForm>
</SerializedFormSummaries> </SerializedFormSummaries>
<Footer/>
</SerializedForm> </SerializedForm>
</Doclet> </Doclet>

View file

@ -111,12 +111,12 @@ doclet.extended_by=extended by
doclet.extends=extends doclet.extends=extends
doclet.Package_private=(package private) doclet.Package_private=(package private)
doclet.implements=implementsdoclet.Same_package_name_used=Package name format used twice: {0} doclet.implements=implementsdoclet.Same_package_name_used=Package name format used twice: {0}
doclet.Nested_Classes_Interfaces_Inherited_From_Class=Nested classes/interfaces inherited from class {0} doclet.Nested_Classes_Interfaces_Inherited_From_Class=Nested classes/interfaces inherited from class
doclet.Nested_Classes_Interface_Inherited_From_Interface=Nested classes/interfaces inherited from interface {0} doclet.Nested_Classes_Interface_Inherited_From_Interface=Nested classes/interfaces inherited from interface
doclet.Methods_Inherited_From_Class=Methods inherited from class {0} doclet.Methods_Inherited_From_Class=Methods inherited from class
doclet.Methods_Inherited_From_Interface=Methods inherited from interface {0} doclet.Methods_Inherited_From_Interface=Methods inherited from interface
doclet.Fields_Inherited_From_Class=Fields inherited from class {0} doclet.Fields_Inherited_From_Class=Fields inherited from class
doclet.Fields_Inherited_From_Interface=Fields inherited from interface {0} doclet.Fields_Inherited_From_Interface=Fields inherited from interface
doclet.Serializable=Serializable doclet.Serializable=Serializable
doclet.Externalizable=Externalizable doclet.Externalizable=Externalizable
doclet.Annotation_Type_Member_Detail=Element Detail doclet.Annotation_Type_Member_Detail=Element Detail
@ -136,12 +136,19 @@ doclet.Use_Table_Summary=Use table, listing {0}, and an explanation
doclet.Constants_Table_Summary={0} table, listing constant fields, and values doclet.Constants_Table_Summary={0} table, listing constant fields, and values
doclet.Member_Table_Summary={0} table, listing {1}, and an explanation doclet.Member_Table_Summary={0} table, listing {1}, and an explanation
doclet.fields=fields doclet.fields=fields
doclet.Fields=Fields
doclet.constructors=constructors doclet.constructors=constructors
doclet.Constructors=Constructors
doclet.methods=methods doclet.methods=methods
doclet.Methods=Methods
doclet.annotation_type_optional_members=optional elements doclet.annotation_type_optional_members=optional elements
doclet.Annotation_Type_Optional_Members=Optional Elements
doclet.annotation_type_required_members=required elements doclet.annotation_type_required_members=required elements
doclet.Annotation_Type_Required_Members=Required Elements
doclet.enum_constants=enum constants doclet.enum_constants=enum constants
doclet.Enum_Constants=Enum Constants
doclet.nested_classes=nested classes doclet.nested_classes=nested classes
doclet.Nested_Classes=Nested Classes
doclet.subclasses=subclasses doclet.subclasses=subclasses
doclet.subinterfaces=subinterfaces doclet.subinterfaces=subinterfaces
doclet.Modifier=Modifier doclet.Modifier=Modifier
@ -173,7 +180,7 @@ doclet.enum_values_doc=\n\
doclet.enum_valueof_doc=\n\ doclet.enum_valueof_doc=\n\
Returns the enum constant of this type with the specified name.\n\ Returns the enum constant of this type with the specified name.\n\
The string must match <I>exactly</I> an identifier used to declare an\n\ The string must match <i>exactly</i> an identifier used to declare an\n\
enum constant in this type. (Extraneous whitespace characters are \n\ enum constant in this type. (Extraneous whitespace characters are \n\
not permitted.)\n\ not permitted.)\n\
\n\ \n\

View file

@ -0,0 +1,439 @@
/* Javadoc style sheet */
/*
Overall document style
*/
* {
margin:0;
padding:0;
}
body {
font-family:Helvetica, Arial, sans-serif;
color:#000000;
}
p {
margin:20px 0;
}
pre {
font-size:1.0em;
}
h1 {
font-size:1.4em;
}
h2 {
font-size:1.35em;
}
h3 {
font-size:1.3em;
}
h4 {
font-size:1.25em;
}
ul {
margin:10px 0 10px 20px;
}
li {
list-style:disc;
}
dl dt {
font-size:0.95em;
font-weight:bold;
margin:10px 0 0 0;
}
dl dd {
margin:10px 0 10px 20px;
}
dl dd ul {
margin-left:0;
}
dl dd ul li {
list-style:none;
margin:10px 0 10px 0;
}
caption {
background: #CCCCFF;
color:#000000;
text-align: left;
font-size: 150%;
font-weight: bold;
border-left: 2px ridge;
border-right: 2px ridge;
border-top: 2px ridge;
padding-left: 5px;
width:auto;
}
/*
Document title and Copyright styles
*/
.aboutLanguage {
float:right;
font-size:0.9em;
color:#000000;
}
.legalCopy {
margin:7px;
}
.bar {
font-size:1em;
margin:10px 0 0 10px;
}
.bar a {
font-weight:normal;
}
/*
Navigation bar styles
*/
.topNav {
border-top:2px solid #C0C0C0;
margin:7px;
padding:7px 0;
height:2.8em;
width:99%;
min-width:600px;
}
.bottomNav {
border-top:2px solid #C0C0C0;
margin:7px;
padding:7px 0;
height:2.8em;
width:99%;
}
.subNav {
border-bottom:2px solid #C0C0C0;
float:left;
width:99%;
margin:7px;
min-width:600px;
}
.subNav div {
clear:left;
float:left;
padding:0 0 5px 2px;
width:100%;
}
.topNav a:link,.topNav a:active, .topNav a:visited, .topNav a:hover,
.bottomNav a:link,.bottomNav a:active, .bottomNav a:visited, .bottomNav a:hover {
color:#000000;
font-weight:bold;
text-decoration:underline;
font-size:1em;
}
/* Navigation bar list styles */
.topNav ul.navList, .bottomNav ul.navList {
background-color:#EEEEFF;
padding:7px 5px;
margin:0;
float:left;
width:80%;
}
ul.navList li{
list-style:none;
float:left;
padding:3px 4px;
color:#000000;
font-size:0.98em;
}
ul.navList li.navBarCell1Rev {
background-color:#00008B;
color:#FFFFFF;
font-weight:bold;
font-size:0.97em;
}
/* Sub-navigation bar list styles */
.subNav ul.navList {
float:left;
margin:0;
font-size:0.7em;
width:350px;
}
ul.subNavList {
float:left;
margin:0;
font-size:0.7em;
width:350px;
}
ul.subNavList li{
list-style:none;
float:left;
font-size:90%;
}
/*
Page header and footer styles
*/
.header, .footer {
clear:both;
margin:0 7px;
}
.indexHeader {
font-size:0.9em;
margin:10px 0 7px 10px;
}
.header ul {
padding-left:20px;
}
/* Header and footer title styles */
.header h1.title {
font-size:1.4em;
text-align:center;
margin:0;
}
.header h2.title {
font-size:1.35em;
margin:0;
}
.subTitle {
margin:0;
padding-top:10px;
font-size:0.75em;
font-weight:bold;
}
/*
Page layout container styles
*/
.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer,
.constantValuesContainer {
clear:both;
padding:10px 10px;
position:relative;
}
.indexContainer {
padding:0 0 10px 10px;
font-size:0.9em;
}
/*
Class inheritance information styles
*/
ul.inheritance {
margin:0;
padding:0;
}
ul.inheritance li {
display:inline;
list-style:none;
}
ul.inheritance li ul.inheritance {
margin-left:15px;
background-image:url(resources/inherit.gif);
background-repeat:no-repeat;
padding-left:15px;
padding-top:1px;
}
/*
Heading styles
*/
.indexContainer h2 {
font-weight:normal;
font-size:1.0em;
padding:10px 0 0 0;
}
.contentContainer h2 {
margin:10px 0;
}
.constantValuesContainer h2 {
background:#CCCCFF;
border:2px ridge;
padding:3px;
margin:0 0 10px 0;
}
.serializedFormContainer ul.blockList li.blockList h2 {
background:#EEEEFF;
border:2px ridge;
padding:3px;
margin:0 0 15px 0;
text-align:center;
}
.classUseContainer ul li ul li h3 {
margin-bottom:30px;
padding:3px;
}
.serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList h3 {
background:#EEEEFF;
margin:0 0 15px 0;
padding:3px;
}
.serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList h3 {
background:#CCCCFF;
margin:0 0 15px 0;
padding:3px;
border:2px ridge;
}
ul.blockList ul.blockList li.blockList h3, ul.blockList ul.blockList li.blockList h3 {
background:#CCCCFF;
border:2px ridge;
padding-left:5px;
}
div.summary ul.blockList ul.blockList li.blockList h3 {
background:#CCCCFF;
border:0;
border:2px ridge;
padding-left:5px;
}
div.summary ul.blockList ul.blockList ul.blockList li.blockList h3 {
background:#EEEEFF;
border:0;
border-bottom:2px ridge;
}
div.details ul.blockList ul.blockList ul.blockList li.blockList h4,
div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
font-size:1.15em;
font-weight:bold;
padding:0 0 10px 0;
}
/*
Table styles
*/
.contentContainer table {
border-collapse: collapse ;
width:100%;
}
.contentContainer table td, .contentContainer table th {
border:2px ridge;
padding:3px;
}
/* Constant values page table styles */
.constantValuesContainer table {
border-collapse: collapse ;
margin:0 0 10px 0;
}
.constantValuesContainer table caption{
font-size:0.95em;
padding:3px;
background:#EEEEFF;
}
.constantValuesContainer table td, .constantValuesContainer table th {
border:2px ridge;
padding:3px;
}
/* Class-use/Package-use page table styles */
.classUseContainer table {
border-collapse: collapse ;
width:100%;
margin:0 0 15px 0;
}
.classUseContainer ul li ul li table {
margin-bottom:30px;
}
.classUseContainer ul li ul li table caption{
font-size:0.95em;
padding:3px;
background:#EEEEFF;
}
.classUseContainer table td, .classUseContainer table th {
border:2px ridge;
padding:3px;
}
/* Summary table styles */
ul.blockList li.blockList table.overviewSummary {
margin:0;
margin-bottom:15px;
}
ul.blockList li.blockList table caption {
padding:3px;
}
ul.blockList li.blockList table.overviewSummary td.colFirst{
text-align:right;
}
table.packageSummary td.colFirst, table.overviewSummary th.colFirst {
width:15%;
}
div.summary ul.blockList ul.blockList li.blockList caption {
display:none;
}
div.summary ul.blockList li.blockList ul.blockList li.blockList table.overviewSummary th {
border-top:0;
}
/* Table column block styles */
ul.blockList li.blockList table.overviewSummary td.colLast div.block{
padding:0;
padding-left:40px;
}
ul.blockList li.blockList table.overviewSummary td.colOne div.block{
padding:0;
padding-left:40px;
}
.contentContainer ul.blockList li.blockList table .colOne div.block{
padding-left:40px;
}
.classUseContainer ul li ul li table .colLast div.block,
.classUseContainer ul li ul li table .colOne div.block{
padding-left:40px;
}
/*
List styles
*/
ul.horizontal li {
display:inline;
font-size:0.9em;
}
/* Container specific list styles */
.indexContainer ul {
margin:0;
}
.indexContainer ul li {
list-style:none;
}
.serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList {
border:0;
}
.serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList {
list-style:none;
border:0;
border-bottom:2px ridge;
}
.serializedFormContainer ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockListLast {
list-style:none;
}
/* General list styles */
ul.blockList, ul.blockListLast {
margin-left:0;
padding-left:0;
}
ul.blockList li.blockList, ul.blockListLast li.blockList {
list-style:none;
margin-bottom:25px;
}
ul.blockList ul.blockList ul.blockList li.blockList {
border:2px ridge;
}
div.details ul.blockList ul.blockList ul.blockList li.blockList {
border:0;
border-bottom:2px ridge;
}
/* Definition list styles */
ul.blockList li.blockList dl{
margin-bottom:15px;
}
ul.blockList li.blockList dl dd{
margin:0 0 0 30px;
}
ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList dl,
ul.blockList li.blockList ul.blockList li.blockList ul.blockListLast li.blockList dl{
padding:0 0 10px 35px;
}
dl.nameValue dt, dl.nameValue dd{
display:inline;
}
ul.blockList li.blockList pre{
margin:0 0 15px 0;
}
/* List content styles */
ul.blockList li.blockList ul.blockList li.blockList pre{
margin:10px 0 15px 0;
}
ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList pre,
ul.blockList li.blockList ul.blockList li.blockList ul.blockListLast li.blockList pre{
padding:0 0 10px 0;
}
ul.blockList li.blockList ul.blockList li.blockList ul.blockList li.blockList div.block,
ul.blockList li.blockList ul.blockList li.blockList ul.blockListLast li.blockList div.block{
padding:0 0 10px 35px;
}
/*
Formatting effect styles
*/
.strong {
font-weight:bold;
}
.sourceLineNo {
color:green;
padding:0 30px 0 0;
}

View file

@ -46,7 +46,7 @@ public class DirectoryManager {
/** /**
* The file separator string, "/", used in the formation of the URL path. * The file separator string, "/", used in the formation of the URL path.
*/ */
public static final String URL_FILE_SEPERATOR = "/"; public static final String URL_FILE_SEPARATOR = "/";
/** /**
* Never instaniated. * Never instaniated.
@ -123,13 +123,13 @@ public class DirectoryManager {
for (int i = 0; i < packageName.length(); i++) { for (int i = 0; i < packageName.length(); i++) {
char ch = packageName.charAt(i); char ch = packageName.charAt(i);
if (ch == '.') { if (ch == '.') {
pathstr.append(URL_FILE_SEPERATOR); pathstr.append(URL_FILE_SEPARATOR);
} else { } else {
pathstr.append(ch); pathstr.append(ch);
} }
} }
if (pathstr.length() > 0 && ! pathstr.toString().endsWith(URL_FILE_SEPERATOR)) { if (pathstr.length() > 0 && ! pathstr.toString().endsWith(URL_FILE_SEPARATOR)) {
pathstr.append(URL_FILE_SEPERATOR); pathstr.append(URL_FILE_SEPARATOR);
} }
return pathstr.toString(); return pathstr.toString();
} }
@ -155,7 +155,7 @@ public class DirectoryManager {
for (int i = 0; i < name.length(); i++) { for (int i = 0; i < name.length(); i++) {
char ch = name.charAt(i); char ch = name.charAt(i);
if (ch == '.') { if (ch == '.') {
pathstr.append(URL_FILE_SEPERATOR); pathstr.append(URL_FILE_SEPARATOR);
} else { } else {
pathstr.append(ch); pathstr.append(ch);
} }
@ -184,7 +184,7 @@ public class DirectoryManager {
StringBuffer pathstr = new StringBuffer(); StringBuffer pathstr = new StringBuffer();
pathstr.append(getRelativePath(from)); pathstr.append(getRelativePath(from));
pathstr.append(getPath(to)); pathstr.append(getPath(to));
pathstr.append(URL_FILE_SEPERATOR); pathstr.append(URL_FILE_SEPARATOR);
return pathstr.toString(); return pathstr.toString();
} }
@ -226,10 +226,10 @@ public class DirectoryManager {
for (int i = 0; i < from.length(); i++) { for (int i = 0; i < from.length(); i++) {
char ch = from.charAt(i); char ch = from.charAt(i);
if (ch == '.') { if (ch == '.') {
pathstr.append(".." + URL_FILE_SEPERATOR); pathstr.append(".." + URL_FILE_SEPARATOR);
} }
} }
pathstr.append(".." + URL_FILE_SEPERATOR); pathstr.append(".." + URL_FILE_SEPARATOR);
return pathstr.toString(); return pathstr.toString();
} }
@ -297,7 +297,7 @@ public class DirectoryManager {
String pathstr = createPathString(pd); String pathstr = createPathString(pd);
if (pathstr.length() > 0) { if (pathstr.length() > 0) {
buf.append(pathstr); buf.append(pathstr);
buf.append(URL_FILE_SEPERATOR); buf.append(URL_FILE_SEPARATOR);
} }
buf.append(filename); buf.append(filename);
return buf.toString(); return buf.toString();

View file

@ -50,6 +50,11 @@ public class Util {
public static final String[][] HTML_ESCAPE_CHARS = public static final String[][] HTML_ESCAPE_CHARS =
{{"&", "&amp;"}, {"<", "&lt;"}, {">", "&gt;"}}; {{"&", "&amp;"}, {"<", "&lt;"}, {">", "&gt;"}};
/**
* Name of the resource directory.
*/
public static final String RESOURCESDIR = "resources";
/** /**
* Return array of class members whose documentation is to be generated. * Return array of class members whose documentation is to be generated.
* If the member is deprecated do not include such a member in the * If the member is deprecated do not include such a member in the
@ -236,8 +241,8 @@ public class Util {
String destname = configuration.docFileDestDirName; String destname = configuration.docFileDestDirName;
File srcdir = new File(path + dir); File srcdir = new File(path + dir);
if (destname.length() > 0 && !destname.endsWith( if (destname.length() > 0 && !destname.endsWith(
DirectoryManager.URL_FILE_SEPERATOR)) { DirectoryManager.URL_FILE_SEPARATOR)) {
destname += DirectoryManager.URL_FILE_SEPERATOR; destname += DirectoryManager.URL_FILE_SEPARATOR;
} }
String dest = destname + dir; String dest = destname + dir;
try { try {
@ -263,7 +268,7 @@ public class Util {
&& ! configuration.shouldExcludeDocFileDir( && ! configuration.shouldExcludeDocFileDir(
srcfile.getName())){ srcfile.getName())){
copyDocFiles(configuration, path, dir + copyDocFiles(configuration, path, dir +
DirectoryManager.URL_FILE_SEPERATOR + srcfile.getName(), DirectoryManager.URL_FILE_SEPARATOR + srcfile.getName(),
overwrite); overwrite);
} }
} }
@ -322,25 +327,38 @@ public class Util {
* it already exists. * it already exists.
*/ */
public static void copyResourceFile(Configuration configuration, public static void copyResourceFile(Configuration configuration,
String resourcefile, String resourcefile, boolean overwrite) {
boolean overwrite) { String destresourcesdir = configuration.destDirName + RESOURCESDIR;
String destdir = configuration.destDirName; copyFile(configuration, resourcefile, RESOURCESDIR, destresourcesdir,
String destresourcesdir = destdir + "resources"; overwrite);
DirectoryManager.createDirectory(configuration, destresourcesdir); }
File destfile = new File(destresourcesdir, resourcefile);
/**
* Copy a file from a source directory to a destination directory
* (if it is not there already). If <code>overwrite</code> is true and
* the destination file already exists, overwrite it.
*
* @param configuration Holds the error message
* @param file The name of the file to copy
* @param source The source directory
* @param destination The destination directory where the file needs to be copied
* @param overwrite A flag to indicate whether the file in the
* destination directory will be overwritten if
* it already exists.
*/
public static void copyFile(Configuration configuration, String file, String source,
String destination, boolean overwrite) {
DirectoryManager.createDirectory(configuration, destination);
File destfile = new File(destination, file);
if(destfile.exists() && (! overwrite)) return; if(destfile.exists() && (! overwrite)) return;
try { try {
InputStream in = Configuration.class.getResourceAsStream( InputStream in = Configuration.class.getResourceAsStream(
"resources/" + resourcefile); source + DirectoryManager.URL_FILE_SEPARATOR + file);
if(in==null) return; if(in==null) return;
OutputStream out = new FileOutputStream(destfile); OutputStream out = new FileOutputStream(destfile);
byte[] buf = new byte[2048]; byte[] buf = new byte[2048];
int n; int n;
while((n = in.read(buf))>0) out.write(buf,0,n); while((n = in.read(buf))>0) out.write(buf,0,n);
in.close(); in.close();
out.close(); out.close();
} catch(Throwable t) {} } catch(Throwable t) {}
@ -357,12 +375,12 @@ public class Util {
try{ try{
String pkgPath = DirectoryManager.getDirectoryPath(pkgDoc); String pkgPath = DirectoryManager.getDirectoryPath(pkgDoc);
String completePath = new SourcePath(configuration.sourcepath). String completePath = new SourcePath(configuration.sourcepath).
getDirectory(pkgPath) + DirectoryManager.URL_FILE_SEPERATOR; getDirectory(pkgPath) + DirectoryManager.URL_FILE_SEPARATOR;
//Make sure that both paths are using the same seperators. //Make sure that both paths are using the same seperators.
completePath = Util.replaceText(completePath, File.separator, completePath = Util.replaceText(completePath, File.separator,
DirectoryManager.URL_FILE_SEPERATOR); DirectoryManager.URL_FILE_SEPARATOR);
pkgPath = Util.replaceText(pkgPath, File.separator, pkgPath = Util.replaceText(pkgPath, File.separator,
DirectoryManager.URL_FILE_SEPERATOR); DirectoryManager.URL_FILE_SEPARATOR);
return completePath.substring(0, completePath.indexOf(pkgPath)); return completePath.substring(0, completePath.indexOf(pkgPath));
} catch (Exception e){ } catch (Exception e){
return ""; return "";
@ -571,6 +589,24 @@ public class Util {
return result; return result;
} }
/**
* Given a string, strips all html characters and
* return the result.
*
* @param rawString The string to check.
* @return the original string with all of the HTML characters
* stripped.
*
*/
public static String stripHtml(String rawString) {
// remove HTML tags
rawString = rawString.replaceAll("\\<.*?>", " ");
// consolidate multiple spaces between a word to a single space
rawString = rawString.replaceAll("\\b\\s{2,}\\b", " ");
// remove extra whitespaces
return rawString.trim();
}
/** /**
* Create the directory path for the file to be generated, construct * Create the directory path for the file to be generated, construct
* FileOutputStream and OutputStreamWriter depending upon docencoding. * FileOutputStream and OutputStreamWriter depending upon docencoding.

View file

@ -84,17 +84,17 @@ public class AccessAsciiArt {
// Test the top line of the class tree // Test the top line of the class tree
{ {
" <IMG SRC=\"../../resources/inherit.gif\" ALT=\"extended by \"><A HREF=\"../../p1/C.html\" title=\"class in p1\">p1.C</A>", "<li><a href=\"../../p1/C.html\" title=\"class in p1\">p1.C</a></li>",
TMPDEST_DIR1 + "p1" + FS + "subpkg" + FS + "SSC.html" }, TMPDEST_DIR1 + "p1" + FS + "subpkg" + FS + "SSC.html" },
// Test the second line of the class tree // Test the second line of the class tree
{ {
" <IMG SRC=\"../../resources/inherit.gif\" ALT=\"extended by \"><A HREF=\"../../p1/SC.html\" title=\"class in p1\">p1.SC</A>", "<li><a href=\"../../p1/SC.html\" title=\"class in p1\">p1.SC</a></li>",
TMPDEST_DIR1 + "p1" + FS + "subpkg" + FS + "SSC.html" }, TMPDEST_DIR1 + "p1" + FS + "subpkg" + FS + "SSC.html" },
// Test the third line of the class tree // Test the third line of the class tree
{ {
" <IMG SRC=\"../../resources/inherit.gif\" ALT=\"extended by \"><STRONG>p1.subpkg.SSC</STRONG>", "<li>p1.subpkg.SSC</li>",
TMPDEST_DIR1 + "p1" + FS + "subpkg" + FS +"SSC.html" }, TMPDEST_DIR1 + "p1" + FS + "subpkg" + FS +"SSC.html" },
}; };

View file

@ -83,18 +83,19 @@ public class AccessH1 {
* NOTE: The standard doclet uses the same separator "\n" for all OS's * NOTE: The standard doclet uses the same separator "\n" for all OS's
*/ */
private static final String[][] testArray = { private static final String[][] testArray = {
// Test the style sheet
// Test the style sheet {
{ ".header h1.title {" + LS + " font-size:1.4em;" + LS +
"h1 { font-size: 145% }", " text-align:center;" + LS + " margin:0;" + LS +
TMPDEST_DIR1 + "stylesheet.css" }, "}",
TMPDEST_DIR1 + "stylesheet.css"
// Test the doc title in the overview page },
{ // Test the doc title in the overview page
"<H1>" + LS + "Document Title" + LS + "</H1>", {
TMPDEST_DIR1 + "overview-summary.html" } "<h1 class=\"title\">Document Title</h1>",
TMPDEST_DIR1 + "overview-summary.html"
}; }
};
public static void runTestsOnHTML(String[][] testArray) { public static void runTestsOnHTML(String[][] testArray) {

View file

@ -46,6 +46,7 @@ public class AccessSkipNav {
private static final String BUGNAME = "AccessSkipNav"; private static final String BUGNAME = "AccessSkipNav";
private static final String FS = System.getProperty("file.separator"); private static final String FS = System.getProperty("file.separator");
private static final String PS = System.getProperty("path.separator"); private static final String PS = System.getProperty("path.separator");
private static final String LS = System.getProperty("line.separator");
private static final String TMPDEST_DIR1 = "." + FS + "docs1" + FS; private static final String TMPDEST_DIR1 = "." + FS + "docs1" + FS;
private static final String TMPDEST_DIR2 = "." + FS + "docs2" + FS; private static final String TMPDEST_DIR2 = "." + FS + "docs2" + FS;
@ -84,20 +85,22 @@ public class AccessSkipNav {
// Testing only for the presence of the <a href> and <a name> // Testing only for the presence of the <a href> and <a name>
// Top navbar <A HREF> // Top navbar <a href>
{ "<A HREF=\"#skip-navbar_top\" title=\"Skip navigation links\"></A>", { "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\"></a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" }, TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Top navbar <A NAME> // Top navbar <a name>
{ "<A NAME=\"skip-navbar_top\"></A>", { "<a name=\"skip-navbar_top\">" + LS +
"<!-- -->" + LS + "</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" }, TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Bottom navbar <A HREF> // Bottom navbar <a href>
{ "<A HREF=\"#skip-navbar_bottom\" title=\"Skip navigation links\"></A>", { "<a href=\"#skip-navbar_bottom\" title=\"Skip navigation links\"></a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" }, TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Bottom navbar <A NAME> // Bottom navbar <a name>
{ "<A NAME=\"skip-navbar_bottom\"></A>", { "<a name=\"skip-navbar_bottom\">" + LS +
"<!-- -->" + LS + "</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" } TMPDEST_DIR1 + "p1" + FS + "C1.html" }
}; };

View file

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 4637604 4775148 * @bug 4637604 4775148
* @summary Test the tables for summary="" * @summary Test the tables for summary attribute
* @author dkramer * @author dkramer
* @library ../lib/ * @library ../lib/
* @build JavadocTester * @build JavadocTester
@ -44,15 +44,15 @@ public class AccessSummary extends JavadocTester {
// Test that the summary attribute appears // Test that the summary attribute appears
{ OUTPUT_DIR1 + "overview-summary.html", { OUTPUT_DIR1 + "overview-summary.html",
"SUMMARY=\"\"" }, "summary=\"Packages table, listing packages, and an explanation\"" },
// Test that the summary attribute appears // Test that the summary attribute appears
{ OUTPUT_DIR1 + "p1" + FS + "C1.html", { OUTPUT_DIR1 + "p1" + FS + "C1.html",
"SUMMARY=\"\"" }, "summary=\"Constructor Summary table, listing constructors, and an explanation\"" },
// Test that the summary attribute appears // Test that the summary attribute appears
{ OUTPUT_DIR1 + "constant-values.html", { OUTPUT_DIR1 + "constant-values.html",
"SUMMARY=\"\"" } "summary=\"Constant Field Values table, listing constant fields, and values\"" }
}; };
// First test with -header only // First test with -header only

View file

@ -86,12 +86,12 @@ public class AuthorDD
// Test single @since tag: // Test single @since tag:
{ "<DT><STRONG>Since:</STRONG></DT>"+NL+" <DD>JDK 1.0</DD>", { "<dt><span class=\"strong\">Since:</span></dt>"+NL+" <dd>JDK 1.0</dd>",
BUGID + FS + "p1" + FS + "C1.html" }, BUGID + FS + "p1" + FS + "C1.html" },
// Test multiple @author tags: // Test multiple @author tags:
{ "<DT><STRONG>Author:</STRONG></DT>"+NL+" <DD>Doug Kramer, Jamie, Neal</DD>", { "<dt><span class=\"strong\">Author:</span></dt>"+NL+" <dd>Doug Kramer, Jamie, Neal</dd>",
BUGID + FS + "p1" + FS + "C1.html" }, BUGID + FS + "p1" + FS + "C1.html" },
}; };

View file

@ -90,44 +90,34 @@ public class JavascriptWinTitle {
private static final String[][] testArray = { private static final String[][] testArray = {
// Test the javascript "type" attribute is present: // Test the javascript "type" attribute is present:
{ "<SCRIPT type=\"text/javascript\">", { "<script type=\"text/javascript\">",
TMPDEST_DIR1 + "overview-summary.html" },
// Test onload is absent:
{ "<body>",
TMPDEST_DIR1 + "overview-summary.html" }, TMPDEST_DIR1 + "overview-summary.html" },
// Test onload is present: // Test onload is present:
{ "onload=\"windowTitle();\"", { "<body>",
TMPDEST_DIR1 + "overview-summary.html" },
// Test onload is present:
{ "onload=\"windowTitle();\"",
TMPDEST_DIR1 + FS + "p1" + FS + "package-summary.html" }, TMPDEST_DIR1 + FS + "p1" + FS + "package-summary.html" },
// Test onload is present:
{ "onload=\"windowTitle();\"",
TMPDEST_DIR1 + FS + "p1" + FS + "C.html" },
// Test that "onload" is not present in BODY tag: // Test that "onload" is not present in BODY tag:
{ "<BODY BGCOLOR=\"white\">", { "<body>",
TMPDEST_DIR1 + "overview-frame.html" }, TMPDEST_DIR1 + "overview-frame.html" },
// Test that "onload" is not present in BODY tag: // Test that "onload" is not present in BODY tag:
{ "<BODY BGCOLOR=\"white\">", { "<body>",
TMPDEST_DIR1 + "allclasses-frame.html" }, TMPDEST_DIR1 + "allclasses-frame.html" },
// Test that "onload" is not present in BODY tag: // Test that "onload" is not present in BODY tag:
{ "<BODY BGCOLOR=\"white\">", { "<body>",
TMPDEST_DIR1 + FS + "p1" + FS + "package-frame.html" }, TMPDEST_DIR1 + FS + "p1" + FS + "package-frame.html" },
// Test that win title javascript is followed by NOSCRIPT code. // Test that win title javascript is followed by NOSCRIPT code.
{"<SCRIPT type=\"text/javascript\">" + LS + {"<script type=\"text/javascript\"><!--" + LS +
"function windowTitle()" + LS + " if (location.href.indexOf('is-external=true') == -1) {" + LS +
"{" + LS + " parent.document.title=\"C (Window Title)\";" + LS +
" if (location.href.indexOf('is-external=true') == -1) {" + LS + " }" + LS + "//-->" + LS + "</script>",
" parent.document.title=\"C (Window Title)\";" + LS +
" }" + LS +
"}" + LS +
"</SCRIPT>" + LS +
"<NOSCRIPT>" + LS +
"</NOSCRIPT>",
TMPDEST_DIR1 + FS + "p1" + FS + "C.html" TMPDEST_DIR1 + FS + "p1" + FS + "C.html"
} }

View file

@ -67,31 +67,31 @@ public class MetaTag extends JavadocTester {
private static final String[][] TEST = { private static final String[][] TEST = {
{ OUTPUT_DIR + FS + "p1" + FS + "C1.html", { OUTPUT_DIR + FS + "p1" + FS + "C1.html",
"<META NAME=\"keywords\" CONTENT=\"p1.C1 class\">" }, "<meta name=\"keywords\" content=\"p1.C1 class\">" },
{ OUTPUT_DIR + FS + "p1" + FS + "C1.html", { OUTPUT_DIR + FS + "p1" + FS + "C1.html",
"<META NAME=\"keywords\" CONTENT=\"field1\">" }, "<meta name=\"keywords\" content=\"field1\">" },
{ OUTPUT_DIR + FS + "p1" + FS + "C1.html", { OUTPUT_DIR + FS + "p1" + FS + "C1.html",
"<META NAME=\"keywords\" CONTENT=\"field2\">" }, "<meta name=\"keywords\" content=\"field2\">" },
{ OUTPUT_DIR + FS + "p1" + FS + "C1.html", { OUTPUT_DIR + FS + "p1" + FS + "C1.html",
"<META NAME=\"keywords\" CONTENT=\"method1()\">" }, "<meta name=\"keywords\" content=\"method1()\">" },
{ OUTPUT_DIR + FS + "p1" + FS + "C1.html", { OUTPUT_DIR + FS + "p1" + FS + "C1.html",
"<META NAME=\"keywords\" CONTENT=\"method2()\">" }, "<meta name=\"keywords\" content=\"method2()\">" },
{ OUTPUT_DIR + FS + "p1" + FS + "package-summary.html", { OUTPUT_DIR + FS + "p1" + FS + "package-summary.html",
"<META NAME=\"keywords\" CONTENT=\"p1 package\">" }, "<meta name=\"keywords\" content=\"p1 package\">" },
{ OUTPUT_DIR + FS + "overview-summary.html", { OUTPUT_DIR + FS + "overview-summary.html",
"<META NAME=\"keywords\" CONTENT=\"Overview, Sample Packages\">" }, "<meta name=\"keywords\" content=\"Overview, Sample Packages\">" },
//NOTE: Hopefully, this regression test is not run at midnight. If the output //NOTE: Hopefully, this regression test is not run at midnight. If the output
//was generated yesterday and this test is run today, the test will fail. //was generated yesterday and this test is run today, the test will fail.
{OUTPUT_DIR + FS + "overview-summary.html", {OUTPUT_DIR + FS + "overview-summary.html",
"<META NAME=\"date\" " "<meta name=\"date\" "
+ "CONTENT=\"" + m_dateFormat.format(new Date()) + "\">"}, + "content=\"" + m_dateFormat.format(new Date()) + "\">"},
}; };
private static final String[][] NEGATED_TEST = NO_TEST; private static final String[][] NEGATED_TEST = NO_TEST;

View file

@ -33,12 +33,10 @@
* @run main ValidHtml * @run main ValidHtml
*/ */
import com.sun.javadoc.*; import com.sun.javadoc.*;
import java.util.*; import java.util.*;
import java.io.*; import java.io.*;
/** /**
* Runs javadoc and runs regression tests on the resulting HTML. * Runs javadoc and runs regression tests on the resulting HTML.
* It reads each file, complete with newlines, into a string to easily * It reads each file, complete with newlines, into a string to easily
@ -66,13 +64,14 @@ public class ValidHtml {
String srcdir = System.getProperty("test.src", "."); String srcdir = System.getProperty("test.src", ".");
// Test for all cases except the split index page // Test for all cases except the split index page
runJavadoc(new String[] {"-d", TMPDEST_DIR1, runJavadoc(new String[]{"-d", TMPDEST_DIR1,
"-doctitle", "Document Title", "-doctitle", "Document Title",
"-windowtitle", "Window Title", "-windowtitle", "Window Title",
"-use", "-use",
"-overview", (srcdir + FS + "overview.html"), "-overview", (srcdir + FS + "overview.html"),
"-sourcepath", srcdir, "-sourcepath", srcdir,
"p1", "p2"}); "p1", "p2"
});
runTestsOnHTML(testArray); runTestsOnHTML(testArray);
printSummary(); printSummary();
@ -90,53 +89,52 @@ public class ValidHtml {
* NOTE: The standard doclet uses the same separator "\n" for all OS's * NOTE: The standard doclet uses the same separator "\n" for all OS's
*/ */
private static final String[][] testArray = { private static final String[][] testArray = {
// Test the proper DOCTYPE element is present:
// Test the proper DOCTYPE element is present: {
{ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">",
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">", TMPDEST_DIR1 + "index.html"
TMPDEST_DIR1 + "index.html" }, },
// Test the proper DOCTYPE element is present:
// Test the proper DOCTYPE element is present: {
{ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">", TMPDEST_DIR1 + "overview-summary.html"
TMPDEST_DIR1 + "overview-summary.html" }, },
// Test the proper DOCTYPE element is present:
// Test the proper DOCTYPE element is present: {
{ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">", TMPDEST_DIR1 + "p1" + FS + "package-summary.html"
TMPDEST_DIR1 + "p1" + FS + "package-summary.html" }, },
// Test the proper DOCTYPE element is present:
// Test the proper DOCTYPE element is present: {
{ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">", TMPDEST_DIR1 + "p1" + FS + "C.html"
TMPDEST_DIR1 + "p1" + FS + "C.html" }, },
// Test the proper DOCTYPE element is present:
// Test the proper DOCTYPE element is present: {
{ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">", TMPDEST_DIR1 + "overview-frame.html"
TMPDEST_DIR1 + "overview-frame.html" }, },
// Test the proper DOCTYPE element is present:
// Test the proper DOCTYPE element is present: {
{ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">", TMPDEST_DIR1 + "allclasses-frame.html"
TMPDEST_DIR1 + "allclasses-frame.html" }, },
// Test the proper DOCTYPE element is present:
// Test the proper DOCTYPE element is present: {
{ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">", TMPDEST_DIR1 + "p1" + FS + "package-frame.html"
TMPDEST_DIR1 + "p1" + FS + "package-frame.html" }, },
// Test that <NOFRAMES> is inside <FRAMESET> element:
// Test that <NOFRAMES> is inside <FRAMESET> element: {
{ "</noframes>" + LS + "</frameset>",
"</NOFRAMES>" + LS + "</FRAMESET>", TMPDEST_DIR1 + "index.html"
TMPDEST_DIR1 + "index.html" }, },
// Test the table elements are in the correct order:
// Test the table elements are in the correct order: {
{ "</td>" + LS + "</tr>",
"</FONT></TD>" + LS + "</TR>", TMPDEST_DIR1 + FS + "p1" + FS + "package-use.html"
TMPDEST_DIR1 + FS + "p1" + FS + "package-use.html" } }
};
};
public static void runTestsOnHTML(String[][] testArray) { public static void runTestsOnHTML(String[][] testArray) {
@ -152,10 +150,7 @@ public class ValidHtml {
// Find string in file's contents // Find string in file's contents
if (findString(fileString, stringToFind) == -1) { if (findString(fileString, stringToFind) == -1) {
System.out.println("\nSub-test " + (subtestNum) System.out.println("\nSub-test " + (subtestNum) + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n" + "when searching for:\n" + stringToFind);
+ " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
+ "when searching for:\n"
+ stringToFind);
} else { } else {
numSubtestsPassed += 1; numSubtestsPassed += 1;
System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind); System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
@ -164,11 +159,10 @@ public class ValidHtml {
} }
public static void printSummary() { public static void printSummary() {
if ( numSubtestsPassed == subtestNum ) { if (numSubtestsPassed == subtestNum) {
System.out.println("\nAll " + numSubtestsPassed + " subtests passed"); System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
} else { } else {
throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum) throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum) + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
+ " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
} }
} }
@ -176,16 +170,16 @@ public class ValidHtml {
public static String readFileToString(String filename) { public static String readFileToString(String filename) {
try { try {
File file = new File(filename); File file = new File(filename);
if ( !file.exists() ) { if (!file.exists()) {
System.out.println("\nFILE DOES NOT EXIST: " + filename); System.out.println("\nFILE DOES NOT EXIST: " + filename);
} }
BufferedReader in = new BufferedReader(new FileReader(file)); BufferedReader in = new BufferedReader(new FileReader(file));
// Create an array of characters the size of the file // Create an array of characters the size of the file
char[] allChars = new char[(int)file.length()]; char[] allChars = new char[(int) file.length()];
// Read the characters into the allChars array // Read the characters into the allChars array
in.read(allChars, 0, (int)file.length()); in.read(allChars, 0, (int) file.length());
in.close(); in.close();
// Convert to a string // Convert to a string

View file

@ -84,7 +84,7 @@ public class VersionNumber {
// Test the proper DOCTYPE element is present: // Test the proper DOCTYPE element is present:
{ {
"<!-- Generated by javadoc (build", "<!-- Generated by javadoc (version",
TMPDEST_DIR1 + "p1" + FS + "C.html" }, TMPDEST_DIR1 + "p1" + FS + "C.html" },
}; };

View file

@ -94,52 +94,52 @@ public class WindowTitles
*/ */
private static final String[][] testArray = { private static final String[][] testArray = {
{ "<TITLE>" + LS + "Overview" + LS + "</TITLE>", { "<title>Overview</title>",
TMPDIR_STRING1 + "overview-summary.html" }, TMPDIR_STRING1 + "overview-summary.html" },
{ "<TITLE>" + LS + "Class Hierarchy" + LS + "</TITLE>", { "<title>Class Hierarchy</title>",
TMPDIR_STRING1 + "overview-tree.html" }, TMPDIR_STRING1 + "overview-tree.html" },
{ "<TITLE>" + LS + "Overview List" + LS + "</TITLE>", { "<title>Overview List</title>",
TMPDIR_STRING1 + "overview-frame.html" }, TMPDIR_STRING1 + "overview-frame.html" },
{ "<TITLE>" + LS + "p1" + LS + "</TITLE>", { "<title>p1</title>",
TMPDIR_STRING1 + "p1" + FS + "package-summary.html" }, TMPDIR_STRING1 + "p1" + FS + "package-summary.html" },
{ "<TITLE>" + LS + "p1" + LS + "</TITLE>", { "<title>p1</title>",
TMPDIR_STRING1 + "p1" + FS + "package-frame.html" }, TMPDIR_STRING1 + "p1" + FS + "package-frame.html" },
{ "<TITLE>" + LS + "p1 Class Hierarchy" + LS + "</TITLE>", { "<title>p1 Class Hierarchy</title>",
TMPDIR_STRING1 + "p1" + FS + "package-tree.html" }, TMPDIR_STRING1 + "p1" + FS + "package-tree.html" },
{ "<TITLE>" + LS + "Uses of Package p1" + LS + "</TITLE>", { "<title>Uses of Package p1</title>",
TMPDIR_STRING1 + "p1" + FS + "package-use.html" }, TMPDIR_STRING1 + "p1" + FS + "package-use.html" },
{ "<TITLE>" + LS + "C1" + LS + "</TITLE>", { "<title>C1</title>",
TMPDIR_STRING1 + "p1" + FS + "C1.html" }, TMPDIR_STRING1 + "p1" + FS + "C1.html" },
{ "<TITLE>" + LS + "All Classes" + LS + "</TITLE>", { "<title>All Classes</title>",
TMPDIR_STRING1 + "allclasses-frame.html" }, TMPDIR_STRING1 + "allclasses-frame.html" },
{ "<TITLE>" + LS + "All Classes" + LS + "</TITLE>", { "<title>All Classes</title>",
TMPDIR_STRING1 + "allclasses-noframe.html" }, TMPDIR_STRING1 + "allclasses-noframe.html" },
{ "<TITLE>" + LS + "Constant Field Values" + LS + "</TITLE>", { "<title>Constant Field Values</title>",
TMPDIR_STRING1 + "constant-values.html" }, TMPDIR_STRING1 + "constant-values.html" },
{ "<TITLE>" + LS + "Deprecated List" + LS + "</TITLE>", { "<title>Deprecated List</title>",
TMPDIR_STRING1 + "deprecated-list.html" }, TMPDIR_STRING1 + "deprecated-list.html" },
{ "<TITLE>" + LS + "Serialized Form" + LS + "</TITLE>", { "<title>Serialized Form</title>",
TMPDIR_STRING1 + "serialized-form.html" }, TMPDIR_STRING1 + "serialized-form.html" },
{ "<TITLE>" + LS + "API Help" + LS + "</TITLE>", { "<title>API Help</title>",
TMPDIR_STRING1 + "help-doc.html" }, TMPDIR_STRING1 + "help-doc.html" },
{ "<TITLE>" + LS + "Index" + LS + "</TITLE>", { "<title>Index</title>",
TMPDIR_STRING1 + "index-all.html" }, TMPDIR_STRING1 + "index-all.html" },
{ "<TITLE>" + LS + "Uses of Class p1.C1" + LS + "</TITLE>", { "<title>Uses of Class p1.C1</title>",
TMPDIR_STRING1 + "p1" + FS + "class-use" + FS + "C1.html" }, TMPDIR_STRING1 + "p1" + FS + "class-use" + FS + "C1.html" },
}; };
@ -147,7 +147,7 @@ public class WindowTitles
* Assign value for [ stringToFind, filename ] for split index page * Assign value for [ stringToFind, filename ] for split index page
*/ */
private static final String[][] testSplitIndexArray = { private static final String[][] testSplitIndexArray = {
{ "<TITLE>" + LS + "C-Index" + LS + "</TITLE>", { "<title>C-Index</title>",
TMPDIR_STRING2 + "index-files" + FS + "index-1.html" }, TMPDIR_STRING2 + "index-files" + FS + "index-1.html" },
}; };

View file

@ -51,7 +51,7 @@ public class TestConstantValuesDriver extends JavadocTester {
tests[i][1] = "TEST"+(i+1)+"PASSES"; tests[i][1] = "TEST"+(i+1)+"PASSES";
} }
tests[tests.length-1][0] = BUG_ID + FS + "constant-values.html"; tests[tests.length-1][0] = BUG_ID + FS + "constant-values.html";
tests[tests.length-1][1] = "<CODE>\"&lt;Hello World&gt;\"</CODE>"; tests[tests.length-1][1] = "<code>\"&lt;Hello World&gt;\"</code>";
TestConstantValuesDriver tester = new TestConstantValuesDriver(); TestConstantValuesDriver tester = new TestConstantValuesDriver();
run(tester, ARGS, tests, NO_TEST); run(tester, ARGS, tests, NO_TEST);
tester.printSummary(); tester.printSummary();

View file

@ -37,18 +37,20 @@ public class TestClassCrossReferences extends JavadocTester {
private static final String BUG_ID = "4652655-4857717"; private static final String BUG_ID = "4652655-4857717";
private static final String[][] TEST = { private static final String[][] TEST = {
{BUG_ID + FS + "C.html", {BUG_ID + FS + "C.html",
"<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/math/package-summary.html?is-external=true\"><CODE>Link to math package</CODE></A>"}, "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/package-summary.html?is-external=true\"><code>Link to math package</code></a>"},
{BUG_ID + FS + "C.html", {BUG_ID + FS + "C.html",
"<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/javax/swing/text/AbstractDocument.AttributeContext.html?is-external=true\" " + "<a href=\"http://java.sun.com/j2se/1.4/docs/api/javax/swing/text/AbstractDocument.AttributeContext.html?is-external=true\" " +
"title=\"class or interface in javax.swing.text\"><CODE>Link to AttributeContext innerclass</CODE></A>"}, "title=\"class or interface in javax.swing.text\"><code>Link to AttributeContext innerclass</code></a>"},
{BUG_ID + FS + "C.html", {BUG_ID + FS + "C.html",
"<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigDecimal.html?is-external=true\" " + "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigDecimal.html?is-external=true\" " +
"title=\"class or interface in java.math\"><CODE>Link to external class BigDecimal</CODE></A>"}, "title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>"},
{BUG_ID + FS + "C.html", {BUG_ID + FS + "C.html",
"<A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd(java.math.BigInteger)\" " + "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd(java.math.BigInteger)\" " +
"title=\"class or interface in java.math\"><CODE>Link to external member gcd</CODE></A>"}, "title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>"},
{BUG_ID + FS + "C.html", {BUG_ID + FS + "C.html",
"<STRONG>Overrides:</STRONG></DT><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE>"} "<dl>" + NL + "<dt><strong>Overrides:</strong></dt>" + NL +
"<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>" + NL +
"</dl>"}
}; };
private static final String[][] NEGATED_TEST = NO_TEST; private static final String[][] NEGATED_TEST = NO_TEST;
private static final String[] ARGS = private static final String[] ARGS =

View file

@ -48,32 +48,29 @@ public class TestClassTree extends JavadocTester {
//Input for string search tests. //Input for string search tests.
private static final String[][] TEST = { private static final String[][] TEST = {
{BUG_ID + FS + "pkg" + FS + "package-tree.html", {BUG_ID + FS + "pkg" + FS + "package-tree.html",
"<LI TYPE=\"circle\">pkg.<A HREF=\"../pkg/ParentClass.html\" " + "<ul>" + NL + "<li type=\"circle\">pkg.<a href=\"../pkg/ParentClass.html\" " +
"title=\"class in pkg\"><STRONG>ParentClass</STRONG></A><UL>"}, "title=\"class in pkg\"><span class=\"strong\">ParentClass</span></a>"},
{BUG_ID + FS + "pkg" + FS + "package-tree.html", {BUG_ID + FS + "pkg" + FS + "package-tree.html",
"Annotation Type Hierarchy" + NL + "</H2>" + NL + "<UL>" + NL + "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>" + NL +
"<LI TYPE=\"circle\">pkg.<A HREF=\"../pkg/AnnotationType.html\" " + "<ul>" + NL + "<li type=\"circle\">pkg.<a href=\"../pkg/AnnotationType.html\" " +
"title=\"annotation in pkg\"><STRONG>AnnotationType</STRONG></A> " + "title=\"annotation in pkg\"><span class=\"strong\">AnnotationType</span></a> " +
"(implements java.lang.annotation.Annotation)" + NL + "</UL>"}, "(implements java.lang.annotation.Annotation)</li>" + NL + "</ul>"},
{BUG_ID + FS + "pkg" + FS + "package-tree.html", {BUG_ID + FS + "pkg" + FS + "package-tree.html",
"<H2>" + NL + "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>" + NL + "<ul>" + NL +
"Enum Hierarchy" + NL + "<li type=\"circle\">java.lang.Object" + NL + "<ul>" + NL +
"</H2>" + NL + "<li type=\"circle\">java.lang.Enum&lt;E&gt; (implements java.lang." +
"<UL>" + NL + "Comparable&lt;T&gt;, java.io.Serializable)" + NL + "<ul>" + NL +
"<LI TYPE=\"circle\">java.lang.Object<UL>" + NL + "<li type=\"circle\">pkg.<a href=\"../pkg/Coin.html\" " +
"<LI TYPE=\"circle\">java.lang.Enum&lt;E&gt; (implements java.lang.Comparable&lt;T&gt;, java.io.Serializable)" + NL + "title=\"enum in pkg\"><span class=\"strong\">Coin</span></a></li>" + NL +
"<UL>" + NL + "</ul>" + NL + "</li>" + NL + "</ul>" + NL + "</li>" + NL + "</ul>"
"<LI TYPE=\"circle\">pkg.<A HREF=\"../pkg/Coin.html\" title=\"enum in pkg\"><STRONG>Coin</STRONG></A></UL>" + NL +
"</UL>" + NL +
"</UL>"
}, },
}; };
private static final String[][] NEGATED_TEST = { private static final String[][] NEGATED_TEST = {
{BUG_ID + FS + "pkg" + FS + "package-tree.html", {BUG_ID + FS + "pkg" + FS + "package-tree.html",
"<LI TYPE=\"circle\">class pkg.<A HREF=\"../pkg/ParentClass.html\" " + "<li type=\"circle\">class pkg.<a href=\"../pkg/ParentClass.html\" " +
"title=\"class in pkg\"><STRONG>ParentClass</STRONG></A><UL>"} "title=\"class in pkg\"><span class=\"strong\">ParentClass</span></a></li>"}
}; };
/** /**

View file

@ -45,10 +45,10 @@ public class TestConstructorIndent extends JavadocTester {
//Input for string search tests. //Input for string search tests.
private static final String[][] TEST = { private static final String[][] TEST = {
{BUG_ID + FS + "C.html", "<DL>" + NL + "<DD>This is just a simple constructor." + NL + {BUG_ID + FS + "C.html", "<div class=\"block\">" +
"<P>" + NL + "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Parameters:</STRONG>" + "This is just a simple constructor.</div>" + NL +
"</DT><DD><CODE>i</CODE> - a param.</DD></DL>" + NL + "<dl><dt><span class=\"strong\">Parameters:</span></dt><dd>" +
"</DD>" + NL + "</DL>" "<code>i</code> - a param.</dd></dl>"
} }
}; };
private static final String[][] NEGATED_TEST = NO_TEST; private static final String[][] NEGATED_TEST = NO_TEST;

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