提交 3338bba0 编写于 作者: L lana

Merge

...@@ -52,6 +52,7 @@ import com.sun.source.tree.Tree; ...@@ -52,6 +52,7 @@ import com.sun.source.tree.Tree;
public abstract class Trees { public abstract class Trees {
/** /**
* Gets a Trees object for a given CompilationTask. * Gets a Trees object for a given CompilationTask.
* @param task the compilation task for which to get the Trees object
* @throws IllegalArgumentException if the task does not support the Trees API. * @throws IllegalArgumentException if the task does not support the Trees API.
*/ */
public static Trees instance(CompilationTask task) { public static Trees instance(CompilationTask task) {
...@@ -61,7 +62,8 @@ public abstract class Trees { ...@@ -61,7 +62,8 @@ public abstract class Trees {
} }
/** /**
* Gets a Trees object for a given CompilationTask. * Gets a Trees object for a given ProcessingEnvironment.
* @param env the processing environment for which to get the Trees object
* @throws IllegalArgumentException if the env does not support the Trees API. * @throws IllegalArgumentException if the env does not support the Trees API.
*/ */
public static Trees instance(ProcessingEnvironment env) { public static Trees instance(ProcessingEnvironment env) {
...@@ -162,6 +164,12 @@ public abstract class Trees { ...@@ -162,6 +164,12 @@ public abstract class Trees {
*/ */
public abstract Scope getScope(TreePath path); public abstract Scope getScope(TreePath path);
/**
* Gets the doc comment, if any, for the Tree node identified by a given TreePath.
* Returns null if no doc comment was found.
*/
public abstract String getDocComment(TreePath path);
/** /**
* Checks whether a given type is accessible in a given scope. * Checks whether a given type is accessible in a given scope.
* @param scope the scope to be checked * @param scope the scope to be checked
......
...@@ -51,16 +51,16 @@ import com.sun.tools.javac.parser.DocCommentScanner; ...@@ -51,16 +51,16 @@ import com.sun.tools.javac.parser.DocCommentScanner;
* or deletion without notice.</b> * or deletion without notice.</b>
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class JavaCompiler extends com.sun.tools.javac.main.JavaCompiler { public class AptJavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
/** The context key for the compiler. */ /** The context key for the compiler. */
protected static final Context.Key<JavaCompiler> compilerKey = protected static final Context.Key<AptJavaCompiler> compilerKey =
new Context.Key<JavaCompiler>(); new Context.Key<AptJavaCompiler>();
/** Get the JavaCompiler instance for this context. */ /** Get the JavaCompiler instance for this context. */
public static JavaCompiler instance(Context context) { public static AptJavaCompiler instance(Context context) {
JavaCompiler instance = context.get(compilerKey); AptJavaCompiler instance = context.get(compilerKey);
if (instance == null) if (instance == null)
instance = new JavaCompiler(context); instance = new AptJavaCompiler(context);
return instance; return instance;
} }
...@@ -107,7 +107,7 @@ public class JavaCompiler extends com.sun.tools.javac.main.JavaCompiler { ...@@ -107,7 +107,7 @@ public class JavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
/** Construct a new compiler from a shared context. /** Construct a new compiler from a shared context.
*/ */
public JavaCompiler(Context context) { public AptJavaCompiler(Context context) {
super(preRegister(context)); super(preRegister(context));
context.put(compilerKey, this); context.put(compilerKey, this);
......
...@@ -421,7 +421,7 @@ public class Main { ...@@ -421,7 +421,7 @@ public class Main {
}, },
new AptOption("-version", "opt.version") { new AptOption("-version", "opt.version") {
boolean process(String option) { boolean process(String option) {
Bark.printLines(out, ownName + " " + JavaCompiler.version()); Bark.printLines(out, ownName + " " + AptJavaCompiler.version());
return super.process(option); return super.process(option);
} }
}, },
...@@ -1111,11 +1111,11 @@ public class Main { ...@@ -1111,11 +1111,11 @@ public class Main {
} }
int exitCode = EXIT_OK; int exitCode = EXIT_OK;
JavaCompiler comp = null; AptJavaCompiler comp = null;
try { try {
context.put(Bark.outKey, out); context.put(Bark.outKey, out);
comp = JavaCompiler.instance(context); comp = AptJavaCompiler.instance(context);
if (comp == null) if (comp == null)
return EXIT_SYSERR; return EXIT_SYSERR;
...@@ -1184,7 +1184,7 @@ public class Main { ...@@ -1184,7 +1184,7 @@ public class Main {
*/ */
void bugMessage(Throwable ex) { void bugMessage(Throwable ex) {
Bark.printLines(out, getLocalizedString("msg.bug", Bark.printLines(out, getLocalizedString("msg.bug",
JavaCompiler.version())); AptJavaCompiler.version()));
ex.printStackTrace(out); ex.printStackTrace(out);
} }
......
...@@ -120,7 +120,7 @@ public class FilerImpl implements Filer { ...@@ -120,7 +120,7 @@ public class FilerImpl implements Filer {
private final Options opts; private final Options opts;
private final DeclarationMaker declMaker; private final DeclarationMaker declMaker;
private final com.sun.tools.apt.main.JavaCompiler comp; private final com.sun.tools.apt.main.AptJavaCompiler comp;
// Platform's default encoding // Platform's default encoding
private final static String DEFAULT_ENCODING = private final static String DEFAULT_ENCODING =
...@@ -177,7 +177,7 @@ public class FilerImpl implements Filer { ...@@ -177,7 +177,7 @@ public class FilerImpl implements Filer {
opts = Options.instance(context); opts = Options.instance(context);
declMaker = DeclarationMaker.instance(context); declMaker = DeclarationMaker.instance(context);
bark = Bark.instance(context); bark = Bark.instance(context);
comp = com.sun.tools.apt.main.JavaCompiler.instance(context); comp = com.sun.tools.apt.main.AptJavaCompiler.instance(context);
roundOver = false; roundOver = false;
this.filesCreated = comp.getAggregateGenFiles(); this.filesCreated = comp.getAggregateGenFiles();
......
...@@ -26,12 +26,16 @@ ...@@ -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 ...@@ -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 ...@@ -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);
} }
} }
} }
......
...@@ -30,6 +30,8 @@ import java.util.*; ...@@ -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.*; ...@@ -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 { ...@@ -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);
} }
} }
...@@ -25,9 +25,11 @@ ...@@ -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 { ...@@ -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); /**
* 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);
protected abstract void printIndexRow(PackageDoc pkg); /**
* 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);
protected abstract void printIndexFooter(); /**
* 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 the contants in the package index file. Call appropriate * 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) {
} }
} }
...@@ -25,11 +25,12 @@ ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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) {
h2();
println(configuration.getText(heading));
h2End();
}
/**
* Highlight "Tree" word in the navigation bar, since this is the tree page.
*/ */
protected void navLinkTree() { protected Content getNavLinkTree() {
navCellRevStart(); Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, treeLabel);
fontStyle("NavBarFont1Rev"); return li;
strongText("doclet.Tree");
fontEnd();
navCellEnd();
} }
} }
...@@ -25,11 +25,14 @@ ...@@ -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.*; ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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();
}
} }
...@@ -28,6 +28,7 @@ package com.sun.tools.doclets.formats.html; ...@@ -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 ...@@ -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 ...@@ -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");
} }
} }
} }
...@@ -28,6 +28,7 @@ package com.sun.tools.doclets.formats.html; ...@@ -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,241 +52,228 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter ...@@ -51,241 +52,228 @@ 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) {
writer.println("<!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== -->");
writer.println();
writer.printSummaryHeader(this, classDoc);
}
/**
* Write the annotation type member summary footer for the given class.
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeMemberSummaryFooter(ClassDoc classDoc) { public Content getMemberSummaryHeader(ClassDoc classDoc,
writer.printSummaryFooter(this, classDoc); Content memberSummaryTree) {
memberSummaryTree.addContent(
HtmlConstants.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
writer.addSummaryHeader(this, classDoc, memberTree);
return memberTree;
} }
/** /**
* {@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"));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.annotationTypeDetailsLabel);
memberDetailsTree.addContent(heading);
writer.printedAnnotationHeading = true;
}
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeInheritedMemberSummary(ClassDoc classDoc, public Content getAnnotationDocTreeHeader(MemberDoc member,
ProgramElementDoc member, boolean isFirst, boolean isLast) { Content annotationDetailsTree) {
//Not appliable. annotationDetailsTree.addContent(
writer.getMarkerAnchor(member.name() +
((ExecutableMemberDoc) member).signature()));
Content annotationDocTree = writer.getMemberTreeHeader();
Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
heading.addContent(member.name());
annotationDocTree.addContent(heading);
return annotationDocTree;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) { public Content getSignature(MemberDoc member) {
//Not appliable. 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) {
Content memberName = new StringContent(member.name());
writer.addSrcLink(member, memberName, pre);
} else {
addName(member.name(), pre);
}
return pre;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeHeader(ClassDoc classDoc, String header) { public void addDeprecated(MemberDoc member, Content annotationDocTree) {
writer.println(); addDeprecatedInfo(member, annotationDocTree);
writer.println("<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->");
writer.println();
writer.anchor("annotation_type_element_detail");
writer.printTableHeadingBackground(header);
writer.println();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeMemberHeader(MemberDoc member, boolean isFirst) { public void addComments(MemberDoc member, Content annotationDocTree) {
if (! isFirst) { addComment(member, annotationDocTree);
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 void addTags(MemberDoc member, Content annotationDocTree) {
writer.pre(); writer.addTagsInfo(member, annotationDocTree);
writer.writeAnnotationInfo(member);
printModifiers(member);
writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
getType(member)));
print(' ');
if (configuration().linksource) {
writer.printSrcLink(member, member.name());
} else {
strong(member.name());
}
writer.preEnd();
assert !writer.getMemberDetailsListPrinted();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeComments(MemberDoc member) { public Content getAnnotationDetails(Content annotationDetailsTree) {
printComment(member); return getMemberTree(annotationDetailsTree);
} }
/** /**
* Write the tag output for the given member. * {@inheritDoc}
*
* @param member the member being documented.
*/ */
public void writeTags(MemberDoc member) { public Content getAnnotationDoc(Content annotationDocTree,
writer.printTags(member); boolean isLastContent) {
return getMemberTree(annotationDocTree, isLastContent);
} }
/** /**
* Write the annotation type member footer. * Close the writer.
*/ */
public void writeMemberFooter() { public void close() throws IOException {
printMemberFooter(); writer.close();
} }
/** /**
* 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 void addSummaryLabel(Content memberTree) {
//No footer to write for annotation type member documentation Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
writer.getResource("doclet.Annotation_Type_Required_Member_Summary"));
memberTree.addContent(label);
} }
/** /**
* Close the writer. * {@inheritDoc}
*/ */
public void close() throws IOException { public String getTableSummary() {
writer.close(); return configuration().getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Annotation_Type_Required_Member_Summary"),
configuration().getText("doclet.annotation_type_required_members"));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void printSummaryLabel() { public String getCaption() {
writer.printText("doclet.Annotation_Type_Required_Member_Summary"); return configuration().getText("doclet.Annotation_Type_Required_Members");
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void printTableSummary() { public String[] getSummaryTableHeader(ProgramElementDoc member) {
writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Annotation_Type_Required_Member_Summary"),
configuration().getText("doclet.annotation_type_required_members")));
}
public void printSummaryTableHeader(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} * {@inheritDoc}
*/ */
public void printInheritedSummaryLabel(ClassDoc cd) { public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
// no such
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) { protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
writer.strong(); Content tdSummary) {
writer.printDocLink(context, (MemberDoc) member, member.name(), false); Content strong = HtmlTree.STRONG(new RawHtml(
writer.strongEnd(); writer.getDocLink(context, (MemberDoc) member, member.name(), false)));
Content code = HtmlTree.CODE(strong);
tdSummary.addContent(code);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void writeInheritedSummaryLink(ClassDoc cd, protected void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member) { 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();
......
...@@ -29,6 +29,7 @@ import com.sun.javadoc.*; ...@@ -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.*; ...@@ -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 ...@@ -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}
*/
public Content getAnnotationContentHeader() {
return getContentHeader();
}
/**
* {@inheritDoc}
*/
public void addFooter(Content contentTree) {
contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
addNavLinks(false, contentTree);
addBottom(contentTree);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeFooter() { public void printDocument(Content contentTree) {
println("<!-- ========= END OF CLASS DATA ========= -->"); printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType),
hr(); true, contentTree);
navLinks(false);
printBottom();
printBodyHtmlEnd();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeAnnotationTypeSignature(String modifiers) { public Content getAnnotationInfoTreeHeader() {
preNoNewLine(); return getMemberTreeHeader();
writeAnnotationInfo(annotationType); }
print(modifiers);
String name = annotationType.name() + /**
getTypeParameterLinks(new LinkInfoImpl( * {@inheritDoc}
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false)); */
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 ...@@ -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 ...@@ -346,11 +394,4 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
public AnnotationTypeDoc getAnnotationTypeDoc() { public AnnotationTypeDoc getAnnotationTypeDoc() {
return annotationType; return annotationType;
} }
/**
* {@inheritDoc}
*/
public void completeMemberSummaryBuild() {
p();
}
} }
...@@ -25,11 +25,12 @@ ...@@ -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 ...@@ -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}
*/
public Content getContentsHeader() {
return new HtmlTree(HtmlTag.UL);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeFooter() { public void addLinkToPackageContent(PackageDoc pkg, String parsedPackageName,
hr(); Set<String> printedPackageHeaders, Content contentListTree) {
navLinks(false); String packageName = pkg.name();
printBottom(); //add link to summary
printBodyHtmlEnd(); Content link;
if (packageName.length() == 0) {
link = getHyperLink("#" + DocletConstants.UNNAMED_PACKAGE_ANCHOR,
"", defaultPackageLabel, "", "");
} else {
Content packageNameContent = getPackageLabel(parsedPackageName);
packageNameContent.addContent(".*");
link = getHyperLink("#" + parsedPackageName,
"", packageNameContent, "", "");
printedPackageHeaders.add(parsedPackageName);
}
contentListTree.addContent(HtmlTree.LI(link));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeContentsHeader() { public Content getContentsList(Content contentListTree) {
strong(configuration.getText("doclet.Contents")); Content titleContent = getResource(
ul(); "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} * {@inheritDoc}
*/ */
public void writeContentsFooter() { public Content getConstantSummaries() {
ulEnd(); HtmlTree summariesDiv = new HtmlTree(HtmlTag.DIV);
println(); summariesDiv.addStyle(HtmlStyle.constantValuesContainer);
return summariesDiv;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeLinkToPackageContent(PackageDoc pkg, String parsedPackageName, Set<String> printedPackageHeaders) { public void addPackageName(PackageDoc pkg, String parsedPackageName,
String packageName = pkg.name(); Content summariesTree) {
//add link to summary Content pkgNameContent;
li(); if (parsedPackageName.length() == 0) {
if (packageName.length() == 0) { summariesTree.addContent(getMarkerAnchor(
printHyperLink("#" + DocletConstants.UNNAMED_PACKAGE_ANCHOR, DocletConstants.UNNAMED_PACKAGE_ANCHOR));
DocletConstants.DEFAULT_PACKAGE_NAME); pkgNameContent = defaultPackageLabel;
} else { } else {
printHyperLink("#" + parsedPackageName, parsedPackageName + ".*"); summariesTree.addContent(getMarkerAnchor(
printedPackageHeaders.add(parsedPackageName); parsedPackageName));
pkgNameContent = getPackageLabel(parsedPackageName);
} }
println(); Content headingContent = new StringContent(".*");
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
pkgNameContent);
heading.addContent(headingContent);
summariesTree.addContent(heading);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void writeConstantMembersHeader(ClassDoc cd) { 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 ...@@ -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(); currentClassDoc = cd;
Content tbody = new HtmlTree(HtmlTag.TBODY);
for (int i = 0; i < fields.size(); ++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);
} }
/** /**
* Print the class name in the table heading. * Add the row for the constant summary table.
* @param classStr the heading to print. *
* @param member the field to be documented.
* @param trTree an htmltree object for the table row
*/ */
protected void writeClassName(String classStr) { private void addConstantMember(FieldDoc member, HtmlTree trTree) {
table(1, 3, 0, constantsTableSummary); trTree.addContent(getTypeColumn(member));
tableSubCaptionStart(); trTree.addContent(getNameColumn(member));
write(classStr); trTree.addContent(getValue(member));
tableCaptionEnd();
summaryTableHeader(constantsTableHeader, "col");
} }
private void tableFooter(boolean isHeader) { /**
fontEnd(); * Get the type column for the constant summary table row.
if (isHeader) { *
thEnd(); * @param member the field to be documented.
} else { * @return the type column of the constant table row
tdEnd(); */
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());
while(mods.hasMoreTokens()) {
Content modifier = new StringContent(mods.nextToken());
code.addContent(modifier);
code.addContent(getSpace());
} }
trEnd(); Content type = new RawHtml(getLink(new LinkInfoImpl(
tableEnd(); LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member.type())));
p(); code.addContent(type);
tdType.addContent(code);
return tdType;
} }
/** /**
* {@inheritDoc} * Get the name column for the constant summary table row.
*
* @param member the field to be documented.
* @return the name column of the constant table row
*/ */
public void writePackageName(PackageDoc pkg, String parsedPackageName) { private Content getNameColumn(FieldDoc member) {
String pkgname; Content nameContent = new RawHtml(getDocLink(
if (parsedPackageName.length() == 0) { LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member, member.name(), false));
anchor(DocletConstants.UNNAMED_PACKAGE_ANCHOR); Content code = HtmlTree.CODE(nameContent);
pkgname = DocletConstants.DEFAULT_PACKAGE_NAME; return HtmlTree.TD(code);
} else {
anchor(parsedPackageName);
pkgname = parsedPackageName;
}
table(1, "100%", 3, 0);
trBgcolorStyle("#CCCCFF", "TableHeadingColor");
thAlign("left");
font("+2");
write(pkgname + ".*");
tableFooter(true);
} }
/** /**
* {@inheritDoc} * Get the value column for the constant summary table row.
*
* @param member the field to be documented.
* @return the value column of the constant table row
*/ */
public void writeConstantMembers(ClassDoc cd, List<FieldDoc> fields) { private Content getValue(FieldDoc member) {
currentClassDoc = cd; Content valueContent = new StringContent(member.constantValueExpression());
for (int i = 0; i < fields.size(); ++i) { Content code = HtmlTree.CODE(valueContent);
writeConstantMember(fields.get(i)); return HtmlTree.TD(HtmlStyle.colLast, code);
}
} }
private void writeConstantMember(FieldDoc member) { /**
trBgcolorStyle("white", "TableRowColor"); * {@inheritDoc}
anchor(currentClassDoc.qualifiedName() + "." + member.name()); */
writeTypeColumn(member); public void addFooter(Content contentTree) {
writeNameColumn(member); addNavLinks(false, contentTree);
writeValue(member); addBottom(contentTree);
trEnd();
} }
private void writeTypeColumn(FieldDoc member) { /**
tdAlign("right"); * {@inheritDoc}
font("-1"); */
code(); public void printDocument(Content contentTree) {
StringTokenizer mods = new StringTokenizer(member.modifiers()); printHtmlDocument(null, true, contentTree);
while(mods.hasMoreTokens()) {
print(mods.nextToken() + "&nbsp;");
}
printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY,
member.type()));
codeEnd();
fontEnd();
tdEnd();
}
private void writeNameColumn(FieldDoc member) {
tdAlign("left");
code();
printDocLink(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member,
member.name(), false);
codeEnd();
tdEnd();
}
private void writeValue(FieldDoc member) {
tdAlign("right");
code();
print(Util.escapeHtmlChars(member.constantValueExpression()));
codeEnd();
tdEnd();
} }
} }
...@@ -29,6 +29,7 @@ import java.io.*; ...@@ -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 ...@@ -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 ...@@ -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) {
printedSummaryHeader = true;
writer.println();
writer.println("<!-- ======== CONSTRUCTOR SUMMARY ======== -->");
writer.println();
writer.printSummaryHeader(this, classDoc);
}
/**
* Write the constructors summary footer for the given class.
*
* @param classDoc the class the summary belongs to.
*/ */
public void writeMemberSummaryFooter(ClassDoc classDoc) { public Content getMemberSummaryHeader(ClassDoc classDoc,
writer.printSummaryFooter(this, classDoc); Content memberSummaryTree) {
memberSummaryTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_SUMMARY);
Content memberTree = writer.getMemberTreeHeader();
writer.addSummaryHeader(this, classDoc, memberTree);
return memberTree;
} }
/** /**
* 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 getConstructorDetailsTreeHeader(ClassDoc classDoc,
writer.println(); Content memberDetailsTree) {
writer.println("<!-- ========= CONSTRUCTOR DETAIL ======== -->"); memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS);
writer.println(); Content constructorDetailsTree = writer.getMemberTreeHeader();
writer.anchor("constructor_detail"); constructorDetailsTree.addContent(writer.getMarkerAnchor("constructor_detail"));
writer.printTableHeadingBackground(header); Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.constructorDetailsLabel);
constructorDetailsTree.addContent(heading);
return constructorDetailsTree;
} }
/** /**
* Write the constructor header for the given constructor. * {@inheritDoc}
*
* @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) { public Content getConstructorDocTreeHeader(ConstructorDoc constructor,
if (! isFirst) { Content constructorDetailsTree) {
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 Content getConstructorDetails(Content constructorDetailsTree) {
return getMemberTree(constructorDetailsTree);
}
/**
* {@inheritDoc}
*/ */
public void writeFooter(ClassDoc classDoc) { public Content getConstructorDoc(Content constructorDocTree,
//No footer to write for constructor documentation boolean isLastContent) {
return getMemberTree(constructorDocTree, isLastContent);
} }
/** /**
...@@ -212,17 +199,35 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter ...@@ -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"));
}
/**
* {@inheritDoc}
*/
public String getCaption() {
return configuration().getText("doclet.Constructors");
} }
public void printSummaryTableHeader(ProgramElementDoc member) { /**
* {@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 ...@@ -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, * {@inheritDoc}
members.size() > 0? true: false); */
} protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
protected void printNavSummaryLink(ClassDoc cd, boolean link) {
if (link) { if (link) {
writer.printHyperLink("", "constructor_summary", return writer.getHyperLink("", "constructor_summary",
ConfigurationImpl.getInstance().getText("doclet.navConstructor")); writer.getResource("doclet.navConstructor"));
} else { } else {
writer.printText("doclet.navConstructor"); return writer.getResource("doclet.navConstructor");
} }
} }
protected void printNavDetailLink(boolean link) { /**
* {@inheritDoc}
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) { if (link) {
writer.printHyperLink("", "constructor_detail", liNav.addContent(writer.getHyperLink("", "constructor_detail",
ConfigurationImpl.getInstance().getText("doclet.navConstructor")); writer.getResource("doclet.navConstructor")));
} else { } else {
writer.printText("doclet.navConstructor"); liNav.addContent(writer.getResource("doclet.navConstructor"));
} }
} }
protected void printSummaryType(ProgramElementDoc member) { /**
* {@inheritDoc}
*/
protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
if (foundNonPubConstructor) { if (foundNonPubConstructor) {
writer.printTypeSummaryHeader(); Content code = new HtmlTree(HtmlTag.CODE);
if (member.isProtected()) { if (member.isProtected()) {
print("protected "); code.addContent("protected ");
} else if (member.isPrivate()) { } else if (member.isPrivate()) {
print("private "); code.addContent("private ");
} else if (member.isPublic()) { } else if (member.isPublic()) {
writer.space(); code.addContent(writer.getSpace());
} else { } else {
writer.printText("doclet.Package_private"); code.addContent(
configuration().getText("doclet.Package_private"));
} }
writer.printTypeSummaryFooter(); tdSummaryType.addContent(code);
} }
} }
/**
* Write the inherited member 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;
}
}
/**
* {@inheritDoc}
*/
public void writeInheritedMemberSummary(ClassDoc classDoc,
ProgramElementDoc member, boolean isFirst, boolean isLast) {}
/**
* Write the inherited member summary footer for the given class.
*
* @param classDoc the class the summary belongs to.
*/
public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {}
} }
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册