ProgramElement
is inherited
* by the class that is being documented.
*
@@ -340,102 +404,134 @@ public abstract class AbstractMemberWriter {
return true;
}
-
/**
- * Generate the code for listing the deprecated APIs. Create the table
- * format for listing the API. Call methods from the sub-class to complete
- * the generation.
+ * Add deprecated information to the documentation tree
+ *
+ * @param deprmembers list of deprecated members
+ * @param headingKey the caption for the deprecated members table
+ * @param tableSummary the summary for the deprecated members table
+ * @param tableHeader table headers for the deprecated members table
+ * @param contentTree the content tree to which the deprecated members table will be added
*/
- protected void printDeprecatedAPI(ListserialData
tag is processed.
*
* @author Joe Fialli
+ * @author Bhavesh Patel (Modified)
*/
public class HtmlSerialMethodWriter extends MethodWriterImpl implements
SerializedFormWriter.SerialMethodWriter{
- private boolean printedFirstMember = false;
-
public HtmlSerialMethodWriter(SubWriterHolderWriter writer,
ClassDoc classdoc) {
super(writer, classdoc);
}
- public void writeHeader(String heading) {
- writer.anchor("serialized_methods");
- writer.printTableHeadingBackground(heading);
- writer.p();
+ /**
+ * Return the header for serializable methods section.
+ *
+ * @return a content tree for the header
+ */
+ public Content getSerializableMethodsHeader() {
+ HtmlTree ul = new HtmlTree(HtmlTag.UL);
+ ul.addStyle(HtmlStyle.blockList);
+ return ul;
}
- public void writeNoCustomizationMsg(String msg) {
- writer.print(msg);
- writer.p();
+ /**
+ * Return the header for serializable methods content section.
+ *
+ * @param isLastContent true if the cotent being documented is the last content.
+ * @return a content tree for the header
+ */
+ public Content getMethodsContentHeader(boolean isLastContent) {
+ HtmlTree li = new HtmlTree(HtmlTag.LI);
+ if (isLastContent)
+ li.addStyle(HtmlStyle.blockListLast);
+ else
+ li.addStyle(HtmlStyle.blockList);
+ return li;
}
- public void writeMemberHeader(MethodDoc member) {
- if (printedFirstMember) {
- writer.printMemberHeader();
- }
- printedFirstMember = true;
- writer.anchor(member);
- printHead(member);
- writeSignature(member);
+ /**
+ * Add serializable methods.
+ *
+ * @param heading the heading for the section
+ * @param serializableMethodContent the tree to be added to the serializable methods
+ * content tree
+ * @return a content tree for the serializable methods content
+ */
+ public Content getSerializableMethods(String heading, Content serializableMethodContent) {
+ Content li = HtmlTree.LI(HtmlStyle.blockList, writer.getMarkerAnchor(
+ "serialized_methods"));
+ Content headingContent = new StringContent(heading);
+ Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
+ headingContent);
+ li.addContent(serialHeading);
+ li.addContent(serializableMethodContent);
+ return li;
}
- public void writeMemberFooter() {
- printMemberFooter();
+ /**
+ * Return the no customization message.
+ *
+ * @param msg the message to be displayed
+ * @return no customization message content
+ */
+ public Content getNoCustomizationMsg(String msg) {
+ Content noCustomizationMsg = new StringContent(msg);
+ return noCustomizationMsg;
}
- public void writeDeprecatedMemberInfo(MethodDoc member) {
- printDeprecated(member);
+ /**
+ * Add the member header.
+ *
+ * @param member the method document to be listed
+ * @param methodsContentTree the content tree to which the member header will be added
+ */
+ public void addMemberHeader(MethodDoc member, Content methodsContentTree) {
+ methodsContentTree.addContent(writer.getMarkerAnchor(
+ writer.getAnchor(member)));
+ methodsContentTree.addContent(getHead(member));
+ methodsContentTree.addContent(getSignature(member));
}
- public void writeMemberDescription(MethodDoc member) {
- printComment(member);
+ /**
+ * Add the deprecated information for this member.
+ *
+ * @param member the method to document.
+ * @param methodsContentTree the tree to which the deprecated info will be added
+ */
+ public void addDeprecatedMemberInfo(MethodDoc member, Content methodsContentTree) {
+ addDeprecatedInfo(member, methodsContentTree);
}
- public void writeMemberTags(MethodDoc member) {
+ /**
+ * Add the description text for this member.
+ *
+ * @param member the method to document.
+ * @param methodsContentTree the tree to which the deprecated info will be added
+ */
+ public void addMemberDescription(MethodDoc member, Content methodsContentTree) {
+ addComment(member, methodsContentTree);
+ }
+
+ /**
+ * Add the tag information for this member.
+ *
+ * @param member the method to document.
+ * @param methodsContentTree the tree to which the member tags info will be added
+ */
+ public void addMemberTags(MethodDoc member, Content methodsContentTree) {
TagletOutputImpl output = new TagletOutputImpl("");
TagletManager tagletManager =
ConfigurationImpl.getInstance().tagletManager;
@@ -86,14 +148,12 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
tagletManager.getSerializedFormTags(),
writer.getTagletWriterInstance(false), output);
String outputString = output.toString().trim();
+ Content dlTags = new HtmlTree(HtmlTag.DL);
if (!outputString.isEmpty()) {
- writer.printMemberDetailsListStartTag();
- writer.dd();
- writer.dl();
- print(outputString);
- writer.dlEnd();
- writer.ddEnd();
+ Content tagContent = new RawHtml(outputString);
+ dlTags.addContent(tagContent);
}
+ methodsContentTree.addContent(dlTags);
MethodDoc method = member;
if (method.name().compareTo("writeExternal") == 0
&& method.tags("serialData").length == 0) {
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
index 08dc1efab27..5660889edad 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
@@ -79,7 +79,7 @@ public class LinkFactoryImpl extends LinkFactory {
String filename = pathString(classLinkInfo);
if (linkInfo.linkToSelf ||
!(linkInfo.classDoc.name() + ".html").equals(m_writer.filename)) {
- linkOutput.append(m_writer.getHyperLink(filename,
+ linkOutput.append(m_writer.getHyperLinkString(filename,
classLinkInfo.where, label.toString(),
classLinkInfo.isStrong, classLinkInfo.styleName,
title, classLinkInfo.target));
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
index 1605d807cfe..c9518d2bd38 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
@@ -28,9 +28,9 @@ package com.sun.tools.doclets.formats.html;
import java.io.*;
import com.sun.javadoc.*;
+import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
-import com.sun.tools.doclets.internal.toolkit.taglets.*;
/**
* Writes method documentation in HTML format.
@@ -43,8 +43,6 @@ import com.sun.tools.doclets.internal.toolkit.taglets.*;
public class MethodWriterImpl extends AbstractExecutableMemberWriter
implements MethodWriter, MemberSummaryWriter {
- private boolean printedSummaryHeader = false;
-
/**
* Construct a new MethodWriterImpl.
*
@@ -65,184 +63,127 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
}
/**
- * Write the methods summary header for the given class.
- *
- * @param classDoc the class the summary belongs to.
+ * {@inheritDoc}
*/
- public void writeMemberSummaryHeader(ClassDoc classDoc) {
- printedSummaryHeader = true;
- writer.println();
- writer.println("");
- writer.println();
- writer.printSummaryHeader(this, classDoc);
- }
-
- /**
- * Write the methods summary footer for the given class.
- *
- * @param classDoc the class the summary belongs to.
- */
- public void writeMemberSummaryFooter(ClassDoc classDoc) {
- writer.printSummaryFooter(this, classDoc);
- }
-
- /**
- * Write the inherited methods summary header for the given class.
- *
- * @param classDoc the class the summary belongs to.
- */
- public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
- if(! printedSummaryHeader){
- //We don't want inherited summary to not be under heading.
- writeMemberSummaryHeader(classDoc);
- writeMemberSummaryFooter(classDoc);
- printedSummaryHeader = true;
- }
- writer.printInheritedSummaryHeader(this, classDoc);
+ public Content getMemberSummaryHeader(ClassDoc classDoc,
+ Content memberSummaryTree) {
+ memberSummaryTree.addContent(HtmlConstants.START_OF_METHOD_SUMMARY);
+ Content memberTree = writer.getMemberTreeHeader();
+ writer.addSummaryHeader(this, classDoc, memberTree);
+ return memberTree;
}
/**
* {@inheritDoc}
*/
- public void writeInheritedMemberSummary(ClassDoc classDoc,
- ProgramElementDoc method, boolean isFirst, boolean isLast) {
- writer.printInheritedSummaryMember(this, classDoc, method, isFirst);
+ public Content getMethodDetailsTreeHeader(ClassDoc classDoc,
+ Content memberDetailsTree) {
+ memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS);
+ Content methodDetailsTree = writer.getMemberTreeHeader();
+ methodDetailsTree.addContent(writer.getMarkerAnchor("method_detail"));
+ Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
+ writer.methodDetailsLabel);
+ methodDetailsTree.addContent(heading);
+ return methodDetailsTree;
}
/**
- * Write the inherited methods summary footer for the given class.
- *
- * @param classDoc the class the summary belongs to.
+ * {@inheritDoc}
*/
- public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
- writer.printInheritedSummaryFooter(this, classDoc); ;
- }
-
- /**
- * Write the header for the method documentation.
- *
- * @param classDoc the class that the methods belong to.
- */
- public void writeHeader(ClassDoc classDoc, String header) {
- writer.println();
- writer.println("");
- writer.println();
- writer.anchor("method_detail");
- writer.printTableHeadingBackground(header);
- }
-
- /**
- * Write the method header for the given method.
- *
- * @param method the method being documented.
- * @param isFirst the flag to indicate whether or not the method is the
- * first to be documented.
- */
- public void writeMethodHeader(MethodDoc method, boolean isFirst) {
- if (! isFirst) {
- writer.printMemberHeader();
- }
- writer.println();
+ public Content getMethodDocTreeHeader(MethodDoc method,
+ Content methodDetailsTree) {
String erasureAnchor;
if ((erasureAnchor = getErasureAnchor(method)) != null) {
- writer.anchor(erasureAnchor);
+ methodDetailsTree.addContent(writer.getMarkerAnchor((erasureAnchor)));
}
- writer.anchor(method);
- writer.h3();
- writer.print(method.name());
- writer.h3End();
+ methodDetailsTree.addContent(
+ writer.getMarkerAnchor(writer.getAnchor(method)));
+ Content methodDocTree = writer.getMemberTreeHeader();
+ Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
+ heading.addContent(method.name());
+ methodDocTree.addContent(heading);
+ return methodDocTree;
}
/**
- * Write the signature for the given method.
+ * Get the signature for the given method.
*
* @param method the method being documented.
+ * @return a content object for the signature
*/
- public void writeSignature(MethodDoc method) {
+ public Content getSignature(MethodDoc method) {
writer.displayLength = 0;
- writer.pre();
- writer.writeAnnotationInfo(method);
- printModifiers(method);
- writeTypeParameters(method);
- printReturnType(method);
+ Content pre = new HtmlTree(HtmlTag.PRE);
+ writer.addAnnotationInfo(method, pre);
+ addModifiers(method, pre);
+ addTypeParameters(method, pre);
+ addReturnType(method, pre);
if (configuration().linksource) {
- writer.printSrcLink(method, method.name());
+ Content methodName = new StringContent(method.name());
+ writer.addSrcLink(method, methodName, pre);
} else {
- strong(method.name());
+ addName(method.name(), pre);
}
- writeParameters(method);
- writeExceptions(method);
- writer.preEnd();
- assert !writer.getMemberDetailsListPrinted();
+ addParameters(method, pre);
+ addExceptions(method, pre);
+ return pre;
}
/**
- * Write the deprecated output for the given method.
- *
- * @param method the method being documented.
+ * {@inheritDoc}
*/
- public void writeDeprecated(MethodDoc method) {
- printDeprecated(method);
+ public void addDeprecated(MethodDoc method, Content methodDocTree) {
+ addDeprecatedInfo(method, methodDocTree);
}
/**
- * Write the comments for the given method.
- *
- * @param method the method being documented.
+ * {@inheritDoc}
*/
- public void writeComments(Type holder, MethodDoc method) {
+ public void addComments(Type holder, MethodDoc method, Content methodDocTree) {
ClassDoc holderClassDoc = holder.asClassDoc();
if (method.inlineTags().length > 0) {
- writer.printMemberDetailsListStartTag();
if (holder.asClassDoc().equals(classdoc) ||
- (! (holderClassDoc.isPublic() ||
+ (! (holderClassDoc.isPublic() ||
Util.isLinkable(holderClassDoc, configuration())))) {
- writer.dd();
- writer.printInlineComment(method);
- writer.ddEnd();
+ writer.addInlineComment(method, methodDocTree);
} else {
- String classlink = writer.codeText(
- writer.getDocLink(LinkInfoImpl.CONTEXT_METHOD_DOC_COPY,
+ Content link = new RawHtml(
+ writer.getDocLink(LinkInfoImpl.CONTEXT_METHOD_DOC_COPY,
holder.asClassDoc(), method,
holder.asClassDoc().isIncluded() ?
holder.typeName() : holder.qualifiedTypeName(),
- false));
- writer.dd();
- writer.strongText(holder.asClassDoc().isClass()?
- "doclet.Description_From_Class":
- "doclet.Description_From_Interface",
- classlink);
- writer.ddEnd();
- writer.dd();
- writer.printInlineComment(method);
- writer.ddEnd();
+ false));
+ Content codelLink = HtmlTree.CODE(link);
+ Content strong = HtmlTree.STRONG(holder.asClassDoc().isClass()?
+ writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
+ strong.addContent(writer.getSpace());
+ strong.addContent(codelLink);
+ methodDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, strong));
+ writer.addInlineComment(method, methodDocTree);
}
}
}
/**
- * Write the tag output for the given method.
- *
- * @param method the method being documented.
+ * {@inheritDoc}
*/
- public void writeTags(MethodDoc method) {
- writer.printTags(method);
+ public void addTags(MethodDoc method, Content methodDocTree) {
+ writer.addTagsInfo(method, methodDocTree);
}
/**
- * Write the method footer.
+ * {@inheritDoc}
*/
- public void writeMethodFooter() {
- printMemberFooter();
+ public Content getMethodDetails(Content methodDetailsTree) {
+ return getMemberTree(methodDetailsTree);
}
/**
- * Write the footer for the method documentation.
- *
- * @param classDoc the class that the methods belong to.
+ * {@inheritDoc}
*/
- public void writeFooter(ClassDoc classDoc) {
- //No footer to write for method documentation
+ public Content getMethodDoc(Content methodDocTree,
+ boolean isLastContent) {
+ return getMemberTree(methodDocTree, isLastContent);
}
/**
@@ -256,53 +197,89 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
return VisibleMemberMap.METHODS;
}
- public void printSummaryLabel() {
- writer.printText("doclet.Method_Summary");
+ /**
+ * {@inheritDoc}
+ */
+ public void addSummaryLabel(Content memberTree) {
+ Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
+ writer.getResource("doclet.Method_Summary"));
+ memberTree.addContent(label);
}
- public void printTableSummary() {
- writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
+ /**
+ * {@inheritDoc}
+ */
+ public String getTableSummary() {
+ return configuration().getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Method_Summary"),
- configuration().getText("doclet.methods")));
+ configuration().getText("doclet.methods"));
}
- public void printSummaryTableHeader(ProgramElementDoc member) {
+ /**
+ * {@inheritDoc}
+ */
+ public String getCaption() {
+ return configuration().getText("doclet.Methods");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header = new String[] {
writer.getModifierTypeHeader(),
configuration().getText("doclet.0_and_1",
configuration().getText("doclet.Method"),
configuration().getText("doclet.Description"))
};
- writer.summaryTableHeader(header, "col");
+ return header;
}
- public void printSummaryAnchor(ClassDoc cd) {
- writer.anchor("method_summary");
+ /**
+ * {@inheritDoc}
+ */
+ public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
+ memberTree.addContent(writer.getMarkerAnchor("method_summary"));
}
- public void printInheritedSummaryAnchor(ClassDoc cd) {
- writer.anchor("methods_inherited_from_class_" +
- ConfigurationImpl.getInstance().getClassName(cd));
+ /**
+ * {@inheritDoc}
+ */
+ public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
+ inheritedTree.addContent(writer.getMarkerAnchor(
+ "methods_inherited_from_class_" +
+ configuration().getClassName(cd)));
}
- public void printInheritedSummaryLabel(ClassDoc cd) {
- String classlink = writer.getPreQualifiedClassLink(
- LinkInfoImpl.CONTEXT_MEMBER, cd, false);
- writer.strong();
- String key = cd.isClass()?
- "doclet.Methods_Inherited_From_Class" :
- "doclet.Methods_Inherited_From_Interface";
- writer.printText(key, classlink);
- writer.strongEnd();
+ /**
+ * {@inheritDoc}
+ */
+ public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
+ Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
+ LinkInfoImpl.CONTEXT_MEMBER, cd, false));
+ Content label = new StringContent(cd.isClass() ?
+ configuration().getText("doclet.Methods_Inherited_From_Class") :
+ configuration().getText("doclet.Methods_Inherited_From_Interface"));
+ Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
+ label);
+ labelHeading.addContent(writer.getSpace());
+ labelHeading.addContent(classLink);
+ inheritedTree.addContent(labelHeading);
}
- protected void printSummaryType(ProgramElementDoc member) {
+ /**
+ * {@inheritDoc}
+ */
+ protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
MethodDoc meth = (MethodDoc)member;
- printModifierAndType(meth, meth.returnType());
+ addModifierAndType(meth, meth.returnType(), tdSummaryType);
}
- protected static void printOverridden(HtmlDocletWriter writer,
- Type overriddenType, MethodDoc method) {
+ /**
+ * {@inheritDoc}
+ */
+ protected static void addOverridden(HtmlDocletWriter writer,
+ Type overriddenType, MethodDoc method, Content dl) {
if(writer.configuration.nocomment){
return;
}
@@ -317,31 +294,33 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
//is not visible so don't document this.
return;
}
- String label = "doclet.Overrides";
+ Content label = writer.overridesLabel;
int context = LinkInfoImpl.CONTEXT_METHOD_OVERRIDES;
if (method != null) {
if(overriddenType.asClassDoc().isAbstract() && method.isAbstract()){
//Abstract method is implemented from abstract class,
//not overridden
- label = "doclet.Specified_By";
+ label = writer.specifiedByLabel;
context = LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY;
}
- String overriddenTypeLink = writer.codeText(
- writer.getLink(new LinkInfoImpl(context, overriddenType)));
+ Content dt = HtmlTree.DT(HtmlTree.STRONG(label));
+ dl.addContent(dt);
+ Content overriddenTypeLink = new RawHtml(
+ writer.getLink(new LinkInfoImpl(context, overriddenType)));
+ Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink);
String name = method.name();
- writer.dt();
- writer.strongText(label);
- writer.dtEnd();
- writer.dd();
- String methLink = writer.codeText(
- writer.getLink(
+ Content methlink = new RawHtml(writer.getLink(
new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
- overriddenType.asClassDoc(),
- writer.getAnchor(method), name, false)
- ));
- writer.printText("doclet.in_class", methLink, overriddenTypeLink);
- writer.ddEnd();
+ overriddenType.asClassDoc(),
+ writer.getAnchor(method), name, false)));
+ Content codeMethLink = HtmlTree.CODE(methlink);
+ Content dd = HtmlTree.DD(codeMethLink);
+ dd.addContent(writer.getSpace());
+ dd.addContent(writer.getResource("doclet.in_class"));
+ dd.addContent(writer.getSpace());
+ dd.addContent(codeOverridenTypeLink);
+ dl.addContent(dd);
}
}
@@ -363,61 +342,78 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
}
}
- protected static void printImplementsInfo(HtmlDocletWriter writer,
- MethodDoc method) {
+ /**
+ * {@inheritDoc}
+ */
+ protected static void addImplementsInfo(HtmlDocletWriter writer,
+ MethodDoc method, Content dl) {
if(writer.configuration.nocomment){
return;
}
ImplementedMethods implementedMethodsFinder =
- new ImplementedMethods(method, writer.configuration);
+ new ImplementedMethods(method, writer.configuration);
MethodDoc[] implementedMethods = implementedMethodsFinder.build();
for (int i = 0; i < implementedMethods.length; i++) {
MethodDoc implementedMeth = implementedMethods[i];
Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth);
- String methlink = "";
- String intfaclink = writer.codeText(
- writer.getLink(new LinkInfoImpl(
+ Content intfaclink = new RawHtml(writer.getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac)));
- writer.dt();
- writer.strongText("doclet.Specified_By");
- writer.dtEnd();
- writer.dd();
- methlink = writer.codeText(writer.getDocLink(
- LinkInfoImpl.CONTEXT_MEMBER, implementedMeth,
- implementedMeth.name(), false));
- writer.printText("doclet.in_interface", methlink, intfaclink);
- writer.ddEnd();
+ Content codeIntfacLink = HtmlTree.CODE(intfaclink);
+ Content dt = HtmlTree.DT(HtmlTree.STRONG(writer.specifiedByLabel));
+ dl.addContent(dt);
+ Content methlink = new RawHtml(writer.getDocLink(
+ LinkInfoImpl.CONTEXT_MEMBER, implementedMeth,
+ implementedMeth.name(), false));
+ Content codeMethLink = HtmlTree.CODE(methlink);
+ Content dd = HtmlTree.DD(codeMethLink);
+ dd.addContent(writer.getSpace());
+ dd.addContent(writer.getResource("doclet.in_interface"));
+ dd.addContent(writer.getSpace());
+ dd.addContent(codeIntfacLink);
+ dl.addContent(dd);
}
-
}
- protected void printReturnType(MethodDoc method) {
+ /**
+ * Add the return type.
+ *
+ * @param method the method being documented.
+ * @param htmltree the content tree to which the return type will be added
+ */
+ protected void addReturnType(MethodDoc method, Content htmltree) {
Type type = method.returnType();
if (type != null) {
- writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_RETURN_TYPE,
- type));
- print(' ');
+ Content linkContent = new RawHtml(writer.getLink(
+ new LinkInfoImpl(LinkInfoImpl.CONTEXT_RETURN_TYPE, type)));
+ htmltree.addContent(linkContent);
+ htmltree.addContent(writer.getSpace());
}
}
- protected void printNavSummaryLink(ClassDoc cd, boolean link) {
+ /**
+ * {@inheritDoc}
+ */
+ protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- writer.printHyperLink("", (cd == null)?
+ return writer.getHyperLink("", (cd == null)?
"method_summary":
"methods_inherited_from_class_" +
- ConfigurationImpl.getInstance().getClassName(cd),
- ConfigurationImpl.getInstance().getText("doclet.navMethod"));
+ configuration().getClassName(cd),
+ writer.getResource("doclet.navMethod"));
} else {
- writer.printText("doclet.navMethod");
+ return writer.getResource("doclet.navMethod");
}
}
- protected void printNavDetailLink(boolean link) {
+ /**
+ * {@inheritDoc}
+ */
+ protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- writer.printHyperLink("", "method_detail",
- ConfigurationImpl.getInstance().getText("doclet.navMethod"));
+ liNav.addContent(writer.getHyperLink("", "method_detail",
+ writer.getResource("doclet.navMethod")));
} else {
- writer.printText("doclet.navMethod");
+ liNav.addContent(writer.getResource("doclet.navMethod"));
}
}
}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
index 083adabef80..3f92c8e9a03 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java
@@ -26,8 +26,10 @@
package com.sun.tools.doclets.formats.html;
import java.io.*;
+import java.util.*;
import com.sun.javadoc.*;
+import com.sun.tools.doclets.formats.html.markup.*;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
@@ -42,8 +44,6 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
public class NestedClassWriterImpl extends AbstractMemberWriter
implements MemberSummaryWriter {
- private boolean printedSummaryHeader = false;
-
public NestedClassWriterImpl(SubWriterHolderWriter writer,
ClassDoc classdoc) {
super(writer, classdoc);
@@ -53,90 +53,17 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
super(writer);
}
- /**
- * Write the classes summary header for the given class.
- *
- * @param classDoc the class the summary belongs to.
- */
- public void writeMemberSummaryHeader(ClassDoc classDoc) {
- printedSummaryHeader = true;
- writer.println("");
- writer.println();
- writer.printSummaryHeader(this, classDoc);
- }
-
- /**
- * Write the classes summary footer for the given class.
- *
- * @param classDoc the class the summary belongs to.
- */
- public void writeMemberSummaryFooter(ClassDoc classDoc) {
- writer.printSummaryFooter(this, classDoc);
- }
-
- /**
- * Write the inherited classes summary header for the given class.
- *
- * @param classDoc the class the summary belongs to.
- */
- public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
- if(! printedSummaryHeader){
- //We don't want inherited summary to not be under heading.
- writeMemberSummaryHeader(classDoc);
- writeMemberSummaryFooter(classDoc);
- printedSummaryHeader = true;
- }
- writer.printInheritedSummaryHeader(this, classDoc);
- }
-
/**
* {@inheritDoc}
*/
- public void writeInheritedMemberSummary(ClassDoc classDoc,
- ProgramElementDoc nestedClass, boolean isFirst, boolean isLast) {
- writer.printInheritedSummaryMember(this, classDoc, nestedClass, isFirst);
+ public Content getMemberSummaryHeader(ClassDoc classDoc,
+ Content memberSummaryTree) {
+ memberSummaryTree.addContent(HtmlConstants.START_OF_NESTED_CLASS_SUMMARY);
+ Content memberTree = writer.getMemberTreeHeader();
+ writer.addSummaryHeader(this, classDoc, memberTree);
+ return memberTree;
}
- /**
- * Write the inherited classes summary footer for the given class.
- *
- * @param classDoc the class the summary belongs to.
- */
- public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
- writer.printInheritedSummaryFooter(this, classDoc);
- writer.println();
- }
-
- /**
- * Write the header for the nested class documentation.
- *
- * @param classDoc the class that the classes belong to.
- */
- public void writeHeader(ClassDoc classDoc, String header) {
- writer.anchor("nested class_detail");
- writer.printTableHeadingBackground(header);
- }
-
- /**
- * Write the nested class header for the given nested class.
- *
- * @param nestedClass the nested class being documented.
- * @param isFirst the flag to indicate whether or not the nested class is the
- * first to be documented.
- */
- public void writeClassHeader(ClassDoc nestedClass, boolean isFirst) {
- if (! isFirst) {
- writer.printMemberHeader();
- writer.println("");
- }
- writer.anchor(nestedClass.name());
- writer.h3();
- writer.print(nestedClass.name());
- writer.h3End();
- }
-
-
-
/**
* Close the writer.
*/
@@ -148,17 +75,35 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
return VisibleMemberMap.INNERCLASSES;
}
- public void printSummaryLabel() {
- writer.printText("doclet.Nested_Class_Summary");
+ /**
+ * {@inheritDoc}
+ */
+ public void addSummaryLabel(Content memberTree) {
+ Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
+ writer.getResource("doclet.Nested_Class_Summary"));
+ memberTree.addContent(label);
}
- public void printTableSummary() {
- writer.tableIndexSummary(configuration().getText("doclet.Member_Table_Summary",
+ /**
+ * {@inheritDoc}
+ */
+ public String getTableSummary() {
+ return configuration().getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Nested_Class_Summary"),
- configuration().getText("doclet.nested_classes")));
+ configuration().getText("doclet.nested_classes"));
}
- public void printSummaryTableHeader(ProgramElementDoc member) {
+ /**
+ * {@inheritDoc}
+ */
+ public String getCaption() {
+ return configuration().getText("doclet.Nested_Classes");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header;
if (member.isInterface()) {
header = new String[] {
@@ -176,92 +121,95 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
configuration().getText("doclet.Description"))
};
}
- writer.summaryTableHeader(header, "col");
+ return header;
}
- public void printSummaryAnchor(ClassDoc cd) {
- writer.anchor("nested_class_summary");
+ /**
+ * {@inheritDoc}
+ */
+ public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
+ memberTree.addContent(writer.getMarkerAnchor("nested_class_summary"));
}
- public void printInheritedSummaryAnchor(ClassDoc cd) {
- writer.anchor("nested_classes_inherited_from_class_" +
- cd.qualifiedName());
+ /**
+ * {@inheritDoc}
+ */
+ public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
+ inheritedTree.addContent(writer.getMarkerAnchor(
+ "nested_classes_inherited_from_class_" + cd.qualifiedName()));
}
- public void printInheritedSummaryLabel(ClassDoc cd) {
- String clslink = writer.getPreQualifiedClassLink(
- LinkInfoImpl.CONTEXT_MEMBER, cd, false);
- writer.strong();
- writer.printText(cd.isInterface() ?
- "doclet.Nested_Classes_Interface_Inherited_From_Interface" :
- "doclet.Nested_Classes_Interfaces_Inherited_From_Class",
- clslink);
- writer.strongEnd();
+ /**
+ * {@inheritDoc}
+ */
+ public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
+ Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
+ LinkInfoImpl.CONTEXT_MEMBER, cd, false));
+ Content label = new StringContent(cd.isInterface() ?
+ configuration().getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") :
+ configuration().getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
+ Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
+ label);
+ labelHeading.addContent(writer.getSpace());
+ labelHeading.addContent(classLink);
+ inheritedTree.addContent(labelHeading);
}
- protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
- writer.strong();
- writer.printLink(new LinkInfoImpl(context, (ClassDoc)member, false));
- writer.strongEnd();
+ /**
+ * {@inheritDoc}
+ */
+ protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
+ Content tdSummary) {
+ Content strong = HtmlTree.STRONG(new RawHtml(
+ writer.getLink(new LinkInfoImpl(context, (ClassDoc)member, false))));
+ Content code = HtmlTree.CODE(strong);
+ tdSummary.addContent(code);
}
- protected void writeInheritedSummaryLink(ClassDoc cd,
- ProgramElementDoc member) {
- writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
- (ClassDoc)member, false));
+ /**
+ * {@inheritDoc}
+ */
+ protected void addInheritedSummaryLink(ClassDoc cd,
+ ProgramElementDoc member, Content linksTree) {
+ linksTree.addContent(new RawHtml(
+ writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
+ (ClassDoc)member, false))));
}
- protected void printSummaryType(ProgramElementDoc member) {
+ /**
+ * {@inheritDoc}
+ */
+ protected void addSummaryType(ProgramElementDoc member,
+ Content tdSummaryType) {
ClassDoc cd = (ClassDoc)member;
- printModifierAndType(cd, null);
+ addModifierAndType(cd, null, tdSummaryType);
}
- protected void printHeader(ClassDoc cd) {
- // N.A.
+ /**
+ * {@inheritDoc}
+ */
+ protected Content getDeprecatedLink(ProgramElementDoc member) {
+ return writer.getQualifiedClassLink(LinkInfoImpl.CONTEXT_MEMBER,
+ (ClassDoc)member);
}
- protected void printBodyHtmlEnd(ClassDoc cd) {
- // N.A.
- }
-
- protected void printMember(ProgramElementDoc member) {
- // N.A.
- }
-
- protected void writeDeprecatedLink(ProgramElementDoc member) {
- writer.printQualifiedClassLink(LinkInfoImpl.CONTEXT_MEMBER,
- (ClassDoc)member);
- }
-
- protected void printNavSummaryLink(ClassDoc cd, boolean link) {
+ /**
+ * {@inheritDoc}
+ */
+ protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- writer.printHyperLink("", (cd == null) ? "nested_class_summary":
- "nested_classes_inherited_from_class_" +
+ return writer.getHyperLink("", (cd == null) ? "nested_class_summary":
+ "nested_classes_inherited_from_class_" +
cd.qualifiedName(),
- ConfigurationImpl.getInstance().getText("doclet.navNested"));
+ writer.getResource("doclet.navNested"));
} else {
- writer.printText("doclet.navNested");
+ return writer.getResource("doclet.navNested");
}
}
- protected void printNavDetailLink(boolean link) {
- }
-
- protected void printMemberLink(ProgramElementDoc member) {
- }
-
- protected void printMembersSummaryLink(ClassDoc cd, ClassDoc icd,
- boolean link) {
- if (link) {
- writer.printHyperLink(cd.name() + ".html",
- (cd == icd)?
- "nested_class_summary":
- "nested_classes_inherited_from_class_" +
- icd.qualifiedName(),
- ConfigurationImpl.getInstance().getText(
- "doclet.Nested_Class_Summary"));
- } else {
- writer.printText("doclet.Nested_Class_Summary");
- }
+ /**
+ * {@inheritDoc}
+ */
+ protected void addNavDetailLink(boolean link, Content liNav) {
}
}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
index 2f19b31e386..ace52703304 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
@@ -25,18 +25,20 @@
package com.sun.tools.doclets.formats.html;
-import com.sun.tools.doclets.internal.toolkit.util.*;
-import com.sun.tools.doclets.internal.toolkit.*;
-
-import com.sun.javadoc.*;
import java.io.*;
import java.util.*;
+import com.sun.javadoc.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.formats.html.markup.*;
+
/**
* Class to generate file for each package contents in the left-hand bottom
* frame. This will list all the Class Kinds in the package. A click on any
* class-kind will update the right-hand frame with the clicked class-kind page.
*
* @author Atul M Dambalkar
+ * @author Bhavesh Patel (Modified)
*/
public class PackageFrameWriter extends HtmlDocletWriter {
@@ -85,132 +87,107 @@ public class PackageFrameWriter extends HtmlDocletWriter {
* @param packageDoc The package for which "pacakge-frame.html" is to be generated.
*/
public static void generate(ConfigurationImpl configuration,
- PackageDoc packageDoc) {
+ PackageDoc packageDoc) {
PackageFrameWriter packgen;
try {
packgen = new PackageFrameWriter(configuration, packageDoc);
String pkgName = Util.getPackageName(packageDoc);
- packgen.printHtmlHeader(pkgName, configuration.metakeywords.getMetaKeywords(packageDoc), false);
- packgen.printPackageHeader(pkgName);
- packgen.generateClassListing();
- packgen.printBodyHtmlEnd();
+ Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
+ Content pkgNameContent = new StringContent(pkgName);
+ Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
+ packgen.getTargetPackageLink(packageDoc, "classFrame", pkgNameContent));
+ body.addContent(heading);
+ HtmlTree div = new HtmlTree(HtmlTag.DIV);
+ div.addStyle(HtmlStyle.indexContainer);
+ packgen.addClassListing(div);
+ body.addContent(div);
+ packgen.printHtmlDocument(
+ configuration.metakeywords.getMetaKeywords(packageDoc), false, body);
packgen.close();
} catch (IOException exc) {
configuration.standardmessage.error(
- "doclet.exception_encountered",
- exc.toString(), OUTPUT_FILE_NAME);
+ "doclet.exception_encountered",
+ exc.toString(), OUTPUT_FILE_NAME);
throw new DocletAbortException();
}
}
/**
- * Generate class listing for all the classes in this package. Divide class
+ * Add class listing for all the classes in this package. Divide class
* listing as per the class kind and generate separate listing for
* Classes, Interfaces, Exceptions and Errors.
+ *
+ * @param contentTree the content tree to which the listing will be added
*/
- protected void generateClassListing() {
+ protected void addClassListing(Content contentTree) {
Configuration config = configuration();
if (packageDoc.isIncluded()) {
- generateClassKindListing(packageDoc.interfaces(),
- configuration.getText("doclet.Interfaces"));
- generateClassKindListing(packageDoc.ordinaryClasses(),
- configuration.getText("doclet.Classes"));
- generateClassKindListing(packageDoc.enums(),
- configuration.getText("doclet.Enums"));
- generateClassKindListing(packageDoc.exceptions(),
- configuration.getText("doclet.Exceptions"));
- generateClassKindListing(packageDoc.errors(),
- configuration.getText("doclet.Errors"));
- generateClassKindListing(packageDoc.annotationTypes(),
- configuration.getText("doclet.AnnotationTypes"));
+ addClassKindListing(packageDoc.interfaces(),
+ getResource("doclet.Interfaces"), contentTree);
+ addClassKindListing(packageDoc.ordinaryClasses(),
+ getResource("doclet.Classes"), contentTree);
+ addClassKindListing(packageDoc.enums(),
+ getResource("doclet.Enums"), contentTree);
+ addClassKindListing(packageDoc.exceptions(),
+ getResource("doclet.Exceptions"), contentTree);
+ addClassKindListing(packageDoc.errors(),
+ getResource("doclet.Errors"), contentTree);
+ addClassKindListing(packageDoc.annotationTypes(),
+ getResource("doclet.AnnotationTypes"), contentTree);
} else {
String name = Util.getPackageName(packageDoc);
- generateClassKindListing(config.classDocCatalog.interfaces(name),
- configuration.getText("doclet.Interfaces"));
- generateClassKindListing(config.classDocCatalog.ordinaryClasses(name),
- configuration.getText("doclet.Classes"));
- generateClassKindListing(config.classDocCatalog.enums(name),
- configuration.getText("doclet.Enums"));
- generateClassKindListing(config.classDocCatalog.exceptions(name),
- configuration.getText("doclet.Exceptions"));
- generateClassKindListing(config.classDocCatalog.errors(name),
- configuration.getText("doclet.Errors"));
- generateClassKindListing(config.classDocCatalog.annotationTypes(name),
- configuration.getText("doclet.AnnotationTypes"));
+ addClassKindListing(config.classDocCatalog.interfaces(name),
+ getResource("doclet.Interfaces"), contentTree);
+ addClassKindListing(config.classDocCatalog.ordinaryClasses(name),
+ getResource("doclet.Classes"), contentTree);
+ addClassKindListing(config.classDocCatalog.enums(name),
+ getResource("doclet.Enums"), contentTree);
+ addClassKindListing(config.classDocCatalog.exceptions(name),
+ getResource("doclet.Exceptions"), contentTree);
+ addClassKindListing(config.classDocCatalog.errors(name),
+ getResource("doclet.Errors"), contentTree);
+ addClassKindListing(config.classDocCatalog.annotationTypes(name),
+ getResource("doclet.AnnotationTypes"), contentTree);
}
}
/**
- * Generate specific class kind listing. Also add label to the listing.
+ * Add specific class kind listing. Also add label to the listing.
*
- * @param arr Array of specific class kinds, namely Class or Interface or
- * Exception or Error.
- * @param label Label for the listing
+ * @param arr Array of specific class kinds, namely Class or Interface or Exception or Error
+ * @param labelContent content tree of the label to be added
+ * @param contentTree the content tree to which the class kind listing will be added
*/
- protected void generateClassKindListing(ClassDoc[] arr, String label) {
+ protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
+ Content contentTree) {
if(arr.length > 0) {
Arrays.sort(arr);
- printPackageTableHeader();
- fontSizeStyle("+1", "FrameHeadingFont");
boolean printedHeader = false;
+ HtmlTree ul = new HtmlTree(HtmlTag.UL);
+ ul.addAttr(HtmlAttr.TITLE, labelContent.toString());
for (int i = 0; i < arr.length; i++) {
if (documentedClasses != null &&
- !documentedClasses.contains(arr[i])) {
+ !documentedClasses.contains(arr[i])) {
continue;
}
if (!Util.isCoreClass(arr[i]) || !
- configuration.isGeneratedDoc(arr[i])) {
+ configuration.isGeneratedDoc(arr[i])) {
continue;
}
if (!printedHeader) {
- print(label);
- fontEnd();
- println(" ");
- fontStyle("FrameItemFont");
+ Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
+ true, labelContent);
+ contentTree.addContent(heading);
printedHeader = true;
}
- br();
- printLink(new LinkInfoImpl(
- LinkInfoImpl.PACKAGE_FRAME,
- arr[i],
- (arr[i].isInterface() ?
- italicsText(arr[i].name()) :
- arr[i].name()),"classFrame")
- );
+ Content link = new RawHtml (getLink(new LinkInfoImpl(
+ LinkInfoImpl.PACKAGE_FRAME, arr[i],
+ (arr[i].isInterface() ? italicsText(arr[i].name()) :
+ arr[i].name()),"classFrame")));
+ Content li = HtmlTree.LI(link);
+ ul.addContent(li);
}
- fontEnd();
- printPackageTableFooter();
- println();
+ contentTree.addContent(ul);
}
}
-
- /**
- * Print the package link at the top of the class kind listing. Clicking
- * this link, package-summary page will appear in the right hand frame.
- *
- * @param heading Top Heading to be used for the class kind listing.
- */
- protected void printPackageHeader(String heading) {
- fontSizeStyle("+1", "FrameTitleFont");
- printTargetPackageLink(packageDoc, "classFrame", heading);
- fontEnd();
- }
-
- /**
- * The table for the class kind listing.
- */
- protected void printPackageTableHeader() {
- table();
- tr();
- tdNowrap();
- }
-
- /**
- * Closing Html tags for table of class kind listing.
- */
- protected void printPackageTableFooter() {
- tdEnd();
- trEnd();
- tableEnd();
- }
}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
index 60f853f2868..a7944122ae2 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
@@ -25,10 +25,11 @@
package com.sun.tools.doclets.formats.html;
-import com.sun.tools.doclets.internal.toolkit.util.*;
-
-import com.sun.javadoc.*;
import java.io.*;
+import com.sun.javadoc.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.doclets.formats.html.markup.*;
/**
* Generate the package index for the left-hand frame in the generated output.
@@ -58,7 +59,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
String filename = "overview-frame.html";
try {
packgen = new PackageIndexFrameWriter(configuration, filename);
- packgen.generatePackageIndexFile("doclet.Window_Overview", false);
+ packgen.buildPackageIndexFile("doclet.Window_Overview", false);
packgen.close();
} catch (IOException exc) {
configuration.standardmessage.error(
@@ -69,114 +70,86 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
}
/**
- * Print each package name on separate rows.
- *
- * @param pd PackageDoc
+ * {@inheritDoc}
*/
- protected void printIndexRow(PackageDoc pd) {
- fontStyle("FrameItemFont");
- if (pd.name().length() > 0) {
- print(getHyperLink(pathString(pd, "package-frame.html"), "",
- pd.name(), false, "", "", "packageFrame"));
- } else {
- print(getHyperLink("package-frame.html", "", "<unnamed package>",
- false, "", "", "packageFrame"));
+ protected void addPackagesList(PackageDoc[] packages, String text,
+ String tableSummary, Content body) {
+ Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
+ packagesLabel);
+ Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
+ HtmlTree ul = new HtmlTree(HtmlTag.UL);
+ ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString());
+ for(int i = 0; i < packages.length; i++) {
+ if (packages[i] != null) {
+ ul.addContent(getPackage(packages[i]));
+ }
}
- fontEnd();
- br();
+ div.addContent(ul);
+ body.addContent(div);
}
/**
- * Print the "-packagesheader" string in strong format, at top of the page,
- * if it is not the empty string. Otherwise print the "-header" string.
- * Despite the name, there is actually no navigation bar for this page.
+ * Gets each package name as a separate link.
+ *
+ * @param pd PackageDoc
+ * @return content for the package link
*/
- protected void printNavigationBarHeader() {
- printTableHeader(true);
- fontSizeStyle("+1", "FrameTitleFont");
- if (configuration.packagesheader.length() > 0) {
- strong(replaceDocRootDir(configuration.packagesheader));
+ protected Content getPackage(PackageDoc pd) {
+ Content packageLinkContent;
+ Content packageLabel;
+ if (pd.name().length() > 0) {
+ packageLabel = getPackageLabel(pd.name());
+ packageLinkContent = getHyperLink(pathString(pd,
+ "package-frame.html"), "", packageLabel, "",
+ "packageFrame");
} else {
- strong(replaceDocRootDir(configuration.header));
+ packageLabel = new RawHtml("<unnamed package>");
+ packageLinkContent = getHyperLink("package-frame.html",
+ "", packageLabel, "", "packageFrame");
}
- fontEnd();
- printTableFooter(true);
+ Content li = HtmlTree.LI(packageLinkContent);
+ return li;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void addNavigationBarHeader(Content body) {
+ Content headerContent;
+ if (configuration.packagesheader.length() > 0) {
+ headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
+ } else {
+ headerContent = new RawHtml(replaceDocRootDir(configuration.header));
+ }
+ Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
+ HtmlStyle.bar, headerContent);
+ body.addContent(heading);
}
/**
* Do nothing as there is no overview information in this page.
*/
- protected void printOverviewHeader() {
+ protected void addOverviewHeader(Content body) {
}
/**
- * Print Html "table" tag for the package index format.
+ * Adds "All Classes" link for the top of the left-hand frame page to the
+ * documentation tree.
*
- * @param text Text string will not be used in this method.
+ * @param body the Content object to which the all classes link should be added
*/
- protected void printIndexHeader(String text, String tableSummary) {
- printTableHeader(false);
+ protected void addAllClassesLink(Content body) {
+ Content linkContent = getHyperLink("allclasses-frame.html", "",
+ allclassesLabel, "", "packageFrame");
+ Content div = HtmlTree.DIV(HtmlStyle.indexHeader, linkContent);
+ body.addContent(div);
}
/**
- * Print Html closing "table" tag at the end of the package index.
+ * {@inheritDoc}
*/
- protected void printIndexFooter() {
- printTableFooter(false);
- }
-
- /**
- * Print "All Classes" link at the top of the left-hand frame page.
- */
- protected void printAllClassesPackagesLink() {
- fontStyle("FrameItemFont");
- print(getHyperLink("allclasses-frame.html", "",
- configuration.getText("doclet.All_Classes"), false, "", "",
- "packageFrame"));
- fontEnd();
- p();
- fontSizeStyle("+1", "FrameHeadingFont");
- printText("doclet.Packages");
- fontEnd();
- br();
- }
-
- /**
- * Just print some space, since there is no navigation bar for this page.
- */
- protected void printNavigationBarFooter() {
- p();
- space();
- }
-
- /**
- * Print Html closing tags for the table for package index.
- *
- * @param isHeading true if this is a table for a heading.
- */
- private void printTableFooter(boolean isHeading) {
- if (isHeading) {
- thEnd();
- } else {
- tdEnd();
- }
- trEnd();
- tableEnd();
- }
-
- /**
- * Print Html tags for the table for package index.
- *
- * @param isHeading true if this is a table for a heading.
- */
- private void printTableHeader(boolean isHeading) {
- table();
- tr();
- if (isHeading) {
- thAlignNowrap("left");
- } else {
- tdNowrap();
- }
-
+ protected void addNavigationBarFooter(Content body) {
+ Content p = HtmlTree.P(getSpace());
+ body.addContent(p);
}
}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
index 4088c14f1be..6a286c71ccb 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
@@ -25,10 +25,12 @@
package com.sun.tools.doclets.formats.html;
-import com.sun.tools.doclets.internal.toolkit.util.*;
-import com.sun.javadoc.*;
import java.io.*;
import java.util.*;
+import com.sun.javadoc.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.doclets.formats.html.markup.*;
/**
* Generate the package index page "overview-summary.html" for the right-hand
@@ -83,7 +85,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
String filename = "overview-summary.html";
try {
packgen = new PackageIndexWriter(configuration, filename);
- packgen.generatePackageIndexFile("doclet.Window_Overview_Summary", true);
+ packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
packgen.close();
} catch (IOException exc) {
configuration.standardmessage.error(
@@ -94,124 +96,140 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
}
/**
- * Print each package in separate rows in the index table. Generate link
- * to each package.
- *
- * @param pkg Package to which link is to be generated.
- */
- protected void printIndexRow(PackageDoc pkg) {
- if(pkg != null && pkg.name().length() > 0) {
- trBgcolorStyle("white", "TableRowColor");
- summaryRow(20);
- strong();
- printPackageLink(pkg, Util.getPackageName(pkg), false);
- strongEnd();
- summaryRowEnd();
- summaryRow(0);
- printSummaryComment(pkg);
- summaryRowEnd();
- trEnd();
- }
- }
-
- /**
- * Depending upon the grouping information and their titles, generate
+ * Depending upon the grouping information and their titles, add
* separate table indices for each package group.
+ *
+ * @param body the documentation tree to which the index will be added
*/
- protected void generateIndex() {
+ protected void addIndex(Content body) {
for (int i = 0; i < groupList.size(); i++) {
String groupname = groupList.get(i);
ListString
, add line numbers.
- * @param s the text to add line numbers to.
+ * Returns a link to the stylesheet file.
*
- * @return the string buffer with the line numbering for each line.
+ * @param configuration the doclet configuration for the current run of javadoc
+ * @return an HtmlTree for the lINK tag which provides the stylesheet location
*/
- private static StringBuffer addLineNumbers(String s) {
- StringBuffer sb = new StringBuffer();
- StringTokenizer st = new StringTokenizer(s, "\n", true);
- int lineno = 1;
- String current;
- while(st.hasMoreTokens()){
- current = st.nextToken();
- sb.append(current.equals("\n") ?
- getHTMLLineNo(lineno) + current :
- getHTMLLineNo(lineno) + current + st.nextToken());
- lineno++;
+ public static HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
+ String filename = configuration.stylesheetfile;
+ if (filename.length() > 0) {
+ File stylefile = new File(filename);
+ String parent = stylefile.getParent();
+ filename = (parent == null)?
+ filename:
+ filename.substring(parent.length() + 1);
+ } else {
+ filename = "stylesheet.css";
}
- return sb;
+ filename = relativePath + filename;
+ HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", filename, "Style");
+ return link;
}
/**
* Get the header.
- * @param configuration the Doclet configuration
- * @return the header to the output file
+ *
+ * @return the header content for the HTML file
*/
- protected static String getHeader(Configuration configuration) {
- StringBuffer result = new StringBuffer("" + DocletConstants.NL);
- result.append("" + DocletConstants.NL);
- result.append("" + DocletConstants.NL); - return result.toString(); + private static Content getHeader() { + return new HtmlTree(HtmlTag.BODY); } /** - * Get the footer - * @return the footer to the output file - */ - protected static String getFooter() { - StringBuffer footer = new StringBuffer(); - for (int i = 0; i < NUM_BLANK_LINES; i++) { - footer.append(DocletConstants.NL); - } - footer.append("" + DocletConstants.NL + "" + - DocletConstants.NL + "" + DocletConstants.NL); - return footer.toString(); - } - - /** - * Get the HTML for the lines. + * Add the line numbers for the source code. + * + * @param pre the content tree to which the line number will be added * @param lineno The line number - * @return the HTML code for the line */ - protected static String getHTMLLineNo(int lineno) { - StringBuffer result = new StringBuffer(""); + private static void addLineNo(Content pre, int lineno) { + HtmlTree span = new HtmlTree(HtmlTag.SPAN); + span.addStyle(HtmlStyle.sourceLineNo); if (lineno < 10) { - result.append("00" + ((new Integer(lineno)).toString())); + span.addContent("00" + Integer.toString(lineno)); } else if (lineno < 100) { - result.append("0" + ((new Integer(lineno)).toString())); + span.addContent("0" + Integer.toString(lineno)); } else { - result.append((new Integer(lineno)).toString()); + span.addContent(Integer.toString(lineno)); } - result.append(" "); - return result.toString(); + pre.addContent(span); } /** - * Format a given line of source.
Doc
s, add to the given HashMap
the
- * line numbers and anchors that should be inserted in the output at those lines.
- * @param docs the array of Doc
s to add anchors for.
- * @param hash the HashMap
to add to.
- */
- protected static void addToHash(Doc[] docs, HashMapDoc
, return an anchor for it.
- * @param d the Doc
to check.
- * @return an anchor of the form <a name="my_name"></a>
+ * Add trailing blank lines at the end of the page.
+ *
+ * @param pre the content tree to which the blank lines will be added.
*/
- protected static String getAnchor(Doc d) {
- return " ";
+ private static void addBlankLines(Content pre) {
+ for (int i = 0; i < NUM_BLANK_LINES; i++) {
+ pre.addContent(NEW_LINE);
+ }
}
/**
* Given a Doc
, return an anchor name for it.
+ *
* @param d the Doc
to check.
* @return the name of the anchor.
*/
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java
index e539667821b..17788129bc3 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java
@@ -25,9 +25,10 @@
package com.sun.tools.doclets.formats.html;
-import com.sun.tools.doclets.internal.toolkit.util.*;
-
import java.io.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
/**
* Generate Separate Index Files for all the member names with Indexing in
@@ -36,6 +37,7 @@ import java.io.*;
*
* @see java.lang.Character
* @author Atul M Dambalkar
+ * @author Bhavesh Patel (Modified)
*/
public class SplitIndexWriter extends AbstractIndexWriter {
@@ -109,56 +111,68 @@ public class SplitIndexWriter extends AbstractIndexWriter {
* index.
*/
protected void generateIndexFile(Character unicode) throws IOException {
- printHtmlHeader(configuration.getText("doclet.Window_Split_Index",
- unicode.toString()), null, true);
- printTop();
- navLinks(true);
- printLinksForIndexes();
-
- hr();
-
- generateContents(unicode, indexbuilder.getMemberList(unicode));
-
- navLinks(false);
- printLinksForIndexes();
-
- printBottom();
- printBodyHtmlEnd();
+ String title = configuration.getText("doclet.Window_Split_Index",
+ unicode.toString());
+ Content body = getBody(true, getWindowTitle(title));
+ addTop(body);
+ addNavLinks(true, body);
+ HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
+ divTree.addStyle(HtmlStyle.contentContainer);
+ addLinksForIndexes(divTree);
+ addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
+ addLinksForIndexes(divTree);
+ body.addContent(divTree);
+ addNavLinks(false, body);
+ addBottom(body);
+ printHtmlDocument(null, true, body);
}
/**
- * Print Links for all the Index Files per unicode character.
+ * Add links for all the Index Files per unicode character.
+ *
+ * @param contentTree the content tree to which the links for indexes will be added
*/
- protected void printLinksForIndexes() {
- for (int i = 0; i < indexbuilder.elements().length; i++) {
+ protected void addLinksForIndexes(Content contentTree) {
+ Object[] unicodeChars = indexbuilder.elements();
+ for (int i = 0; i < unicodeChars.length; i++) {
int j = i + 1;
- printHyperLink("index-" + j + ".html",
- indexbuilder.elements()[i].toString());
- print(' ');
+ contentTree.addContent(getHyperLink("index-" + j + ".html",
+ new StringContent(unicodeChars[i].toString())));
+ contentTree.addContent(getSpace());
}
}
/**
- * Print the previous unicode character index link.
+ * Get link to the previous unicode character.
+ *
+ * @return a content tree for the link
*/
- protected void navLinkPrevious() {
+ public Content getNavLinkPrevious() {
+ Content prevletterLabel = getResource("doclet.Prev_Letter");
if (prev == -1) {
- printText("doclet.Prev_Letter");
- } else {
- printHyperLink("index-" + prev + ".html", "",
- configuration.getText("doclet.Prev_Letter"), true);
+ return HtmlTree.LI(prevletterLabel);
+ }
+ else {
+ Content prevLink = getHyperLink("index-" + prev + ".html", "",
+ prevletterLabel);
+ return HtmlTree.LI(prevLink);
}
}
/**
- * Print the next unicode character index link.
+ * Get link to the next unicode character.
+ *
+ * @return a content tree for the link
*/
- protected void navLinkNext() {
+ public Content getNavLinkNext() {
+ Content nextletterLabel = getResource("doclet.Next_Letter");
if (next == -1) {
- printText("doclet.Next_Letter");
- } else {
- printHyperLink("index-" + next + ".html","",
- configuration.getText("doclet.Next_Letter"), true);
+ return HtmlTree.LI(nextletterLabel);
+ }
+ else {
+ Content nextLink = getHyperLink("index-" + next + ".html","",
+ nextletterLabel);
+ return HtmlTree.LI(nextLink);
}
}
}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/StylesheetWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/StylesheetWriter.java
deleted file mode 100644
index 3363be5f8f7..00000000000
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/StylesheetWriter.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.doclets.formats.html;
-
-import com.sun.tools.doclets.internal.toolkit.util.*;
-
-import java.io.*;
-
-/**
- * Writes the style sheet for the doclet output.
- *
- * @author Atul M Dambalkar
- * @author Bhavesh Patel (Modified)
- */
-public class StylesheetWriter extends HtmlDocletWriter {
-
- /**
- * Constructor.
- */
- public StylesheetWriter(ConfigurationImpl configuration,
- String filename) throws IOException {
- super(configuration, filename);
- }
-
- /**
- * Generate the style file contents.
- * @throws DocletAbortException
- */
- public static void generate(ConfigurationImpl configuration) {
- StylesheetWriter stylegen;
- String filename = "";
- try {
- filename = "stylesheet.css";
- stylegen = new StylesheetWriter(configuration, filename);
- stylegen.generateStyleFile();
- stylegen.close();
- } catch (IOException exc) {
- configuration.standardmessage.error(
- "doclet.exception_encountered",
- exc.toString(), filename);
- throw new DocletAbortException();
- }
- }
-
- /**
- * Generate the style file contents.
- */
- protected void generateStyleFile() {
- print("/* "); printText("doclet.Style_line_1"); println(" */");
- println("");
-
- print("/* "); printText("doclet.Style_line_2"); println(" */");
- println("");
-
- print("/* "); printText("doclet.Style_line_3"); println(" */");
- println("body { background-color: #FFFFFF; color:#000000 }");
- println("");
-
- print("/* "); printText("doclet.Style_Headings"); println(" */");
- println("h1 { font-size: 145% }");
- println("");
-
- print("/* "); printText("doclet.Style_line_4"); println(" */");
- print(".TableHeadingColor { background: #CCCCFF; color:#000000 }");
- print(" /* "); printText("doclet.Style_line_5"); println(" */");
- print(".TableSubHeadingColor { background: #EEEEFF; color:#000000 }");
- print(" /* "); printText("doclet.Style_line_6"); println(" */");
- print(".TableRowColor { background: #FFFFFF; color:#000000 }");
- print(" /* "); printText("doclet.Style_line_7"); println(" */");
- println("");
-
- print("/* "); printText("doclet.Style_line_8"); println(" */");
- println(".FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
- println(".FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
- println(".FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }");
- println("");
-
- // Removed doclet.Style_line_9 as no longer needed
-
- print("/* "); printText("doclet.Style_line_10"); println(" */");
- print(".NavBarCell1 { background-color:#EEEEFF; color:#000000}");
- print(" /* "); printText("doclet.Style_line_6"); println(" */");
- print(".NavBarCell1Rev { background-color:#00008B; color:#FFFFFF}");
- print(" /* "); printText("doclet.Style_line_11"); println(" */");
-
- print(".NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;");
- println("color:#000000;}");
- print(".NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;");
- println("color:#FFFFFF;}");
- println("");
-
- print(".NavBarCell2 { font-family: Arial, Helvetica, sans-serif; ");
- println("background-color:#FFFFFF; color:#000000}");
- print(".NavBarCell3 { font-family: Arial, Helvetica, sans-serif; ");
- println("background-color:#FFFFFF; color:#000000}");
-
- print("/* "); printText("doclet.Style_line_12"); println(" */");
- print(".TableCaption { background: #CCCCFF; color:#000000; text-align: left; font-size: 150%; font-weight: bold; border-left: 2px ridge; border-right: 2px ridge; border-top: 2px ridge; padding-left: 5px; }");
- print(" /* "); printText("doclet.Style_line_5"); println(" */");
- print(".TableSubCaption { background: #EEEEFF; color:#000000; text-align: left; font-weight: bold; border-left: 2px ridge; border-right: 2px ridge; border-top: 2px ridge; padding-left: 5px; }");
- print(" /* "); printText("doclet.Style_line_6"); println(" */");
- print(".TableHeader { text-align: center; font-size: 80%; font-weight: bold; }");
- println("");
-
- }
-
-}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
index ae5a8e8db37..33e2fdc54f7 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
@@ -25,10 +25,11 @@
package com.sun.tools.doclets.formats.html;
-import com.sun.javadoc.*;
-import com.sun.tools.doclets.internal.toolkit.util.*;
-
import java.io.*;
+import com.sun.javadoc.*;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+import com.sun.tools.doclets.formats.html.markup.*;
/**
* This abstract class exists to provide functionality needed in the
@@ -71,13 +72,31 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
tdEnd();
}
- public void printSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
- mw.printSummaryAnchor(cd);
- mw.printTableSummary();
- tableCaptionStart();
- mw.printSummaryLabel();
- tableCaptionEnd();
- mw.printSummaryTableHeader(cd);
+ /**
+ * Add the summary header.
+ *
+ * @param mw the writer for the member being documented
+ * @param cd the classdoc to be documented
+ * @param memberTree the content tree to which the summary header will be added
+ */
+ public void addSummaryHeader(AbstractMemberWriter mw, ClassDoc cd,
+ Content memberTree) {
+ mw.addSummaryAnchor(cd, memberTree);
+ mw.addSummaryLabel(memberTree);
+ }
+
+ /**
+ * Get the summary table.
+ *
+ * @param mw the writer for the member being documented
+ * @param cd the classdoc to be documented
+ * @return the content tree for the summary table
+ */
+ public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd) {
+ Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0,
+ mw.getTableSummary(), getTableCaption(mw.getCaption()));
+ table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col"));
+ return table;
}
public void printTableHeadingBackground(String str) {
@@ -88,15 +107,17 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
tableEnd();
}
- public void printInheritedSummaryHeader(AbstractMemberWriter mw, ClassDoc cd) {
- mw.printInheritedSummaryAnchor(cd);
- tableIndexSummary();
- tableInheritedHeaderStart("#EEEEFF");
- mw.printInheritedSummaryLabel(cd);
- tableInheritedHeaderEnd();
- trBgcolorStyle("white", "TableRowColor");
- summaryRow(0);
- code();
+ /**
+ * Add the inherited summary header.
+ *
+ * @param mw the writer for the member being documented
+ * @param cd the classdoc to be documented
+ * @param inheritedTree the content tree to which the inherited summary header will be added
+ */
+ public void addInheritedSummaryHeader(AbstractMemberWriter mw, ClassDoc cd,
+ Content inheritedTree) {
+ mw.addInheritedSummaryAnchor(cd, inheritedTree);
+ mw.addInheritedSummaryLabel(cd, inheritedTree);
}
public void printSummaryFooter(AbstractMemberWriter mw, ClassDoc cd) {
@@ -112,8 +133,14 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
space();
}
- protected void printIndexComment(Doc member) {
- printIndexComment(member, member.firstSentenceTags());
+ /**
+ * Add the index comment.
+ *
+ * @param member the member being documented
+ * @param contentTree the content tree to which the comment will be added
+ */
+ protected void addIndexComment(Doc member, Content contentTree) {
+ addIndexComment(member, member.firstSentenceTags(), contentTree);
}
protected void printIndexComment(Doc member, Tag[] firstSentenceTags) {
@@ -134,17 +161,60 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
printSummaryComment(member, firstSentenceTags);
}
- public void printSummaryLinkType(AbstractMemberWriter mw,
- ProgramElementDoc member) {
- trBgcolorStyle("white", "TableRowColor");
- mw.printSummaryType(member);
- summaryRow(0);
- code();
+ /**
+ * Add the index comment.
+ *
+ * @param member the member being documented
+ * @param firstSentenceTags the first sentence tags for the member to be documented
+ * @param tdSummary the content tree to which the comment will be added
+ */
+ protected void addIndexComment(Doc member, Tag[] firstSentenceTags,
+ Content tdSummary) {
+ Tag[] deprs = member.tags("deprecated");
+ Content div;
+ if (Util.isDeprecated((ProgramElementDoc) member)) {
+ Content strong = HtmlTree.STRONG(deprecatedPhrase);
+ div = HtmlTree.DIV(HtmlStyle.block, strong);
+ div.addContent(getSpace());
+ if (deprs.length > 0) {
+ addInlineDeprecatedComment(member, deprs[0], div);
+ }
+ tdSummary.addContent(div);
+ return;
+ } else {
+ ClassDoc cd = ((ProgramElementDoc)member).containingClass();
+ if (cd != null && Util.isDeprecated(cd)) {
+ Content strong = HtmlTree.STRONG(deprecatedPhrase);
+ div = HtmlTree.DIV(HtmlStyle.block, strong);
+ div.addContent(getSpace());
+ tdSummary.addContent(div);
+ }
+ }
+ addSummaryComment(member, firstSentenceTags, tdSummary);
}
- public void printSummaryLinkComment(AbstractMemberWriter mw,
- ProgramElementDoc member) {
- printSummaryLinkComment(mw, member, member.firstSentenceTags());
+ /**
+ * Add the summary type for the member.
+ *
+ * @param mw the writer for the member being documented
+ * @param member the member to be documented
+ * @param tdSummaryType the content tree to which the type will be added
+ */
+ public void addSummaryType(AbstractMemberWriter mw, ProgramElementDoc member,
+ Content tdSummaryType) {
+ mw.addSummaryType(member, tdSummaryType);
+ }
+
+ /**
+ * Add the summary link for the member.
+ *
+ * @param mw the writer for the member being documented
+ * @param member the member to be documented
+ * @param contentTree the content tree to which the link will be added
+ */
+ public void addSummaryLinkComment(AbstractMemberWriter mw,
+ ProgramElementDoc member, Content contentTree) {
+ addSummaryLinkComment(mw, member, member.firstSentenceTags(), contentTree);
}
public void printSummaryLinkComment(AbstractMemberWriter mw,
@@ -159,12 +229,34 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
trEnd();
}
- public void printInheritedSummaryMember(AbstractMemberWriter mw, ClassDoc cd,
- ProgramElementDoc member, boolean isFirst) {
+ /**
+ * Add the summary link comment.
+ *
+ * @param mw the writer for the member being documented
+ * @param member the member being documented
+ * @param firstSentenceTags the first sentence tags for the member to be documented
+ * @param tdSummary the content tree to which the comment will be added
+ */
+ public void addSummaryLinkComment(AbstractMemberWriter mw,
+ ProgramElementDoc member, Tag[] firstSentenceTags, Content tdSummary) {
+ addIndexComment(member, firstSentenceTags, tdSummary);
+ }
+
+ /**
+ * Add the inherited member summary.
+ *
+ * @param mw the writer for the member being documented
+ * @param cd the class being documented
+ * @param member the member being documented
+ * @param isFirst true if its the first link being documented
+ * @param linksTree the content tree to which the summary will be added
+ */
+ public void addInheritedMemberSummary(AbstractMemberWriter mw, ClassDoc cd,
+ ProgramElementDoc member, boolean isFirst, Content linksTree) {
if (! isFirst) {
- mw.print(", ");
+ linksTree.addContent(", ");
}
- mw.writeInheritedSummaryLink(cd, member);
+ mw.addInheritedSummaryLink(cd, member, linksTree);
}
public void printMemberHeader() {
@@ -174,4 +266,67 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
public void printMemberFooter() {
}
+ /**
+ * Get the document content header tree
+ *
+ * @return a content tree the document content header
+ */
+ public Content getContentHeader() {
+ HtmlTree div = new HtmlTree(HtmlTag.DIV);
+ div.addStyle(HtmlStyle.contentContainer);
+ return div;
+ }
+
+ /**
+ * Get the member header tree
+ *
+ * @return a content tree the member header
+ */
+ public Content getMemberTreeHeader() {
+ HtmlTree li = new HtmlTree(HtmlTag.LI);
+ li.addStyle(HtmlStyle.blockList);
+ return li;
+ }
+
+ /**
+ * Get the member tree
+ *
+ * @param contentTree the tree used to generate the complete member tree
+ * @return a content tree for the member
+ */
+ public Content getMemberTree(Content contentTree) {
+ Content ul = HtmlTree.UL(HtmlStyle.blockList, contentTree);
+ return ul;
+ }
+
+ /**
+ * Get the member summary tree
+ *
+ * @param contentTree the tree used to generate the member summary tree
+ * @return a content tree for the member summary
+ */
+ public Content getMemberSummaryTree(Content contentTree) {
+ return getMemberTree(HtmlStyle.summary, contentTree);
+ }
+
+ /**
+ * Get the member details tree
+ *
+ * @param contentTree the tree used to generate the member details tree
+ * @return a content tree for the member details
+ */
+ public Content getMemberDetailsTree(Content contentTree) {
+ return getMemberTree(HtmlStyle.details, contentTree);
+ }
+
+ /**
+ * Get the member tree
+ *
+ * @param style the style class to be added to the content tree
+ * @param contentTree the tree used to generate the complete member tree
+ */
+ public Content getMemberTree(HtmlStyle style, Content contentTree) {
+ Content div = HtmlTree.DIV(style, getMemberTree(contentTree));
+ return div;
+ }
}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
index 2f7c0071f94..b3570d58190 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
@@ -70,9 +70,9 @@ public class TagletWriterImpl extends TagletWriter {
Tag[] deprs = doc.tags("deprecated");
if (doc instanceof ClassDoc) {
if (Util.isDeprecated((ProgramElementDoc) doc)) {
- output.append("" +
+ output.append("" +
ConfigurationImpl.getInstance().
- getText("doclet.Deprecated") + " ");
+ getText("doclet.Deprecated") + " ");
if (deprs.length > 0) {
Tag[] commentTags = deprs[0].inlineTags();
if (commentTags.length > 0) {
@@ -82,30 +82,24 @@ public class TagletWriterImpl extends TagletWriter {
);
}
}
- output.append(""); } } else { MemberDoc member = (MemberDoc) doc; if (Util.isDeprecated((ProgramElementDoc) doc)) { - output.append("
" + - DocletConstants.NL); - } - output.append("
" + paramName + "
"
- + " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false) + "" + paramName + "
"
+ + " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false) + "" + text + "
";
+ return "" + text + "
";
}
/**
@@ -539,6 +745,13 @@ public class HtmlWriter extends PrintWriter {
print(" ");
}
+ /**
+ * Return " ", non-breaking space.
+ */
+ public Content getSpace() {
+ return RawHtml.nbsp;
+ }
+
/**
* Print <DL> tag. Add a newline character at the end.
*/
@@ -1182,21 +1395,21 @@ public class HtmlWriter extends PrintWriter {
}
/**
- * Get the "<CODE>" string.
+ * Get the "<code>" string.
*
- * @return String Return String "<CODE>";
+ * @return String Return String "<code>";
*/
public String getCode() {
- return "";
+ return "";
}
/**
- * Get the "</CODE>" string.
+ * Get the "</code>" string.
*
- * @return String Return String "</CODE>";
+ * @return String Return String "</code>";
*/
public String getCodeEnd() {
- return "
";
+ return "
";
}
/**
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java
new file mode 100644
index 00000000000..56c23965534
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.formats.html.markup;
+
+import com.sun.tools.doclets.internal.toolkit.Content;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Class for generating raw HTML content to be added to HTML pages of javadoc output.
+ *
+ * @author Bhavesh Patel
+ */
+public class RawHtml extends Content{
+
+ private String rawHtmlContent;
+
+ public static final Content nbsp = new RawHtml(" ");
+
+ /**
+ * Constructor to construct a RawHtml object.
+ *
+ * @param rawHtml raw HTML text to be added
+ */
+ public RawHtml(String rawHtml) {
+ rawHtmlContent = nullCheck(rawHtml);
+ }
+
+ /**
+ * This method is not supported by the class.
+ *
+ * @param content content that needs to be added
+ * @throws DocletAbortException this method will always throw a
+ * DocletAbortException because it
+ * is not supported.
+ */
+ public void addContent(Content content) {
+ throw new DocletAbortException();
+ }
+
+ /**
+ * This method is not supported by the class.
+ *
+ * @param stringContent string content that needs to be added
+ * @throws DocletAbortException this method will always throw a
+ * DocletAbortException because it
+ * is not supported.
+ */
+ public void addContent(String stringContent) {
+ throw new DocletAbortException();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isEmpty() {
+ return rawHtmlContent.isEmpty();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void write(StringBuilder contentBuilder) {
+ contentBuilder.append(rawHtmlContent);
+ }
+}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java
new file mode 100644
index 00000000000..2bf4437fb31
--- /dev/null
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.formats.html.markup;
+
+import com.sun.tools.doclets.internal.toolkit.Content;
+import com.sun.tools.doclets.internal.toolkit.util.*;
+
+/**
+ * Class for generating string content for HTML tags of javadoc output.
+ *
+ * @author Bhavesh Patel
+ */
+public class StringContent extends Content{
+
+ private StringBuilder stringContent;
+
+ /**
+ * Constructor to construct StringContent object.
+ */
+ public StringContent() {
+ stringContent = new StringBuilder();
+ }
+
+ /**
+ * Constructor to construct StringContent object with some initial content.
+ *
+ * @param initialContent initial content for the object
+ */
+ public StringContent(String initialContent) {
+ stringContent = new StringBuilder(
+ Util.escapeHtmlChars(nullCheck(initialContent)));
+ }
+
+ /**
+ * This method is not supported by the class.
+ *
+ * @param content content that needs to be added
+ * @throws DocletAbortException this method will always throw a
+ * DocletAbortException because it
+ * is not supported.
+ */
+ public void addContent(Content content) {
+ throw new DocletAbortException();
+ }
+
+ /**
+ * Adds content for the StringContent object. The method escapes
+ * HTML characters for the string content that is added.
+ *
+ * @param strContent string content to be added
+ */
+ public void addContent(String strContent) {
+ stringContent.append(Util.escapeHtmlChars(nullCheck(strContent)));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isEmpty() {
+ return (stringContent.length() == 0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString() {
+ return stringContent.toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void write(StringBuilder contentBuilder) {
+ contentBuilder.append(stringContent);
+ }
+}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
index 598cc88d74b..46a783c1b90 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
@@ -43,6 +43,7 @@ doclet.Window_Single_Index=Index
doclet.Window_Split_Index={0}-Index
doclet.Help=Help
doclet.Skip_navigation_links=Skip navigation links
+doclet.New_Page=NewPage
doclet.None=None
doclet.CLASSES=CLASSES
doclet.MEMBERS=MEMBERS
@@ -53,7 +54,7 @@ doclet.Deprecated_List=Deprecated List
doclet.Window_Deprecated_List=Deprecated List
doclet.Note_0_is_deprecated=Note: {0} is deprecated.
doclet.Overrides=Overrides:
-doclet.in_class={0} in class {1}
+doclet.in_class=in class
doclet.0_Fields_and_Methods="{0}" Fields and Methods
doclet.Index_of_Fields_and_Methods=Index of Fields and Methods
doclet.Static_variable_in=Static variable in {0}
@@ -103,7 +104,7 @@ doclet.Other_Packages=Other Packages
doclet.Package_Description=Package {0} Description
doclet.Description=Description
doclet.Specified_By=Specified by:
-doclet.in_interface={0} in interface {1}
+doclet.in_interface=in interface
doclet.Subclasses=Direct Known Subclasses:
doclet.Subinterfaces=All Known Subinterfaces:
doclet.Implementing_Classes=All Known Implementing Classes:
@@ -121,18 +122,20 @@ doclet.Cannot_handle_no_packages=Cannot handle no packages.
doclet.Frame_Alert=Frame Alert
doclet.Overview-Member-Frame=Overview Member Frame
doclet.Frame_Warning_Message=This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
+doclet.No_Script_Message=JavaScript is disabled on your browser.
doclet.Non_Frame_Version=Non-frame version.
doclet.Frame_Version=Frame version
doclet.Link_To=Link to
doclet.Following_From_Class=Following copied from class: {0}
doclet.Following_From_Interface=Following copied from interface: {0}
-doclet.Description_From_Interface=Description copied from interface: {0}
-doclet.Description_From_Class=Description copied from class: {0}
+doclet.Description_From_Interface=Description copied from interface:
+doclet.Description_From_Class=Description copied from class:
doclet.Standard_doclet_invoked=Standard doclet invoked...
doclet.No_Non_Deprecated_Classes_To_Document=No non-deprecated classes found to document.
doclet.Interfaces_Italic=Interfaces (italic)
doclet.Enclosing_Class=Enclosing class:
doclet.Enclosing_Interface=Enclosing interface:
+doclet.Window_Source_title=Source code
doclet.Help_title=API Help
doclet.Window_Help_title=API Help
doclet.Help_line_1=How This API Document Is Organized
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeOptionalMemberWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeOptionalMemberWriter.java
index b823eb2ca42..f31de8eca10 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeOptionalMemberWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeOptionalMemberWriter.java
@@ -35,14 +35,18 @@ import com.sun.javadoc.*;
* Do not use it as an API
*
* @author Jamie Ho
+ * @author Bhavesh Patel (Modified)
* @since 1.5
*/
public interface AnnotationTypeOptionalMemberWriter extends
- AnnotationTypeRequiredMemberWriter {
+ AnnotationTypeRequiredMemberWriter {
/**
- * Write the default value documentation.
+ * Add the the default value documentation.
+ *
+ * @param member the member being documented
+ * @param annotationDocTree content tree to which the default value will be added
*/
- public void writeDefaultValueInfo(MemberDoc member);
+ public void addDefaultValueInfo(MemberDoc member, Content annotationDocTree);
}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java
index 60f4912da21..b17040c304a 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeRequiredMemberWriter.java
@@ -36,67 +36,79 @@ import com.sun.javadoc.*;
* Do not use it as an API
*
* @author Jamie Ho
+ * @author Bhavesh Patel (Modified)
* @since 1.5
*/
public interface AnnotationTypeRequiredMemberWriter {
/**
- * Write the header for the member documentation.
+ * Add the annotation type details tree header.
*
- * @param classDoc the annotation type that the members belong to.
- * @param header the header to write.
+ * @param classDoc the annotation type being documented
+ * @param memberDetailsTree the content tree representing member details
*/
- public void writeHeader(ClassDoc classDoc, String header);
+ public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
+ Content memberDetailsTree);
/**
- * Write the member header for the given member.
+ * Get the annotation type documentation tree header.
*
- * @param member the member being documented.
- * @param isFirst the flag to indicate whether or not the member is
- * the first to be documented.
+ * @param member the annotation type being documented
+ * @param annotationDetailsTree the content tree representing annotation type details
+ * @return content tree for the annotation type documentation header
*/
- public void writeMemberHeader(MemberDoc member, boolean isFirst);
+ public Content getAnnotationDocTreeHeader(MemberDoc member,
+ Content annotationDetailsTree);
/**
- * Write the signature for the given member.
+ * Get the annotation type details tree.
*
- * @param member the member being documented.
+ * @param annotationDetailsTree the content tree representing annotation type details
+ * @return content tree for the annotation type details
*/
- public void writeSignature(MemberDoc member);
+ public Content getAnnotationDetails(Content annotationDetailsTree);
/**
- * Write the deprecated output for the given member.
+ * Get the annotation type documentation.
*
- * @param member the member being documented.
+ * @param annotationDocTree the content tree representing annotation type documentation
+ * @param isLastContent true if the content to be added is the last content
+ * @return content tree for the annotation type documentation
*/
- public void writeDeprecated(MemberDoc member);
+ public Content getAnnotationDoc(Content annotationDocTree, boolean isLastContent);
/**
- * Write the comments for the given member.
+ * Get the signature for the given member.
*
- * @param member the member being documented.
+ * @param member the member being documented
+ * @return content tree for the annotation type signature
*/
- public void writeComments(MemberDoc member);
+ public Content getSignature(MemberDoc member);
/**
- * Write the tag output for the given member.
+ * Add the deprecated output for the given member.
*
- * @param member the member being documented.
+ * @param member the member being documented
+ * @param annotationDocTree content tree to which the deprecated information will be added
*/
- public void writeTags(MemberDoc member);
+ public void addDeprecated(MemberDoc member, Content annotationDocTree);
/**
- * Write the member footer.
+ * Add the comments for the given member.
+ *
+ * @param member the member being documented
+ * @param annotationDocTree the content tree to which the comments will be added
*/
- public void writeMemberFooter();
+ public void addComments(MemberDoc member, Content annotationDocTree);
/**
- * Write the footer for the member documentation.
+ * Add the tags for the given member.
*
- * @param classDoc the class that the member belong to.
+ * @param member the member being documented
+ * @param annotationDocTree the content tree to which the tags will be added
*/
- public void writeFooter(ClassDoc classDoc);
+ public void addTags(MemberDoc member, Content annotationDocTree);
/**
* Close the writer.
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java
index 51c037aced6..357ce28b11a 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AnnotationTypeWriter.java
@@ -37,43 +37,122 @@ import com.sun.javadoc.*;
* Do not use it as an API.
*
* @author Jamie Ho
+ * @author Bhavesh Patel (Modified)
* @since 1.5
*/
public interface AnnotationTypeWriter {
/**
- * Write the header of the page.
- * @param header the header to write.
+ * Get the header of the page.
+ *
+ * @param header the header string to write
+ * @return a content tree for the header documentation
*/
- public void writeHeader(String header);
+ public Content getHeader(String header);
/**
- * Write the signature of the current annotation type.
+ * Get the annotation content header.
*
- * @param modifiers the modifiers for the signature.
+ * @return annotation content header that needs to be added to the documentation
*/
- public void writeAnnotationTypeSignature(String modifiers);
+ public Content getAnnotationContentHeader();
+
+ /**
+ * Get the annotation information tree header.
+ *
+ * @return annotation information tree header that needs to be added to the documentation
+ */
+ public Content getAnnotationInfoTreeHeader();
+
+ /**
+ * Get the annotation information.
+ *
+ * @param annotationInfoTree content tree containing the annotation information
+ * @return a content tree for the annotation
+ */
+ public Content getAnnotationInfo(Content annotationInfoTree);
+
+ /**
+ * Add the signature of the current annotation type.
+ *
+ * @param modifiers the modifiers for the signature
+ * @param annotationInfoTree the annotation content tree to which the signature will be added
+ */
+ public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree);
/**
* Build the annotation type description.
+ *
+ * @param annotationInfoTree content tree to which the description will be added
*/
- public void writeAnnotationTypeDescription();
+ public void addAnnotationTypeDescription(Content annotationInfoTree);
/**
- * Write the tag information for the current annotation type.
+ * Add the tag information for the current annotation type.
+ *
+ * @param annotationInfoTree content tree to which the tag information will be added
*/
- public void writeAnnotationTypeTagInfo();
+ public void addAnnotationTypeTagInfo(Content annotationInfoTree);
/**
- * If this annotation type is deprecated, write the appropriate information.
+ * If this annotation is deprecated, add the appropriate information.
+ *
+ * @param annotationInfoTree content tree to which the deprecated information will be added
*/
- public void writeAnnotationTypeDeprecationInfo();
+ public void addAnnotationTypeDeprecationInfo (Content annotationInfoTree);
/**
- * Write the footer of the page.
+ * Add the annotation type details marker.
+ *
+ * @param memberDetails the content tree representing member details marker
*/
- public void writeFooter();
+ public void addAnnotationDetailsMarker(Content memberDetails);
+
+ /**
+ * Get the member tree header for the annotation type.
+ *
+ * @return a content tree for the member tree header
+ */
+ public Content getMemberTreeHeader();
+
+ /**
+ * Get the member tree.
+ *
+ * @param memberTree the content tree that will be modified and returned
+ * @return a content tree for the member
+ */
+ public Content getMemberTree(Content memberTree);
+
+ /**
+ * Get the member summary tree.
+ *
+ * @param memberTree the content tree that will be used to build the summary tree
+ * @return a content tree for the member summary
+ */
+ public Content getMemberSummaryTree(Content memberTree);
+
+ /**
+ * Get the member details tree.
+ *
+ * @param memberTree the content tree that will be used to build the details tree
+ * @return a content tree for the member details
+ */
+ public Content getMemberDetailsTree(Content memberTree);
+
+ /**
+ * Add the footer of the page.
+ *
+ * @param contentTree content tree to which the footer will be added
+ */
+ public void addFooter(Content contentTree);
+
+ /**
+ * Print the document.
+ *
+ * @param contentTree content tree that will be printed as a document
+ */
+ public void printDocument(Content contentTree);
/**
* Close the writer.
@@ -86,10 +165,4 @@ public interface AnnotationTypeWriter {
* @return the AnnotationTypeDoc being documented.
*/
public AnnotationTypeDoc getAnnotationTypeDoc();
-
- /**
- * Perform any operations that are necessary when the member summary
- * finished building.
- */
- public void completeMemberSummaryBuild();
}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java
index 5af17724ae7..999019d0a57 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ClassWriter.java
@@ -37,85 +37,149 @@ import com.sun.javadoc.*;
* Do not use it as an API
*
* @author Jamie Ho
+ * @author Bhavesh Patel (Modified)
* @since 1.5
*/
public interface ClassWriter {
/**
- * Write the header of the page.
- * @param header the header to write.
- */
- public void writeHeader(String header);
-
- /**
- * Write the class tree documentation.
- */
- public void writeClassTree();
-
- /**
- * Write all implemented interfaces if this is a class.
- */
- public void writeImplementedInterfacesInfo();
-
- /**
- * Write all super interfaces if this is an interface.
- */
- public void writeSuperInterfacesInfo();
-
- /**
- * Write the type parameter information.
- */
- public void writeTypeParamInfo();
-
- /**
- * Write all the classes that extend this one.
- */
- public void writeSubClassInfo();
-
- /**
- * Write all the interfaces that extend this one.
- */
- public void writeSubInterfacesInfo();
-
- /**
- * If this is an interface, write all classes that implement this
- * interface.
- */
- public void writeInterfaceUsageInfo ();
-
- /**
- * If this is an inner class or interface, write the enclosing class or
- * interface.
- */
- public void writeNestedClassInfo ();
-
- /**
- * If this class is deprecated, write the appropriate information.
- */
- public void writeClassDeprecationInfo ();
-
- /**
- * Write the signature of the current class.
+ * Get the header of the page.
*
- * @param modifiers the modifiers for the signature.
+ * @param header the header string to write
+ * @return header content that needs to be added to the documentation
*/
- public void writeClassSignature(String modifiers);
+ public Content getHeader(String header);
+
+ /**
+ * Get the class content header.
+ *
+ * @return class content header that needs to be added to the documentation
+ */
+ public Content getClassContentHeader();
+
+ /**
+ * Add the class tree documentation.
+ *
+ * @param classContentTree class content tree to which the documentation will be added
+ */
+ public void addClassTree(Content classContentTree);
+
+ /**
+ * Get the class information tree header.
+ *
+ * @return class informaion tree header that needs to be added to the documentation
+ */
+ public Content getClassInfoTreeHeader();
+
+ /**
+ * Add the type parameter information.
+ *
+ * @param classInfoTree content tree to which the documentation will be added
+ */
+ public void addTypeParamInfo(Content classInfoTree);
+
+ /**
+ * Add all super interfaces if this is an interface.
+ *
+ * @param classInfoTree content tree to which the documentation will be added
+ */
+ public void addSuperInterfacesInfo(Content classInfoTree);
+
+ /**
+ * Add all implemented interfaces if this is a class.
+ *
+ * @param classInfoTree content tree to which the documentation will be added
+ */
+ public void addImplementedInterfacesInfo(Content classInfoTree);
+
+ /**
+ * Add all the classes that extend this one.
+ *
+ * @param classInfoTree content tree to which the documentation will be added
+ */
+ public void addSubClassInfo(Content classInfoTree);
+
+ /**
+ * Add all the interfaces that extend this one.
+ *
+ * @param classInfoTree content tree to which the documentation will be added
+ */
+ public void addSubInterfacesInfo(Content classInfoTree);
+
+ /**
+ * If this is an interface, add all classes that implement this
+ * interface.
+ *
+ * @param classInfoTree content tree to which the documentation will be added
+ */
+ public void addInterfaceUsageInfo(Content classInfoTree);
+
+ /**
+ * If this is an inner class or interface, add the enclosing class or
+ * interface.
+ *
+ * @param classInfoTree content tree to which the documentation will be added
+ */
+ public void addNestedClassInfo (Content classInfoTree);
+
+ /**
+ * Get the class information.
+ *
+ * @param classInfoTree content tree conatining the class information
+ * @return a content tree for the class
+ */
+ public Content getClassInfo(Content classInfoTree);
+
+ /**
+ * If this class is deprecated, add the appropriate information.
+ *
+ * @param classInfoTree content tree to which the documentation will be added
+ */
+ public void addClassDeprecationInfo (Content classInfoTree);
+
+ /**
+ * Add the signature of the current class content tree.
+ *
+ * @param modifiers the modifiers for the signature
+ * @param classInfoTree the class content tree to which the signature will be added
+ */
+ public void addClassSignature(String modifiers, Content classInfoTree);
/**
* Build the class description.
+ *
+ * @param classInfoTree content tree to which the documentation will be added
*/
- public void writeClassDescription();
+ public void addClassDescription(Content classInfoTree);
/**
- * Write the tag information for the current class.
+ * Add the tag information for the current class.
+ *
+ * @param classInfoTree content tree to which the tag information will be added
*/
- public void writeClassTagInfo();
+ public void addClassTagInfo(Content classInfoTree);
/**
- * Write the footer of the page.
+ * Get the member tree header for the class.
+ *
+ * @return a content tree for the member tree header
*/
- public void writeFooter();
+ public Content getMemberTreeHeader();
+
+ /**
+ * Add the footer of the page.
+ *
+ * @param contentTree content tree to which the footer will be added
+ */
+ public void addFooter(Content contentTree);
+
+ /**
+ * Print the document.
+ *
+ * @param contentTree content tree that will be printed as a document
+ */
+ public void printDocument(Content contentTree);
/**
* Close the writer.
@@ -130,8 +194,18 @@ public interface ClassWriter {
public ClassDoc getClassDoc();
/**
- * Perform any operations that are necessary when the member summary
- * finished building.
+ * Get the member summary tree.
+ *
+ * @param memberTree the content tree used to build the summary tree
+ * @return a content tree for the member summary
*/
- public void completeMemberSummaryBuild();
+ public Content getMemberSummaryTree(Content memberTree);
+
+ /**
+ * Get the member details tree.
+ *
+ * @param memberTree the content tree used to build the details tree
+ * @return a content tree for the member details
+ */
+ public Content getMemberDetailsTree(Content memberTree);
}
diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java
index 5c7133232b4..6598ee81043 100644
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java
@@ -25,9 +25,9 @@
package com.sun.tools.doclets.internal.toolkit;
-import com.sun.javadoc.*;
import java.util.*;
import java.io.*;
+import com.sun.javadoc.*;
/**
* The interface for writing constants summary output.
@@ -37,38 +37,34 @@ import java.io.*;
* Do not use it as an API
*
* @author Jamie Ho
+ * @author Bhavesh Patel (Modified)
* @since 1.5
*/
public interface ConstantsSummaryWriter {
- /**
- * Write the header for the summary.
- */
- public abstract void writeHeader();
-
- /**
- * Write the footer for the summary.
- */
- public abstract void writeFooter();
-
/**
* Close the writer.
*/
public abstract void close() throws IOException;
/**
- * Write the header for the index.
+ * Get the header for the constant summary documentation.
+ *
+ * @return header that needs to be added to the documentation
*/
- public abstract void writeContentsHeader();
+ public abstract Content getHeader();
/**
- * Write the footer for the index.
+ * Get the header for the constant content list.
+ *
+ * @return content header that needs to be added to the documentation
*/
- public abstract void writeContentsFooter();
+ public abstract Content getContentsHeader();
/**
- * Add the given package name to the index.
+ * Adds the given package name link to the constant content list tree.
+ *
* @param pkg the {@link PackageDoc} to index.
* @param parsedPackageName the parsed package name. We only Write the
* first 2 directory levels of the package
@@ -77,38 +73,70 @@ public interface ConstantsSummaryWriter {
* @param WriteedPackageHeaders the set of package headers that have already
* been indexed. We don't want to index
* something more than once.
+ * @param contentListTree the content tree to which the link will be added
*/
- public abstract void writeLinkToPackageContent(PackageDoc pkg, String parsedPackageName,
- Setoverwrite
is true and
+ * the destination file already exists, overwrite it.
+ *
+ * @param configuration Holds the error message
+ * @param file The name of the file to copy
+ * @param source The source directory
+ * @param destination The destination directory where the file needs to be copied
+ * @param overwrite A flag to indicate whether the file in the
+ * destination directory will be overwritten if
+ * it already exists.
+ */
+ public static void copyFile(Configuration configuration, String file, String source,
+ String destination, boolean overwrite) {
+ DirectoryManager.createDirectory(configuration, destination);
+ File destfile = new File(destination, file);
if(destfile.exists() && (! overwrite)) return;
try {
-
InputStream in = Configuration.class.getResourceAsStream(
- "resources/" + resourcefile);
-
+ source + DirectoryManager.URL_FILE_SEPARATOR + file);
if(in==null) return;
-
OutputStream out = new FileOutputStream(destfile);
byte[] buf = new byte[2048];
int n;
while((n = in.read(buf))>0) out.write(buf,0,n);
-
in.close();
out.close();
} catch(Throwable t) {}
@@ -357,12 +375,12 @@ public class Util {
try{
String pkgPath = DirectoryManager.getDirectoryPath(pkgDoc);
String completePath = new SourcePath(configuration.sourcepath).
- getDirectory(pkgPath) + DirectoryManager.URL_FILE_SEPERATOR;
+ getDirectory(pkgPath) + DirectoryManager.URL_FILE_SEPARATOR;
//Make sure that both paths are using the same seperators.
completePath = Util.replaceText(completePath, File.separator,
- DirectoryManager.URL_FILE_SEPERATOR);
+ DirectoryManager.URL_FILE_SEPARATOR);
pkgPath = Util.replaceText(pkgPath, File.separator,
- DirectoryManager.URL_FILE_SEPERATOR);
+ DirectoryManager.URL_FILE_SEPARATOR);
return completePath.substring(0, completePath.indexOf(pkgPath));
} catch (Exception e){
return "";
@@ -571,6 +589,24 @@ public class Util {
return result;
}
+ /**
+ * Given a string, strips all html characters and
+ * return the result.
+ *
+ * @param rawString The string to check.
+ * @return the original string with all of the HTML characters
+ * stripped.
+ *
+ */
+ public static String stripHtml(String rawString) {
+ // remove HTML tags
+ rawString = rawString.replaceAll("\\<.*?>", " ");
+ // consolidate multiple spaces between a word to a single space
+ rawString = rawString.replaceAll("\\b\\s{2,}\\b", " ");
+ // remove extra whitespaces
+ return rawString.trim();
+ }
+
/**
* Create the directory path for the file to be generated, construct
* FileOutputStream and OutputStreamWriter depending upon docencoding.
diff --git a/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java b/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java
index 73b6710cad0..6edcf204bf8 100644
--- a/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java
+++ b/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java
@@ -84,17 +84,17 @@ public class AccessAsciiArt {
// Test the top line of the class tree
{
-" public class " + - "C1" + NL + "extends " + - "java.lang.Object" + NL + "implements " + - "java.io.Serializable"}, - {BUG_ID + FS + "pkg1" + FS + "C4.html", "
public class C1" + NL + + "extends java.lang.Object" + NL + "implements java.io.Serializable"}, + {BUG_ID + FS + "pkg1" + FS + "C4.html", "
C2
, " + NL +
- "" +
- "Serialized FormsetUndecorated(boolean)
." + NL + "
" +
- "setUndecorated(boolean)
" + NL + "
title
- the titletest
" +
- " - boolean valuejava.lang.IllegalArgumentException
" +
- " - if the owner
's" + NL + " GraphicsConfiguration" +
- "
is not from a screen device" +
- "HeadlessException
" + NL + - "
undecorated
- true
" +
- " if no decorations are" + NL + " to be enabled;" + NL +
- " false
if decorations are to be enabled." +
- "" +
- "readObject()
" +
- "java.io.IOException
setUndecorated(boolean)
" + NL +"
" + NL +"
setUndecorated(boolean)
." + NL + "" + NL + - "
" + NL + "
set
- boolean" + NL + "
" +
- "java.io.IOException
C1.setUndecorated(boolean)
setUndecorated(boolean)
." + NL + "
C1.setUndecorated(boolean)
setUndecorated(boolean)
." + NL + "" + NL + - "
" + NL + - "
" +
- "IOException
java.io.IOException
" + NL + "
" +
- "setUndecorated(boolean)
.setUndecorated(boolean)
." + NL + "" + NL + - "
" + NL + - "protected C5()" + NL + "
" + NL + - "public void printInfo()" + NL + "
" + NL + "boolean " + - "undecorated" + NL + "
" +
- "setUndecorated(boolean)
.setUndecorated(boolean)
." + NL + "" + NL + - "
" + NL + "int " + - "publicKey" + NL + "
" +
+ "C2
, " + NL + "" +
+ "Serialized FormsetUndecorated(boolean)
title" +
+ "
- the titletest
- boolean value" +
+ "java.lang.IllegalArgumentException
- if the " +
+ "owner
's" + NL +
+ " GraphicsConfiguration
is not from a screen " +
+ "deviceHeadlessException
undecorated" +
+ "
- true
if no decorations are" + NL +
+ " to be enabled;" + NL + " false
" +
+ "if decorations are to be enabled.readObject()" +
+ "
java.io.IOException
setUndecorated(boolean)
set
- boolean" +
+ "java.io.IOException
C1.setUndecorated(boolean)
setUndecorated(boolean)
." + NL +
+ "C1.setUndecorated(boolean)
setUndecorated(boolean)
." + NL +
+ "" +
+ "IOException
java.io.IOException
C2
, " + NL +
- "" +
- "Serialized Form" + NL + "
title
- the titletest
" +
- " - boolean valuejava.lang.IllegalArgumentException
" +
- " - if the owner
's" + NL + " GraphicsConfiguration" +
- "
is not from a screen device" +
- "HeadlessException
" + NL + - "
undecorated
- true
" +
+ {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "C2
, " + NL + "" +
+ "Serialized Formtitle
- the title" +
+ "test
- boolean valuejava.lang.IllegalArgumentException" +
+ "
- if the owner
's" + NL + " GraphicsConfiguration" +
+ "
is not from a screen device" +
+ "HeadlessException
undecorated
- true
" +
" if no decorations are" + NL + " to be enabled;" + NL +
" false
if decorations are to be enabled." +
- "" +
- "readObject()
" +
- "java.io.IOException
setUndecorated(boolean)
" + NL +"
" + NL +"
" + NL + "
" +
- "java.io.IOException
C1.setUndecorated(boolean)
setUndecorated(boolean)
." + NL + "
C1.setUndecorated(boolean)
setUndecorated(boolean)
." + NL + "" + NL + - "
" + NL + - "
" +
- "IOException
java.io.IOException
" + NL + "
readObject()
java.io.IOException
setUndecorated(boolean)
" +
+ "java.io.IOException
C1.setUndecorated(boolean)
setUndecorated(boolean)
." + NL +
+ "C1.setUndecorated(boolean)
setUndecorated(boolean)
." + NL +
+ "" +
+ "IOException
java.io.IOException
" + NL + "public void " + - "readObject()" + NL + " throws" + - " java.io.IOException" + NL + "
" +NL + "public " + - "C2()" + NL + "
" + NL + - "public static final " + - "C1.ModalExclusionType " + - "APPLICATION_EXCLUDE" + NL + "
" + NL + "boolean " + - "undecorated" + NL + "
" +
- "setUndecorated(boolean)
.public void readObject()" + NL + + " throws java.io.IOException" + NL + ""}, + {BUG_ID + FS + "pkg1" + FS + "C2.html", "
public C2()" + NL + + ""}, + {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "
public " + + "static final C1.ModalExclusionType " + + "APPLICATION_EXCLUDE" + NL + ""}, + {BUG_ID + FS + "serialized-form.html", "
boolean " + + "undecorated" + NL + "
" +
+ "setUndecorated(boolean)
.setUndecorated(boolean)
." + NL + "" + NL + - "
" + NL + "int " + - "publicKey" + NL + "
setUndecorated(boolean)
." + NL + ""}};
// Test for valid HTML generation which should not comprise of empty
// definition list tags.
private static final String[][] NEGATED_TEST = {
- {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "This document is generated from sample source code and HTML files with examples of a wide variety of Java language constructs: packages, subclasses, subinterfaces, nested classes, nested interfaces,inheriting from other packages, constructors, fields,methods, and so forth. Click Here to <test> out a link.
+ +