feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
157
jdkSrc/jdk8/com/sun/tools/doclets/Taglet.java
Normal file
157
jdkSrc/jdk8/com/sun/tools/doclets/Taglet.java
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2006, 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;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for a custom tag used by Doclets. A custom
|
||||
* tag must implement this interface. To be loaded and used by
|
||||
* doclets at run-time, the taglet must have a static method called
|
||||
* <code>register</code> that accepts a {@link java.util.Map} as an
|
||||
* argument with the following signature:
|
||||
* <pre>
|
||||
* public void register(Map map)
|
||||
* </pre>
|
||||
* This method should add an instance of the custom taglet to the map
|
||||
* with the name of the taglet as the key. If overriding a taglet,
|
||||
* to avoid a name conflict, the overridden taglet must be deleted from
|
||||
* the map before an instance of the new taglet is added to the map.
|
||||
* <p>
|
||||
* It is recommended that the taglet throw an exception when it fails
|
||||
* to register itself. The exception that it throws is up to the user.
|
||||
* <p>
|
||||
* Here are two sample taglets: <br>
|
||||
* <ul>
|
||||
* <li><a href="{@docRoot}/../../../../technotes/guides/javadoc/taglet/ToDoTaglet.java">ToDoTaglet.java</a>
|
||||
* - Standalone taglet</li>
|
||||
* <li><a href="{@docRoot}/../../../../technotes/guides/javadoc/taglet/UnderlineTaglet.java">UnderlineTaglet.java</a>
|
||||
* - Inline taglet</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* For more information on how to create your own Taglets, please see the
|
||||
* <a href="{@docRoot}/../../../../technotes/guides/javadoc/taglet/overview.html">Taglet Overview</a>.
|
||||
*
|
||||
* @since 1.4
|
||||
* @author Jamie Ho
|
||||
*/
|
||||
|
||||
public interface Taglet {
|
||||
|
||||
/**
|
||||
* Return true if this <code>Taglet</code>
|
||||
* is used in field documentation. Set to
|
||||
* false for inline tags.
|
||||
* @return true if this <code>Taglet</code>
|
||||
* is used in field documentation and false
|
||||
* otherwise.
|
||||
*/
|
||||
public abstract boolean inField();
|
||||
|
||||
/**
|
||||
* Return true if this <code>Taglet</code>
|
||||
* is used in constructor documentation. Set to
|
||||
* false for inline tags.
|
||||
* @return true if this <code>Taglet</code>
|
||||
* is used in constructor documentation and false
|
||||
* otherwise.
|
||||
*/
|
||||
public abstract boolean inConstructor();
|
||||
|
||||
/**
|
||||
* Return true if this <code>Taglet</code>
|
||||
* is used in method documentation. Set to
|
||||
* false for inline tags.
|
||||
* @return true if this <code>Taglet</code>
|
||||
* is used in method documentation and false
|
||||
* otherwise.
|
||||
*/
|
||||
public abstract boolean inMethod();
|
||||
|
||||
/**
|
||||
* Return true if this <code>Taglet</code>
|
||||
* is used in overview documentation. Set to
|
||||
* false for inline tags.
|
||||
* @return true if this <code>Taglet</code>
|
||||
* is used in method documentation and false
|
||||
* otherwise.
|
||||
*/
|
||||
public abstract boolean inOverview();
|
||||
|
||||
/**
|
||||
* Return true if this <code>Taglet</code>
|
||||
* is used in package documentation. Set to
|
||||
* false for inline tags.
|
||||
* @return true if this <code>Taglet</code>
|
||||
* is used in package documentation and false
|
||||
* otherwise.
|
||||
*/
|
||||
public abstract boolean inPackage();
|
||||
|
||||
/**
|
||||
* Return true if this <code>Taglet</code>
|
||||
* is used in type documentation (classes or
|
||||
* interfaces). Set to false for inline tags.
|
||||
* @return true if this <code>Taglet</code>
|
||||
* is used in type documentation and false
|
||||
* otherwise.
|
||||
*/
|
||||
public abstract boolean inType();
|
||||
|
||||
/**
|
||||
* Return true if this <code>Taglet</code>
|
||||
* is an inline tag. Return false otherwise.
|
||||
* @return true if this <code>Taglet</code>
|
||||
* is an inline tag and false otherwise.
|
||||
*/
|
||||
public abstract boolean isInlineTag();
|
||||
|
||||
/**
|
||||
* Return the name of this custom tag.
|
||||
* @return the name of this custom tag.
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Given the <code>Tag</code> representation of this custom
|
||||
* tag, return its string representation, which is output
|
||||
* to the generated page.
|
||||
* @param tag the <code>Tag</code> representation of this custom tag.
|
||||
* @return the string representation of this <code>Tag</code>.
|
||||
*/
|
||||
public abstract String toString(Tag tag);
|
||||
|
||||
/**
|
||||
* Given an array of <code>Tag</code>s representing this custom
|
||||
* tag, return its string representation, which is output
|
||||
* to the generated page. This method should
|
||||
* return null if this taglet represents an inline tag.
|
||||
* @param tags the array of <code>Tag</code>s representing of this custom tag.
|
||||
* @return the string representation of this <code>Tag</code>.
|
||||
*/
|
||||
public abstract String toString(Tag[] tags);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Print method and constructor info.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Robert Field
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public abstract class AbstractExecutableMemberWriter extends AbstractMemberWriter {
|
||||
|
||||
public AbstractExecutableMemberWriter(SubWriterHolderWriter writer,
|
||||
ClassDoc classdoc) {
|
||||
super(writer, classdoc);
|
||||
}
|
||||
|
||||
public AbstractExecutableMemberWriter(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the type parameters for the executable member.
|
||||
*
|
||||
* @param member the member to write type parameters for.
|
||||
* @param htmltree the content tree to which the parameters will be added.
|
||||
* @return the display length required to write this information.
|
||||
*/
|
||||
protected void addTypeParameters(ExecutableMemberDoc member, Content htmltree) {
|
||||
Content typeParameters = getTypeParameters(member);
|
||||
if (!typeParameters.isEmpty()) {
|
||||
htmltree.addContent(typeParameters);
|
||||
htmltree.addContent(writer.getSpace());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type parameters for the executable member.
|
||||
*
|
||||
* @param member the member for which to get the type parameters.
|
||||
* @return the type parameters.
|
||||
*/
|
||||
protected Content getTypeParameters(ExecutableMemberDoc member) {
|
||||
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.MEMBER_TYPE_PARAMS, member);
|
||||
return writer.getTypeParameterLinks(linkInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getDeprecatedLink(ProgramElementDoc member) {
|
||||
ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
|
||||
return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, (MemberDoc) emd,
|
||||
emd.qualifiedName() + emd.flatSignature());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the summary link for the member.
|
||||
*
|
||||
* @param context the id of the context where the link will be printed
|
||||
* @param cd the classDoc that we should link to
|
||||
* @param member the member being linked to
|
||||
* @param tdSummary the content tree to which the link will be added
|
||||
*/
|
||||
protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
|
||||
Content tdSummary) {
|
||||
ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
|
||||
String name = emd.name();
|
||||
Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
|
||||
writer.getDocLink(context, cd, (MemberDoc) emd,
|
||||
name, false));
|
||||
Content code = HtmlTree.CODE(memberLink);
|
||||
addParameters(emd, false, code, name.length() - 1);
|
||||
tdSummary.addContent(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the inherited summary link for the member.
|
||||
*
|
||||
* @param cd the classDoc that we should link to
|
||||
* @param member the member being linked to
|
||||
* @param linksTree the content tree to which the link will be added
|
||||
*/
|
||||
protected void addInheritedSummaryLink(ClassDoc cd,
|
||||
ProgramElementDoc member, Content linksTree) {
|
||||
linksTree.addContent(
|
||||
writer.getDocLink(LinkInfoImpl.Kind.MEMBER, cd, (MemberDoc) member,
|
||||
member.name(), false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the parameter for the executable member.
|
||||
*
|
||||
* @param member the member to write parameter for.
|
||||
* @param param the parameter that needs to be written.
|
||||
* @param isVarArg true if this is a link to var arg.
|
||||
* @param tree the content tree to which the parameter information will be added.
|
||||
*/
|
||||
protected void addParam(ExecutableMemberDoc member, Parameter param,
|
||||
boolean isVarArg, Content tree) {
|
||||
if (param.type() != null) {
|
||||
Content link = writer.getLink(new LinkInfoImpl(
|
||||
configuration, LinkInfoImpl.Kind.EXECUTABLE_MEMBER_PARAM,
|
||||
param.type()).varargs(isVarArg));
|
||||
tree.addContent(link);
|
||||
}
|
||||
if(param.name().length() > 0) {
|
||||
tree.addContent(writer.getSpace());
|
||||
tree.addContent(param.name());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the receiver annotations information.
|
||||
*
|
||||
* @param member the member to write receiver annotations for.
|
||||
* @param rcvrType the receiver type.
|
||||
* @param descList list of annotation description.
|
||||
* @param tree the content tree to which the information will be added.
|
||||
*/
|
||||
protected void addReceiverAnnotations(ExecutableMemberDoc member, Type rcvrType,
|
||||
AnnotationDesc[] descList, Content tree) {
|
||||
writer.addReceiverAnnotationInfo(member, descList, tree);
|
||||
tree.addContent(writer.getSpace());
|
||||
tree.addContent(rcvrType.typeName());
|
||||
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_SIGNATURE, rcvrType);
|
||||
tree.addContent(writer.getTypeParameterLinks(linkInfo));
|
||||
tree.addContent(writer.getSpace());
|
||||
tree.addContent("this");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add all the parameters for the executable member.
|
||||
*
|
||||
* @param member the member to write parameters for.
|
||||
* @param htmltree the content tree to which the parameters information will be added.
|
||||
*/
|
||||
protected void addParameters(ExecutableMemberDoc member, Content htmltree, int indentSize) {
|
||||
addParameters(member, true, htmltree, indentSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all the parameters for the executable member.
|
||||
*
|
||||
* @param member the member to write parameters for.
|
||||
* @param includeAnnotations true if annotation information needs to be added.
|
||||
* @param htmltree the content tree to which the parameters information will be added.
|
||||
*/
|
||||
protected void addParameters(ExecutableMemberDoc member,
|
||||
boolean includeAnnotations, Content htmltree, int indentSize) {
|
||||
htmltree.addContent("(");
|
||||
String sep = "";
|
||||
Parameter[] params = member.parameters();
|
||||
String indent = makeSpace(indentSize + 1);
|
||||
Type rcvrType = member.receiverType();
|
||||
if (includeAnnotations && rcvrType instanceof AnnotatedType) {
|
||||
AnnotationDesc[] descList = rcvrType.asAnnotatedType().annotations();
|
||||
if (descList.length > 0) {
|
||||
addReceiverAnnotations(member, rcvrType, descList, htmltree);
|
||||
sep = "," + DocletConstants.NL + indent;
|
||||
}
|
||||
}
|
||||
int paramstart;
|
||||
for (paramstart = 0; paramstart < params.length; paramstart++) {
|
||||
htmltree.addContent(sep);
|
||||
Parameter param = params[paramstart];
|
||||
if (!param.name().startsWith("this$")) {
|
||||
if (includeAnnotations) {
|
||||
boolean foundAnnotations =
|
||||
writer.addAnnotationInfo(indent.length(),
|
||||
member, param, htmltree);
|
||||
if (foundAnnotations) {
|
||||
htmltree.addContent(DocletConstants.NL);
|
||||
htmltree.addContent(indent);
|
||||
}
|
||||
}
|
||||
addParam(member, param,
|
||||
(paramstart == params.length - 1) && member.isVarArgs(), htmltree);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = paramstart + 1; i < params.length; i++) {
|
||||
htmltree.addContent(",");
|
||||
htmltree.addContent(DocletConstants.NL);
|
||||
htmltree.addContent(indent);
|
||||
if (includeAnnotations) {
|
||||
boolean foundAnnotations =
|
||||
writer.addAnnotationInfo(indent.length(), member, params[i],
|
||||
htmltree);
|
||||
if (foundAnnotations) {
|
||||
htmltree.addContent(DocletConstants.NL);
|
||||
htmltree.addContent(indent);
|
||||
}
|
||||
}
|
||||
addParam(member, params[i], (i == params.length - 1) && member.isVarArgs(),
|
||||
htmltree);
|
||||
}
|
||||
htmltree.addContent(")");
|
||||
}
|
||||
|
||||
/**
|
||||
* Add exceptions for the executable member.
|
||||
*
|
||||
* @param member the member to write exceptions for.
|
||||
* @param htmltree the content tree to which the exceptions information will be added.
|
||||
*/
|
||||
protected void addExceptions(ExecutableMemberDoc member, Content htmltree, int indentSize) {
|
||||
Type[] exceptions = member.thrownExceptionTypes();
|
||||
if (exceptions.length > 0) {
|
||||
LinkInfoImpl memberTypeParam = new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.MEMBER, member);
|
||||
String indent = makeSpace(indentSize + 1 - 7);
|
||||
htmltree.addContent(DocletConstants.NL);
|
||||
htmltree.addContent(indent);
|
||||
htmltree.addContent("throws ");
|
||||
indent = makeSpace(indentSize + 1);
|
||||
Content link = writer.getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.MEMBER, exceptions[0]));
|
||||
htmltree.addContent(link);
|
||||
for(int i = 1; i < exceptions.length; i++) {
|
||||
htmltree.addContent(",");
|
||||
htmltree.addContent(DocletConstants.NL);
|
||||
htmltree.addContent(indent);
|
||||
Content exceptionLink = writer.getLink(new LinkInfoImpl(
|
||||
configuration, LinkInfoImpl.Kind.MEMBER, exceptions[i]));
|
||||
htmltree.addContent(exceptionLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected ClassDoc implementsMethodInIntfac(MethodDoc method,
|
||||
ClassDoc[] intfacs) {
|
||||
for (int i = 0; i < intfacs.length; i++) {
|
||||
MethodDoc[] methods = intfacs[i].methods();
|
||||
if (methods.length > 0) {
|
||||
for (int j = 0; j < methods.length; j++) {
|
||||
if (methods[j].name().equals(method.name()) &&
|
||||
methods[j].signature().equals(method.signature())) {
|
||||
return intfacs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* For backward compatibility, include an anchor using the erasures of the
|
||||
* parameters. NOTE: We won't need this method anymore after we fix
|
||||
* see tags so that they use the type instead of the erasure.
|
||||
*
|
||||
* @param emd the ExecutableMemberDoc to anchor to.
|
||||
* @return the 1.4.x style anchor for the ExecutableMemberDoc.
|
||||
*/
|
||||
protected String getErasureAnchor(ExecutableMemberDoc emd) {
|
||||
StringBuilder buf = new StringBuilder(emd.name() + "(");
|
||||
Parameter[] params = emd.parameters();
|
||||
boolean foundTypeVariable = false;
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
if (i > 0) {
|
||||
buf.append(",");
|
||||
}
|
||||
Type t = params[i].type();
|
||||
foundTypeVariable = foundTypeVariable || t.asTypeVariable() != null;
|
||||
buf.append(t.isPrimitive() ?
|
||||
t.typeName() : t.asClassDoc().qualifiedName());
|
||||
buf.append(t.dimension());
|
||||
}
|
||||
buf.append(")");
|
||||
return foundTypeVariable ? writer.getName(buf.toString()) : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Generate Index for all the Member Names with Indexing in
|
||||
* Unicode Order. This class is a base class for {@link SingleIndexWriter} and
|
||||
* {@link SplitIndexWriter}. It uses the functionality from
|
||||
* {@link HtmlDocletWriter} to generate the Index Contents.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @see IndexBuilder
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* The index of all the members with unicode character.
|
||||
*/
|
||||
protected IndexBuilder indexbuilder;
|
||||
|
||||
/**
|
||||
* This constructor will be used by {@link SplitIndexWriter}. Initializes
|
||||
* path to this file and relative path from this file.
|
||||
*
|
||||
* @param configuration The current configuration
|
||||
* @param path Path to the file which is getting generated.
|
||||
* @param indexbuilder Unicode based Index from {@link IndexBuilder}
|
||||
*/
|
||||
protected AbstractIndexWriter(ConfigurationImpl configuration,
|
||||
DocPath path,
|
||||
IndexBuilder indexbuilder)
|
||||
throws IOException {
|
||||
super(configuration, path);
|
||||
this.indexbuilder = indexbuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the index label for navigation bar.
|
||||
*
|
||||
* @return a content tree for the tree label
|
||||
*/
|
||||
protected Content getNavLinkIndex() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, indexLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the member information for the unicode character along with the
|
||||
* list of the members.
|
||||
*
|
||||
* @param unicode Unicode for which member list information to be generated
|
||||
* @param memberlist List of members for the unicode character
|
||||
* @param contentTree the content tree to which the information will be added
|
||||
*/
|
||||
protected void addContents(Character uc, List<? extends Doc> memberlist,
|
||||
Content contentTree) {
|
||||
String unicode = uc.toString();
|
||||
contentTree.addContent(getMarkerAnchorForIndex(unicode));
|
||||
Content headContent = new StringContent(unicode);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false,
|
||||
HtmlStyle.title, headContent);
|
||||
contentTree.addContent(heading);
|
||||
int memberListSize = memberlist.size();
|
||||
// Display the list only if there are elements to be displayed.
|
||||
if (memberListSize > 0) {
|
||||
Content dl = new HtmlTree(HtmlTag.DL);
|
||||
for (int i = 0; i < memberListSize; i++) {
|
||||
Doc element = memberlist.get(i);
|
||||
if (element instanceof MemberDoc) {
|
||||
addDescription((MemberDoc)element, dl);
|
||||
} else if (element instanceof ClassDoc) {
|
||||
addDescription((ClassDoc)element, dl);
|
||||
} else if (element instanceof PackageDoc) {
|
||||
addDescription((PackageDoc)element, dl);
|
||||
}
|
||||
}
|
||||
contentTree.addContent(dl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add one line summary comment for the package.
|
||||
*
|
||||
* @param pkg the package to be documented
|
||||
* @param dlTree the content tree to which the description will be added
|
||||
*/
|
||||
protected void addDescription(PackageDoc pkg, Content dlTree) {
|
||||
Content link = getPackageLink(pkg, new StringContent(Util.getPackageName(pkg)));
|
||||
Content dt = HtmlTree.DT(link);
|
||||
dt.addContent(" - ");
|
||||
dt.addContent(getResource("doclet.package"));
|
||||
dt.addContent(" " + pkg.name());
|
||||
dlTree.addContent(dt);
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
addSummaryComment(pkg, dd);
|
||||
dlTree.addContent(dd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add one line summary comment for the class.
|
||||
*
|
||||
* @param cd the class being documented
|
||||
* @param dlTree the content tree to which the description will be added
|
||||
*/
|
||||
protected void addDescription(ClassDoc cd, Content dlTree) {
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.INDEX, cd).strong(true));
|
||||
Content dt = HtmlTree.DT(link);
|
||||
dt.addContent(" - ");
|
||||
addClassInfo(cd, dt);
|
||||
dlTree.addContent(dt);
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
addComment(cd, dd);
|
||||
dlTree.addContent(dd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the classkind (class, interface, exception), error of the class
|
||||
* passed.
|
||||
*
|
||||
* @param cd the class being documented
|
||||
* @param contentTree the content tree to which the class info will be added
|
||||
*/
|
||||
protected void addClassInfo(ClassDoc cd, Content contentTree) {
|
||||
contentTree.addContent(getResource("doclet.in",
|
||||
Util.getTypeName(configuration, cd, false),
|
||||
getPackageLink(cd.containingPackage(),
|
||||
Util.getPackageName(cd.containingPackage()))
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add description for Class, Field, Method or Constructor.
|
||||
*
|
||||
* @param member MemberDoc for the member of the Class Kind
|
||||
* @param dlTree the content tree to which the description will be added
|
||||
*/
|
||||
protected void addDescription(MemberDoc member, Content dlTree) {
|
||||
String name = (member instanceof ExecutableMemberDoc)?
|
||||
member.name() + ((ExecutableMemberDoc)member).flatSignature() :
|
||||
member.name();
|
||||
Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink,
|
||||
getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
|
||||
Content dt = HtmlTree.DT(span);
|
||||
dt.addContent(" - ");
|
||||
addMemberDesc(member, dt);
|
||||
dlTree.addContent(dt);
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
addComment(member, dd);
|
||||
dlTree.addContent(dd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add comment for each element in the index. If the element is deprecated
|
||||
* and it has a @deprecated tag, use that comment. Else if the containing
|
||||
* class for this element is deprecated, then add the word "Deprecated." at
|
||||
* the start and then print the normal comment.
|
||||
*
|
||||
* @param element Index element
|
||||
* @param contentTree the content tree to which the comment will be added
|
||||
*/
|
||||
protected void addComment(ProgramElementDoc element, Content contentTree) {
|
||||
Tag[] tags;
|
||||
Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.block);
|
||||
if (Util.isDeprecated(element)) {
|
||||
div.addContent(span);
|
||||
if ((tags = element.tags("deprecated")).length > 0)
|
||||
addInlineDeprecatedComment(element, tags[0], div);
|
||||
contentTree.addContent(div);
|
||||
} else {
|
||||
ClassDoc cont = element.containingClass();
|
||||
while (cont != null) {
|
||||
if (Util.isDeprecated(cont)) {
|
||||
div.addContent(span);
|
||||
contentTree.addContent(div);
|
||||
break;
|
||||
}
|
||||
cont = cont.containingClass();
|
||||
}
|
||||
addSummaryComment(element, contentTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add description about the Static Varible/Method/Constructor for a
|
||||
* member.
|
||||
*
|
||||
* @param member MemberDoc for the member within the Class Kind
|
||||
* @param contentTree the content tree to which the member description will be added
|
||||
*/
|
||||
protected void addMemberDesc(MemberDoc member, Content contentTree) {
|
||||
ClassDoc containing = member.containingClass();
|
||||
String classdesc = Util.getTypeName(
|
||||
configuration, containing, true) + " ";
|
||||
if (member.isField()) {
|
||||
if (member.isStatic()) {
|
||||
contentTree.addContent(
|
||||
getResource("doclet.Static_variable_in", classdesc));
|
||||
} else {
|
||||
contentTree.addContent(
|
||||
getResource("doclet.Variable_in", classdesc));
|
||||
}
|
||||
} else if (member.isConstructor()) {
|
||||
contentTree.addContent(
|
||||
getResource("doclet.Constructor_for", classdesc));
|
||||
} else if (member.isMethod()) {
|
||||
if (member.isStatic()) {
|
||||
contentTree.addContent(
|
||||
getResource("doclet.Static_method_in", classdesc));
|
||||
} else {
|
||||
contentTree.addContent(
|
||||
getResource("doclet.Method_in", classdesc));
|
||||
}
|
||||
}
|
||||
addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
|
||||
false, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the marker anchor which will be added to the index documentation tree.
|
||||
*
|
||||
* @param anchorNameForIndex the anchor name attribute for index page
|
||||
* @return a content tree for the marker anchor
|
||||
*/
|
||||
public Content getMarkerAnchorForIndex(String anchorNameForIndex) {
|
||||
return getMarkerAnchor(getNameForIndex(anchorNameForIndex), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a valid HTML name for member index page.
|
||||
*
|
||||
* @param unicode the string that needs to be converted to valid HTML name.
|
||||
* @return a valid HTML name string.
|
||||
*/
|
||||
public String getNameForIndex(String unicode) {
|
||||
return "I:" + getName(unicode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,692 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 java.lang.reflect.Modifier;
|
||||
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.taglets.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* The base class for member writers.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Robert Field
|
||||
* @author Atul M Dambalkar
|
||||
* @author Jamie Ho (Re-write)
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public abstract class AbstractMemberWriter {
|
||||
|
||||
protected final ConfigurationImpl configuration;
|
||||
protected final SubWriterHolderWriter writer;
|
||||
protected final ClassDoc classdoc;
|
||||
protected Map<String,Integer> typeMap = new LinkedHashMap<String,Integer>();
|
||||
protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class);
|
||||
private int methodTypesOr = 0;
|
||||
public final boolean nodepr;
|
||||
|
||||
protected boolean printedSummaryHeader = false;
|
||||
|
||||
public AbstractMemberWriter(SubWriterHolderWriter writer, ClassDoc classdoc) {
|
||||
this.configuration = writer.configuration;
|
||||
this.writer = writer;
|
||||
this.nodepr = configuration.nodeprecated;
|
||||
this.classdoc = classdoc;
|
||||
}
|
||||
|
||||
public AbstractMemberWriter(SubWriterHolderWriter writer) {
|
||||
this(writer, null);
|
||||
}
|
||||
|
||||
/*** abstracts ***/
|
||||
|
||||
/**
|
||||
* Add the summary label for the member.
|
||||
*
|
||||
* @param memberTree the content tree to which the label will be added
|
||||
*/
|
||||
public abstract void addSummaryLabel(Content memberTree);
|
||||
|
||||
/**
|
||||
* Get the summary for the member summary table.
|
||||
*
|
||||
* @return a string for the table summary
|
||||
*/
|
||||
public abstract String getTableSummary();
|
||||
|
||||
/**
|
||||
* Get the caption for the member summary table.
|
||||
*
|
||||
* @return a string for the table caption
|
||||
*/
|
||||
public abstract Content getCaption();
|
||||
|
||||
/**
|
||||
* Get the summary table header for the member.
|
||||
*
|
||||
* @param member the member to be documented
|
||||
* @return the summary table header
|
||||
*/
|
||||
public abstract String[] getSummaryTableHeader(ProgramElementDoc member);
|
||||
|
||||
/**
|
||||
* Add inherited summary lable for the member.
|
||||
*
|
||||
* @param cd the class doc to which to link to
|
||||
* @param inheritedTree the content tree to which the inherited summary label will be added
|
||||
*/
|
||||
public abstract void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree);
|
||||
|
||||
/**
|
||||
* Add the anchor for the summary section of the member.
|
||||
*
|
||||
* @param cd the class doc to be documented
|
||||
* @param memberTree the content tree to which the summary anchor will be added
|
||||
*/
|
||||
public abstract void addSummaryAnchor(ClassDoc cd, Content memberTree);
|
||||
|
||||
/**
|
||||
* Add the anchor for the inherited summary section of the member.
|
||||
*
|
||||
* @param cd the class doc to be documented
|
||||
* @param inheritedTree the content tree to which the inherited summary anchor will be added
|
||||
*/
|
||||
public abstract void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree);
|
||||
|
||||
/**
|
||||
* Add the summary type for the member.
|
||||
*
|
||||
* @param member the member to be documented
|
||||
* @param tdSummaryType the content tree to which the type will be added
|
||||
*/
|
||||
protected abstract void addSummaryType(ProgramElementDoc member,
|
||||
Content tdSummaryType);
|
||||
|
||||
/**
|
||||
* Add the summary link for the member.
|
||||
*
|
||||
* @param cd the class doc to be documented
|
||||
* @param member the member to be documented
|
||||
* @param tdSummary the content tree to which the link will be added
|
||||
*/
|
||||
protected void addSummaryLink(ClassDoc cd, ProgramElementDoc member,
|
||||
Content tdSummary) {
|
||||
addSummaryLink(LinkInfoImpl.Kind.MEMBER, cd, member, tdSummary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the summary link for the member.
|
||||
*
|
||||
* @param context the id of the context where the link will be printed
|
||||
* @param cd the class doc to be documented
|
||||
* @param member the member to be documented
|
||||
* @param tdSummary the content tree to which the summary link will be added
|
||||
*/
|
||||
protected abstract void addSummaryLink(LinkInfoImpl.Kind context,
|
||||
ClassDoc cd, ProgramElementDoc member, Content tdSummary);
|
||||
|
||||
/**
|
||||
* Add the inherited summary link for the member.
|
||||
*
|
||||
* @param cd the class doc to be documented
|
||||
* @param member the member to be documented
|
||||
* @param linksTree the content tree to which the inherited summary link will be added
|
||||
*/
|
||||
protected abstract void addInheritedSummaryLink(ClassDoc cd,
|
||||
ProgramElementDoc member, Content linksTree);
|
||||
|
||||
/**
|
||||
* Get the deprecated link.
|
||||
*
|
||||
* @param member the member being linked to
|
||||
* @return a content tree representing the link
|
||||
*/
|
||||
protected abstract Content getDeprecatedLink(ProgramElementDoc member);
|
||||
|
||||
/**
|
||||
* Get the navigation summary link.
|
||||
*
|
||||
* @param cd the class doc to be documented
|
||||
* @param link true if its a link else the label to be printed
|
||||
* @return a content tree for the navigation summary link.
|
||||
*/
|
||||
protected abstract Content getNavSummaryLink(ClassDoc cd, boolean link);
|
||||
|
||||
/**
|
||||
* Add the navigation detail link.
|
||||
*
|
||||
* @param link true if its a link else the label to be printed
|
||||
* @param liNav the content tree to which the navigation detail link will be added
|
||||
*/
|
||||
protected abstract void addNavDetailLink(boolean link, Content liNav);
|
||||
|
||||
/**
|
||||
* Add the member name to the content tree.
|
||||
*
|
||||
* @param name the member name to be added to the content tree.
|
||||
* @param htmltree the content tree to which the name will be added.
|
||||
*/
|
||||
protected void addName(String name, Content htmltree) {
|
||||
htmltree.addContent(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string describing the access modifier flags.
|
||||
* Don't include native or synchronized.
|
||||
*
|
||||
* The modifier names are returned in canonical order, as
|
||||
* specified by <em>The Java Language Specification</em>.
|
||||
*/
|
||||
protected String modifierString(MemberDoc member) {
|
||||
int ms = member.modifierSpecifier();
|
||||
int no = Modifier.NATIVE | Modifier.SYNCHRONIZED;
|
||||
return Modifier.toString(ms & ~no);
|
||||
}
|
||||
|
||||
protected String typeString(MemberDoc member) {
|
||||
String type = "";
|
||||
if (member instanceof MethodDoc) {
|
||||
type = ((MethodDoc)member).returnType().toString();
|
||||
} else if (member instanceof FieldDoc) {
|
||||
type = ((FieldDoc)member).type().toString();
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the modifier for the member.
|
||||
*
|
||||
* @param member the member for which teh modifier will be added.
|
||||
* @param htmltree the content tree to which the modifier information will be added.
|
||||
*/
|
||||
protected void addModifiers(MemberDoc member, Content htmltree) {
|
||||
String mod = modifierString(member);
|
||||
// According to JLS, we should not be showing public modifier for
|
||||
// interface methods.
|
||||
if ((member.isField() || member.isMethod()) &&
|
||||
writer instanceof ClassWriterImpl &&
|
||||
((ClassWriterImpl) writer).getClassDoc().isInterface()) {
|
||||
// This check for isDefault() and the default modifier needs to be
|
||||
// added for it to appear on the method details section. Once the
|
||||
// default modifier is added to the Modifier list on DocEnv and once
|
||||
// it is updated to use the javax.lang.model.element.Modifier, we
|
||||
// will need to remove this.
|
||||
mod = (member.isMethod() && ((MethodDoc)member).isDefault()) ?
|
||||
Util.replaceText(mod, "public", "default").trim() :
|
||||
Util.replaceText(mod, "public", "").trim();
|
||||
}
|
||||
if(mod.length() > 0) {
|
||||
htmltree.addContent(mod);
|
||||
htmltree.addContent(writer.getSpace());
|
||||
}
|
||||
}
|
||||
|
||||
protected String makeSpace(int len) {
|
||||
if (len <= 0) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
sb.append(' ');
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the modifier and type for the member in the member summary.
|
||||
*
|
||||
* @param member the member to add the type for
|
||||
* @param type the type to add
|
||||
* @param tdSummaryType the content tree to which the modified and type will be added
|
||||
*/
|
||||
protected void addModifierAndType(ProgramElementDoc member, Type type,
|
||||
Content tdSummaryType) {
|
||||
HtmlTree code = new HtmlTree(HtmlTag.CODE);
|
||||
addModifier(member, code);
|
||||
if (type == null) {
|
||||
if (member.isClass()) {
|
||||
code.addContent("class");
|
||||
} else {
|
||||
code.addContent("interface");
|
||||
}
|
||||
code.addContent(writer.getSpace());
|
||||
} else {
|
||||
if (member instanceof ExecutableMemberDoc &&
|
||||
((ExecutableMemberDoc) member).typeParameters().length > 0) {
|
||||
Content typeParameters = ((AbstractExecutableMemberWriter) this).getTypeParameters(
|
||||
(ExecutableMemberDoc) member);
|
||||
code.addContent(typeParameters);
|
||||
//Code to avoid ugly wrapping in member summary table.
|
||||
if (typeParameters.charCount() > 10) {
|
||||
code.addContent(new HtmlTree(HtmlTag.BR));
|
||||
} else {
|
||||
code.addContent(writer.getSpace());
|
||||
}
|
||||
code.addContent(
|
||||
writer.getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
|
||||
} else {
|
||||
code.addContent(
|
||||
writer.getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
|
||||
}
|
||||
|
||||
}
|
||||
tdSummaryType.addContent(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the modifier for the member.
|
||||
*
|
||||
* @param member the member to add the type for
|
||||
* @param code the content tree to which the modified will be added
|
||||
*/
|
||||
private void addModifier(ProgramElementDoc member, Content code) {
|
||||
if (member.isProtected()) {
|
||||
code.addContent("protected ");
|
||||
} else if (member.isPrivate()) {
|
||||
code.addContent("private ");
|
||||
} else if (!member.isPublic()) { // Package private
|
||||
code.addContent(configuration.getText("doclet.Package_private"));
|
||||
code.addContent(" ");
|
||||
}
|
||||
if (member.isMethod()) {
|
||||
if (!(member.containingClass().isInterface()) &&
|
||||
((MethodDoc)member).isAbstract()) {
|
||||
code.addContent("abstract ");
|
||||
}
|
||||
// This check for isDefault() and the default modifier needs to be
|
||||
// added for it to appear on the "Modifier and Type" column in the
|
||||
// method summary section. Once the default modifier is added
|
||||
// to the Modifier list on DocEnv and once it is updated to use the
|
||||
// javax.lang.model.element.Modifier, we will need to remove this.
|
||||
if (((MethodDoc)member).isDefault()) {
|
||||
code.addContent("default ");
|
||||
}
|
||||
}
|
||||
if (member.isStatic()) {
|
||||
code.addContent("static ");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the deprecated information for the given member.
|
||||
*
|
||||
* @param member the member being documented.
|
||||
* @param contentTree the content tree to which the deprecated information will be added.
|
||||
*/
|
||||
protected void addDeprecatedInfo(ProgramElementDoc member, Content contentTree) {
|
||||
Content output = (new DeprecatedTaglet()).getTagletOutput(member,
|
||||
writer.getTagletWriterInstance(false));
|
||||
if (!output.isEmpty()) {
|
||||
Content deprecatedContent = output;
|
||||
Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
|
||||
contentTree.addContent(div);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the comment for the given member.
|
||||
*
|
||||
* @param member the member being documented.
|
||||
* @param htmltree the content tree to which the comment will be added.
|
||||
*/
|
||||
protected void addComment(ProgramElementDoc member, Content htmltree) {
|
||||
if (member.inlineTags().length > 0) {
|
||||
writer.addInlineComment(member, htmltree);
|
||||
}
|
||||
}
|
||||
|
||||
protected String name(ProgramElementDoc member) {
|
||||
return member.name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the header for the section.
|
||||
*
|
||||
* @param member the member being documented.
|
||||
* @return a header content for the section.
|
||||
*/
|
||||
protected Content getHead(MemberDoc member) {
|
||||
Content memberContent = new StringContent(member.name());
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent);
|
||||
return heading;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given <code>ProgramElement</code> is inherited
|
||||
* by the class that is being documented.
|
||||
*
|
||||
* @param ped The <code>ProgramElement</code> being checked.
|
||||
* return true if the <code>ProgramElement</code> is being inherited and
|
||||
* false otherwise.
|
||||
*/
|
||||
protected boolean isInherited(ProgramElementDoc ped){
|
||||
if(ped.isPrivate() || (ped.isPackagePrivate() &&
|
||||
! ped.containingPackage().equals(classdoc.containingPackage()))){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 addDeprecatedAPI(List<Doc> deprmembers, String headingKey,
|
||||
String tableSummary, String[] tableHeader, Content contentTree) {
|
||||
if (deprmembers.size() > 0) {
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.deprecatedSummary, 0, 3, 0, tableSummary,
|
||||
writer.getTableCaption(configuration.getResource(headingKey)));
|
||||
table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
for (int i = 0; i < deprmembers.size(); i++) {
|
||||
ProgramElementDoc member =(ProgramElementDoc)deprmembers.get(i);
|
||||
HtmlTree td = HtmlTree.TD(HtmlStyle.colOne, getDeprecatedLink(member));
|
||||
if (member.tags("deprecated").length > 0)
|
||||
writer.addInlineDeprecatedComment(member,
|
||||
member.tags("deprecated")[0], td);
|
||||
HtmlTree tr = HtmlTree.TR(td);
|
||||
if (i%2 == 0)
|
||||
tr.addStyle(HtmlStyle.altColor);
|
||||
else
|
||||
tr.addStyle(HtmlStyle.rowColor);
|
||||
tbody.addContent(tr);
|
||||
}
|
||||
table.addContent(tbody);
|
||||
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
|
||||
Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
|
||||
contentTree.addContent(ul);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add use information to the documentation tree.
|
||||
*
|
||||
* @param mems list of program elements for which the use information will be added
|
||||
* @param heading the section heading
|
||||
* @param tableSummary the summary for the use table
|
||||
* @param contentTree the content tree to which the use information will be added
|
||||
*/
|
||||
protected void addUseInfo(List<? extends ProgramElementDoc> mems,
|
||||
Content heading, String tableSummary, Content contentTree) {
|
||||
if (mems == null) {
|
||||
return;
|
||||
}
|
||||
List<? extends ProgramElementDoc> members = mems;
|
||||
boolean printedUseTableHeader = false;
|
||||
if (members.size() > 0) {
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, tableSummary,
|
||||
writer.getTableCaption(heading));
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
Iterator<? extends ProgramElementDoc> it = members.iterator();
|
||||
for (int i = 0; it.hasNext(); i++) {
|
||||
ProgramElementDoc pgmdoc = it.next();
|
||||
ClassDoc cd = pgmdoc.containingClass();
|
||||
if (!printedUseTableHeader) {
|
||||
table.addContent(writer.getSummaryTableHeader(
|
||||
this.getSummaryTableHeader(pgmdoc), "col"));
|
||||
printedUseTableHeader = true;
|
||||
}
|
||||
HtmlTree tr = new HtmlTree(HtmlTag.TR);
|
||||
if (i % 2 == 0) {
|
||||
tr.addStyle(HtmlStyle.altColor);
|
||||
} else {
|
||||
tr.addStyle(HtmlStyle.rowColor);
|
||||
}
|
||||
HtmlTree tdFirst = new HtmlTree(HtmlTag.TD);
|
||||
tdFirst.addStyle(HtmlStyle.colFirst);
|
||||
writer.addSummaryType(this, pgmdoc, tdFirst);
|
||||
tr.addContent(tdFirst);
|
||||
HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
|
||||
tdLast.addStyle(HtmlStyle.colLast);
|
||||
if (cd != null && !(pgmdoc instanceof ConstructorDoc)
|
||||
&& !(pgmdoc instanceof ClassDoc)) {
|
||||
HtmlTree name = new HtmlTree(HtmlTag.SPAN);
|
||||
name.addStyle(HtmlStyle.typeNameLabel);
|
||||
name.addContent(cd.name() + ".");
|
||||
tdLast.addContent(name);
|
||||
}
|
||||
addSummaryLink(pgmdoc instanceof ClassDoc ?
|
||||
LinkInfoImpl.Kind.CLASS_USE : LinkInfoImpl.Kind.MEMBER,
|
||||
cd, pgmdoc, tdLast);
|
||||
writer.addSummaryLinkComment(this, pgmdoc, tdLast);
|
||||
tr.addContent(tdLast);
|
||||
tbody.addContent(tr);
|
||||
}
|
||||
table.addContent(tbody);
|
||||
contentTree.addContent(table);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the navigation detail link.
|
||||
*
|
||||
* @param members the members to be linked
|
||||
* @param liNav the content tree to which the navigation detail link will be added
|
||||
*/
|
||||
protected void addNavDetailLink(List<?> members, Content liNav) {
|
||||
addNavDetailLink(members.size() > 0 ? true : false, liNav);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the navigation summary link.
|
||||
*
|
||||
* @param members members to be linked
|
||||
* @param visibleMemberMap the visible inherited members map
|
||||
* @param liNav the content tree to which the navigation summary link will be added
|
||||
*/
|
||||
protected void addNavSummaryLink(List<?> members,
|
||||
VisibleMemberMap visibleMemberMap, Content liNav) {
|
||||
if (members.size() > 0) {
|
||||
liNav.addContent(getNavSummaryLink(null, true));
|
||||
return;
|
||||
}
|
||||
ClassDoc icd = classdoc.superclass();
|
||||
while (icd != null) {
|
||||
List<?> inhmembers = visibleMemberMap.getMembersFor(icd);
|
||||
if (inhmembers.size() > 0) {
|
||||
liNav.addContent(getNavSummaryLink(icd, true));
|
||||
return;
|
||||
}
|
||||
icd = icd.superclass();
|
||||
}
|
||||
liNav.addContent(getNavSummaryLink(null, false));
|
||||
}
|
||||
|
||||
protected void serialWarning(SourcePosition pos, String key, String a1, String a2) {
|
||||
if (configuration.serialwarn) {
|
||||
configuration.getDocletSpecificMsg().warning(pos, key, a1, a2);
|
||||
}
|
||||
}
|
||||
|
||||
public ProgramElementDoc[] eligibleMembers(ProgramElementDoc[] members) {
|
||||
return nodepr? Util.excludeDeprecatedMembers(members): members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the member summary for the given class.
|
||||
*
|
||||
* @param classDoc the class that is being documented
|
||||
* @param member the member being documented
|
||||
* @param firstSentenceTags the first sentence tags to be added to the summary
|
||||
* @param tableContents the list of contents to which the documentation will be added
|
||||
* @param counter the counter for determining id and style for the table row
|
||||
*/
|
||||
public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
|
||||
Tag[] firstSentenceTags, List<Content> tableContents, int counter) {
|
||||
HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
|
||||
tdSummaryType.addStyle(HtmlStyle.colFirst);
|
||||
writer.addSummaryType(this, member, tdSummaryType);
|
||||
HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
|
||||
setSummaryColumnStyle(tdSummary);
|
||||
addSummaryLink(classDoc, member, tdSummary);
|
||||
writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
|
||||
HtmlTree tr = HtmlTree.TR(tdSummaryType);
|
||||
tr.addContent(tdSummary);
|
||||
if (member instanceof MethodDoc && !member.isAnnotationTypeElement()) {
|
||||
int methodType = (member.isStatic()) ? MethodTypes.STATIC.value() :
|
||||
MethodTypes.INSTANCE.value();
|
||||
if (member.containingClass().isInterface()) {
|
||||
methodType = (((MethodDoc) member).isAbstract())
|
||||
? methodType | MethodTypes.ABSTRACT.value()
|
||||
: methodType | MethodTypes.DEFAULT.value();
|
||||
} else {
|
||||
methodType = (((MethodDoc) member).isAbstract())
|
||||
? methodType | MethodTypes.ABSTRACT.value()
|
||||
: methodType | MethodTypes.CONCRETE.value();
|
||||
}
|
||||
if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) {
|
||||
methodType = methodType | MethodTypes.DEPRECATED.value();
|
||||
}
|
||||
methodTypesOr = methodTypesOr | methodType;
|
||||
String tableId = "i" + counter;
|
||||
typeMap.put(tableId, methodType);
|
||||
tr.addAttr(HtmlAttr.ID, tableId);
|
||||
}
|
||||
if (counter%2 == 0)
|
||||
tr.addStyle(HtmlStyle.altColor);
|
||||
else
|
||||
tr.addStyle(HtmlStyle.rowColor);
|
||||
tableContents.add(tr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the method types set and return true if the method summary table
|
||||
* needs to show tabs.
|
||||
*
|
||||
* @return true if the table should show tabs
|
||||
*/
|
||||
public boolean showTabs() {
|
||||
int value;
|
||||
for (MethodTypes type : EnumSet.allOf(MethodTypes.class)) {
|
||||
value = type.value();
|
||||
if ((value & methodTypesOr) == value) {
|
||||
methodTypes.add(type);
|
||||
}
|
||||
}
|
||||
boolean showTabs = methodTypes.size() > 1;
|
||||
if (showTabs) {
|
||||
methodTypes.add(MethodTypes.ALL);
|
||||
}
|
||||
return showTabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the style for the summary column.
|
||||
*
|
||||
* @param tdTree the column for which the style will be set
|
||||
*/
|
||||
public void setSummaryColumnStyle(HtmlTree tdTree) {
|
||||
tdTree.addStyle(HtmlStyle.colLast);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add inherited member summary for the given class and member.
|
||||
*
|
||||
* @param classDoc the class the inherited member belongs to
|
||||
* @param nestedClass the inherited member that is summarized
|
||||
* @param isFirst true if this is the first member in the list
|
||||
* @param isLast true if this is the last member in the list
|
||||
* @param linksTree the content tree to which the summary will be added
|
||||
*/
|
||||
public void addInheritedMemberSummary(ClassDoc classDoc,
|
||||
ProgramElementDoc nestedClass, boolean isFirst, boolean isLast,
|
||||
Content linksTree) {
|
||||
writer.addInheritedMemberSummary(this, classDoc, nestedClass, isFirst,
|
||||
linksTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the inherited summary header for the given class.
|
||||
*
|
||||
* @param classDoc the class the inherited member belongs to
|
||||
* @return a content tree for the inherited summary header
|
||||
*/
|
||||
public Content getInheritedSummaryHeader(ClassDoc classDoc) {
|
||||
Content inheritedTree = writer.getMemberTreeHeader();
|
||||
writer.addInheritedSummaryHeader(this, classDoc, inheritedTree);
|
||||
return inheritedTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the inherited summary links tree.
|
||||
*
|
||||
* @return a content tree for the inherited summary links
|
||||
*/
|
||||
public Content getInheritedSummaryLinksTree() {
|
||||
return new HtmlTree(HtmlTag.CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the summary table tree for the given class.
|
||||
*
|
||||
* @param classDoc the class for which the summary table is generated
|
||||
* @param tableContents list of contents to be displayed in the summary table
|
||||
* @return a content tree for the summary table
|
||||
*/
|
||||
public Content getSummaryTableTree(ClassDoc classDoc, List<Content> tableContents) {
|
||||
return writer.getSummaryTableTree(this, classDoc, tableContents, showTabs());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the member tree to be documented.
|
||||
*
|
||||
* @param memberTree the content tree of member to be documented
|
||||
* @return a content tree that will be added to the class documentation
|
||||
*/
|
||||
public Content getMemberTree(Content memberTree) {
|
||||
return writer.getMemberTree(memberTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the member tree to be documented.
|
||||
*
|
||||
* @param memberTree the content tree of member to be documented
|
||||
* @param isLastContent true if the content to be added is the last content
|
||||
* @return a content tree that will be added to the class documentation
|
||||
*/
|
||||
public Content getMemberTree(Content memberTree, boolean isLastContent) {
|
||||
if (isLastContent)
|
||||
return HtmlTree.UL(HtmlStyle.blockListLast, memberTree);
|
||||
else
|
||||
return HtmlTree.UL(HtmlStyle.blockList, memberTree);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 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.DocPath;
|
||||
|
||||
/**
|
||||
* Abstract class to generate the overview files in
|
||||
* Frame and Non-Frame format. This will be sub-classed by to
|
||||
* generate overview-frame.html as well as overview-summary.html.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* Array of Packages to be documented.
|
||||
*/
|
||||
protected PackageDoc[] packages;
|
||||
|
||||
/**
|
||||
* Constructor. Also initializes the packages variable.
|
||||
*
|
||||
* @param configuration The current configuration
|
||||
* @param filename Name of the package index file to be generated.
|
||||
*/
|
||||
public AbstractPackageIndexWriter(ConfigurationImpl configuration,
|
||||
DocPath filename) throws IOException {
|
||||
super(configuration, filename);
|
||||
packages = configuration.packages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the navigation bar header to the documentation tree.
|
||||
*
|
||||
* @param body the document tree to which the navigation bar header will be added
|
||||
*/
|
||||
protected abstract void addNavigationBarHeader(Content body);
|
||||
|
||||
/**
|
||||
* Adds the navigation bar footer to the documentation tree.
|
||||
*
|
||||
* @param body the document tree to which the navigation bar footer will be added
|
||||
*/
|
||||
protected abstract void addNavigationBarFooter(Content body);
|
||||
|
||||
/**
|
||||
* Adds the overview header to the documentation tree.
|
||||
*
|
||||
* @param body the document tree to which the overview header will be added
|
||||
*/
|
||||
protected abstract void addOverviewHeader(Content body);
|
||||
|
||||
/**
|
||||
* Adds the packages list to the documentation tree.
|
||||
*
|
||||
* @param packages an array of packagedoc objects
|
||||
* @param text caption for the table
|
||||
* @param tableSummary summary for the table
|
||||
* @param body the document tree to which the packages list will be added
|
||||
*/
|
||||
protected abstract void addPackagesList(PackageDoc[] packages, String text,
|
||||
String tableSummary, Content body);
|
||||
|
||||
/**
|
||||
* Generate and prints the contents in the package index file. Call appropriate
|
||||
* methods from the sub-class in order to generate Frame or Non
|
||||
* Frame format.
|
||||
*
|
||||
* @param title the title of the window.
|
||||
* @param includeScript boolean set true if windowtitle script is to be included
|
||||
*/
|
||||
protected void buildPackageIndexFile(String title, boolean includeScript) throws IOException {
|
||||
String windowOverview = configuration.getText(title);
|
||||
Content body = getBody(includeScript, getWindowTitle(windowOverview));
|
||||
addNavigationBarHeader(body);
|
||||
addOverviewHeader(body);
|
||||
addIndex(body);
|
||||
addOverview(body);
|
||||
addNavigationBarFooter(body);
|
||||
printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
|
||||
configuration.doctitle), includeScript, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default to no overview, override to add overview.
|
||||
*
|
||||
* @param body the document tree to which the overview will be added
|
||||
*/
|
||||
protected void addOverview(Content body) throws IOException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the frame or non-frame package index to the documentation tree.
|
||||
*
|
||||
* @param body the document tree to which the index will be added
|
||||
*/
|
||||
protected void addIndex(Content body) {
|
||||
addIndexContents(packages, "doclet.Package_Summary",
|
||||
configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Package_Summary"),
|
||||
configuration.getText("doclet.packages")), body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds package index contents. Call appropriate methods from
|
||||
* the sub-classes. Adds it to the body HtmlTree
|
||||
*
|
||||
* @param packages array of packages to be documented
|
||||
* @param text string which will be used as the heading
|
||||
* @param tableSummary summary for the table
|
||||
* @param body the document tree to which the index contents will be added
|
||||
*/
|
||||
protected void addIndexContents(PackageDoc[] packages, String text,
|
||||
String tableSummary, Content body) {
|
||||
if (packages.length > 0) {
|
||||
Arrays.sort(packages);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.indexHeader);
|
||||
addAllClassesLink(div);
|
||||
if (configuration.showProfiles) {
|
||||
addAllProfilesLink(div);
|
||||
}
|
||||
body.addContent(div);
|
||||
if (configuration.showProfiles && configuration.profilePackages.size() > 0) {
|
||||
Content profileSummary = configuration.getResource("doclet.Profiles");
|
||||
addProfilesList(profileSummary, body);
|
||||
}
|
||||
addPackagesList(packages, text, tableSummary, body);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the doctitle to the documentation tree, if it is specified on the command line.
|
||||
*
|
||||
* @param body the document tree to which the title will be added
|
||||
*/
|
||||
protected void addConfigurationTitle(Content body) {
|
||||
if (configuration.doctitle.length() > 0) {
|
||||
Content title = new RawHtml(configuration.doctitle);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
|
||||
HtmlStyle.title, title);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
body.addContent(div);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns highlighted "Overview", in the navigation bar as this is the
|
||||
* overview page.
|
||||
*
|
||||
* @return a Content object to be added to the documentation tree
|
||||
*/
|
||||
protected Content getNavLinkContents() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing. This will be overridden.
|
||||
*
|
||||
* @param div the document tree to which the all classes link will be added
|
||||
*/
|
||||
protected void addAllClassesLink(Content div) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing. This will be overridden.
|
||||
*
|
||||
* @param div the document tree to which the all profiles link will be added
|
||||
*/
|
||||
protected void addAllProfilesLink(Content div) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing. This will be overridden.
|
||||
*
|
||||
* @param profileSummary the profile summary heading
|
||||
* @param body the content tree to which the profiles list will be added
|
||||
*/
|
||||
protected void addProfilesList(Content profileSummary, Content body) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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 java.io.*;
|
||||
|
||||
import com.sun.tools.javac.sym.Profiles;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.DocPath;
|
||||
|
||||
/**
|
||||
* Abstract class to generate the profile overview files in
|
||||
* Frame and Non-Frame format. This will be sub-classed to
|
||||
* generate profile-overview-frame.html as well as profile-overview-summary.html.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public abstract class AbstractProfileIndexWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* Profiles to be documented.
|
||||
*/
|
||||
protected Profiles profiles;
|
||||
|
||||
/**
|
||||
* Constructor. Also initializes the profiles variable.
|
||||
*
|
||||
* @param configuration The current configuration
|
||||
* @param filename Name of the profile index file to be generated.
|
||||
*/
|
||||
public AbstractProfileIndexWriter(ConfigurationImpl configuration,
|
||||
DocPath filename) throws IOException {
|
||||
super(configuration, filename);
|
||||
profiles = configuration.profiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the navigation bar header to the documentation tree.
|
||||
*
|
||||
* @param body the document tree to which the navigation bar header will be added
|
||||
*/
|
||||
protected abstract void addNavigationBarHeader(Content body);
|
||||
|
||||
/**
|
||||
* Adds the navigation bar footer to the documentation tree.
|
||||
*
|
||||
* @param body the document tree to which the navigation bar footer will be added
|
||||
*/
|
||||
protected abstract void addNavigationBarFooter(Content body);
|
||||
|
||||
/**
|
||||
* Adds the overview header to the documentation tree.
|
||||
*
|
||||
* @param body the document tree to which the overview header will be added
|
||||
*/
|
||||
protected abstract void addOverviewHeader(Content body);
|
||||
|
||||
/**
|
||||
* Adds the profiles list to the documentation tree.
|
||||
*
|
||||
* @param profiles profiles object
|
||||
* @param text caption for the table
|
||||
* @param tableSummary summary for the table
|
||||
* @param body the document tree to which the profiles list will be added
|
||||
*/
|
||||
protected abstract void addProfilesList(Profiles profiles, String text,
|
||||
String tableSummary, Content body);
|
||||
|
||||
/**
|
||||
* Adds the profile packages list to the documentation tree.
|
||||
*
|
||||
* @param profiles profiles object
|
||||
* @param text caption for the table
|
||||
* @param tableSummary summary for the table
|
||||
* @param body the document tree to which the profiles list will be added
|
||||
* @param profileName the name for the profile being documented
|
||||
*/
|
||||
protected abstract void addProfilePackagesList(Profiles profiles, String text,
|
||||
String tableSummary, Content body, String profileName);
|
||||
|
||||
/**
|
||||
* Generate and prints the contents in the profile index file. Call appropriate
|
||||
* methods from the sub-class in order to generate Frame or Non
|
||||
* Frame format.
|
||||
*
|
||||
* @param title the title of the window.
|
||||
* @param includeScript boolean set true if windowtitle script is to be included
|
||||
*/
|
||||
protected void buildProfileIndexFile(String title, boolean includeScript) throws IOException {
|
||||
String windowOverview = configuration.getText(title);
|
||||
Content body = getBody(includeScript, getWindowTitle(windowOverview));
|
||||
addNavigationBarHeader(body);
|
||||
addOverviewHeader(body);
|
||||
addIndex(body);
|
||||
addOverview(body);
|
||||
addNavigationBarFooter(body);
|
||||
printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
|
||||
configuration.doctitle), includeScript, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate and prints the contents in the profile packages index file. Call appropriate
|
||||
* methods from the sub-class in order to generate Frame or Non
|
||||
* Frame format.
|
||||
*
|
||||
* @param title the title of the window.
|
||||
* @param includeScript boolean set true if windowtitle script is to be included
|
||||
* @param profileName the name of the profile being documented
|
||||
*/
|
||||
protected void buildProfilePackagesIndexFile(String title,
|
||||
boolean includeScript, String profileName) throws IOException {
|
||||
String windowOverview = configuration.getText(title);
|
||||
Content body = getBody(includeScript, getWindowTitle(windowOverview));
|
||||
addNavigationBarHeader(body);
|
||||
addOverviewHeader(body);
|
||||
addProfilePackagesIndex(body, profileName);
|
||||
addOverview(body);
|
||||
addNavigationBarFooter(body);
|
||||
printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
|
||||
configuration.doctitle), includeScript, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default to no overview, override to add overview.
|
||||
*
|
||||
* @param body the document tree to which the overview will be added
|
||||
*/
|
||||
protected void addOverview(Content body) throws IOException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the frame or non-frame profile index to the documentation tree.
|
||||
*
|
||||
* @param body the document tree to which the index will be added
|
||||
*/
|
||||
protected void addIndex(Content body) {
|
||||
addIndexContents(profiles, "doclet.Profile_Summary",
|
||||
configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Profile_Summary"),
|
||||
configuration.getText("doclet.profiles")), body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the frame or non-frame profile packages index to the documentation tree.
|
||||
*
|
||||
* @param body the document tree to which the index will be added
|
||||
* @param profileName the name of the profile being documented
|
||||
*/
|
||||
protected void addProfilePackagesIndex(Content body, String profileName) {
|
||||
addProfilePackagesIndexContents(profiles, "doclet.Profile_Summary",
|
||||
configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Profile_Summary"),
|
||||
configuration.getText("doclet.profiles")), body, profileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds profile index contents. Call appropriate methods from
|
||||
* the sub-classes. Adds it to the body HtmlTree
|
||||
*
|
||||
* @param profiles profiles to be documented
|
||||
* @param text string which will be used as the heading
|
||||
* @param tableSummary summary for the table
|
||||
* @param body the document tree to which the index contents will be added
|
||||
*/
|
||||
protected void addIndexContents(Profiles profiles, String text,
|
||||
String tableSummary, Content body) {
|
||||
if (profiles.getProfileCount() > 0) {
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.indexHeader);
|
||||
addAllClassesLink(div);
|
||||
addAllPackagesLink(div);
|
||||
body.addContent(div);
|
||||
addProfilesList(profiles, text, tableSummary, body);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds profile packages index contents. Call appropriate methods from
|
||||
* the sub-classes. Adds it to the body HtmlTree
|
||||
*
|
||||
* @param profiles profiles to be documented
|
||||
* @param text string which will be used as the heading
|
||||
* @param tableSummary summary for the table
|
||||
* @param body the document tree to which the index contents will be added
|
||||
* @param profileName the name of the profile being documented
|
||||
*/
|
||||
protected void addProfilePackagesIndexContents(Profiles profiles, String text,
|
||||
String tableSummary, Content body, String profileName) {
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.indexHeader);
|
||||
addAllClassesLink(div);
|
||||
addAllPackagesLink(div);
|
||||
addAllProfilesLink(div);
|
||||
body.addContent(div);
|
||||
addProfilePackagesList(profiles, text, tableSummary, body, profileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the doctitle to the documentation tree, if it is specified on the command line.
|
||||
*
|
||||
* @param body the document tree to which the title will be added
|
||||
*/
|
||||
protected void addConfigurationTitle(Content body) {
|
||||
if (configuration.doctitle.length() > 0) {
|
||||
Content title = new RawHtml(configuration.doctitle);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
|
||||
HtmlStyle.title, title);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
body.addContent(div);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns highlighted "Overview", in the navigation bar as this is the
|
||||
* overview page.
|
||||
*
|
||||
* @return a Content object to be added to the documentation tree
|
||||
*/
|
||||
protected Content getNavLinkContents() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing. This will be overridden in ProfileIndexFrameWriter.
|
||||
*
|
||||
* @param div the document tree to which the all classes link will be added
|
||||
*/
|
||||
protected void addAllClassesLink(Content div) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing. This will be overridden in ProfileIndexFrameWriter.
|
||||
*
|
||||
* @param div the document tree to which the all packages link will be added
|
||||
*/
|
||||
protected void addAllPackagesLink(Content div) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Do nothing. This will be overridden in ProfilePackageIndexFrameWriter.
|
||||
*
|
||||
* @param div the document tree to which the all profiles link will be added
|
||||
*/
|
||||
protected void addAllProfilesLink(Content div) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Abstract class to print the class hierarchy page for all the Classes. This
|
||||
* is sub-classed by {@link PackageTreeWriter} and {@link TreeWriter} to
|
||||
* generate the Package Tree and global Tree(for all the classes and packages)
|
||||
* pages.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
*/
|
||||
public abstract class AbstractTreeWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* The class and interface tree built by using {@link ClassTree}
|
||||
*/
|
||||
protected final ClassTree classtree;
|
||||
|
||||
private static final String LI_CIRCLE = "circle";
|
||||
|
||||
/**
|
||||
* Constructor initializes classtree variable. This constructor will be used
|
||||
* while generating global tree file "overview-tree.html".
|
||||
*
|
||||
* @param configuration The current configuration
|
||||
* @param filename File to be generated.
|
||||
* @param classtree Tree built by {@link ClassTree}.
|
||||
* @throws IOException
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
protected AbstractTreeWriter(ConfigurationImpl configuration,
|
||||
DocPath filename, ClassTree classtree)
|
||||
throws IOException {
|
||||
super(configuration, filename);
|
||||
this.classtree = classtree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add each level of the class tree. For each sub-class or
|
||||
* sub-interface indents the next level information.
|
||||
* Recurses itself to add subclasses info.
|
||||
*
|
||||
* @param parent the superclass or superinterface of the list
|
||||
* @param list list of the sub-classes at this level
|
||||
* @param isEnum true if we are generating a tree for enums
|
||||
* @param contentTree the content tree to which the level information will be added
|
||||
*/
|
||||
protected void addLevelInfo(ClassDoc parent, List<ClassDoc> list,
|
||||
boolean isEnum, Content contentTree) {
|
||||
int size = list.size();
|
||||
if (size > 0) {
|
||||
Content ul = new HtmlTree(HtmlTag.UL);
|
||||
for (int i = 0; i < size; i++) {
|
||||
ClassDoc local = list.get(i);
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addAttr(HtmlAttr.TYPE, LI_CIRCLE);
|
||||
addPartialInfo(local, li);
|
||||
addExtendsImplements(parent, local, li);
|
||||
addLevelInfo(local, classtree.subs(local, isEnum),
|
||||
isEnum, li); // Recurse
|
||||
ul.addContent(li);
|
||||
}
|
||||
contentTree.addContent(ul);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the heading for the tree depending upon tree type if it's a
|
||||
* Class Tree or Interface tree.
|
||||
*
|
||||
* @param list List of classes which are at the most base level, all the
|
||||
* other classes in this run will derive from these classes
|
||||
* @param heading heading for the tree
|
||||
* @param div the content tree to which the tree will be added
|
||||
*/
|
||||
protected void addTree(List<ClassDoc> list, String heading, Content div) {
|
||||
if (list.size() > 0) {
|
||||
ClassDoc firstClassDoc = list.get(0);
|
||||
Content headingContent = getResource(heading);
|
||||
div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
|
||||
headingContent));
|
||||
addLevelInfo(!firstClassDoc.isInterface()? firstClassDoc : null,
|
||||
list, list == classtree.baseEnums(), div);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add information regarding the classes which this class extends or
|
||||
* implements.
|
||||
*
|
||||
* @param parent the parent class of the class being documented
|
||||
* @param cd the classdoc under consideration
|
||||
* @param contentTree the content tree to which the information will be added
|
||||
*/
|
||||
protected void addExtendsImplements(ClassDoc parent, ClassDoc cd,
|
||||
Content contentTree) {
|
||||
ClassDoc[] interfaces = cd.interfaces();
|
||||
if (interfaces.length > (cd.isInterface()? 1 : 0)) {
|
||||
Arrays.sort(interfaces);
|
||||
int counter = 0;
|
||||
for (int i = 0; i < interfaces.length; i++) {
|
||||
if (parent != interfaces[i]) {
|
||||
if (! (interfaces[i].isPublic() ||
|
||||
Util.isLinkable(interfaces[i], configuration))) {
|
||||
continue;
|
||||
}
|
||||
if (counter == 0) {
|
||||
if (cd.isInterface()) {
|
||||
contentTree.addContent(" (");
|
||||
contentTree.addContent(getResource("doclet.also"));
|
||||
contentTree.addContent(" extends ");
|
||||
} else {
|
||||
contentTree.addContent(" (implements ");
|
||||
}
|
||||
} else {
|
||||
contentTree.addContent(", ");
|
||||
}
|
||||
addPreQualifiedClassLink(LinkInfoImpl.Kind.TREE,
|
||||
interfaces[i], contentTree);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
if (counter > 0) {
|
||||
contentTree.addContent(")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add information about the class kind, if it's a "class" or "interface".
|
||||
*
|
||||
* @param cd the class being documented
|
||||
* @param contentTree the content tree to which the information will be added
|
||||
*/
|
||||
protected void addPartialInfo(ClassDoc cd, Content contentTree) {
|
||||
addPreQualifiedStrongClassLink(LinkInfoImpl.Kind.TREE, cd, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tree label for the navigation bar.
|
||||
*
|
||||
* @return a content tree for the tree label
|
||||
*/
|
||||
protected Content getNavLinkTree() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, treeLabel);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Generate the file with list of all the classes in this run. This page will be
|
||||
* used in the left-hand bottom frame, when "All Classes" link is clicked in
|
||||
* the left-hand top frame. The name of the generated file is
|
||||
* "allclasses-frame.html".
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
* @author Doug Kramer
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class AllClassesFrameWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* Index of all the classes.
|
||||
*/
|
||||
protected IndexBuilder indexbuilder;
|
||||
|
||||
/**
|
||||
* BR tag to be used within a document tree.
|
||||
*/
|
||||
final HtmlTree BR = new HtmlTree(HtmlTag.BR);
|
||||
|
||||
/**
|
||||
* Construct AllClassesFrameWriter object. Also initializes the indexbuilder
|
||||
* variable in this class.
|
||||
* @param configuration The current configuration
|
||||
* @param filename Path to the file which is getting generated.
|
||||
* @param indexbuilder Unicode based Index from {@link IndexBuilder}
|
||||
* @throws IOException
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public AllClassesFrameWriter(ConfigurationImpl configuration,
|
||||
DocPath filename, IndexBuilder indexbuilder)
|
||||
throws IOException {
|
||||
super(configuration, filename);
|
||||
this.indexbuilder = indexbuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create AllClassesFrameWriter object. Then use it to generate the
|
||||
* "allclasses-frame.html" file. Generate the file in the current or the
|
||||
* destination directory.
|
||||
*
|
||||
* @param indexbuilder IndexBuilder object for all classes index.
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration,
|
||||
IndexBuilder indexbuilder) {
|
||||
AllClassesFrameWriter allclassgen;
|
||||
DocPath filename = DocPaths.ALLCLASSES_FRAME;
|
||||
try {
|
||||
allclassgen = new AllClassesFrameWriter(configuration,
|
||||
filename, indexbuilder);
|
||||
allclassgen.buildAllClassesFile(true);
|
||||
allclassgen.close();
|
||||
filename = DocPaths.ALLCLASSES_NOFRAME;
|
||||
allclassgen = new AllClassesFrameWriter(configuration,
|
||||
filename, indexbuilder);
|
||||
allclassgen.buildAllClassesFile(false);
|
||||
allclassgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.
|
||||
error("doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print all the classes in the file.
|
||||
* @param wantFrames True if we want frames.
|
||||
*/
|
||||
protected void buildAllClassesFile(boolean wantFrames) throws IOException {
|
||||
String label = configuration.getText("doclet.All_Classes");
|
||||
Content body = getBody(false, getWindowTitle(label));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
|
||||
HtmlStyle.bar, allclassesLabel);
|
||||
body.addContent(heading);
|
||||
Content ul = new HtmlTree(HtmlTag.UL);
|
||||
// Generate the class links and add it to the tdFont tree.
|
||||
addAllClasses(ul, wantFrames);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, ul);
|
||||
body.addContent(div);
|
||||
printHtmlDocument(null, false, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the sorted index of all the classes and add all the classes to the
|
||||
* content list.
|
||||
*
|
||||
* @param content HtmlTree content to which all classes information will be added
|
||||
* @param wantFrames True if we want frames.
|
||||
*/
|
||||
protected void addAllClasses(Content content, boolean wantFrames) {
|
||||
for (int i = 0; i < indexbuilder.elements().length; i++) {
|
||||
Character unicode = (Character)((indexbuilder.elements())[i]);
|
||||
addContents(indexbuilder.getMemberList(unicode), wantFrames, content);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a list of classes, generate links for each class or interface.
|
||||
* If the class kind is interface, print it in the italics font. Also all
|
||||
* links should target the right-hand frame. If clicked on any class name
|
||||
* in this page, appropriate class page should get opened in the right-hand
|
||||
* frame.
|
||||
*
|
||||
* @param classlist Sorted list of classes.
|
||||
* @param wantFrames True if we want frames.
|
||||
* @param content HtmlTree content to which the links will be added
|
||||
*/
|
||||
protected void addContents(List<Doc> classlist, boolean wantFrames,
|
||||
Content content) {
|
||||
for (int i = 0; i < classlist.size(); i++) {
|
||||
ClassDoc cd = (ClassDoc)classlist.get(i);
|
||||
if (!Util.isCoreClass(cd)) {
|
||||
continue;
|
||||
}
|
||||
Content label = italicsClassName(cd, false);
|
||||
Content linkContent;
|
||||
if (wantFrames) {
|
||||
linkContent = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd).label(label).target("classFrame"));
|
||||
} else {
|
||||
linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, cd).label(label));
|
||||
}
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
content.addContent(li);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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 java.io.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
|
||||
/**
|
||||
* Writes annotation type field documentation in HTML format.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
|
||||
implements AnnotationTypeFieldWriter, MemberSummaryWriter {
|
||||
|
||||
/**
|
||||
* Construct a new AnnotationTypeFieldWriterImpl.
|
||||
*
|
||||
* @param writer the writer that will write the output.
|
||||
* @param annotationType the AnnotationType that holds this member.
|
||||
*/
|
||||
public AnnotationTypeFieldWriterImpl(SubWriterHolderWriter writer,
|
||||
AnnotationTypeDoc annotationType) {
|
||||
super(writer, annotationType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMemberSummaryHeader(ClassDoc classDoc,
|
||||
Content memberSummaryTree) {
|
||||
memberSummaryTree.addContent(
|
||||
HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_SUMMARY);
|
||||
Content memberTree = writer.getMemberTreeHeader();
|
||||
writer.addSummaryHeader(this, classDoc, memberTree);
|
||||
return memberTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMemberTreeHeader() {
|
||||
return writer.getMemberTreeHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addAnnotationFieldDetailsMarker(Content memberDetails) {
|
||||
memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_FIELD_DETAILS);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree) {
|
||||
if (!writer.printedAnnotationFieldHeading) {
|
||||
memberDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.ANNOTATION_TYPE_FIELD_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.fieldDetailsLabel);
|
||||
memberDetailsTree.addContent(heading);
|
||||
writer.printedAnnotationFieldHeading = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getAnnotationDocTreeHeader(MemberDoc member,
|
||||
Content annotationDetailsTree) {
|
||||
annotationDetailsTree.addContent(
|
||||
writer.getMarkerAnchor(member.name()));
|
||||
Content annotationDocTree = writer.getMemberTreeHeader();
|
||||
Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
|
||||
heading.addContent(member.name());
|
||||
annotationDocTree.addContent(heading);
|
||||
return annotationDocTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getSignature(MemberDoc member) {
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
writer.addAnnotationInfo(member, pre);
|
||||
addModifiers(member, pre);
|
||||
Content link =
|
||||
writer.getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.MEMBER, getType(member)));
|
||||
pre.addContent(link);
|
||||
pre.addContent(writer.getSpace());
|
||||
if (configuration.linksource) {
|
||||
Content memberName = new StringContent(member.name());
|
||||
writer.addSrcLink(member, memberName, pre);
|
||||
} else {
|
||||
addName(member.name(), pre);
|
||||
}
|
||||
return pre;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addDeprecated(MemberDoc member, Content annotationDocTree) {
|
||||
addDeprecatedInfo(member, annotationDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addComments(MemberDoc member, Content annotationDocTree) {
|
||||
addComment(member, annotationDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addTags(MemberDoc member, Content annotationDocTree) {
|
||||
writer.addTagsInfo(member, annotationDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getAnnotationDetails(Content annotationDetailsTree) {
|
||||
return getMemberTree(annotationDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getAnnotationDoc(Content annotationDocTree,
|
||||
boolean isLastContent) {
|
||||
return getMemberTree(annotationDocTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Field_Summary"));
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Field_Summary"),
|
||||
configuration.getText("doclet.fields"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Fields");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String[] getSummaryTableHeader(ProgramElementDoc member) {
|
||||
String[] header = new String[] {
|
||||
writer.getModifierTypeHeader(),
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Fields"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
|
||||
memberTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.ANNOTATION_TYPE_FIELD_SUMMARY));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
|
||||
Content tdSummary) {
|
||||
Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
|
||||
writer.getDocLink(context, (MemberDoc) member, member.name(), false));
|
||||
Content code = HtmlTree.CODE(memberLink);
|
||||
tdSummary.addContent(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addInheritedSummaryLink(ClassDoc cd,
|
||||
ProgramElementDoc member, Content linksTree) {
|
||||
//Not applicable.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
|
||||
MemberDoc m = (MemberDoc)member;
|
||||
addModifierAndType(m, getType(m), tdSummaryType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getDeprecatedLink(ProgramElementDoc member) {
|
||||
return writer.getDocLink(LinkInfoImpl.Kind.MEMBER,
|
||||
(MemberDoc) member, ((MemberDoc)member).qualifiedName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
|
||||
if (link) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.ANNOTATION_TYPE_FIELD_SUMMARY,
|
||||
writer.getResource("doclet.navField"));
|
||||
} else {
|
||||
return writer.getResource("doclet.navField");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavDetailLink(boolean link, Content liNav) {
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.ANNOTATION_TYPE_FIELD_DETAIL,
|
||||
writer.getResource("doclet.navField")));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navField"));
|
||||
}
|
||||
}
|
||||
|
||||
private Type getType(MemberDoc member) {
|
||||
if (member instanceof FieldDoc) {
|
||||
return ((FieldDoc) member).type();
|
||||
} else {
|
||||
return ((MethodDoc) member).returnType();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, 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 java.io.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
|
||||
/**
|
||||
* Writes annotation type optional member documentation in HTML format.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class AnnotationTypeOptionalMemberWriterImpl extends
|
||||
AnnotationTypeRequiredMemberWriterImpl
|
||||
implements AnnotationTypeOptionalMemberWriter, MemberSummaryWriter {
|
||||
|
||||
/**
|
||||
* Construct a new AnnotationTypeOptionalMemberWriterImpl.
|
||||
*
|
||||
* @param writer the writer that will write the output.
|
||||
* @param annotationType the AnnotationType that holds this member.
|
||||
*/
|
||||
public AnnotationTypeOptionalMemberWriterImpl(SubWriterHolderWriter writer,
|
||||
AnnotationTypeDoc annotationType) {
|
||||
super(writer, annotationType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMemberSummaryHeader(ClassDoc classDoc,
|
||||
Content memberSummaryTree) {
|
||||
memberSummaryTree.addContent(
|
||||
HtmlConstants.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY);
|
||||
Content memberTree = writer.getMemberTreeHeader();
|
||||
writer.addSummaryHeader(this, classDoc, memberTree);
|
||||
return memberTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addDefaultValueInfo(MemberDoc member, Content annotationDocTree) {
|
||||
if (((AnnotationTypeElementDoc) member).defaultValue() != null) {
|
||||
Content dt = HtmlTree.DT(writer.getResource("doclet.Default"));
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
Content dd = HtmlTree.DD(new StringContent(
|
||||
((AnnotationTypeElementDoc) member).defaultValue().toString()));
|
||||
dl.addContent(dd);
|
||||
annotationDocTree.addContent(dl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Annotation_Type_Optional_Member_Summary"));
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Annotation_Type_Optional_Member_Summary"),
|
||||
configuration.getText("doclet.annotation_type_optional_members"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Annotation_Type_Optional_Members");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String[] getSummaryTableHeader(ProgramElementDoc member) {
|
||||
String[] header = new String[] {
|
||||
writer.getModifierTypeHeader(),
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Annotation_Type_Optional_Member"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
|
||||
memberTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
|
||||
if (link) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY,
|
||||
writer.getResource("doclet.navAnnotationTypeOptionalMember"));
|
||||
} else {
|
||||
return writer.getResource("doclet.navAnnotationTypeOptionalMember");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, 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 java.io.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
|
||||
/**
|
||||
* Writes annotation type required member documentation in HTML format.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
|
||||
implements AnnotationTypeRequiredMemberWriter, MemberSummaryWriter {
|
||||
|
||||
/**
|
||||
* Construct a new AnnotationTypeRequiredMemberWriterImpl.
|
||||
*
|
||||
* @param writer the writer that will write the output.
|
||||
* @param annotationType the AnnotationType that holds this member.
|
||||
*/
|
||||
public AnnotationTypeRequiredMemberWriterImpl(SubWriterHolderWriter writer,
|
||||
AnnotationTypeDoc annotationType) {
|
||||
super(writer, annotationType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMemberSummaryHeader(ClassDoc classDoc,
|
||||
Content memberSummaryTree) {
|
||||
memberSummaryTree.addContent(
|
||||
HtmlConstants.START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY);
|
||||
Content memberTree = writer.getMemberTreeHeader();
|
||||
writer.addSummaryHeader(this, classDoc, memberTree);
|
||||
return memberTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMemberTreeHeader() {
|
||||
return writer.getMemberTreeHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addAnnotationDetailsMarker(Content memberDetails) {
|
||||
memberDetails.addContent(HtmlConstants.START_OF_ANNOTATION_TYPE_DETAILS);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree) {
|
||||
if (!writer.printedAnnotationHeading) {
|
||||
memberDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.annotationTypeDetailsLabel);
|
||||
memberDetailsTree.addContent(heading);
|
||||
writer.printedAnnotationHeading = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getAnnotationDocTreeHeader(MemberDoc member,
|
||||
Content annotationDetailsTree) {
|
||||
annotationDetailsTree.addContent(
|
||||
writer.getMarkerAnchor(member.name() +
|
||||
((ExecutableMemberDoc) member).signature()));
|
||||
Content annotationDocTree = writer.getMemberTreeHeader();
|
||||
Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
|
||||
heading.addContent(member.name());
|
||||
annotationDocTree.addContent(heading);
|
||||
return annotationDocTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getSignature(MemberDoc member) {
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
writer.addAnnotationInfo(member, pre);
|
||||
addModifiers(member, pre);
|
||||
Content link =
|
||||
writer.getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.MEMBER, getType(member)));
|
||||
pre.addContent(link);
|
||||
pre.addContent(writer.getSpace());
|
||||
if (configuration.linksource) {
|
||||
Content memberName = new StringContent(member.name());
|
||||
writer.addSrcLink(member, memberName, pre);
|
||||
} else {
|
||||
addName(member.name(), pre);
|
||||
}
|
||||
return pre;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addDeprecated(MemberDoc member, Content annotationDocTree) {
|
||||
addDeprecatedInfo(member, annotationDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addComments(MemberDoc member, Content annotationDocTree) {
|
||||
addComment(member, annotationDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addTags(MemberDoc member, Content annotationDocTree) {
|
||||
writer.addTagsInfo(member, annotationDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getAnnotationDetails(Content annotationDetailsTree) {
|
||||
return getMemberTree(annotationDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getAnnotationDoc(Content annotationDocTree,
|
||||
boolean isLastContent) {
|
||||
return getMemberTree(annotationDocTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Annotation_Type_Required_Member_Summary"));
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Annotation_Type_Required_Member_Summary"),
|
||||
configuration.getText("doclet.annotation_type_required_members"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Annotation_Type_Required_Members");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String[] getSummaryTableHeader(ProgramElementDoc member) {
|
||||
String[] header = new String[] {
|
||||
writer.getModifierTypeHeader(),
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Annotation_Type_Required_Member"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
|
||||
memberTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
|
||||
Content tdSummary) {
|
||||
Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
|
||||
writer.getDocLink(context, (MemberDoc) member, member.name(), false));
|
||||
Content code = HtmlTree.CODE(memberLink);
|
||||
tdSummary.addContent(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addInheritedSummaryLink(ClassDoc cd,
|
||||
ProgramElementDoc member, Content linksTree) {
|
||||
//Not applicable.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
|
||||
MemberDoc m = (MemberDoc)member;
|
||||
addModifierAndType(m, getType(m), tdSummaryType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getDeprecatedLink(ProgramElementDoc member) {
|
||||
return writer.getDocLink(LinkInfoImpl.Kind.MEMBER,
|
||||
(MemberDoc) member, ((MemberDoc)member).qualifiedName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
|
||||
if (link) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY,
|
||||
writer.getResource("doclet.navAnnotationTypeRequiredMember"));
|
||||
} else {
|
||||
return writer.getResource("doclet.navAnnotationTypeRequiredMember");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavDetailLink(boolean link, Content liNav) {
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL,
|
||||
writer.getResource("doclet.navAnnotationTypeMember")));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navAnnotationTypeMember"));
|
||||
}
|
||||
}
|
||||
|
||||
private Type getType(MemberDoc member) {
|
||||
if (member instanceof FieldDoc) {
|
||||
return ((FieldDoc) member).type();
|
||||
} else {
|
||||
return ((MethodDoc) member).returnType();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,415 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, 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 java.io.IOException;
|
||||
|
||||
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.builders.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Generate the Class Information Page.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @see com.sun.javadoc.ClassDoc
|
||||
* @see java.util.Collections
|
||||
* @see java.util.List
|
||||
* @see java.util.ArrayList
|
||||
* @see java.util.HashMap
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
* @author Robert Field
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
|
||||
implements AnnotationTypeWriter {
|
||||
|
||||
protected AnnotationTypeDoc annotationType;
|
||||
|
||||
protected Type prev;
|
||||
|
||||
protected Type next;
|
||||
|
||||
/**
|
||||
* @param annotationType the annotation type being documented.
|
||||
* @param prevType the previous class that was documented.
|
||||
* @param nextType the next class being documented.
|
||||
*/
|
||||
public AnnotationTypeWriterImpl(ConfigurationImpl configuration,
|
||||
AnnotationTypeDoc annotationType, Type prevType, Type nextType)
|
||||
throws Exception {
|
||||
super(configuration, DocPath.forClass(annotationType));
|
||||
this.annotationType = annotationType;
|
||||
configuration.currentcd = annotationType.asClassDoc();
|
||||
this.prev = prevType;
|
||||
this.next = nextType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this package link.
|
||||
*
|
||||
* @return a content tree for the package link
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
|
||||
packageLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class link.
|
||||
*
|
||||
* @return a content tree for the class link
|
||||
*/
|
||||
protected Content getNavLinkClass() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class use link.
|
||||
*
|
||||
* @return a content tree for the class use link
|
||||
*/
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), useLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to previous class.
|
||||
*
|
||||
* @return a content tree for the previous class link
|
||||
*/
|
||||
public Content getNavLinkPrevious() {
|
||||
Content li;
|
||||
if (prev != null) {
|
||||
Content prevLink = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS, prev.asClassDoc())
|
||||
.label(prevclassLabel).strong(true));
|
||||
li = HtmlTree.LI(prevLink);
|
||||
}
|
||||
else
|
||||
li = HtmlTree.LI(prevclassLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to next class.
|
||||
*
|
||||
* @return a content tree for the next class link
|
||||
*/
|
||||
public Content getNavLinkNext() {
|
||||
Content li;
|
||||
if (next != null) {
|
||||
Content nextLink = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS, next.asClassDoc())
|
||||
.label(nextclassLabel).strong(true));
|
||||
li = HtmlTree.LI(nextLink);
|
||||
}
|
||||
else
|
||||
li = HtmlTree.LI(nextclassLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getHeader(String header) {
|
||||
String pkgname = (annotationType.containingPackage() != null)?
|
||||
annotationType.containingPackage().name(): "";
|
||||
String clname = annotationType.name();
|
||||
Content bodyTree = getBody(true, getWindowTitle(clname));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.header);
|
||||
if (pkgname.length() > 0) {
|
||||
Content pkgNameContent = new StringContent(pkgname);
|
||||
Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
|
||||
div.addContent(pkgNameDiv);
|
||||
}
|
||||
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_HEADER, annotationType);
|
||||
Content headerContent = new StringContent(header);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
|
||||
HtmlStyle.title, headerContent);
|
||||
heading.addContent(getTypeParameterLinks(linkInfo));
|
||||
div.addContent(heading);
|
||||
bodyTree.addContent(div);
|
||||
return bodyTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getAnnotationContentHeader() {
|
||||
return getContentHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addFooter(Content contentTree) {
|
||||
contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
|
||||
addNavLinks(false, contentTree);
|
||||
addBottom(contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void printDocument(Content contentTree) throws IOException {
|
||||
printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType),
|
||||
true, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getAnnotationInfoTreeHeader() {
|
||||
return getMemberTreeHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getAnnotationInfo(Content annotationInfoTree) {
|
||||
return getMemberTree(HtmlStyle.description, annotationInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) {
|
||||
annotationInfoTree.addContent(new HtmlTree(HtmlTag.BR));
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
addAnnotationInfo(annotationType, pre);
|
||||
pre.addContent(modifiers);
|
||||
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType);
|
||||
Content annotationName = new StringContent(annotationType.name());
|
||||
Content parameterLinks = getTypeParameterLinks(linkInfo);
|
||||
if (configuration.linksource) {
|
||||
addSrcLink(annotationType, annotationName, pre);
|
||||
pre.addContent(parameterLinks);
|
||||
} else {
|
||||
Content span = HtmlTree.SPAN(HtmlStyle.memberNameLabel, annotationName);
|
||||
span.addContent(parameterLinks);
|
||||
pre.addContent(span);
|
||||
}
|
||||
annotationInfoTree.addContent(pre);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addAnnotationTypeDescription(Content annotationInfoTree) {
|
||||
if(!configuration.nocomment) {
|
||||
if (annotationType.inlineTags().length > 0) {
|
||||
addInlineComment(annotationType, annotationInfoTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addAnnotationTypeTagInfo(Content annotationInfoTree) {
|
||||
if(!configuration.nocomment) {
|
||||
addTagsInfo(annotationType, annotationInfoTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) {
|
||||
Content hr = new HtmlTree(HtmlTag.HR);
|
||||
annotationInfoTree.addContent(hr);
|
||||
Tag[] deprs = annotationType.tags("deprecated");
|
||||
if (Util.isDeprecated(annotationType)) {
|
||||
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
|
||||
if (deprs.length > 0) {
|
||||
Tag[] commentTags = deprs[0].inlineTags();
|
||||
if (commentTags.length > 0) {
|
||||
div.addContent(getSpace());
|
||||
addInlineDeprecatedComment(annotationType, deprs[0], div);
|
||||
}
|
||||
}
|
||||
annotationInfoTree.addContent(div);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getNavLinkTree() {
|
||||
Content treeLinkContent = getHyperLink(DocPaths.PACKAGE_TREE,
|
||||
treeLabel, "", "");
|
||||
Content li = HtmlTree.LI(treeLinkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add summary details to the navigation bar.
|
||||
*
|
||||
* @param subDiv the content tree to which the summary detail links will be added
|
||||
*/
|
||||
protected void addSummaryDetailLinks(Content subDiv) {
|
||||
try {
|
||||
Content div = HtmlTree.DIV(getNavSummaryLinks());
|
||||
div.addContent(getNavDetailLinks());
|
||||
subDiv.addContent(div);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new DocletAbortException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get summary links for navigation bar.
|
||||
*
|
||||
* @return the content tree for the navigation summary links
|
||||
*/
|
||||
protected Content getNavSummaryLinks() throws Exception {
|
||||
Content li = HtmlTree.LI(summaryLabel);
|
||||
li.addContent(getSpace());
|
||||
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
|
||||
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
|
||||
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
|
||||
Content liNavField = new HtmlTree(HtmlTag.LI);
|
||||
addNavSummaryLink(memberSummaryBuilder,
|
||||
"doclet.navField",
|
||||
VisibleMemberMap.ANNOTATION_TYPE_FIELDS, liNavField);
|
||||
addNavGap(liNavField);
|
||||
ulNav.addContent(liNavField);
|
||||
Content liNavReq = new HtmlTree(HtmlTag.LI);
|
||||
addNavSummaryLink(memberSummaryBuilder,
|
||||
"doclet.navAnnotationTypeRequiredMember",
|
||||
VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED, liNavReq);
|
||||
addNavGap(liNavReq);
|
||||
ulNav.addContent(liNavReq);
|
||||
Content liNavOpt = new HtmlTree(HtmlTag.LI);
|
||||
addNavSummaryLink(memberSummaryBuilder,
|
||||
"doclet.navAnnotationTypeOptionalMember",
|
||||
VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL, liNavOpt);
|
||||
ulNav.addContent(liNavOpt);
|
||||
return ulNav;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the navigation summary link.
|
||||
*
|
||||
* @param builder builder for the member to be documented
|
||||
* @param label the label for the navigation
|
||||
* @param type type to be documented
|
||||
* @param liNav the content tree to which the navigation summary link will be added
|
||||
*/
|
||||
protected void addNavSummaryLink(MemberSummaryBuilder builder,
|
||||
String label, int type, Content liNav) {
|
||||
AbstractMemberWriter writer = ((AbstractMemberWriter) builder.
|
||||
getMemberSummaryWriter(type));
|
||||
if (writer == null) {
|
||||
liNav.addContent(getResource(label));
|
||||
} else {
|
||||
liNav.addContent(writer.getNavSummaryLink(null,
|
||||
! builder.getVisibleMemberMap(type).noVisibleMembers()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get detail links for the navigation bar.
|
||||
*
|
||||
* @return the content tree for the detail links
|
||||
*/
|
||||
protected Content getNavDetailLinks() throws Exception {
|
||||
Content li = HtmlTree.LI(detailLabel);
|
||||
li.addContent(getSpace());
|
||||
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
|
||||
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
|
||||
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
|
||||
AbstractMemberWriter writerField =
|
||||
((AbstractMemberWriter) memberSummaryBuilder.
|
||||
getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_FIELDS));
|
||||
AbstractMemberWriter writerOptional =
|
||||
((AbstractMemberWriter) memberSummaryBuilder.
|
||||
getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL));
|
||||
AbstractMemberWriter writerRequired =
|
||||
((AbstractMemberWriter) memberSummaryBuilder.
|
||||
getMemberSummaryWriter(VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED));
|
||||
Content liNavField = new HtmlTree(HtmlTag.LI);
|
||||
if (writerField != null){
|
||||
writerField.addNavDetailLink(annotationType.fields().length > 0, liNavField);
|
||||
} else {
|
||||
liNavField.addContent(getResource("doclet.navField"));
|
||||
}
|
||||
addNavGap(liNavField);
|
||||
ulNav.addContent(liNavField);
|
||||
if (writerOptional != null){
|
||||
Content liNavOpt = new HtmlTree(HtmlTag.LI);
|
||||
writerOptional.addNavDetailLink(annotationType.elements().length > 0, liNavOpt);
|
||||
ulNav.addContent(liNavOpt);
|
||||
} else if (writerRequired != null){
|
||||
Content liNavReq = new HtmlTree(HtmlTag.LI);
|
||||
writerRequired.addNavDetailLink(annotationType.elements().length > 0, liNavReq);
|
||||
ulNav.addContent(liNavReq);
|
||||
} else {
|
||||
Content liNav = HtmlTree.LI(getResource("doclet.navAnnotationTypeMember"));
|
||||
ulNav.addContent(liNav);
|
||||
}
|
||||
return ulNav;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add gap between navigation bar elements.
|
||||
*
|
||||
* @param liNav the content tree to which the gap will be added
|
||||
*/
|
||||
protected void addNavGap(Content liNav) {
|
||||
liNav.addContent(getSpace());
|
||||
liNav.addContent("|");
|
||||
liNav.addContent(getSpace());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public AnnotationTypeDoc getAnnotationTypeDoc() {
|
||||
return annotationType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,518 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* Generate class usage information.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Robert G. Field
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
|
||||
final ClassDoc classdoc;
|
||||
Set<PackageDoc> pkgToPackageAnnotations = null;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToClassTypeParameter;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToClassAnnotations;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToMethodTypeParameter;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToMethodArgTypeParameter;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToMethodReturnTypeParameter;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToMethodAnnotations;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToMethodParameterAnnotations;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToFieldTypeParameter;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToFieldAnnotations;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToSubclass;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToSubinterface;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToImplementingClass;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToField;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToMethodReturn;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToMethodArgs;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToMethodThrows;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToConstructorAnnotations;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToConstructorParameterAnnotations;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToConstructorArgs;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToConstructorArgTypeParameter;
|
||||
final Map<String,List<ProgramElementDoc>> pkgToConstructorThrows;
|
||||
final SortedSet<PackageDoc> pkgSet;
|
||||
final MethodWriterImpl methodSubWriter;
|
||||
final ConstructorWriterImpl constrSubWriter;
|
||||
final FieldWriterImpl fieldSubWriter;
|
||||
final NestedClassWriterImpl classSubWriter;
|
||||
// Summary for various use tables.
|
||||
final String classUseTableSummary;
|
||||
final String subclassUseTableSummary;
|
||||
final String subinterfaceUseTableSummary;
|
||||
final String fieldUseTableSummary;
|
||||
final String methodUseTableSummary;
|
||||
final String constructorUseTableSummary;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param filename the file to be generated.
|
||||
* @throws IOException
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public ClassUseWriter(ConfigurationImpl configuration,
|
||||
ClassUseMapper mapper, DocPath filename,
|
||||
ClassDoc classdoc) throws IOException {
|
||||
super(configuration, filename);
|
||||
this.classdoc = classdoc;
|
||||
if (mapper.classToPackageAnnotations.containsKey(classdoc.qualifiedName()))
|
||||
pkgToPackageAnnotations = new TreeSet<PackageDoc>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName()));
|
||||
configuration.currentcd = classdoc;
|
||||
this.pkgSet = new TreeSet<PackageDoc>();
|
||||
this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam);
|
||||
this.pkgToClassAnnotations = pkgDivide(mapper.classToClassAnnotations);
|
||||
this.pkgToMethodTypeParameter = pkgDivide(mapper.classToExecMemberDocTypeParam);
|
||||
this.pkgToMethodArgTypeParameter = pkgDivide(mapper.classToExecMemberDocArgTypeParam);
|
||||
this.pkgToFieldTypeParameter = pkgDivide(mapper.classToFieldDocTypeParam);
|
||||
this.pkgToFieldAnnotations = pkgDivide(mapper.annotationToFieldDoc);
|
||||
this.pkgToMethodReturnTypeParameter = pkgDivide(mapper.classToExecMemberDocReturnTypeParam);
|
||||
this.pkgToMethodAnnotations = pkgDivide(mapper.classToExecMemberDocAnnotations);
|
||||
this.pkgToMethodParameterAnnotations = pkgDivide(mapper.classToExecMemberDocParamAnnotation);
|
||||
this.pkgToSubclass = pkgDivide(mapper.classToSubclass);
|
||||
this.pkgToSubinterface = pkgDivide(mapper.classToSubinterface);
|
||||
this.pkgToImplementingClass = pkgDivide(mapper.classToImplementingClass);
|
||||
this.pkgToField = pkgDivide(mapper.classToField);
|
||||
this.pkgToMethodReturn = pkgDivide(mapper.classToMethodReturn);
|
||||
this.pkgToMethodArgs = pkgDivide(mapper.classToMethodArgs);
|
||||
this.pkgToMethodThrows = pkgDivide(mapper.classToMethodThrows);
|
||||
this.pkgToConstructorAnnotations = pkgDivide(mapper.classToConstructorAnnotations);
|
||||
this.pkgToConstructorParameterAnnotations = pkgDivide(mapper.classToConstructorParamAnnotation);
|
||||
this.pkgToConstructorArgs = pkgDivide(mapper.classToConstructorArgs);
|
||||
this.pkgToConstructorArgTypeParameter = pkgDivide(mapper.classToConstructorDocArgTypeParam);
|
||||
this.pkgToConstructorThrows = pkgDivide(mapper.classToConstructorThrows);
|
||||
//tmp test
|
||||
if (pkgSet.size() > 0 &&
|
||||
mapper.classToPackage.containsKey(classdoc.qualifiedName()) &&
|
||||
!pkgSet.equals(mapper.classToPackage.get(classdoc.qualifiedName()))) {
|
||||
configuration.root.printWarning("Internal error: package sets don't match: " + pkgSet + " with: " +
|
||||
mapper.classToPackage.get(classdoc.qualifiedName()));
|
||||
}
|
||||
methodSubWriter = new MethodWriterImpl(this);
|
||||
constrSubWriter = new ConstructorWriterImpl(this);
|
||||
fieldSubWriter = new FieldWriterImpl(this);
|
||||
classSubWriter = new NestedClassWriterImpl(this);
|
||||
classUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
|
||||
configuration.getText("doclet.classes"));
|
||||
subclassUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
|
||||
configuration.getText("doclet.subclasses"));
|
||||
subinterfaceUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
|
||||
configuration.getText("doclet.subinterfaces"));
|
||||
fieldUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
|
||||
configuration.getText("doclet.fields"));
|
||||
methodUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
|
||||
configuration.getText("doclet.methods"));
|
||||
constructorUseTableSummary = configuration.getText("doclet.Use_Table_Summary",
|
||||
configuration.getText("doclet.constructors"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Write out class use pages.
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration,
|
||||
ClassTree classtree) {
|
||||
ClassUseMapper mapper = new ClassUseMapper(configuration.root, classtree);
|
||||
ClassDoc[] classes = configuration.root.classes();
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
// If -nodeprecated option is set and the containing package is marked
|
||||
// as deprecated, do not generate the class-use page. We will still generate
|
||||
// the class-use page if the class is marked as deprecated but the containing
|
||||
// package is not since it could still be linked from that package-use page.
|
||||
if (!(configuration.nodeprecated &&
|
||||
Util.isDeprecated(classes[i].containingPackage())))
|
||||
ClassUseWriter.generate(configuration, mapper, classes[i]);
|
||||
}
|
||||
PackageDoc[] pkgs = configuration.packages;
|
||||
for (int i = 0; i < pkgs.length; i++) {
|
||||
// If -nodeprecated option is set and the package is marked
|
||||
// as deprecated, do not generate the package-use page.
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(pkgs[i])))
|
||||
PackageUseWriter.generate(configuration, mapper, pkgs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String,List<ProgramElementDoc>> pkgDivide(Map<String,? extends List<? extends ProgramElementDoc>> classMap) {
|
||||
Map<String,List<ProgramElementDoc>> map = new HashMap<String,List<ProgramElementDoc>>();
|
||||
List<? extends ProgramElementDoc> list= classMap.get(classdoc.qualifiedName());
|
||||
if (list != null) {
|
||||
Collections.sort(list);
|
||||
Iterator<? extends ProgramElementDoc> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
ProgramElementDoc doc = it.next();
|
||||
PackageDoc pkg = doc.containingPackage();
|
||||
pkgSet.add(pkg);
|
||||
List<ProgramElementDoc> inPkg = map.get(pkg.name());
|
||||
if (inPkg == null) {
|
||||
inPkg = new ArrayList<ProgramElementDoc>();
|
||||
map.put(pkg.name(), inPkg);
|
||||
}
|
||||
inPkg.add(doc);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a class page.
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration,
|
||||
ClassUseMapper mapper, ClassDoc classdoc) {
|
||||
ClassUseWriter clsgen;
|
||||
DocPath path = DocPath.forPackage(classdoc)
|
||||
.resolve(DocPaths.CLASS_USE)
|
||||
.resolve(DocPath.forName(classdoc));
|
||||
try {
|
||||
clsgen = new ClassUseWriter(configuration,
|
||||
mapper, path,
|
||||
classdoc);
|
||||
clsgen.generateClassUseFile();
|
||||
clsgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.
|
||||
error("doclet.exception_encountered",
|
||||
exc.toString(), path.getPath());
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the class use list.
|
||||
*/
|
||||
protected void generateClassUseFile() throws IOException {
|
||||
Content body = getClassUseHeader();
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.classUseContainer);
|
||||
if (pkgSet.size() > 0) {
|
||||
addClassUse(div);
|
||||
} else {
|
||||
div.addContent(getResource("doclet.ClassUse_No.usage.of.0",
|
||||
classdoc.qualifiedName()));
|
||||
}
|
||||
body.addContent(div);
|
||||
addNavLinks(false, body);
|
||||
addBottom(body);
|
||||
printHtmlDocument(null, true, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the class use documentation.
|
||||
*
|
||||
* @param contentTree the content tree to which the class use information will be added
|
||||
*/
|
||||
protected void addClassUse(Content contentTree) throws IOException {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
if (configuration.packages.length > 1) {
|
||||
addPackageList(ul);
|
||||
addPackageAnnotationList(ul);
|
||||
}
|
||||
addClassList(ul);
|
||||
contentTree.addContent(ul);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the packages list that use the given class.
|
||||
*
|
||||
* @param contentTree the content tree to which the packages list will be added
|
||||
*/
|
||||
protected void addPackageList(Content contentTree) throws IOException {
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary,
|
||||
getTableCaption(configuration.getResource(
|
||||
"doclet.ClassUse_Packages.that.use.0",
|
||||
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc
|
||||
)))));
|
||||
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
Iterator<PackageDoc> it = pkgSet.iterator();
|
||||
for (int i = 0; it.hasNext(); i++) {
|
||||
PackageDoc pkg = it.next();
|
||||
HtmlTree tr = new HtmlTree(HtmlTag.TR);
|
||||
if (i % 2 == 0) {
|
||||
tr.addStyle(HtmlStyle.altColor);
|
||||
} else {
|
||||
tr.addStyle(HtmlStyle.rowColor);
|
||||
}
|
||||
addPackageUse(pkg, tr);
|
||||
tbody.addContent(tr);
|
||||
}
|
||||
table.addContent(tbody);
|
||||
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
|
||||
contentTree.addContent(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the package annotation list.
|
||||
*
|
||||
* @param contentTree the content tree to which the package annotation list will be added
|
||||
*/
|
||||
protected void addPackageAnnotationList(Content contentTree) throws IOException {
|
||||
if ((!classdoc.isAnnotationType()) ||
|
||||
pkgToPackageAnnotations == null ||
|
||||
pkgToPackageAnnotations.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary,
|
||||
getTableCaption(configuration.getResource(
|
||||
"doclet.ClassUse_PackageAnnotation",
|
||||
getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)))));
|
||||
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
|
||||
for (int i = 0; it.hasNext(); i++) {
|
||||
PackageDoc pkg = it.next();
|
||||
HtmlTree tr = new HtmlTree(HtmlTag.TR);
|
||||
if (i % 2 == 0) {
|
||||
tr.addStyle(HtmlStyle.altColor);
|
||||
} else {
|
||||
tr.addStyle(HtmlStyle.rowColor);
|
||||
}
|
||||
Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
|
||||
getPackageLink(pkg, new StringContent(pkg.name())));
|
||||
tr.addContent(tdFirst);
|
||||
HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
|
||||
tdLast.addStyle(HtmlStyle.colLast);
|
||||
addSummaryComment(pkg, tdLast);
|
||||
tr.addContent(tdLast);
|
||||
tbody.addContent(tr);
|
||||
}
|
||||
table.addContent(tbody);
|
||||
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
|
||||
contentTree.addContent(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the class list that use the given class.
|
||||
*
|
||||
* @param contentTree the content tree to which the class list will be added
|
||||
*/
|
||||
protected void addClassList(Content contentTree) throws IOException {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) {
|
||||
PackageDoc pkg = it.next();
|
||||
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name()));
|
||||
Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
|
||||
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
|
||||
classdoc)),
|
||||
getPackageLink(pkg, Util.getPackageName(pkg)));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
|
||||
li.addContent(heading);
|
||||
addClassUse(pkg, li);
|
||||
ul.addContent(li);
|
||||
}
|
||||
Content li = HtmlTree.LI(HtmlStyle.blockList, ul);
|
||||
contentTree.addContent(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the package use information.
|
||||
*
|
||||
* @param pkg the package that uses the given class
|
||||
* @param contentTree the content tree to which the package use information will be added
|
||||
*/
|
||||
protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
|
||||
Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
|
||||
getHyperLink(pkg.name(), new StringContent(Util.getPackageName(pkg))));
|
||||
contentTree.addContent(tdFirst);
|
||||
HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
|
||||
tdLast.addStyle(HtmlStyle.colLast);
|
||||
addSummaryComment(pkg, tdLast);
|
||||
contentTree.addContent(tdLast);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the class use information.
|
||||
*
|
||||
* @param pkg the package that uses the given class
|
||||
* @param contentTree the content tree to which the class use information will be added
|
||||
*/
|
||||
protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
|
||||
Content classLink = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc));
|
||||
Content pkgLink = getPackageLink(pkg, Util.getPackageName(pkg));
|
||||
classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_Annotation", classLink,
|
||||
pkgLink), classUseTableSummary, contentTree);
|
||||
classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_TypeParameter", classLink,
|
||||
pkgLink), classUseTableSummary, contentTree);
|
||||
classSubWriter.addUseInfo(pkgToSubclass.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_Subclass", classLink,
|
||||
pkgLink), subclassUseTableSummary, contentTree);
|
||||
classSubWriter.addUseInfo(pkgToSubinterface.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_Subinterface", classLink,
|
||||
pkgLink), subinterfaceUseTableSummary, contentTree);
|
||||
classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_ImplementingClass", classLink,
|
||||
pkgLink), classUseTableSummary, contentTree);
|
||||
fieldSubWriter.addUseInfo(pkgToField.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_Field", classLink,
|
||||
pkgLink), fieldUseTableSummary, contentTree);
|
||||
fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_FieldAnnotations", classLink,
|
||||
pkgLink), fieldUseTableSummary, contentTree);
|
||||
fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_FieldTypeParameter", classLink,
|
||||
pkgLink), fieldUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_MethodAnnotations", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_MethodParameterAnnotations", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_MethodTypeParameter", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_MethodReturn", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_MethodReturnTypeParameter", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_MethodArgs", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_MethodArgsTypeParameters", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_MethodThrows", classLink,
|
||||
pkgLink), methodUseTableSummary, contentTree);
|
||||
constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_ConstructorAnnotations", classLink,
|
||||
pkgLink), constructorUseTableSummary, contentTree);
|
||||
constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
|
||||
pkgLink), constructorUseTableSummary, contentTree);
|
||||
constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_ConstructorArgs", classLink,
|
||||
pkgLink), constructorUseTableSummary, contentTree);
|
||||
constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
|
||||
pkgLink), constructorUseTableSummary, contentTree);
|
||||
constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg.name()),
|
||||
configuration.getResource("doclet.ClassUse_ConstructorThrows", classLink,
|
||||
pkgLink), constructorUseTableSummary, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the header for the class use Listing.
|
||||
*
|
||||
* @return a content tree representing the class use header
|
||||
*/
|
||||
protected Content getClassUseHeader() {
|
||||
String cltype = configuration.getText(classdoc.isInterface()?
|
||||
"doclet.Interface":"doclet.Class");
|
||||
String clname = classdoc.qualifiedName();
|
||||
String title = configuration.getText("doclet.Window_ClassUse_Header",
|
||||
cltype, clname);
|
||||
Content bodyTree = getBody(true, getWindowTitle(title));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
ContentBuilder headContent = new ContentBuilder();
|
||||
headContent.addContent(getResource("doclet.ClassUse_Title", cltype));
|
||||
headContent.addContent(new HtmlTree(HtmlTag.BR));
|
||||
headContent.addContent(clname);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
|
||||
true, HtmlStyle.title, headContent);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
bodyTree.addContent(div);
|
||||
return bodyTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this package link.
|
||||
*
|
||||
* @return a content tree for the package link
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content linkContent =
|
||||
getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY), packageLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get class page link.
|
||||
*
|
||||
* @return a content tree for the class page link
|
||||
*/
|
||||
protected Content getNavLinkClass() {
|
||||
Content linkContent = getLink(new LinkInfoImpl(
|
||||
configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)
|
||||
.label(configuration.getText("doclet.Class")));
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the use link.
|
||||
*
|
||||
* @return a content tree for the use link
|
||||
*/
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, useLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tree link.
|
||||
*
|
||||
* @return a content tree for the tree link
|
||||
*/
|
||||
protected Content getNavLinkTree() {
|
||||
Content linkContent = classdoc.containingPackage().isIncluded() ?
|
||||
getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), treeLabel) :
|
||||
getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), treeLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,730 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.javadoc.RootDocImpl;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.builders.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.taglets.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Generate the Class Information Page.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @see com.sun.javadoc.ClassDoc
|
||||
* @see java.util.Collections
|
||||
* @see java.util.List
|
||||
* @see java.util.ArrayList
|
||||
* @see java.util.HashMap
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
* @author Robert Field
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class ClassWriterImpl extends SubWriterHolderWriter
|
||||
implements ClassWriter {
|
||||
|
||||
protected final ClassDoc classDoc;
|
||||
|
||||
protected final ClassTree classtree;
|
||||
|
||||
protected final ClassDoc prev;
|
||||
|
||||
protected final ClassDoc next;
|
||||
|
||||
/**
|
||||
* @param configuration the configuration data for the doclet
|
||||
* @param classDoc the class being documented.
|
||||
* @param prevClass the previous class that was documented.
|
||||
* @param nextClass the next class being documented.
|
||||
* @param classTree the class tree for the given class.
|
||||
*/
|
||||
public ClassWriterImpl (ConfigurationImpl configuration, ClassDoc classDoc,
|
||||
ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree)
|
||||
throws IOException {
|
||||
super(configuration, DocPath.forClass(classDoc));
|
||||
this.classDoc = classDoc;
|
||||
configuration.currentcd = classDoc;
|
||||
this.classtree = classTree;
|
||||
this.prev = prevClass;
|
||||
this.next = nextClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this package link.
|
||||
*
|
||||
* @return a content tree for the package link
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
|
||||
packageLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class link.
|
||||
*
|
||||
* @return a content tree for the class link
|
||||
*/
|
||||
protected Content getNavLinkClass() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class use link.
|
||||
*
|
||||
* @return a content tree for the class use link
|
||||
*/
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), useLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to previous class.
|
||||
*
|
||||
* @return a content tree for the previous class link
|
||||
*/
|
||||
public Content getNavLinkPrevious() {
|
||||
Content li;
|
||||
if (prev != null) {
|
||||
Content prevLink = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS, prev)
|
||||
.label(prevclassLabel).strong(true));
|
||||
li = HtmlTree.LI(prevLink);
|
||||
}
|
||||
else
|
||||
li = HtmlTree.LI(prevclassLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to next class.
|
||||
*
|
||||
* @return a content tree for the next class link
|
||||
*/
|
||||
public Content getNavLinkNext() {
|
||||
Content li;
|
||||
if (next != null) {
|
||||
Content nextLink = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS, next)
|
||||
.label(nextclassLabel).strong(true));
|
||||
li = HtmlTree.LI(nextLink);
|
||||
}
|
||||
else
|
||||
li = HtmlTree.LI(nextclassLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getHeader(String header) {
|
||||
String pkgname = (classDoc.containingPackage() != null)?
|
||||
classDoc.containingPackage().name(): "";
|
||||
String clname = classDoc.name();
|
||||
Content bodyTree = getBody(true, getWindowTitle(clname));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.header);
|
||||
if (configuration.showProfiles) {
|
||||
String sep = "";
|
||||
int profile = configuration.profiles.getProfile(getTypeNameForProfile(classDoc));
|
||||
if (profile > 0) {
|
||||
Content profNameContent = new StringContent();
|
||||
for (int i = profile; i < configuration.profiles.getProfileCount(); i++) {
|
||||
profNameContent.addContent(sep);
|
||||
profNameContent.addContent(Profile.lookup(i).name);
|
||||
sep = ", ";
|
||||
}
|
||||
Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profNameContent);
|
||||
div.addContent(profileNameDiv);
|
||||
}
|
||||
}
|
||||
if (pkgname.length() > 0) {
|
||||
Content pkgNameContent = new StringContent(pkgname);
|
||||
Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
|
||||
div.addContent(pkgNameDiv);
|
||||
}
|
||||
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_HEADER, classDoc);
|
||||
//Let's not link to ourselves in the header.
|
||||
linkInfo.linkToSelf = false;
|
||||
Content headerContent = new StringContent(header);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
|
||||
HtmlStyle.title, headerContent);
|
||||
heading.addContent(getTypeParameterLinks(linkInfo));
|
||||
div.addContent(heading);
|
||||
bodyTree.addContent(div);
|
||||
return bodyTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getClassContentHeader() {
|
||||
return getContentHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addFooter(Content contentTree) {
|
||||
contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
|
||||
addNavLinks(false, contentTree);
|
||||
addBottom(contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void printDocument(Content contentTree) throws IOException {
|
||||
printHtmlDocument(configuration.metakeywords.getMetaKeywords(classDoc),
|
||||
true, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getClassInfoTreeHeader() {
|
||||
return getMemberTreeHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getClassInfo(Content classInfoTree) {
|
||||
return getMemberTree(HtmlStyle.description, classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addClassSignature(String modifiers, Content classInfoTree) {
|
||||
boolean isInterface = classDoc.isInterface();
|
||||
classInfoTree.addContent(new HtmlTree(HtmlTag.BR));
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
addAnnotationInfo(classDoc, pre);
|
||||
pre.addContent(modifiers);
|
||||
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_SIGNATURE, classDoc);
|
||||
//Let's not link to ourselves in the signature.
|
||||
linkInfo.linkToSelf = false;
|
||||
Content className = new StringContent(classDoc.name());
|
||||
Content parameterLinks = getTypeParameterLinks(linkInfo);
|
||||
if (configuration.linksource) {
|
||||
addSrcLink(classDoc, className, pre);
|
||||
pre.addContent(parameterLinks);
|
||||
} else {
|
||||
Content span = HtmlTree.SPAN(HtmlStyle.typeNameLabel, className);
|
||||
span.addContent(parameterLinks);
|
||||
pre.addContent(span);
|
||||
}
|
||||
if (!isInterface) {
|
||||
Type superclass = Util.getFirstVisibleSuperClass(classDoc,
|
||||
configuration);
|
||||
if (superclass != null) {
|
||||
pre.addContent(DocletConstants.NL);
|
||||
pre.addContent("extends ");
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
|
||||
superclass));
|
||||
pre.addContent(link);
|
||||
}
|
||||
}
|
||||
Type[] implIntfacs = classDoc.interfaceTypes();
|
||||
if (implIntfacs != null && implIntfacs.length > 0) {
|
||||
int counter = 0;
|
||||
for (int i = 0; i < implIntfacs.length; i++) {
|
||||
ClassDoc classDoc = implIntfacs[i].asClassDoc();
|
||||
if (! (classDoc.isPublic() ||
|
||||
Util.isLinkable(classDoc, configuration))) {
|
||||
continue;
|
||||
}
|
||||
if (counter == 0) {
|
||||
pre.addContent(DocletConstants.NL);
|
||||
pre.addContent(isInterface? "extends " : "implements ");
|
||||
} else {
|
||||
pre.addContent(", ");
|
||||
}
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
|
||||
implIntfacs[i]));
|
||||
pre.addContent(link);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
classInfoTree.addContent(pre);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addClassDescription(Content classInfoTree) {
|
||||
if(!configuration.nocomment) {
|
||||
// generate documentation for the class.
|
||||
if (classDoc.inlineTags().length > 0) {
|
||||
addInlineComment(classDoc, classInfoTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addClassTagInfo(Content classInfoTree) {
|
||||
if(!configuration.nocomment) {
|
||||
// Print Information about all the tags here
|
||||
addTagsInfo(classDoc, classInfoTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class hierarchy tree for the given class.
|
||||
*
|
||||
* @param type the class to print the hierarchy for
|
||||
* @return a content tree for class inheritence
|
||||
*/
|
||||
private Content getClassInheritenceTree(Type type) {
|
||||
Type sup;
|
||||
HtmlTree classTreeUl = new HtmlTree(HtmlTag.UL);
|
||||
classTreeUl.addStyle(HtmlStyle.inheritance);
|
||||
Content liTree = null;
|
||||
do {
|
||||
sup = Util.getFirstVisibleSuperClass(
|
||||
type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(),
|
||||
configuration);
|
||||
if (sup != null) {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.inheritance);
|
||||
ul.addContent(getTreeForClassHelper(type));
|
||||
if (liTree != null)
|
||||
ul.addContent(liTree);
|
||||
Content li = HtmlTree.LI(ul);
|
||||
liTree = li;
|
||||
type = sup;
|
||||
}
|
||||
else
|
||||
classTreeUl.addContent(getTreeForClassHelper(type));
|
||||
}
|
||||
while (sup != null);
|
||||
if (liTree != null)
|
||||
classTreeUl.addContent(liTree);
|
||||
return classTreeUl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class helper tree for the given class.
|
||||
*
|
||||
* @param type the class to print the helper for
|
||||
* @return a content tree for class helper
|
||||
*/
|
||||
private Content getTreeForClassHelper(Type type) {
|
||||
Content li = new HtmlTree(HtmlTag.LI);
|
||||
if (type.equals(classDoc)) {
|
||||
Content typeParameters = getTypeParameterLinks(
|
||||
new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
|
||||
classDoc));
|
||||
if (configuration.shouldExcludeQualifier(
|
||||
classDoc.containingPackage().name())) {
|
||||
li.addContent(type.asClassDoc().name());
|
||||
li.addContent(typeParameters);
|
||||
} else {
|
||||
li.addContent(type.asClassDoc().qualifiedName());
|
||||
li.addContent(typeParameters);
|
||||
}
|
||||
} else {
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_TREE_PARENT, type)
|
||||
.label(configuration.getClassName(type.asClassDoc())));
|
||||
li.addContent(link);
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addClassTree(Content classContentTree) {
|
||||
if (!classDoc.isClass()) {
|
||||
return;
|
||||
}
|
||||
classContentTree.addContent(getClassInheritenceTree(classDoc));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addTypeParamInfo(Content classInfoTree) {
|
||||
if (classDoc.typeParamTags().length > 0) {
|
||||
Content typeParam = (new ParamTaglet()).getTagletOutput(classDoc,
|
||||
getTagletWriterInstance(false));
|
||||
Content dl = HtmlTree.DL(typeParam);
|
||||
classInfoTree.addContent(dl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSubClassInfo(Content classInfoTree) {
|
||||
if (classDoc.isClass()) {
|
||||
if (classDoc.qualifiedName().equals("java.lang.Object") ||
|
||||
classDoc.qualifiedName().equals("org.omg.CORBA.Object")) {
|
||||
return; // Don't generate the list, too huge
|
||||
}
|
||||
List<ClassDoc> subclasses = classtree.subs(classDoc, false);
|
||||
if (subclasses.size() > 0) {
|
||||
Content label = getResource(
|
||||
"doclet.Subclasses");
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUBCLASSES,
|
||||
subclasses));
|
||||
classInfoTree.addContent(dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSubInterfacesInfo(Content classInfoTree) {
|
||||
if (classDoc.isInterface()) {
|
||||
List<ClassDoc> subInterfaces = classtree.allSubs(classDoc, false);
|
||||
if (subInterfaces.size() > 0) {
|
||||
Content label = getResource(
|
||||
"doclet.Subinterfaces");
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUBINTERFACES,
|
||||
subInterfaces));
|
||||
classInfoTree.addContent(dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInterfaceUsageInfo (Content classInfoTree) {
|
||||
if (! classDoc.isInterface()) {
|
||||
return;
|
||||
}
|
||||
if (classDoc.qualifiedName().equals("java.lang.Cloneable") ||
|
||||
classDoc.qualifiedName().equals("java.io.Serializable")) {
|
||||
return; // Don't generate the list, too big
|
||||
}
|
||||
List<ClassDoc> implcl = classtree.implementingclasses(classDoc);
|
||||
if (implcl.size() > 0) {
|
||||
Content label = getResource(
|
||||
"doclet.Implementing_Classes");
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.addContent(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_CLASSES,
|
||||
implcl));
|
||||
classInfoTree.addContent(dl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addImplementedInterfacesInfo(Content classInfoTree) {
|
||||
//NOTE: we really should be using ClassDoc.interfaceTypes() here, but
|
||||
// it doesn't walk up the tree like we want it to.
|
||||
List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration);
|
||||
if (classDoc.isClass() && interfaceArray.size() > 0) {
|
||||
Content label = getResource(
|
||||
"doclet.All_Implemented_Interfaces");
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.addContent(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_INTERFACES,
|
||||
interfaceArray));
|
||||
classInfoTree.addContent(dl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSuperInterfacesInfo(Content classInfoTree) {
|
||||
//NOTE: we really should be using ClassDoc.interfaceTypes() here, but
|
||||
// it doesn't walk up the tree like we want it to.
|
||||
List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration);
|
||||
if (classDoc.isInterface() && interfaceArray.size() > 0) {
|
||||
Content label = getResource(
|
||||
"doclet.All_Superinterfaces");
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUPER_INTERFACES,
|
||||
interfaceArray));
|
||||
classInfoTree.addContent(dl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addNestedClassInfo(Content classInfoTree) {
|
||||
ClassDoc outerClass = classDoc.containingClass();
|
||||
if (outerClass != null) {
|
||||
Content label;
|
||||
if (outerClass.isInterface()) {
|
||||
label = getResource(
|
||||
"doclet.Enclosing_Interface");
|
||||
} else {
|
||||
label = getResource(
|
||||
"doclet.Enclosing_Class");
|
||||
}
|
||||
Content dt = HtmlTree.DT(label);
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
dd.addContent(getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS, outerClass)));
|
||||
dl.addContent(dd);
|
||||
classInfoTree.addContent(dl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addFunctionalInterfaceInfo (Content classInfoTree) {
|
||||
if (isFunctionalInterface()) {
|
||||
Content dt = HtmlTree.DT(getResource("doclet.Functional_Interface"));
|
||||
Content dl = HtmlTree.DL(dt);
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
dd.addContent(getResource("doclet.Functional_Interface_Message"));
|
||||
dl.addContent(dd);
|
||||
classInfoTree.addContent(dl);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFunctionalInterface() {
|
||||
if (configuration.root instanceof RootDocImpl) {
|
||||
RootDocImpl root = (RootDocImpl) configuration.root;
|
||||
AnnotationDesc[] annotationDescList = classDoc.annotations();
|
||||
for (AnnotationDesc annoDesc : annotationDescList) {
|
||||
if (root.isFunctionalInterface(annoDesc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addClassDeprecationInfo(Content classInfoTree) {
|
||||
Content hr = new HtmlTree(HtmlTag.HR);
|
||||
classInfoTree.addContent(hr);
|
||||
Tag[] deprs = classDoc.tags("deprecated");
|
||||
if (Util.isDeprecated(classDoc)) {
|
||||
Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
|
||||
if (deprs.length > 0) {
|
||||
Tag[] commentTags = deprs[0].inlineTags();
|
||||
if (commentTags.length > 0) {
|
||||
div.addContent(getSpace());
|
||||
addInlineDeprecatedComment(classDoc, deprs[0], div);
|
||||
}
|
||||
}
|
||||
classInfoTree.addContent(div);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get links to the given classes.
|
||||
*
|
||||
* @param context the id of the context where the link will be printed
|
||||
* @param list the list of classes
|
||||
* @return a content tree for the class list
|
||||
*/
|
||||
private Content getClassLinks(LinkInfoImpl.Kind context, List<?> list) {
|
||||
Object[] typeList = list.toArray();
|
||||
Content dd = new HtmlTree(HtmlTag.DD);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (i > 0) {
|
||||
Content separator = new StringContent(", ");
|
||||
dd.addContent(separator);
|
||||
}
|
||||
if (typeList[i] instanceof ClassDoc) {
|
||||
Content link = getLink(
|
||||
new LinkInfoImpl(configuration, context, (ClassDoc)(typeList[i])));
|
||||
dd.addContent(link);
|
||||
} else {
|
||||
Content link = getLink(
|
||||
new LinkInfoImpl(configuration, context, (Type)(typeList[i])));
|
||||
dd.addContent(link);
|
||||
}
|
||||
}
|
||||
return dd;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getNavLinkTree() {
|
||||
Content treeLinkContent = getHyperLink(DocPaths.PACKAGE_TREE,
|
||||
treeLabel, "", "");
|
||||
Content li = HtmlTree.LI(treeLinkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add summary details to the navigation bar.
|
||||
*
|
||||
* @param subDiv the content tree to which the summary detail links will be added
|
||||
*/
|
||||
protected void addSummaryDetailLinks(Content subDiv) {
|
||||
try {
|
||||
Content div = HtmlTree.DIV(getNavSummaryLinks());
|
||||
div.addContent(getNavDetailLinks());
|
||||
subDiv.addContent(div);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new DocletAbortException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get summary links for navigation bar.
|
||||
*
|
||||
* @return the content tree for the navigation summary links
|
||||
*/
|
||||
protected Content getNavSummaryLinks() throws Exception {
|
||||
Content li = HtmlTree.LI(summaryLabel);
|
||||
li.addContent(getSpace());
|
||||
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
|
||||
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
|
||||
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
|
||||
String[] navLinkLabels = new String[] {
|
||||
"doclet.navNested", "doclet.navEnum", "doclet.navField", "doclet.navConstructor",
|
||||
"doclet.navMethod"
|
||||
};
|
||||
for (int i = 0; i < navLinkLabels.length; i++ ) {
|
||||
Content liNav = new HtmlTree(HtmlTag.LI);
|
||||
if (i == VisibleMemberMap.ENUM_CONSTANTS && ! classDoc.isEnum()) {
|
||||
continue;
|
||||
}
|
||||
if (i == VisibleMemberMap.CONSTRUCTORS && classDoc.isEnum()) {
|
||||
continue;
|
||||
}
|
||||
AbstractMemberWriter writer =
|
||||
((AbstractMemberWriter) memberSummaryBuilder.
|
||||
getMemberSummaryWriter(i));
|
||||
if (writer == null) {
|
||||
liNav.addContent(getResource(navLinkLabels[i]));
|
||||
} else {
|
||||
writer.addNavSummaryLink(
|
||||
memberSummaryBuilder.members(i),
|
||||
memberSummaryBuilder.getVisibleMemberMap(i), liNav);
|
||||
}
|
||||
if (i < navLinkLabels.length-1) {
|
||||
addNavGap(liNav);
|
||||
}
|
||||
ulNav.addContent(liNav);
|
||||
}
|
||||
return ulNav;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get detail links for the navigation bar.
|
||||
*
|
||||
* @return the content tree for the detail links
|
||||
*/
|
||||
protected Content getNavDetailLinks() throws Exception {
|
||||
Content li = HtmlTree.LI(detailLabel);
|
||||
li.addContent(getSpace());
|
||||
Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
|
||||
MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
|
||||
configuration.getBuilderFactory().getMemberSummaryBuilder(this);
|
||||
String[] navLinkLabels = new String[] {
|
||||
"doclet.navNested", "doclet.navEnum", "doclet.navField", "doclet.navConstructor",
|
||||
"doclet.navMethod"
|
||||
};
|
||||
for (int i = 1; i < navLinkLabels.length; i++ ) {
|
||||
Content liNav = new HtmlTree(HtmlTag.LI);
|
||||
AbstractMemberWriter writer =
|
||||
((AbstractMemberWriter) memberSummaryBuilder.
|
||||
getMemberSummaryWriter(i));
|
||||
if (i == VisibleMemberMap.ENUM_CONSTANTS && ! classDoc.isEnum()) {
|
||||
continue;
|
||||
}
|
||||
if (i == VisibleMemberMap.CONSTRUCTORS && classDoc.isEnum()) {
|
||||
continue;
|
||||
}
|
||||
if (writer == null) {
|
||||
liNav.addContent(getResource(navLinkLabels[i]));
|
||||
} else {
|
||||
writer.addNavDetailLink(memberSummaryBuilder.members(i), liNav);
|
||||
}
|
||||
if (i < navLinkLabels.length - 1) {
|
||||
addNavGap(liNav);
|
||||
}
|
||||
ulNav.addContent(liNav);
|
||||
}
|
||||
return ulNav;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add gap between navigation bar elements.
|
||||
*
|
||||
* @param liNav the content tree to which the gap will be added
|
||||
*/
|
||||
protected void addNavGap(Content liNav) {
|
||||
liNav.addContent(getSpace());
|
||||
liNav.addContent("|");
|
||||
liNav.addContent(getSpace());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the classDoc being documented.
|
||||
*
|
||||
* @return the classDoc being documented.
|
||||
*/
|
||||
public ClassDoc getClassDoc() {
|
||||
return classDoc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,638 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2016, 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 java.net.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.tools.JavaFileManager;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
import com.sun.tools.doclint.DocLint;
|
||||
import com.sun.tools.javac.file.JavacFileManager;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
import com.sun.tools.javac.util.StringUtils;
|
||||
import com.sun.tools.javadoc.JavaScriptScanner;
|
||||
import com.sun.tools.javadoc.RootDocImpl;
|
||||
|
||||
/**
|
||||
* Configure the output based on the command line options.
|
||||
* <p>
|
||||
* Also determine the length of the command line option. For example,
|
||||
* for a option "-header" there will be a string argument associated, then the
|
||||
* the length of option "-header" is two. But for option "-nohelp" no argument
|
||||
* is needed so it's length is 1.
|
||||
* </p>
|
||||
* <p>
|
||||
* Also do the error checking on the options used. For example it is illegal to
|
||||
* use "-helpfile" option when already "-nohelp" option is used.
|
||||
* </p>
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Robert Field.
|
||||
* @author Atul Dambalkar.
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class ConfigurationImpl extends Configuration {
|
||||
|
||||
/**
|
||||
* The build date. Note: For now, we will use
|
||||
* a version number instead of a date.
|
||||
*/
|
||||
public static final String BUILD_DATE = System.getProperty("java.version");
|
||||
|
||||
/**
|
||||
* Argument for command line option "-header".
|
||||
*/
|
||||
public String header = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-packagesheader".
|
||||
*/
|
||||
public String packagesheader = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-footer".
|
||||
*/
|
||||
public String footer = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-doctitle".
|
||||
*/
|
||||
public String doctitle = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-windowtitle".
|
||||
*/
|
||||
public String windowtitle = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-top".
|
||||
*/
|
||||
public String top = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-bottom".
|
||||
*/
|
||||
public String bottom = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-helpfile".
|
||||
*/
|
||||
public String helpfile = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-stylesheetfile".
|
||||
*/
|
||||
public String stylesheetfile = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-Xdocrootparent".
|
||||
*/
|
||||
public String docrootparent = "";
|
||||
|
||||
/**
|
||||
* True if command line option "-nohelp" is used. Default value is false.
|
||||
*/
|
||||
public boolean nohelp = false;
|
||||
|
||||
/**
|
||||
* True if command line option "-splitindex" is used. Default value is
|
||||
* false.
|
||||
*/
|
||||
public boolean splitindex = false;
|
||||
|
||||
/**
|
||||
* False if command line option "-noindex" is used. Default value is true.
|
||||
*/
|
||||
public boolean createindex = true;
|
||||
|
||||
/**
|
||||
* True if command line option "-use" is used. Default value is false.
|
||||
*/
|
||||
public boolean classuse = false;
|
||||
|
||||
/**
|
||||
* False if command line option "-notree" is used. Default value is true.
|
||||
*/
|
||||
public boolean createtree = true;
|
||||
|
||||
/**
|
||||
* True if command line option "-nodeprecated" is used. Default value is
|
||||
* false.
|
||||
*/
|
||||
public boolean nodeprecatedlist = false;
|
||||
|
||||
/**
|
||||
* True if command line option "-nonavbar" is used. Default value is false.
|
||||
*/
|
||||
public boolean nonavbar = false;
|
||||
|
||||
/**
|
||||
* True if command line option "-nooverview" is used. Default value is
|
||||
* false
|
||||
*/
|
||||
private boolean nooverview = false;
|
||||
|
||||
/**
|
||||
* True if command line option "-overview" is used. Default value is false.
|
||||
*/
|
||||
public boolean overview = false;
|
||||
|
||||
/**
|
||||
* This is true if option "-overview" is used or option "-overview" is not
|
||||
* used and number of packages is more than one.
|
||||
*/
|
||||
public boolean createoverview = false;
|
||||
|
||||
/**
|
||||
* Collected set of doclint options
|
||||
*/
|
||||
public Set<String> doclintOpts = new LinkedHashSet<String>();
|
||||
|
||||
/**
|
||||
* Whether or not to check for JavaScript in doc comments.
|
||||
*/
|
||||
private boolean allowScriptInComments;
|
||||
|
||||
/**
|
||||
* Unique Resource Handler for this package.
|
||||
*/
|
||||
public final MessageRetriever standardmessage;
|
||||
|
||||
/**
|
||||
* First file to appear in the right-hand frame in the generated
|
||||
* documentation.
|
||||
*/
|
||||
public DocPath topFile = DocPath.empty;
|
||||
|
||||
/**
|
||||
* The classdoc for the class file getting generated.
|
||||
*/
|
||||
public ClassDoc currentcd = null; // Set this classdoc in the ClassWriter.
|
||||
|
||||
/**
|
||||
* Constructor. Initializes resource for the
|
||||
* {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}.
|
||||
*/
|
||||
public ConfigurationImpl() {
|
||||
standardmessage = new MessageRetriever(this,
|
||||
"com.sun.tools.doclets.formats.html.resources.standard");
|
||||
}
|
||||
|
||||
private final String versionRBName = "com.sun.tools.javadoc.resources.version";
|
||||
private ResourceBundle versionRB;
|
||||
|
||||
/**
|
||||
* Return the build date for the doclet.
|
||||
*/
|
||||
@Override
|
||||
public String getDocletSpecificBuildDate() {
|
||||
if (versionRB == null) {
|
||||
try {
|
||||
versionRB = ResourceBundle.getBundle(versionRBName);
|
||||
} catch (MissingResourceException e) {
|
||||
return BUILD_DATE;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return versionRB.getString("release");
|
||||
} catch (MissingResourceException e) {
|
||||
return BUILD_DATE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Depending upon the command line options provided by the user, set
|
||||
* configure the output generation environment.
|
||||
*
|
||||
* @param options The array of option names and values.
|
||||
*/
|
||||
@Override
|
||||
public void setSpecificDocletOptions(String[][] options) {
|
||||
for (int oi = 0; oi < options.length; ++oi) {
|
||||
String[] os = options[oi];
|
||||
String opt = StringUtils.toLowerCase(os[0]);
|
||||
if (opt.equals("-footer")) {
|
||||
footer = os[1];
|
||||
} else if (opt.equals("-header")) {
|
||||
header = os[1];
|
||||
} else if (opt.equals("-packagesheader")) {
|
||||
packagesheader = os[1];
|
||||
} else if (opt.equals("-doctitle")) {
|
||||
doctitle = os[1];
|
||||
} else if (opt.equals("-windowtitle")) {
|
||||
windowtitle = os[1].replaceAll("\\<.*?>", "");
|
||||
} else if (opt.equals("-top")) {
|
||||
top = os[1];
|
||||
} else if (opt.equals("-bottom")) {
|
||||
bottom = os[1];
|
||||
} else if (opt.equals("-helpfile")) {
|
||||
helpfile = os[1];
|
||||
} else if (opt.equals("-stylesheetfile")) {
|
||||
stylesheetfile = os[1];
|
||||
} else if (opt.equals("-charset")) {
|
||||
charset = os[1];
|
||||
} else if (opt.equals("-xdocrootparent")) {
|
||||
docrootparent = os[1];
|
||||
} else if (opt.equals("-nohelp")) {
|
||||
nohelp = true;
|
||||
} else if (opt.equals("-splitindex")) {
|
||||
splitindex = true;
|
||||
} else if (opt.equals("-noindex")) {
|
||||
createindex = false;
|
||||
} else if (opt.equals("-use")) {
|
||||
classuse = true;
|
||||
} else if (opt.equals("-notree")) {
|
||||
createtree = false;
|
||||
} else if (opt.equals("-nodeprecatedlist")) {
|
||||
nodeprecatedlist = true;
|
||||
} else if (opt.equals("-nonavbar")) {
|
||||
nonavbar = true;
|
||||
} else if (opt.equals("-nooverview")) {
|
||||
nooverview = true;
|
||||
} else if (opt.equals("-overview")) {
|
||||
overview = true;
|
||||
} else if (opt.equals("-xdoclint")) {
|
||||
doclintOpts.add(null);
|
||||
} else if (opt.startsWith("-xdoclint:")) {
|
||||
doclintOpts.add(opt.substring(opt.indexOf(":") + 1));
|
||||
} else if (opt.equals("--allow-script-in-comments")) {
|
||||
allowScriptInComments = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (root.specifiedClasses().length > 0) {
|
||||
Map<String,PackageDoc> map = new HashMap<String,PackageDoc>();
|
||||
PackageDoc pd;
|
||||
ClassDoc[] classes = root.classes();
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
pd = classes[i].containingPackage();
|
||||
if(! map.containsKey(pd.name())) {
|
||||
map.put(pd.name(), pd);
|
||||
}
|
||||
}
|
||||
}
|
||||
setCreateOverview();
|
||||
setTopFile(root);
|
||||
|
||||
if (root instanceof RootDocImpl) {
|
||||
((RootDocImpl) root).initDocLint(doclintOpts, tagletManager.getCustomTagNames());
|
||||
JavaScriptScanner jss = ((RootDocImpl) root).initJavaScriptScanner(isAllowScriptInComments());
|
||||
if (jss != null) {
|
||||
// In a more object-oriented world, this would be done by methods on the Option objects.
|
||||
// Note that -windowtitle silently removes any and all HTML elements, and so does not need
|
||||
// to be handled here.
|
||||
checkJavaScript(jss, "-header", header);
|
||||
checkJavaScript(jss, "-footer", footer);
|
||||
checkJavaScript(jss, "-top", top);
|
||||
checkJavaScript(jss, "-bottom", bottom);
|
||||
checkJavaScript(jss, "-doctitle", doctitle);
|
||||
checkJavaScript(jss, "-packagesheader", packagesheader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkJavaScript(JavaScriptScanner jss, final String opt, String value) {
|
||||
jss.parse(value, new JavaScriptScanner.Reporter() {
|
||||
public void report() {
|
||||
root.printError(getText("doclet.JavaScript_in_option", opt));
|
||||
throw new FatalError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the "length" of a given option. If an option takes no
|
||||
* arguments, its length is one. If it takes one argument, it's
|
||||
* length is two, and so on. This method is called by JavaDoc to
|
||||
* parse the options it does not recognize. It then calls
|
||||
* {@link #validOptions(String[][], DocErrorReporter)} to
|
||||
* validate them.
|
||||
* <b>Note:</b><br>
|
||||
* The options arrive as case-sensitive strings. For options that
|
||||
* are not case-sensitive, use toLowerCase() on the option string
|
||||
* before comparing it.
|
||||
* </blockquote>
|
||||
*
|
||||
* @return number of arguments + 1 for a option. Zero return means
|
||||
* option not known. Negative value means error occurred.
|
||||
*/
|
||||
public int optionLength(String option) {
|
||||
int result = -1;
|
||||
if ((result = super.optionLength(option)) > 0) {
|
||||
return result;
|
||||
}
|
||||
// otherwise look for the options we have added
|
||||
option = StringUtils.toLowerCase(option);
|
||||
if (option.equals("-nodeprecatedlist") ||
|
||||
option.equals("-noindex") ||
|
||||
option.equals("-notree") ||
|
||||
option.equals("-nohelp") ||
|
||||
option.equals("-splitindex") ||
|
||||
option.equals("-serialwarn") ||
|
||||
option.equals("-use") ||
|
||||
option.equals("-nonavbar") ||
|
||||
option.equals("-nooverview") ||
|
||||
option.equals("-xdoclint") ||
|
||||
option.startsWith("-xdoclint:") ||
|
||||
option.equals("--allow-script-in-comments")) {
|
||||
return 1;
|
||||
} else if (option.equals("-help")) {
|
||||
// Uugh: first, this should not be hidden inside optionLength,
|
||||
// and second, we should not be writing directly to stdout.
|
||||
// But we have no access to a DocErrorReporter, which would
|
||||
// allow use of reporter.printNotice
|
||||
System.out.println(getText("doclet.usage"));
|
||||
return 1;
|
||||
} else if (option.equals("-x")) {
|
||||
// Uugh: first, this should not be hidden inside optionLength,
|
||||
// and second, we should not be writing directly to stdout.
|
||||
// But we have no access to a DocErrorReporter, which would
|
||||
// allow use of reporter.printNotice
|
||||
System.out.println(getText("doclet.X.usage"));
|
||||
return 1;
|
||||
} else if (option.equals("-footer") ||
|
||||
option.equals("-header") ||
|
||||
option.equals("-packagesheader") ||
|
||||
option.equals("-doctitle") ||
|
||||
option.equals("-windowtitle") ||
|
||||
option.equals("-top") ||
|
||||
option.equals("-bottom") ||
|
||||
option.equals("-helpfile") ||
|
||||
option.equals("-stylesheetfile") ||
|
||||
option.equals("-charset") ||
|
||||
option.equals("-overview") ||
|
||||
option.equals("-xdocrootparent")) {
|
||||
return 2;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean validOptions(String options[][],
|
||||
DocErrorReporter reporter) {
|
||||
boolean helpfile = false;
|
||||
boolean nohelp = false;
|
||||
boolean overview = false;
|
||||
boolean nooverview = false;
|
||||
boolean splitindex = false;
|
||||
boolean noindex = false;
|
||||
// check shared options
|
||||
if (!generalValidOptions(options, reporter)) {
|
||||
return false;
|
||||
}
|
||||
// otherwise look at our options
|
||||
for (int oi = 0; oi < options.length; ++oi) {
|
||||
String[] os = options[oi];
|
||||
String opt = StringUtils.toLowerCase(os[0]);
|
||||
if (opt.equals("-helpfile")) {
|
||||
if (nohelp == true) {
|
||||
reporter.printError(getText("doclet.Option_conflict",
|
||||
"-helpfile", "-nohelp"));
|
||||
return false;
|
||||
}
|
||||
if (helpfile == true) {
|
||||
reporter.printError(getText("doclet.Option_reuse",
|
||||
"-helpfile"));
|
||||
return false;
|
||||
}
|
||||
DocFile help = DocFile.createFileForInput(this, os[1]);
|
||||
if (!help.exists()) {
|
||||
reporter.printError(getText("doclet.File_not_found", os[1]));
|
||||
return false;
|
||||
}
|
||||
helpfile = true;
|
||||
} else if (opt.equals("-nohelp")) {
|
||||
if (helpfile == true) {
|
||||
reporter.printError(getText("doclet.Option_conflict",
|
||||
"-nohelp", "-helpfile"));
|
||||
return false;
|
||||
}
|
||||
nohelp = true;
|
||||
} else if (opt.equals("-xdocrootparent")) {
|
||||
try {
|
||||
new URL(os[1]);
|
||||
} catch (MalformedURLException e) {
|
||||
reporter.printError(getText("doclet.MalformedURL", os[1]));
|
||||
return false;
|
||||
}
|
||||
} else if (opt.equals("-overview")) {
|
||||
if (nooverview == true) {
|
||||
reporter.printError(getText("doclet.Option_conflict",
|
||||
"-overview", "-nooverview"));
|
||||
return false;
|
||||
}
|
||||
if (overview == true) {
|
||||
reporter.printError(getText("doclet.Option_reuse",
|
||||
"-overview"));
|
||||
return false;
|
||||
}
|
||||
overview = true;
|
||||
} else if (opt.equals("-nooverview")) {
|
||||
if (overview == true) {
|
||||
reporter.printError(getText("doclet.Option_conflict",
|
||||
"-nooverview", "-overview"));
|
||||
return false;
|
||||
}
|
||||
nooverview = true;
|
||||
} else if (opt.equals("-splitindex")) {
|
||||
if (noindex == true) {
|
||||
reporter.printError(getText("doclet.Option_conflict",
|
||||
"-splitindex", "-noindex"));
|
||||
return false;
|
||||
}
|
||||
splitindex = true;
|
||||
} else if (opt.equals("-noindex")) {
|
||||
if (splitindex == true) {
|
||||
reporter.printError(getText("doclet.Option_conflict",
|
||||
"-noindex", "-splitindex"));
|
||||
return false;
|
||||
}
|
||||
noindex = true;
|
||||
} else if (opt.startsWith("-xdoclint:")) {
|
||||
if (opt.contains("/")) {
|
||||
reporter.printError(getText("doclet.Option_doclint_no_qualifiers"));
|
||||
return false;
|
||||
}
|
||||
if (!DocLint.isValidOption(
|
||||
opt.replace("-xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX))) {
|
||||
reporter.printError(getText("doclet.Option_doclint_invalid_arg"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public MessageRetriever getDocletSpecificMsg() {
|
||||
return standardmessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide the page which will appear first in the right-hand frame. It will
|
||||
* be "overview-summary.html" if "-overview" option is used or no
|
||||
* "-overview" but the number of packages is more than one. It will be
|
||||
* "package-summary.html" of the respective package if there is only one
|
||||
* package to document. It will be a class page(first in the sorted order),
|
||||
* if only classes are provided on the command line.
|
||||
*
|
||||
* @param root Root of the program structure.
|
||||
*/
|
||||
protected void setTopFile(RootDoc root) {
|
||||
if (!checkForDeprecation(root)) {
|
||||
return;
|
||||
}
|
||||
if (createoverview) {
|
||||
topFile = DocPaths.OVERVIEW_SUMMARY;
|
||||
} else {
|
||||
if (packages.length == 1 && packages[0].name().equals("")) {
|
||||
if (root.classes().length > 0) {
|
||||
ClassDoc[] classarr = root.classes();
|
||||
Arrays.sort(classarr);
|
||||
ClassDoc cd = getValidClass(classarr);
|
||||
topFile = DocPath.forClass(cd);
|
||||
}
|
||||
} else {
|
||||
topFile = DocPath.forPackage(packages[0]).resolve(DocPaths.PACKAGE_SUMMARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected ClassDoc getValidClass(ClassDoc[] classarr) {
|
||||
if (!nodeprecated) {
|
||||
return classarr[0];
|
||||
}
|
||||
for (int i = 0; i < classarr.length; i++) {
|
||||
if (classarr[i].tags("deprecated").length == 0) {
|
||||
return classarr[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean checkForDeprecation(RootDoc root) {
|
||||
ClassDoc[] classarr = root.classes();
|
||||
for (int i = 0; i < classarr.length; i++) {
|
||||
if (isGeneratedDoc(classarr[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate "overview.html" page if option "-overview" is used or number of
|
||||
* packages is more than one. Sets {@link #createoverview} field to true.
|
||||
*/
|
||||
protected void setCreateOverview() {
|
||||
if ((overview || packages.length > 1) && !nooverview) {
|
||||
createoverview = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public WriterFactory getWriterFactory() {
|
||||
return new WriterFactoryImpl(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Comparator<ProgramElementDoc> getMemberComparator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
if (root instanceof RootDocImpl)
|
||||
return ((RootDocImpl)root).getLocale();
|
||||
else
|
||||
return Locale.getDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public JavaFileManager getFileManager() {
|
||||
if (fileManager == null) {
|
||||
if (root instanceof RootDocImpl)
|
||||
fileManager = ((RootDocImpl) root).getFileManager();
|
||||
else
|
||||
fileManager = new JavacFileManager(new Context(), false, null);
|
||||
}
|
||||
return fileManager;
|
||||
}
|
||||
|
||||
private JavaFileManager fileManager;
|
||||
|
||||
@Override
|
||||
public boolean showMessage(SourcePosition pos, String key) {
|
||||
if (root instanceof RootDocImpl) {
|
||||
return pos == null || ((RootDocImpl) root).showTagMessages();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content newContent() {
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not to allow JavaScript in comments.
|
||||
* Default is off; can be set true from a command line option.
|
||||
* @return the allowScriptInComments
|
||||
*/
|
||||
public boolean isAllowScriptInComments() {
|
||||
return allowScriptInComments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Write the Constants Summary Page in HTML format.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.4
|
||||
*/
|
||||
public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
|
||||
implements ConstantsSummaryWriter {
|
||||
|
||||
/**
|
||||
* The configuration used in this run of the standard doclet.
|
||||
*/
|
||||
ConfigurationImpl configuration;
|
||||
|
||||
/**
|
||||
* The current class being documented.
|
||||
*/
|
||||
private ClassDoc currentClassDoc;
|
||||
|
||||
private final String constantsTableSummary;
|
||||
|
||||
private final String[] constantsTableHeader;
|
||||
|
||||
/**
|
||||
* Construct a ConstantsSummaryWriter.
|
||||
* @param configuration the configuration used in this run
|
||||
* of the standard doclet.
|
||||
*/
|
||||
public ConstantsSummaryWriterImpl(ConfigurationImpl configuration)
|
||||
throws IOException {
|
||||
super(configuration, DocPaths.CONSTANT_VALUES);
|
||||
this.configuration = configuration;
|
||||
constantsTableSummary = configuration.getText("doclet.Constants_Table_Summary",
|
||||
configuration.getText("doclet.Constants_Summary"));
|
||||
constantsTableHeader = new String[] {
|
||||
getModifierTypeHeader(),
|
||||
configuration.getText("doclet.ConstantField"),
|
||||
configuration.getText("doclet.Value")
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getHeader() {
|
||||
String label = configuration.getText("doclet.Constants_Summary");
|
||||
Content bodyTree = getBody(true, getWindowTitle(label));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
return bodyTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getContentsHeader() {
|
||||
return new HtmlTree(HtmlTag.UL);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addLinkToPackageContent(PackageDoc pkg, String parsedPackageName,
|
||||
Set<String> printedPackageHeaders, Content contentListTree) {
|
||||
String packageName = pkg.name();
|
||||
//add link to summary
|
||||
Content link;
|
||||
if (packageName.length() == 0) {
|
||||
link = getHyperLink(getDocLink(
|
||||
SectionName.UNNAMED_PACKAGE_ANCHOR),
|
||||
defaultPackageLabel, "", "");
|
||||
} else {
|
||||
Content packageNameContent = getPackageLabel(parsedPackageName);
|
||||
packageNameContent.addContent(".*");
|
||||
link = getHyperLink(DocLink.fragment(parsedPackageName),
|
||||
packageNameContent, "", "");
|
||||
printedPackageHeaders.add(parsedPackageName);
|
||||
}
|
||||
contentListTree.addContent(HtmlTree.LI(link));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getContentsList(Content contentListTree) {
|
||||
Content titleContent = getResource(
|
||||
"doclet.Constants_Summary");
|
||||
Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, titleContent);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, pHeading);
|
||||
Content headingContent = getResource(
|
||||
"doclet.Contents");
|
||||
div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
|
||||
headingContent));
|
||||
div.addContent(contentListTree);
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getConstantSummaries() {
|
||||
HtmlTree summariesDiv = new HtmlTree(HtmlTag.DIV);
|
||||
summariesDiv.addStyle(HtmlStyle.constantValuesContainer);
|
||||
return summariesDiv;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addPackageName(PackageDoc pkg, String parsedPackageName,
|
||||
Content summariesTree) {
|
||||
Content pkgNameContent;
|
||||
if (parsedPackageName.length() == 0) {
|
||||
summariesTree.addContent(getMarkerAnchor(
|
||||
SectionName.UNNAMED_PACKAGE_ANCHOR));
|
||||
pkgNameContent = defaultPackageLabel;
|
||||
} else {
|
||||
summariesTree.addContent(getMarkerAnchor(
|
||||
parsedPackageName));
|
||||
pkgNameContent = getPackageLabel(parsedPackageName);
|
||||
}
|
||||
Content headingContent = new StringContent(".*");
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
|
||||
pkgNameContent);
|
||||
heading.addContent(headingContent);
|
||||
summariesTree.addContent(heading);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getClassConstantHeader() {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
return ul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the table caption and header for the constant summary table
|
||||
*
|
||||
* @param cd classdoc to be documented
|
||||
* @return constant members header content
|
||||
*/
|
||||
public Content getConstantMembersHeader(ClassDoc cd) {
|
||||
//generate links backward only to public classes.
|
||||
Content classlink = (cd.isPublic() || cd.isProtected()) ?
|
||||
getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CONSTANT_SUMMARY, cd)) :
|
||||
new StringContent(cd.qualifiedName());
|
||||
String name = cd.containingPackage().name();
|
||||
if (name.length() > 0) {
|
||||
Content cb = new ContentBuilder();
|
||||
cb.addContent(name);
|
||||
cb.addContent(".");
|
||||
cb.addContent(classlink);
|
||||
return getClassName(cb);
|
||||
} else {
|
||||
return getClassName(classlink);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class name in the table caption and the table header.
|
||||
*
|
||||
* @param classStr the class name to print.
|
||||
* @return the table caption and header
|
||||
*/
|
||||
protected Content getClassName(Content classStr) {
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.constantsSummary, 0, 3, 0, constantsTableSummary,
|
||||
getTableCaption(classStr));
|
||||
table.addContent(getSummaryTableHeader(constantsTableHeader, "col"));
|
||||
return table;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addConstantMembers(ClassDoc cd, List<FieldDoc> fields,
|
||||
Content classConstantTree) {
|
||||
currentClassDoc = cd;
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
for (int i = 0; i < fields.size(); ++i) {
|
||||
HtmlTree tr = new HtmlTree(HtmlTag.TR);
|
||||
if (i%2 == 0)
|
||||
tr.addStyle(HtmlStyle.altColor);
|
||||
else
|
||||
tr.addStyle(HtmlStyle.rowColor);
|
||||
addConstantMember(fields.get(i), tr);
|
||||
tbody.addContent(tr);
|
||||
}
|
||||
Content table = getConstantMembersHeader(cd);
|
||||
table.addContent(tbody);
|
||||
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
|
||||
classConstantTree.addContent(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the row for the constant summary table.
|
||||
*
|
||||
* @param member the field to be documented.
|
||||
* @param trTree an htmltree object for the table row
|
||||
*/
|
||||
private void addConstantMember(FieldDoc member, HtmlTree trTree) {
|
||||
trTree.addContent(getTypeColumn(member));
|
||||
trTree.addContent(getNameColumn(member));
|
||||
trTree.addContent(getValue(member));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type column for the constant summary table row.
|
||||
*
|
||||
* @param member the field to be documented.
|
||||
* @return the type column of the constant table row
|
||||
*/
|
||||
private Content getTypeColumn(FieldDoc member) {
|
||||
Content anchor = getMarkerAnchor(currentClassDoc.qualifiedName() +
|
||||
"." + member.name());
|
||||
Content tdType = HtmlTree.TD(HtmlStyle.colFirst, anchor);
|
||||
Content code = new HtmlTree(HtmlTag.CODE);
|
||||
StringTokenizer mods = new StringTokenizer(member.modifiers());
|
||||
while(mods.hasMoreTokens()) {
|
||||
Content modifier = new StringContent(mods.nextToken());
|
||||
code.addContent(modifier);
|
||||
code.addContent(getSpace());
|
||||
}
|
||||
Content type = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CONSTANT_SUMMARY, member.type()));
|
||||
code.addContent(type);
|
||||
tdType.addContent(code);
|
||||
return tdType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name column for the constant summary table row.
|
||||
*
|
||||
* @param member the field to be documented.
|
||||
* @return the name column of the constant table row
|
||||
*/
|
||||
private Content getNameColumn(FieldDoc member) {
|
||||
Content nameContent = getDocLink(
|
||||
LinkInfoImpl.Kind.CONSTANT_SUMMARY, member, member.name(), false);
|
||||
Content code = HtmlTree.CODE(nameContent);
|
||||
return HtmlTree.TD(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value column for the constant summary table row.
|
||||
*
|
||||
* @param member the field to be documented.
|
||||
* @return the value column of the constant table row
|
||||
*/
|
||||
private Content getValue(FieldDoc member) {
|
||||
Content valueContent = new StringContent(member.constantValueExpression());
|
||||
Content code = HtmlTree.CODE(valueContent);
|
||||
return HtmlTree.TD(HtmlStyle.colLast, code);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addFooter(Content contentTree) {
|
||||
addNavLinks(false, contentTree);
|
||||
addBottom(contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void printDocument(Content contentTree) throws IOException {
|
||||
printHtmlDocument(null, true, contentTree);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,324 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Writes constructor documentation.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Robert Field
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
implements ConstructorWriter, MemberSummaryWriter {
|
||||
|
||||
private boolean foundNonPubConstructor = false;
|
||||
|
||||
/**
|
||||
* Construct a new ConstructorWriterImpl.
|
||||
*
|
||||
* @param writer The writer for the class that the constructors belong to.
|
||||
* @param classDoc the class being documented.
|
||||
*/
|
||||
public ConstructorWriterImpl(SubWriterHolderWriter writer,
|
||||
ClassDoc classDoc) {
|
||||
super(writer, classDoc);
|
||||
VisibleMemberMap visibleMemberMap = new VisibleMemberMap(classDoc,
|
||||
VisibleMemberMap.CONSTRUCTORS, configuration);
|
||||
List<ProgramElementDoc> constructors = new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
|
||||
for (int i = 0; i < constructors.size(); i++) {
|
||||
if ((constructors.get(i)).isProtected() ||
|
||||
(constructors.get(i)).isPrivate()) {
|
||||
setFoundNonPubConstructor(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new ConstructorWriterImpl.
|
||||
*
|
||||
* @param writer The writer for the class that the constructors belong to.
|
||||
*/
|
||||
public ConstructorWriterImpl(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMemberSummaryHeader(ClassDoc classDoc,
|
||||
Content memberSummaryTree) {
|
||||
memberSummaryTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_SUMMARY);
|
||||
Content memberTree = writer.getMemberTreeHeader();
|
||||
writer.addSummaryHeader(this, classDoc, memberTree);
|
||||
return memberTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getConstructorDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree) {
|
||||
memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS);
|
||||
Content constructorDetailsTree = writer.getMemberTreeHeader();
|
||||
constructorDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.CONSTRUCTOR_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.constructorDetailsLabel);
|
||||
constructorDetailsTree.addContent(heading);
|
||||
return constructorDetailsTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getConstructorDocTreeHeader(ConstructorDoc constructor,
|
||||
Content constructorDetailsTree) {
|
||||
String erasureAnchor;
|
||||
if ((erasureAnchor = getErasureAnchor(constructor)) != null) {
|
||||
constructorDetailsTree.addContent(writer.getMarkerAnchor((erasureAnchor)));
|
||||
}
|
||||
constructorDetailsTree.addContent(
|
||||
writer.getMarkerAnchor(writer.getAnchor(constructor)));
|
||||
Content constructorDocTree = writer.getMemberTreeHeader();
|
||||
Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
|
||||
heading.addContent(constructor.name());
|
||||
constructorDocTree.addContent(heading);
|
||||
return constructorDocTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getSignature(ConstructorDoc constructor) {
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
writer.addAnnotationInfo(constructor, pre);
|
||||
addModifiers(constructor, pre);
|
||||
if (configuration.linksource) {
|
||||
Content constructorName = new StringContent(constructor.name());
|
||||
writer.addSrcLink(constructor, constructorName, pre);
|
||||
} else {
|
||||
addName(constructor.name(), pre);
|
||||
}
|
||||
int indent = pre.charCount();
|
||||
addParameters(constructor, pre, indent);
|
||||
addExceptions(constructor, pre, indent);
|
||||
return pre;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setSummaryColumnStyle(HtmlTree tdTree) {
|
||||
if (foundNonPubConstructor)
|
||||
tdTree.addStyle(HtmlStyle.colLast);
|
||||
else
|
||||
tdTree.addStyle(HtmlStyle.colOne);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addDeprecated(ConstructorDoc constructor, Content constructorDocTree) {
|
||||
addDeprecatedInfo(constructor, constructorDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addComments(ConstructorDoc constructor, Content constructorDocTree) {
|
||||
addComment(constructor, constructorDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addTags(ConstructorDoc constructor, Content constructorDocTree) {
|
||||
writer.addTagsInfo(constructor, constructorDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getConstructorDetails(Content constructorDetailsTree) {
|
||||
return getMemberTree(constructorDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getConstructorDoc(Content constructorDocTree,
|
||||
boolean isLastContent) {
|
||||
return getMemberTree(constructorDocTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Let the writer know whether a non public constructor was found.
|
||||
*
|
||||
* @param foundNonPubConstructor true if we found a non public constructor.
|
||||
*/
|
||||
public void setFoundNonPubConstructor(boolean foundNonPubConstructor) {
|
||||
this.foundNonPubConstructor = foundNonPubConstructor;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Constructor_Summary"));
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Constructor_Summary"),
|
||||
configuration.getText("doclet.constructors"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Constructors");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String[] getSummaryTableHeader(ProgramElementDoc member) {
|
||||
String[] header;
|
||||
if (foundNonPubConstructor) {
|
||||
header = new String[] {
|
||||
configuration.getText("doclet.Modifier"),
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Constructor"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
}
|
||||
else {
|
||||
header = new String[] {
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Constructor"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
}
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
|
||||
memberTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.CONSTRUCTOR_SUMMARY));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
|
||||
}
|
||||
|
||||
public int getMemberKind() {
|
||||
return VisibleMemberMap.CONSTRUCTORS;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
|
||||
if (link) {
|
||||
return writer.getHyperLink(SectionName.CONSTRUCTOR_SUMMARY,
|
||||
writer.getResource("doclet.navConstructor"));
|
||||
} else {
|
||||
return writer.getResource("doclet.navConstructor");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavDetailLink(boolean link, Content liNav) {
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.CONSTRUCTOR_DETAIL,
|
||||
writer.getResource("doclet.navConstructor")));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navConstructor"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
|
||||
if (foundNonPubConstructor) {
|
||||
Content code = new HtmlTree(HtmlTag.CODE);
|
||||
if (member.isProtected()) {
|
||||
code.addContent("protected ");
|
||||
} else if (member.isPrivate()) {
|
||||
code.addContent("private ");
|
||||
} else if (member.isPublic()) {
|
||||
code.addContent(writer.getSpace());
|
||||
} else {
|
||||
code.addContent(
|
||||
configuration.getText("doclet.Package_private"));
|
||||
}
|
||||
tdSummaryType.addContent(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 java.io.*;
|
||||
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Generate File to list all the deprecated classes and class members with the
|
||||
* appropriate links.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @see java.util.List
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class DeprecatedListWriter extends SubWriterHolderWriter {
|
||||
|
||||
private static final String[] ANCHORS = new String[] {
|
||||
"package", "interface", "class", "enum", "exception", "error",
|
||||
"annotation.type", "field", "method", "constructor", "enum.constant",
|
||||
"annotation.type.member"
|
||||
};
|
||||
|
||||
private static final String[] HEADING_KEYS = new String[] {
|
||||
"doclet.Deprecated_Packages", "doclet.Deprecated_Interfaces",
|
||||
"doclet.Deprecated_Classes", "doclet.Deprecated_Enums",
|
||||
"doclet.Deprecated_Exceptions", "doclet.Deprecated_Errors",
|
||||
"doclet.Deprecated_Annotation_Types",
|
||||
"doclet.Deprecated_Fields",
|
||||
"doclet.Deprecated_Methods", "doclet.Deprecated_Constructors",
|
||||
"doclet.Deprecated_Enum_Constants",
|
||||
"doclet.Deprecated_Annotation_Type_Members"
|
||||
};
|
||||
|
||||
private static final String[] SUMMARY_KEYS = new String[] {
|
||||
"doclet.deprecated_packages", "doclet.deprecated_interfaces",
|
||||
"doclet.deprecated_classes", "doclet.deprecated_enums",
|
||||
"doclet.deprecated_exceptions", "doclet.deprecated_errors",
|
||||
"doclet.deprecated_annotation_types",
|
||||
"doclet.deprecated_fields",
|
||||
"doclet.deprecated_methods", "doclet.deprecated_constructors",
|
||||
"doclet.deprecated_enum_constants",
|
||||
"doclet.deprecated_annotation_type_members"
|
||||
};
|
||||
|
||||
private static final String[] HEADER_KEYS = new String[] {
|
||||
"doclet.Package", "doclet.Interface", "doclet.Class",
|
||||
"doclet.Enum", "doclet.Exceptions",
|
||||
"doclet.Errors",
|
||||
"doclet.AnnotationType",
|
||||
"doclet.Field",
|
||||
"doclet.Method", "doclet.Constructor",
|
||||
"doclet.Enum_Constant",
|
||||
"doclet.Annotation_Type_Member"
|
||||
};
|
||||
|
||||
private AbstractMemberWriter[] writers;
|
||||
|
||||
private ConfigurationImpl configuration;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param filename the file to be generated.
|
||||
*/
|
||||
public DeprecatedListWriter(ConfigurationImpl configuration,
|
||||
DocPath filename) throws IOException {
|
||||
super(configuration, filename);
|
||||
this.configuration = configuration;
|
||||
NestedClassWriterImpl classW = new NestedClassWriterImpl(this);
|
||||
writers = new AbstractMemberWriter[]
|
||||
{classW, classW, classW, classW, classW, classW,
|
||||
new FieldWriterImpl(this),
|
||||
new MethodWriterImpl(this),
|
||||
new ConstructorWriterImpl(this),
|
||||
new EnumConstantWriterImpl(this),
|
||||
new AnnotationTypeOptionalMemberWriterImpl(this, null)};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of all the deprecated classes and members in all the Packages
|
||||
* specified on the Command Line.
|
||||
* Then instantiate DeprecatedListWriter and generate File.
|
||||
*
|
||||
* @param configuration the current configuration of the doclet.
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration) {
|
||||
DocPath filename = DocPaths.DEPRECATED_LIST;
|
||||
try {
|
||||
DeprecatedListWriter depr =
|
||||
new DeprecatedListWriter(configuration, filename);
|
||||
depr.generateDeprecatedListFile(
|
||||
new DeprecatedAPIListBuilder(configuration));
|
||||
depr.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the deprecated API list.
|
||||
*
|
||||
* @param deprapi list of deprecated API built already.
|
||||
*/
|
||||
protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi)
|
||||
throws IOException {
|
||||
Content body = getHeader();
|
||||
body.addContent(getContentsList(deprapi));
|
||||
String memberTableSummary;
|
||||
String[] memberTableHeader = new String[1];
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.contentContainer);
|
||||
for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
|
||||
if (deprapi.hasDocumentation(i)) {
|
||||
addAnchor(deprapi, i, div);
|
||||
memberTableSummary =
|
||||
configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText(HEADING_KEYS[i]),
|
||||
configuration.getText(SUMMARY_KEYS[i]));
|
||||
memberTableHeader[0] = configuration.getText("doclet.0_and_1",
|
||||
configuration.getText(HEADER_KEYS[i]),
|
||||
configuration.getText("doclet.Description"));
|
||||
// DeprecatedAPIListBuilder.PACKAGE == 0, so if i == 0, it is
|
||||
// a PackageDoc.
|
||||
if (i == DeprecatedAPIListBuilder.PACKAGE)
|
||||
addPackageDeprecatedAPI(deprapi.getList(i),
|
||||
HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
|
||||
else
|
||||
writers[i - 1].addDeprecatedAPI(deprapi.getList(i),
|
||||
HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
|
||||
}
|
||||
}
|
||||
body.addContent(div);
|
||||
addNavLinks(false, body);
|
||||
addBottom(body);
|
||||
printHtmlDocument(null, true, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the index link.
|
||||
*
|
||||
* @param builder the deprecated list builder
|
||||
* @param type the type of list being documented
|
||||
* @param contentTree the content tree to which the index link will be added
|
||||
*/
|
||||
private void addIndexLink(DeprecatedAPIListBuilder builder,
|
||||
int type, Content contentTree) {
|
||||
if (builder.hasDocumentation(type)) {
|
||||
Content li = HtmlTree.LI(getHyperLink(ANCHORS[type],
|
||||
getResource(HEADING_KEYS[type])));
|
||||
contentTree.addContent(li);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents list.
|
||||
*
|
||||
* @param deprapi the deprecated list builder
|
||||
* @return a content tree for the contents list
|
||||
*/
|
||||
public Content getContentsList(DeprecatedAPIListBuilder deprapi) {
|
||||
Content headContent = getResource("doclet.Deprecated_API");
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, headContent);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
Content headingContent = getResource("doclet.Contents");
|
||||
div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
|
||||
headingContent));
|
||||
Content ul = new HtmlTree(HtmlTag.UL);
|
||||
for (int i = 0; i < DeprecatedAPIListBuilder.NUM_TYPES; i++) {
|
||||
addIndexLink(deprapi, i, ul);
|
||||
}
|
||||
div.addContent(ul);
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the anchor.
|
||||
*
|
||||
* @param builder the deprecated list builder
|
||||
* @param type the type of list being documented
|
||||
* @param htmlTree the content tree to which the anchor will be added
|
||||
*/
|
||||
private void addAnchor(DeprecatedAPIListBuilder builder, int type, Content htmlTree) {
|
||||
if (builder.hasDocumentation(type)) {
|
||||
htmlTree.addContent(getMarkerAnchor(ANCHORS[type]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the header for the deprecated API Listing.
|
||||
*
|
||||
* @return a content tree for the header
|
||||
*/
|
||||
public Content getHeader() {
|
||||
String title = configuration.getText("doclet.Window_Deprecated_List");
|
||||
Content bodyTree = getBody(true, getWindowTitle(title));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
return bodyTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the deprecated label.
|
||||
*
|
||||
* @return a content tree for the deprecated label
|
||||
*/
|
||||
protected Content getNavLinkDeprecated() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, deprecatedLabel);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Writes enum constant documentation in HTML format.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class EnumConstantWriterImpl extends AbstractMemberWriter
|
||||
implements EnumConstantWriter, MemberSummaryWriter {
|
||||
|
||||
public EnumConstantWriterImpl(SubWriterHolderWriter writer,
|
||||
ClassDoc classdoc) {
|
||||
super(writer, classdoc);
|
||||
}
|
||||
|
||||
public EnumConstantWriterImpl(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMemberSummaryHeader(ClassDoc classDoc,
|
||||
Content memberSummaryTree) {
|
||||
memberSummaryTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_SUMMARY);
|
||||
Content memberTree = writer.getMemberTreeHeader();
|
||||
writer.addSummaryHeader(this, classDoc, memberTree);
|
||||
return memberTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getEnumConstantsDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree) {
|
||||
memberDetailsTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_DETAILS);
|
||||
Content enumConstantsDetailsTree = writer.getMemberTreeHeader();
|
||||
enumConstantsDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.ENUM_CONSTANT_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.enumConstantsDetailsLabel);
|
||||
enumConstantsDetailsTree.addContent(heading);
|
||||
return enumConstantsDetailsTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getEnumConstantsTreeHeader(FieldDoc enumConstant,
|
||||
Content enumConstantsDetailsTree) {
|
||||
enumConstantsDetailsTree.addContent(
|
||||
writer.getMarkerAnchor(enumConstant.name()));
|
||||
Content enumConstantsTree = writer.getMemberTreeHeader();
|
||||
Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
|
||||
heading.addContent(enumConstant.name());
|
||||
enumConstantsTree.addContent(heading);
|
||||
return enumConstantsTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getSignature(FieldDoc enumConstant) {
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
writer.addAnnotationInfo(enumConstant, pre);
|
||||
addModifiers(enumConstant, pre);
|
||||
Content enumConstantLink = writer.getLink(new LinkInfoImpl(
|
||||
configuration, LinkInfoImpl.Kind.MEMBER, enumConstant.type()));
|
||||
pre.addContent(enumConstantLink);
|
||||
pre.addContent(" ");
|
||||
if (configuration.linksource) {
|
||||
Content enumConstantName = new StringContent(enumConstant.name());
|
||||
writer.addSrcLink(enumConstant, enumConstantName, pre);
|
||||
} else {
|
||||
addName(enumConstant.name(), pre);
|
||||
}
|
||||
return pre;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addDeprecated(FieldDoc enumConstant, Content enumConstantsTree) {
|
||||
addDeprecatedInfo(enumConstant, enumConstantsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addComments(FieldDoc enumConstant, Content enumConstantsTree) {
|
||||
addComment(enumConstant, enumConstantsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addTags(FieldDoc enumConstant, Content enumConstantsTree) {
|
||||
writer.addTagsInfo(enumConstant, enumConstantsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getEnumConstantsDetails(Content enumConstantsDetailsTree) {
|
||||
return getMemberTree(enumConstantsDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getEnumConstants(Content enumConstantsTree,
|
||||
boolean isLastContent) {
|
||||
return getMemberTree(enumConstantsTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
public int getMemberKind() {
|
||||
return VisibleMemberMap.ENUM_CONSTANTS;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Enum_Constant_Summary"));
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Enum_Constant_Summary"),
|
||||
configuration.getText("doclet.enum_constants"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Enum_Constants");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String[] getSummaryTableHeader(ProgramElementDoc member) {
|
||||
String[] header = new String[] {
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Enum_Constant"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
|
||||
memberTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.ENUM_CONSTANT_SUMMARY));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
|
||||
Content tdSummary) {
|
||||
Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
|
||||
writer.getDocLink(context, (MemberDoc) member, member.name(), false));
|
||||
Content code = HtmlTree.CODE(memberLink);
|
||||
tdSummary.addContent(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setSummaryColumnStyle(HtmlTree tdTree) {
|
||||
tdTree.addStyle(HtmlStyle.colOne);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addInheritedSummaryLink(ClassDoc cd,
|
||||
ProgramElementDoc member, Content linksTree) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
|
||||
//Not applicable.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getDeprecatedLink(ProgramElementDoc member) {
|
||||
return writer.getDocLink(LinkInfoImpl.Kind.MEMBER,
|
||||
(MemberDoc) member, ((FieldDoc)member).qualifiedName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
|
||||
if (link) {
|
||||
if (cd == null) {
|
||||
return writer.getHyperLink(SectionName.ENUM_CONSTANT_SUMMARY,
|
||||
writer.getResource("doclet.navEnum"));
|
||||
} else {
|
||||
return writer.getHyperLink(
|
||||
SectionName.ENUM_CONSTANTS_INHERITANCE,
|
||||
configuration.getClassName(cd), writer.getResource("doclet.navEnum"));
|
||||
}
|
||||
} else {
|
||||
return writer.getResource("doclet.navEnum");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavDetailLink(boolean link, Content liNav) {
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.ENUM_CONSTANT_DETAIL,
|
||||
writer.getResource("doclet.navEnum")));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navEnum"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,324 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Writes field documentation in HTML format.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Robert Field
|
||||
* @author Atul M Dambalkar
|
||||
* @author Jamie Ho (rewrite)
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class FieldWriterImpl extends AbstractMemberWriter
|
||||
implements FieldWriter, MemberSummaryWriter {
|
||||
|
||||
public FieldWriterImpl(SubWriterHolderWriter writer, ClassDoc classdoc) {
|
||||
super(writer, classdoc);
|
||||
}
|
||||
|
||||
public FieldWriterImpl(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMemberSummaryHeader(ClassDoc classDoc,
|
||||
Content memberSummaryTree) {
|
||||
memberSummaryTree.addContent(HtmlConstants.START_OF_FIELD_SUMMARY);
|
||||
Content memberTree = writer.getMemberTreeHeader();
|
||||
writer.addSummaryHeader(this, classDoc, memberTree);
|
||||
return memberTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getFieldDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree) {
|
||||
memberDetailsTree.addContent(HtmlConstants.START_OF_FIELD_DETAILS);
|
||||
Content fieldDetailsTree = writer.getMemberTreeHeader();
|
||||
fieldDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.FIELD_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.fieldDetailsLabel);
|
||||
fieldDetailsTree.addContent(heading);
|
||||
return fieldDetailsTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getFieldDocTreeHeader(FieldDoc field,
|
||||
Content fieldDetailsTree) {
|
||||
fieldDetailsTree.addContent(
|
||||
writer.getMarkerAnchor(field.name()));
|
||||
Content fieldDocTree = writer.getMemberTreeHeader();
|
||||
Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
|
||||
heading.addContent(field.name());
|
||||
fieldDocTree.addContent(heading);
|
||||
return fieldDocTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getSignature(FieldDoc field) {
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
writer.addAnnotationInfo(field, pre);
|
||||
addModifiers(field, pre);
|
||||
Content fieldlink = writer.getLink(new LinkInfoImpl(
|
||||
configuration, LinkInfoImpl.Kind.MEMBER, field.type()));
|
||||
pre.addContent(fieldlink);
|
||||
pre.addContent(" ");
|
||||
if (configuration.linksource) {
|
||||
Content fieldName = new StringContent(field.name());
|
||||
writer.addSrcLink(field, fieldName, pre);
|
||||
} else {
|
||||
addName(field.name(), pre);
|
||||
}
|
||||
return pre;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addDeprecated(FieldDoc field, Content fieldDocTree) {
|
||||
addDeprecatedInfo(field, fieldDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addComments(FieldDoc field, Content fieldDocTree) {
|
||||
ClassDoc holder = field.containingClass();
|
||||
if (field.inlineTags().length > 0) {
|
||||
if (holder.equals(classdoc) ||
|
||||
(! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
|
||||
writer.addInlineComment(field, fieldDocTree);
|
||||
} else {
|
||||
Content link =
|
||||
writer.getDocLink(LinkInfoImpl.Kind.FIELD_DOC_COPY,
|
||||
holder, field,
|
||||
holder.isIncluded() ?
|
||||
holder.typeName() : holder.qualifiedTypeName(),
|
||||
false);
|
||||
Content codeLink = HtmlTree.CODE(link);
|
||||
Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel, holder.isClass()?
|
||||
writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
|
||||
descfrmLabel.addContent(writer.getSpace());
|
||||
descfrmLabel.addContent(codeLink);
|
||||
fieldDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel));
|
||||
writer.addInlineComment(field, fieldDocTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addTags(FieldDoc field, Content fieldDocTree) {
|
||||
writer.addTagsInfo(field, fieldDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getFieldDetails(Content fieldDetailsTree) {
|
||||
return getMemberTree(fieldDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getFieldDoc(Content fieldDocTree,
|
||||
boolean isLastContent) {
|
||||
return getMemberTree(fieldDocTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
public int getMemberKind() {
|
||||
return VisibleMemberMap.FIELDS;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Field_Summary"));
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Field_Summary"),
|
||||
configuration.getText("doclet.fields"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Fields");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String[] getSummaryTableHeader(ProgramElementDoc member) {
|
||||
String[] header = new String[] {
|
||||
writer.getModifierTypeHeader(),
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Field"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
|
||||
memberTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.FIELD_SUMMARY));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
|
||||
inheritedTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.FIELDS_INHERITANCE, configuration.getClassName(cd)));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
|
||||
Content classLink = writer.getPreQualifiedClassLink(
|
||||
LinkInfoImpl.Kind.MEMBER, cd, false);
|
||||
Content label = new StringContent(cd.isClass() ?
|
||||
configuration.getText("doclet.Fields_Inherited_From_Class") :
|
||||
configuration.getText("doclet.Fields_Inherited_From_Interface"));
|
||||
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
|
||||
label);
|
||||
labelHeading.addContent(writer.getSpace());
|
||||
labelHeading.addContent(classLink);
|
||||
inheritedTree.addContent(labelHeading);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
|
||||
Content tdSummary) {
|
||||
Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
|
||||
writer.getDocLink(context, cd , (MemberDoc) member, member.name(), false));
|
||||
Content code = HtmlTree.CODE(memberLink);
|
||||
tdSummary.addContent(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addInheritedSummaryLink(ClassDoc cd,
|
||||
ProgramElementDoc member, Content linksTree) {
|
||||
linksTree.addContent(
|
||||
writer.getDocLink(LinkInfoImpl.Kind.MEMBER, cd, (MemberDoc)member,
|
||||
member.name(), false));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
|
||||
FieldDoc field = (FieldDoc)member;
|
||||
addModifierAndType(field, field.type(), tdSummaryType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getDeprecatedLink(ProgramElementDoc member) {
|
||||
return writer.getDocLink(LinkInfoImpl.Kind.MEMBER,
|
||||
(MemberDoc) member, ((FieldDoc)member).qualifiedName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
|
||||
if (link) {
|
||||
if (cd == null) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.FIELD_SUMMARY,
|
||||
writer.getResource("doclet.navField"));
|
||||
} else {
|
||||
return writer.getHyperLink(
|
||||
SectionName.FIELDS_INHERITANCE,
|
||||
configuration.getClassName(cd), writer.getResource("doclet.navField"));
|
||||
}
|
||||
} else {
|
||||
return writer.getResource("doclet.navField");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavDetailLink(boolean link, Content liNav) {
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.FIELD_DETAIL,
|
||||
writer.getResource("doclet.navField")));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navField"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 java.io.*;
|
||||
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Generate the documentation in the Html "frame" format in the browser. The
|
||||
* generated documentation will have two or three frames depending upon the
|
||||
* number of packages on the command line. In general there will be three frames
|
||||
* in the output, a left-hand top frame will have a list of all packages with
|
||||
* links to target left-hand bottom frame. The left-hand bottom frame will have
|
||||
* the particular package contents or the all-classes list, where as the single
|
||||
* right-hand frame will have overview or package summary or class file. Also
|
||||
* take care of browsers which do not support Html frames.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
*/
|
||||
public class FrameOutputWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* Number of packages specified on the command line.
|
||||
*/
|
||||
int noOfPackages;
|
||||
|
||||
private final String SCROLL_YES = "yes";
|
||||
|
||||
/**
|
||||
* Constructor to construct FrameOutputWriter object.
|
||||
*
|
||||
* @param filename File to be generated.
|
||||
*/
|
||||
public FrameOutputWriter(ConfigurationImpl configuration,
|
||||
DocPath filename) throws IOException {
|
||||
super(configuration, filename);
|
||||
noOfPackages = configuration.packages.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct FrameOutputWriter object and then use it to generate the Html
|
||||
* file which will have the description of all the frames in the
|
||||
* documentation. The name of the generated file is "index.html" which is
|
||||
* the default first file for Html documents.
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration) {
|
||||
FrameOutputWriter framegen;
|
||||
DocPath filename = DocPath.empty;
|
||||
try {
|
||||
filename = DocPaths.INDEX;
|
||||
framegen = new FrameOutputWriter(configuration, filename);
|
||||
framegen.generateFrameFile();
|
||||
framegen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the constants in the "index.html" file. Print the frame details
|
||||
* as well as warning if browser is not supporting the Html frames.
|
||||
*/
|
||||
protected void generateFrameFile() throws IOException {
|
||||
Content frameset = getFrameDetails();
|
||||
if (configuration.windowtitle.length() > 0) {
|
||||
printFramesetDocument(configuration.windowtitle, configuration.notimestamp,
|
||||
frameset);
|
||||
} else {
|
||||
printFramesetDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
|
||||
configuration.notimestamp, frameset);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the code for issueing the warning for a non-frame capable web
|
||||
* client. Also provide links to the non-frame version documentation.
|
||||
*
|
||||
* @param contentTree the content tree to which the non-frames information will be added
|
||||
*/
|
||||
protected void addFrameWarning(Content contentTree) {
|
||||
Content noframes = new HtmlTree(HtmlTag.NOFRAMES);
|
||||
Content noScript = HtmlTree.NOSCRIPT(
|
||||
HtmlTree.DIV(getResource("doclet.No_Script_Message")));
|
||||
noframes.addContent(noScript);
|
||||
Content noframesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Frame_Alert"));
|
||||
noframes.addContent(noframesHead);
|
||||
Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message",
|
||||
getHyperLink(configuration.topFile,
|
||||
configuration.getText("doclet.Non_Frame_Version"))));
|
||||
noframes.addContent(p);
|
||||
contentTree.addContent(noframes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the frame sizes and their contents.
|
||||
*
|
||||
* @return a content tree for the frame details
|
||||
*/
|
||||
protected Content getFrameDetails() {
|
||||
HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame",
|
||||
"top.loadFrames()");
|
||||
if (noOfPackages <= 1) {
|
||||
addAllClassesFrameTag(frameset);
|
||||
} else if (noOfPackages > 1) {
|
||||
HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
|
||||
"top.loadFrames()");
|
||||
addAllPackagesFrameTag(leftFrameset);
|
||||
addAllClassesFrameTag(leftFrameset);
|
||||
frameset.addContent(leftFrameset);
|
||||
}
|
||||
addClassFrameTag(frameset);
|
||||
addFrameWarning(frameset);
|
||||
return frameset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the FRAME tag for the frame that lists all packages.
|
||||
*
|
||||
* @param contentTree the content tree to which the information will be added
|
||||
*/
|
||||
private void addAllPackagesFrameTag(Content contentTree) {
|
||||
HtmlTree frame = HtmlTree.FRAME(DocPaths.OVERVIEW_FRAME.getPath(),
|
||||
"packageListFrame", configuration.getText("doclet.All_Packages"));
|
||||
contentTree.addContent(frame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the FRAME tag for the frame that lists all classes.
|
||||
*
|
||||
* @param contentTree the content tree to which the information will be added
|
||||
*/
|
||||
private void addAllClassesFrameTag(Content contentTree) {
|
||||
HtmlTree frame = HtmlTree.FRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
|
||||
"packageFrame", configuration.getText("doclet.All_classes_and_interfaces"));
|
||||
contentTree.addContent(frame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the FRAME tag for the frame that describes the class in detail.
|
||||
*
|
||||
* @param contentTree the content tree to which the information will be added
|
||||
*/
|
||||
private void addClassFrameTag(Content contentTree) {
|
||||
HtmlTree frame = HtmlTree.FRAME(configuration.topFile.getPath(), "classFrame",
|
||||
configuration.getText("doclet.Package_class_and_interface_descriptions"),
|
||||
SCROLL_YES);
|
||||
contentTree.addContent(frame);
|
||||
}
|
||||
}
|
||||
334
jdkSrc/jdk8/com/sun/tools/doclets/formats/html/HelpWriter.java
Normal file
334
jdkSrc/jdk8/com/sun/tools/doclets/formats/html/HelpWriter.java
Normal file
@@ -0,0 +1,334 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 java.io.*;
|
||||
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Generate the Help File for the generated API documentation. The help file
|
||||
* contents are helpful for browsing the generated documentation.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
*/
|
||||
public class HelpWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* Constructor to construct HelpWriter object.
|
||||
* @param filename File to be generated.
|
||||
*/
|
||||
public HelpWriter(ConfigurationImpl configuration,
|
||||
DocPath filename) throws IOException {
|
||||
super(configuration, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the HelpWriter object and then use it to generate the help
|
||||
* file. The name of the generated file is "help-doc.html". The help file
|
||||
* will get generated if and only if "-helpfile" and "-nohelp" is not used
|
||||
* on the command line.
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration) {
|
||||
HelpWriter helpgen;
|
||||
DocPath filename = DocPath.empty;
|
||||
try {
|
||||
filename = DocPaths.HELP_DOC;
|
||||
helpgen = new HelpWriter(configuration, filename);
|
||||
helpgen.generateHelpFile();
|
||||
helpgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the help file contents.
|
||||
*/
|
||||
protected void generateHelpFile() throws IOException {
|
||||
String title = configuration.getText("doclet.Window_Help_title");
|
||||
Content body = getBody(true, getWindowTitle(title));
|
||||
addTop(body);
|
||||
addNavLinks(true, body);
|
||||
addHelpFileContents(body);
|
||||
addNavLinks(false, body);
|
||||
addBottom(body);
|
||||
printHtmlDocument(null, true, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the help file contents from the resource file to the content tree. While adding the
|
||||
* help file contents it also keeps track of user options. If "-notree"
|
||||
* is used, then the "overview-tree.html" will not get added and hence
|
||||
* help information also will not get added.
|
||||
*
|
||||
* @param contentTree the content tree to which the help file contents will be added
|
||||
*/
|
||||
protected void addHelpFileContents(Content contentTree) {
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title,
|
||||
getResource("doclet.Help_line_1"));
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
Content line2 = HtmlTree.DIV(HtmlStyle.subTitle,
|
||||
getResource("doclet.Help_line_2"));
|
||||
div.addContent(line2);
|
||||
contentTree.addContent(div);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
if (configuration.createoverview) {
|
||||
Content overviewHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Overview"));
|
||||
Content liOverview = HtmlTree.LI(HtmlStyle.blockList, overviewHeading);
|
||||
Content line3 = getResource("doclet.Help_line_3",
|
||||
getHyperLink(DocPaths.OVERVIEW_SUMMARY,
|
||||
configuration.getText("doclet.Overview")));
|
||||
Content overviewPara = HtmlTree.P(line3);
|
||||
liOverview.addContent(overviewPara);
|
||||
ul.addContent(liOverview);
|
||||
}
|
||||
Content packageHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Package"));
|
||||
Content liPackage = HtmlTree.LI(HtmlStyle.blockList, packageHead);
|
||||
Content line4 = getResource("doclet.Help_line_4");
|
||||
Content packagePara = HtmlTree.P(line4);
|
||||
liPackage.addContent(packagePara);
|
||||
HtmlTree ulPackage = new HtmlTree(HtmlTag.UL);
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Interfaces_Italic")));
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Classes")));
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Enums")));
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Exceptions")));
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Errors")));
|
||||
ulPackage.addContent(HtmlTree.LI(
|
||||
getResource("doclet.AnnotationTypes")));
|
||||
liPackage.addContent(ulPackage);
|
||||
ul.addContent(liPackage);
|
||||
Content classHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_5"));
|
||||
Content liClass = HtmlTree.LI(HtmlStyle.blockList, classHead);
|
||||
Content line6 = getResource("doclet.Help_line_6");
|
||||
Content classPara = HtmlTree.P(line6);
|
||||
liClass.addContent(classPara);
|
||||
HtmlTree ul1 = new HtmlTree(HtmlTag.UL);
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_7")));
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_8")));
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_9")));
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_10")));
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_11")));
|
||||
ul1.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_12")));
|
||||
liClass.addContent(ul1);
|
||||
HtmlTree ul2 = new HtmlTree(HtmlTag.UL);
|
||||
ul2.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Nested_Class_Summary")));
|
||||
ul2.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Field_Summary")));
|
||||
ul2.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Constructor_Summary")));
|
||||
ul2.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Method_Summary")));
|
||||
liClass.addContent(ul2);
|
||||
HtmlTree ul3 = new HtmlTree(HtmlTag.UL);
|
||||
ul3.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Field_Detail")));
|
||||
ul3.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Constructor_Detail")));
|
||||
ul3.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Method_Detail")));
|
||||
liClass.addContent(ul3);
|
||||
Content line13 = getResource("doclet.Help_line_13");
|
||||
Content para = HtmlTree.P(line13);
|
||||
liClass.addContent(para);
|
||||
ul.addContent(liClass);
|
||||
//Annotation Types
|
||||
Content aHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.AnnotationType"));
|
||||
Content liAnnotation = HtmlTree.LI(HtmlStyle.blockList, aHead);
|
||||
Content aline1 = getResource("doclet.Help_annotation_type_line_1");
|
||||
Content aPara = HtmlTree.P(aline1);
|
||||
liAnnotation.addContent(aPara);
|
||||
HtmlTree aul = new HtmlTree(HtmlTag.UL);
|
||||
aul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_annotation_type_line_2")));
|
||||
aul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_annotation_type_line_3")));
|
||||
aul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Annotation_Type_Required_Member_Summary")));
|
||||
aul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Annotation_Type_Optional_Member_Summary")));
|
||||
aul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Annotation_Type_Member_Detail")));
|
||||
liAnnotation.addContent(aul);
|
||||
ul.addContent(liAnnotation);
|
||||
//Enums
|
||||
Content enumHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Enum"));
|
||||
Content liEnum = HtmlTree.LI(HtmlStyle.blockList, enumHead);
|
||||
Content eline1 = getResource("doclet.Help_enum_line_1");
|
||||
Content enumPara = HtmlTree.P(eline1);
|
||||
liEnum.addContent(enumPara);
|
||||
HtmlTree eul = new HtmlTree(HtmlTag.UL);
|
||||
eul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_enum_line_2")));
|
||||
eul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_enum_line_3")));
|
||||
eul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Enum_Constant_Summary")));
|
||||
eul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Enum_Constant_Detail")));
|
||||
liEnum.addContent(eul);
|
||||
ul.addContent(liEnum);
|
||||
if (configuration.classuse) {
|
||||
Content useHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_14"));
|
||||
Content liUse = HtmlTree.LI(HtmlStyle.blockList, useHead);
|
||||
Content line15 = getResource("doclet.Help_line_15");
|
||||
Content usePara = HtmlTree.P(line15);
|
||||
liUse.addContent(usePara);
|
||||
ul.addContent(liUse);
|
||||
}
|
||||
if (configuration.createtree) {
|
||||
Content treeHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_16"));
|
||||
Content liTree = HtmlTree.LI(HtmlStyle.blockList, treeHead);
|
||||
Content line17 = getResource("doclet.Help_line_17_with_tree_link",
|
||||
getHyperLink(DocPaths.OVERVIEW_TREE,
|
||||
configuration.getText("doclet.Class_Hierarchy")),
|
||||
HtmlTree.CODE(new StringContent("java.lang.Object")));
|
||||
Content treePara = HtmlTree.P(line17);
|
||||
liTree.addContent(treePara);
|
||||
HtmlTree tul = new HtmlTree(HtmlTag.UL);
|
||||
tul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_18")));
|
||||
tul.addContent(HtmlTree.LI(
|
||||
getResource("doclet.Help_line_19")));
|
||||
liTree.addContent(tul);
|
||||
ul.addContent(liTree);
|
||||
}
|
||||
if (!(configuration.nodeprecatedlist ||
|
||||
configuration.nodeprecated)) {
|
||||
Content dHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Deprecated_API"));
|
||||
Content liDeprecated = HtmlTree.LI(HtmlStyle.blockList, dHead);
|
||||
Content line20 = getResource("doclet.Help_line_20_with_deprecated_api_link",
|
||||
getHyperLink(DocPaths.DEPRECATED_LIST,
|
||||
configuration.getText("doclet.Deprecated_API")));
|
||||
Content dPara = HtmlTree.P(line20);
|
||||
liDeprecated.addContent(dPara);
|
||||
ul.addContent(liDeprecated);
|
||||
}
|
||||
if (configuration.createindex) {
|
||||
Content indexlink;
|
||||
if (configuration.splitindex) {
|
||||
indexlink = getHyperLink(DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1)),
|
||||
configuration.getText("doclet.Index"));
|
||||
} else {
|
||||
indexlink = getHyperLink(DocPaths.INDEX_ALL,
|
||||
configuration.getText("doclet.Index"));
|
||||
}
|
||||
Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_21"));
|
||||
Content liIndex = HtmlTree.LI(HtmlStyle.blockList, indexHead);
|
||||
Content line22 = getResource("doclet.Help_line_22", indexlink);
|
||||
Content indexPara = HtmlTree.P(line22);
|
||||
liIndex.addContent(indexPara);
|
||||
ul.addContent(liIndex);
|
||||
}
|
||||
Content prevHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_23"));
|
||||
Content liPrev = HtmlTree.LI(HtmlStyle.blockList, prevHead);
|
||||
Content line24 = getResource("doclet.Help_line_24");
|
||||
Content prevPara = HtmlTree.P(line24);
|
||||
liPrev.addContent(prevPara);
|
||||
ul.addContent(liPrev);
|
||||
Content frameHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Help_line_25"));
|
||||
Content liFrame = HtmlTree.LI(HtmlStyle.blockList, frameHead);
|
||||
Content line26 = getResource("doclet.Help_line_26");
|
||||
Content framePara = HtmlTree.P(line26);
|
||||
liFrame.addContent(framePara);
|
||||
ul.addContent(liFrame);
|
||||
Content allclassesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.All_Classes"));
|
||||
Content liAllClasses = HtmlTree.LI(HtmlStyle.blockList, allclassesHead);
|
||||
Content line27 = getResource("doclet.Help_line_27",
|
||||
getHyperLink(DocPaths.ALLCLASSES_NOFRAME,
|
||||
configuration.getText("doclet.All_Classes")));
|
||||
Content allclassesPara = HtmlTree.P(line27);
|
||||
liAllClasses.addContent(allclassesPara);
|
||||
ul.addContent(liAllClasses);
|
||||
Content sHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Serialized_Form"));
|
||||
Content liSerial = HtmlTree.LI(HtmlStyle.blockList, sHead);
|
||||
Content line28 = getResource("doclet.Help_line_28");
|
||||
Content serialPara = HtmlTree.P(line28);
|
||||
liSerial.addContent(serialPara);
|
||||
ul.addContent(liSerial);
|
||||
Content constHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
getResource("doclet.Constants_Summary"));
|
||||
Content liConst = HtmlTree.LI(HtmlStyle.blockList, constHead);
|
||||
Content line29 = getResource("doclet.Help_line_29",
|
||||
getHyperLink(DocPaths.CONSTANT_VALUES,
|
||||
configuration.getText("doclet.Constants_Summary")));
|
||||
Content constPara = HtmlTree.P(line29);
|
||||
liConst.addContent(constPara);
|
||||
ul.addContent(liConst);
|
||||
Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul);
|
||||
Content line30 = HtmlTree.SPAN(HtmlStyle.emphasizedPhrase, getResource("doclet.Help_line_30"));
|
||||
divContent.addContent(line30);
|
||||
contentTree.addContent(divContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the help label.
|
||||
*
|
||||
* @return a content tree for the help label
|
||||
*/
|
||||
@Override
|
||||
protected Content getNavLinkHelp() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, helpLabel);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
335
jdkSrc/jdk8/com/sun/tools/doclets/formats/html/HtmlDoclet.java
Normal file
335
jdkSrc/jdk8/com/sun/tools/doclets/formats/html/HtmlDoclet.java
Normal file
@@ -0,0 +1,335 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, 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 java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.javac.sym.Profiles;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.builders.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* The class with "start" method, calls individual Writers.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
* @author Robert Field
|
||||
* @author Jamie Ho
|
||||
*
|
||||
*/
|
||||
public class HtmlDoclet extends AbstractDoclet {
|
||||
// An instance will be created by validOptions, and used by start.
|
||||
private static HtmlDoclet docletToStart = null;
|
||||
|
||||
public HtmlDoclet() {
|
||||
configuration = new ConfigurationImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* The global configuration information for this run.
|
||||
*/
|
||||
public final ConfigurationImpl configuration;
|
||||
|
||||
/**
|
||||
* The "start" method as required by Javadoc.
|
||||
*
|
||||
* @param root the root of the documentation tree.
|
||||
* @see com.sun.javadoc.RootDoc
|
||||
* @return true if the doclet ran without encountering any errors.
|
||||
*/
|
||||
public static boolean start(RootDoc root) {
|
||||
// In typical use, options will have been set up by calling validOptions,
|
||||
// which will create an HtmlDoclet for use here.
|
||||
HtmlDoclet doclet;
|
||||
if (docletToStart != null) {
|
||||
doclet = docletToStart;
|
||||
docletToStart = null;
|
||||
} else {
|
||||
doclet = new HtmlDoclet();
|
||||
}
|
||||
return doclet.start(doclet, root);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the configuration instance.
|
||||
* Override this method to use a different
|
||||
* configuration.
|
||||
*/
|
||||
public Configuration configuration() {
|
||||
return configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the generation of files. Call generate methods in the individual
|
||||
* writers, which will in turn genrate the documentation files. Call the
|
||||
* TreeWriter generation first to ensure the Class Hierarchy is built
|
||||
* first and then can be used in the later generation.
|
||||
*
|
||||
* For new format.
|
||||
*
|
||||
* @see com.sun.javadoc.RootDoc
|
||||
*/
|
||||
protected void generateOtherFiles(RootDoc root, ClassTree classtree)
|
||||
throws Exception {
|
||||
super.generateOtherFiles(root, classtree);
|
||||
if (configuration.linksource) {
|
||||
SourceToHTMLConverter.convertRoot(configuration,
|
||||
root, DocPaths.SOURCE_OUTPUT);
|
||||
}
|
||||
|
||||
if (configuration.topFile.isEmpty()) {
|
||||
configuration.standardmessage.
|
||||
error("doclet.No_Non_Deprecated_Classes_To_Document");
|
||||
return;
|
||||
}
|
||||
boolean nodeprecated = configuration.nodeprecated;
|
||||
performCopy(configuration.helpfile);
|
||||
performCopy(configuration.stylesheetfile);
|
||||
// do early to reduce memory footprint
|
||||
if (configuration.classuse) {
|
||||
ClassUseWriter.generate(configuration, classtree);
|
||||
}
|
||||
IndexBuilder indexbuilder = new IndexBuilder(configuration, nodeprecated);
|
||||
|
||||
if (configuration.createtree) {
|
||||
TreeWriter.generate(configuration, classtree);
|
||||
}
|
||||
if (configuration.createindex) {
|
||||
if (configuration.splitindex) {
|
||||
SplitIndexWriter.generate(configuration, indexbuilder);
|
||||
} else {
|
||||
SingleIndexWriter.generate(configuration, indexbuilder);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(configuration.nodeprecatedlist || nodeprecated)) {
|
||||
DeprecatedListWriter.generate(configuration);
|
||||
}
|
||||
|
||||
AllClassesFrameWriter.generate(configuration,
|
||||
new IndexBuilder(configuration, nodeprecated, true));
|
||||
|
||||
FrameOutputWriter.generate(configuration);
|
||||
|
||||
if (configuration.createoverview) {
|
||||
PackageIndexWriter.generate(configuration);
|
||||
}
|
||||
if (configuration.helpfile.length() == 0 &&
|
||||
!configuration.nohelp) {
|
||||
HelpWriter.generate(configuration);
|
||||
}
|
||||
// If a stylesheet file is not specified, copy the default stylesheet
|
||||
// and replace newline with platform-specific newline.
|
||||
DocFile f;
|
||||
if (configuration.stylesheetfile.length() == 0) {
|
||||
f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET);
|
||||
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true);
|
||||
}
|
||||
f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT);
|
||||
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void generateClassFiles(ClassDoc[] arr, ClassTree classtree) {
|
||||
Arrays.sort(arr);
|
||||
for(int i = 0; i < arr.length; i++) {
|
||||
if (!(configuration.isGeneratedDoc(arr[i]) && arr[i].isIncluded())) {
|
||||
continue;
|
||||
}
|
||||
ClassDoc prev = (i == 0)?
|
||||
null:
|
||||
arr[i-1];
|
||||
ClassDoc curr = arr[i];
|
||||
ClassDoc next = (i+1 == arr.length)?
|
||||
null:
|
||||
arr[i+1];
|
||||
try {
|
||||
if (curr.isAnnotationType()) {
|
||||
AbstractBuilder annotationTypeBuilder =
|
||||
configuration.getBuilderFactory()
|
||||
.getAnnotationTypeBuilder((AnnotationTypeDoc) curr,
|
||||
prev, next);
|
||||
annotationTypeBuilder.build();
|
||||
} else {
|
||||
AbstractBuilder classBuilder =
|
||||
configuration.getBuilderFactory()
|
||||
.getClassBuilder(curr, prev, next, classtree);
|
||||
classBuilder.build();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new DocletAbortException(e);
|
||||
} catch (FatalError fe) {
|
||||
throw fe;
|
||||
} catch (DocletAbortException de) {
|
||||
throw de;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new DocletAbortException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void generateProfileFiles() throws Exception {
|
||||
if (configuration.showProfiles && configuration.profilePackages.size() > 0) {
|
||||
ProfileIndexFrameWriter.generate(configuration);
|
||||
Profile prevProfile = null, nextProfile;
|
||||
String profileName;
|
||||
for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
|
||||
profileName = Profile.lookup(i).name;
|
||||
// Generate profile package pages only if there are any packages
|
||||
// in a profile to be documented. The profilePackages map will not
|
||||
// contain an entry for the profile if there are no packages to be documented.
|
||||
if (!configuration.shouldDocumentProfile(profileName))
|
||||
continue;
|
||||
ProfilePackageIndexFrameWriter.generate(configuration, profileName);
|
||||
PackageDoc[] packages = configuration.profilePackages.get(
|
||||
profileName);
|
||||
PackageDoc prev = null, next;
|
||||
for (int j = 0; j < packages.length; j++) {
|
||||
// if -nodeprecated option is set and the package is marked as
|
||||
// deprecated, do not generate the profilename-package-summary.html
|
||||
// and profilename-package-frame.html pages for that package.
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(packages[j]))) {
|
||||
ProfilePackageFrameWriter.generate(configuration, packages[j], i);
|
||||
next = (j + 1 < packages.length
|
||||
&& packages[j + 1].name().length() > 0) ? packages[j + 1] : null;
|
||||
AbstractBuilder profilePackageSummaryBuilder =
|
||||
configuration.getBuilderFactory().getProfilePackageSummaryBuilder(
|
||||
packages[j], prev, next, Profile.lookup(i));
|
||||
profilePackageSummaryBuilder.build();
|
||||
prev = packages[j];
|
||||
}
|
||||
}
|
||||
nextProfile = (i + 1 < configuration.profiles.getProfileCount()) ?
|
||||
Profile.lookup(i + 1) : null;
|
||||
AbstractBuilder profileSummaryBuilder =
|
||||
configuration.getBuilderFactory().getProfileSummaryBuilder(
|
||||
Profile.lookup(i), prevProfile, nextProfile);
|
||||
profileSummaryBuilder.build();
|
||||
prevProfile = Profile.lookup(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void generatePackageFiles(ClassTree classtree) throws Exception {
|
||||
PackageDoc[] packages = configuration.packages;
|
||||
if (packages.length > 1) {
|
||||
PackageIndexFrameWriter.generate(configuration);
|
||||
}
|
||||
PackageDoc prev = null, next;
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
// if -nodeprecated option is set and the package is marked as
|
||||
// deprecated, do not generate the package-summary.html, package-frame.html
|
||||
// and package-tree.html pages for that package.
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(packages[i]))) {
|
||||
PackageFrameWriter.generate(configuration, packages[i]);
|
||||
next = (i + 1 < packages.length &&
|
||||
packages[i + 1].name().length() > 0) ? packages[i + 1] : null;
|
||||
//If the next package is unnamed package, skip 2 ahead if possible
|
||||
next = (i + 2 < packages.length && next == null) ? packages[i + 2] : next;
|
||||
AbstractBuilder packageSummaryBuilder =
|
||||
configuration.getBuilderFactory().getPackageSummaryBuilder(
|
||||
packages[i], prev, next);
|
||||
packageSummaryBuilder.build();
|
||||
if (configuration.createtree) {
|
||||
PackageTreeWriter.generate(configuration,
|
||||
packages[i], prev, next,
|
||||
configuration.nodeprecated);
|
||||
}
|
||||
prev = packages[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final ConfigurationImpl sharedInstanceForOptions =
|
||||
new ConfigurationImpl();
|
||||
|
||||
/**
|
||||
* Check for doclet added options here.
|
||||
*
|
||||
* @return number of arguments to option. Zero return means
|
||||
* option not known. Negative value means error occurred.
|
||||
*/
|
||||
public static int optionLength(String option) {
|
||||
// Construct temporary configuration for check
|
||||
return sharedInstanceForOptions.optionLength(option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that options have the correct arguments here.
|
||||
* <P>
|
||||
* This method is not required and will default gracefully
|
||||
* (to true) if absent.
|
||||
* <P>
|
||||
* Printing option related error messages (using the provided
|
||||
* DocErrorReporter) is the responsibility of this method.
|
||||
*
|
||||
* @return true if the options are valid.
|
||||
*/
|
||||
public static boolean validOptions(String options[][],
|
||||
DocErrorReporter reporter) {
|
||||
docletToStart = new HtmlDoclet();
|
||||
return docletToStart.configuration.validOptions(options, reporter);
|
||||
}
|
||||
|
||||
private void performCopy(String filename) {
|
||||
if (filename.isEmpty())
|
||||
return;
|
||||
|
||||
try {
|
||||
DocFile fromfile = DocFile.createFileForInput(configuration, filename);
|
||||
DocPath path = DocPath.create(fromfile.getName());
|
||||
DocFile toFile = DocFile.createFileForOutput(configuration, path);
|
||||
if (toFile.isSameFile(fromfile))
|
||||
return;
|
||||
|
||||
configuration.message.notice((SourcePosition) null,
|
||||
"doclet.Copying_File_0_To_File_1",
|
||||
fromfile.toString(), path.getPath());
|
||||
toFile.copyFile(fromfile);
|
||||
} catch (IOException exc) {
|
||||
configuration.message.error((SourcePosition) null,
|
||||
"doclet.perform_copy_exception_encountered",
|
||||
exc.toString());
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
}
|
||||
2147
jdkSrc/jdk8/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
Normal file
2147
jdkSrc/jdk8/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 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.taglets.*;
|
||||
|
||||
/**
|
||||
* Generate serialized form for serializable fields.
|
||||
* Documentation denoted by the tags <code>serial</code> and
|
||||
* <code>serialField</code> is processed.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Joe Fialli
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class HtmlSerialFieldWriter extends FieldWriterImpl
|
||||
implements SerializedFormWriter.SerialFieldWriter {
|
||||
ProgramElementDoc[] members = null;
|
||||
|
||||
public HtmlSerialFieldWriter(SubWriterHolderWriter writer,
|
||||
ClassDoc classdoc) {
|
||||
super(writer, classdoc);
|
||||
}
|
||||
|
||||
public List<FieldDoc> members(ClassDoc cd) {
|
||||
return Arrays.asList(cd.serializableFields());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the header for serializable fields section.
|
||||
*
|
||||
* @return a content tree for the header
|
||||
*/
|
||||
public Content getSerializableFieldsHeader() {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
return ul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the header for serializable fields content section.
|
||||
*
|
||||
* @param isLastContent true if the cotent being documented is the last content.
|
||||
* @return a content tree for the header
|
||||
*/
|
||||
public Content getFieldsContentHeader(boolean isLastContent) {
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
if (isLastContent)
|
||||
li.addStyle(HtmlStyle.blockListLast);
|
||||
else
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add serializable fields.
|
||||
*
|
||||
* @param heading the heading for the section
|
||||
* @param serializableFieldsTree the tree to be added to the serializable fileds
|
||||
* content tree
|
||||
* @return a content tree for the serializable fields content
|
||||
*/
|
||||
public Content getSerializableFields(String heading, Content serializableFieldsTree) {
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
if (serializableFieldsTree.isValid()) {
|
||||
Content headingContent = new StringContent(heading);
|
||||
Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
|
||||
headingContent);
|
||||
li.addContent(serialHeading);
|
||||
li.addContent(serializableFieldsTree);
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the member header.
|
||||
*
|
||||
* @param fieldType the class document to be listed
|
||||
* @param fieldTypeStr the string for the field type to be documented
|
||||
* @param fieldDimensions the dimensions of the field string to be added
|
||||
* @param fieldName name of the field to be added
|
||||
* @param contentTree the content tree to which the member header will be added
|
||||
*/
|
||||
public void addMemberHeader(ClassDoc fieldType, String fieldTypeStr,
|
||||
String fieldDimensions, String fieldName, Content contentTree) {
|
||||
Content nameContent = new RawHtml(fieldName);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, nameContent);
|
||||
contentTree.addContent(heading);
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
if (fieldType == null) {
|
||||
pre.addContent(fieldTypeStr);
|
||||
} else {
|
||||
Content fieldContent = writer.getLink(new LinkInfoImpl(
|
||||
configuration, LinkInfoImpl.Kind.SERIAL_MEMBER, fieldType));
|
||||
pre.addContent(fieldContent);
|
||||
}
|
||||
pre.addContent(fieldDimensions + " ");
|
||||
pre.addContent(fieldName);
|
||||
contentTree.addContent(pre);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the deprecated information for this member.
|
||||
*
|
||||
* @param field the field to document.
|
||||
* @param contentTree the tree to which the deprecated info will be added
|
||||
*/
|
||||
public void addMemberDeprecatedInfo(FieldDoc field, Content contentTree) {
|
||||
addDeprecatedInfo(field, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the description text for this member.
|
||||
*
|
||||
* @param field the field to document.
|
||||
* @param contentTree the tree to which the deprecated info will be added
|
||||
*/
|
||||
public void addMemberDescription(FieldDoc field, Content contentTree) {
|
||||
if (field.inlineTags().length > 0) {
|
||||
writer.addInlineComment(field, contentTree);
|
||||
}
|
||||
Tag[] tags = field.tags("serial");
|
||||
if (tags.length > 0) {
|
||||
writer.addInlineComment(field, tags[0], contentTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the description text for this member represented by the tag.
|
||||
*
|
||||
* @param serialFieldTag the field to document (represented by tag)
|
||||
* @param contentTree the tree to which the deprecated info will be added
|
||||
*/
|
||||
public void addMemberDescription(SerialFieldTag serialFieldTag, Content contentTree) {
|
||||
String serialFieldTagDesc = serialFieldTag.description().trim();
|
||||
if (!serialFieldTagDesc.isEmpty()) {
|
||||
Content serialFieldContent = new RawHtml(serialFieldTagDesc);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.block, serialFieldContent);
|
||||
contentTree.addContent(div);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the tag information for this member.
|
||||
*
|
||||
* @param field the field to document.
|
||||
* @param contentTree the tree to which the member tags info will be added
|
||||
*/
|
||||
public void addMemberTags(FieldDoc field, Content contentTree) {
|
||||
Content tagContent = new ContentBuilder();
|
||||
TagletWriter.genTagOuput(configuration.tagletManager, field,
|
||||
configuration.tagletManager.getCustomTaglets(field),
|
||||
writer.getTagletWriterInstance(false), tagContent);
|
||||
Content dlTags = new HtmlTree(HtmlTag.DL);
|
||||
dlTags.addContent(tagContent);
|
||||
contentTree.addContent(dlTags); // TODO: what if empty?
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if overview details should be printed. If
|
||||
* nocomment option set or if there is no text to be printed
|
||||
* for deprecation info, comment or tags, do not print overview details.
|
||||
*
|
||||
* @param field the field to check overview details for.
|
||||
* @return true if overview details need to be printed
|
||||
*/
|
||||
public boolean shouldPrintOverview(FieldDoc field) {
|
||||
if (!configuration.nocomment) {
|
||||
if(!field.commentText().isEmpty() ||
|
||||
writer.hasSerializationOverviewTags(field))
|
||||
return true;
|
||||
}
|
||||
if (field.tags("deprecated").length > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.taglets.*;
|
||||
|
||||
/**
|
||||
* Generate serialized form for Serializable/Externalizable methods.
|
||||
* Documentation denoted by the <code>serialData</code> tag is processed.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Joe Fialli
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
||||
SerializedFormWriter.SerialMethodWriter{
|
||||
|
||||
public HtmlSerialMethodWriter(SubWriterHolderWriter writer,
|
||||
ClassDoc classdoc) {
|
||||
super(writer, classdoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 headingContent = new StringContent(heading);
|
||||
Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
|
||||
headingContent);
|
||||
Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading);
|
||||
li.addContent(serializableMethodContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(getHead(member));
|
||||
methodsContentTree.addContent(getSignature(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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
Content tagContent = new ContentBuilder();
|
||||
TagletManager tagletManager =
|
||||
configuration.tagletManager;
|
||||
TagletWriter.genTagOuput(tagletManager, member,
|
||||
tagletManager.getSerializedFormTaglets(),
|
||||
writer.getTagletWriterInstance(false), tagContent);
|
||||
Content dlTags = new HtmlTree(HtmlTag.DL);
|
||||
dlTags.addContent(tagContent);
|
||||
methodsContentTree.addContent(dlTags); // TODO: what if empty?
|
||||
MethodDoc method = member;
|
||||
if (method.name().compareTo("writeExternal") == 0
|
||||
&& method.tags("serialData").length == 0) {
|
||||
serialWarning(member.position(), "doclet.MissingSerialDataTag",
|
||||
method.containingClass().qualifiedName(), method.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, 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 java.util.List;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
|
||||
import com.sun.tools.doclets.formats.html.markup.RawHtml;
|
||||
import com.sun.tools.doclets.formats.html.markup.StringContent;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.links.*;
|
||||
|
||||
/**
|
||||
* A factory that returns a link given the information about it.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @since 1.5
|
||||
*/
|
||||
public class LinkFactoryImpl extends LinkFactory {
|
||||
|
||||
private HtmlDocletWriter m_writer;
|
||||
|
||||
public LinkFactoryImpl(HtmlDocletWriter writer) {
|
||||
m_writer = writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content newContent() {
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getClassLink(LinkInfo linkInfo) {
|
||||
LinkInfoImpl classLinkInfo = (LinkInfoImpl) linkInfo;
|
||||
boolean noLabel = linkInfo.label == null || linkInfo.label.isEmpty();
|
||||
ClassDoc classDoc = classLinkInfo.classDoc;
|
||||
//Create a tool tip if we are linking to a class or interface. Don't
|
||||
//create one if we are linking to a member.
|
||||
String title =
|
||||
(classLinkInfo.where == null || classLinkInfo.where.length() == 0) ?
|
||||
getClassToolTip(classDoc,
|
||||
classLinkInfo.type != null &&
|
||||
!classDoc.qualifiedTypeName().equals(classLinkInfo.type.qualifiedTypeName())) :
|
||||
"";
|
||||
Content label = classLinkInfo.getClassLinkLabel(m_writer.configuration);
|
||||
Configuration configuration = m_writer.configuration;
|
||||
Content link = new ContentBuilder();
|
||||
if (classDoc.isIncluded()) {
|
||||
if (configuration.isGeneratedDoc(classDoc)) {
|
||||
DocPath filename = getPath(classLinkInfo);
|
||||
if (linkInfo.linkToSelf ||
|
||||
!(DocPath.forName(classDoc)).equals(m_writer.filename)) {
|
||||
link.addContent(m_writer.getHyperLink(
|
||||
filename.fragment(classLinkInfo.where),
|
||||
label,
|
||||
classLinkInfo.isStrong, classLinkInfo.styleName,
|
||||
title, classLinkInfo.target));
|
||||
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
|
||||
link.addContent(getTypeParameterLinks(linkInfo));
|
||||
}
|
||||
return link;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Content crossLink = m_writer.getCrossClassLink(
|
||||
classDoc.qualifiedName(), classLinkInfo.where,
|
||||
label, classLinkInfo.isStrong, classLinkInfo.styleName,
|
||||
true);
|
||||
if (crossLink != null) {
|
||||
link.addContent(crossLink);
|
||||
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
|
||||
link.addContent(getTypeParameterLinks(linkInfo));
|
||||
}
|
||||
return link;
|
||||
}
|
||||
}
|
||||
// Can't link so just write label.
|
||||
link.addContent(label);
|
||||
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
|
||||
link.addContent(getTypeParameterLinks(linkInfo));
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getTypeParameterLink(LinkInfo linkInfo,
|
||||
Type typeParam) {
|
||||
LinkInfoImpl typeLinkInfo = new LinkInfoImpl(m_writer.configuration,
|
||||
((LinkInfoImpl) linkInfo).getContext(), typeParam);
|
||||
typeLinkInfo.excludeTypeBounds = linkInfo.excludeTypeBounds;
|
||||
typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks;
|
||||
typeLinkInfo.linkToSelf = linkInfo.linkToSelf;
|
||||
typeLinkInfo.isJava5DeclarationLocation = false;
|
||||
return getLink(typeLinkInfo);
|
||||
}
|
||||
|
||||
protected Content getTypeAnnotationLink(LinkInfo linkInfo,
|
||||
AnnotationDesc annotation) {
|
||||
throw new RuntimeException("Not implemented yet!");
|
||||
}
|
||||
|
||||
public Content getTypeAnnotationLinks(LinkInfo linkInfo) {
|
||||
ContentBuilder links = new ContentBuilder();
|
||||
AnnotationDesc[] annotations;
|
||||
if (linkInfo.type instanceof AnnotatedType) {
|
||||
annotations = linkInfo.type.asAnnotatedType().annotations();
|
||||
} else if (linkInfo.type instanceof TypeVariable) {
|
||||
annotations = linkInfo.type.asTypeVariable().annotations();
|
||||
} else {
|
||||
return links;
|
||||
}
|
||||
|
||||
if (annotations.length == 0)
|
||||
return links;
|
||||
|
||||
List<Content> annos = m_writer.getAnnotations(0, annotations, false, linkInfo.isJava5DeclarationLocation);
|
||||
|
||||
boolean isFirst = true;
|
||||
for (Content anno : annos) {
|
||||
if (!isFirst) {
|
||||
links.addContent(" ");
|
||||
}
|
||||
links.addContent(anno);
|
||||
isFirst = false;
|
||||
}
|
||||
if (!annos.isEmpty()) {
|
||||
links.addContent(" ");
|
||||
}
|
||||
|
||||
return links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a class, return the appropriate tool tip.
|
||||
*
|
||||
* @param classDoc the class to get the tool tip for.
|
||||
* @return the tool tip for the appropriate class.
|
||||
*/
|
||||
private String getClassToolTip(ClassDoc classDoc, boolean isTypeLink) {
|
||||
Configuration configuration = m_writer.configuration;
|
||||
if (isTypeLink) {
|
||||
return configuration.getText("doclet.Href_Type_Param_Title",
|
||||
classDoc.name());
|
||||
} else if (classDoc.isInterface()){
|
||||
return configuration.getText("doclet.Href_Interface_Title",
|
||||
Util.getPackageName(classDoc.containingPackage()));
|
||||
} else if (classDoc.isAnnotationType()) {
|
||||
return configuration.getText("doclet.Href_Annotation_Title",
|
||||
Util.getPackageName(classDoc.containingPackage()));
|
||||
} else if (classDoc.isEnum()) {
|
||||
return configuration.getText("doclet.Href_Enum_Title",
|
||||
Util.getPackageName(classDoc.containingPackage()));
|
||||
} else {
|
||||
return configuration.getText("doclet.Href_Class_Title",
|
||||
Util.getPackageName(classDoc.containingPackage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return path to the given file name in the given package. So if the name
|
||||
* passed is "Object.html" and the name of the package is "java.lang", and
|
||||
* if the relative path is "../.." then returned string will be
|
||||
* "../../java/lang/Object.html"
|
||||
*
|
||||
* @param linkInfo the information about the link.
|
||||
*/
|
||||
private DocPath getPath(LinkInfoImpl linkInfo) {
|
||||
if (linkInfo.context == LinkInfoImpl.Kind.PACKAGE_FRAME) {
|
||||
//Not really necessary to do this but we want to be consistent
|
||||
//with 1.4.2 output.
|
||||
return DocPath.forName(linkInfo.classDoc);
|
||||
}
|
||||
return m_writer.pathToRoot.resolve(DocPath.forClass(linkInfo.classDoc));
|
||||
}
|
||||
}
|
||||
431
jdkSrc/jdk8/com/sun/tools/doclets/formats/html/LinkInfoImpl.java
Normal file
431
jdkSrc/jdk8/com/sun/tools/doclets/formats/html/LinkInfoImpl.java
Normal file
@@ -0,0 +1,431 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, 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.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
|
||||
import com.sun.tools.doclets.formats.html.markup.StringContent;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.links.*;
|
||||
|
||||
/**
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*/
|
||||
public class LinkInfoImpl extends LinkInfo {
|
||||
|
||||
public enum Kind {
|
||||
DEFAULT,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in a class list.
|
||||
*/
|
||||
ALL_CLASSES_FRAME,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in a class documentation.
|
||||
*/
|
||||
CLASS,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in member documentation.
|
||||
*/
|
||||
MEMBER,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in class use documentation.
|
||||
*/
|
||||
CLASS_USE,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in index documentation.
|
||||
*/
|
||||
INDEX,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in constant value summary.
|
||||
*/
|
||||
CONSTANT_SUMMARY,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in serialized form documentation.
|
||||
*/
|
||||
SERIALIZED_FORM,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in serial member documentation.
|
||||
*/
|
||||
SERIAL_MEMBER,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in package documentation.
|
||||
*/
|
||||
PACKAGE,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in see tag documentation.
|
||||
*/
|
||||
SEE_TAG,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in value tag documentation.
|
||||
*/
|
||||
VALUE_TAG,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in tree documentation.
|
||||
*/
|
||||
TREE,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in a class list.
|
||||
*/
|
||||
PACKAGE_FRAME,
|
||||
|
||||
/**
|
||||
* The header in the class documentation.
|
||||
*/
|
||||
CLASS_HEADER,
|
||||
|
||||
/**
|
||||
* The signature in the class documentation.
|
||||
*/
|
||||
CLASS_SIGNATURE,
|
||||
|
||||
/**
|
||||
* The return type of a method.
|
||||
*/
|
||||
RETURN_TYPE,
|
||||
|
||||
/**
|
||||
* The return type of a method in a member summary.
|
||||
*/
|
||||
SUMMARY_RETURN_TYPE,
|
||||
|
||||
/**
|
||||
* The type of a method/constructor parameter.
|
||||
*/
|
||||
EXECUTABLE_MEMBER_PARAM,
|
||||
|
||||
/**
|
||||
* Super interface links.
|
||||
*/
|
||||
SUPER_INTERFACES,
|
||||
|
||||
/**
|
||||
* Implemented interface links.
|
||||
*/
|
||||
IMPLEMENTED_INTERFACES,
|
||||
|
||||
/**
|
||||
* Implemented class links.
|
||||
*/
|
||||
IMPLEMENTED_CLASSES,
|
||||
|
||||
/**
|
||||
* Subinterface links.
|
||||
*/
|
||||
SUBINTERFACES,
|
||||
|
||||
/**
|
||||
* Subclasses links.
|
||||
*/
|
||||
SUBCLASSES,
|
||||
|
||||
/**
|
||||
* The signature in the class documentation (implements/extends portion).
|
||||
*/
|
||||
CLASS_SIGNATURE_PARENT_NAME,
|
||||
|
||||
/**
|
||||
* The header for method documentation copied from parent.
|
||||
*/
|
||||
METHOD_DOC_COPY,
|
||||
|
||||
/**
|
||||
* Method "specified by" link.
|
||||
*/
|
||||
METHOD_SPECIFIED_BY,
|
||||
|
||||
/**
|
||||
* Method "overrides" link.
|
||||
*/
|
||||
METHOD_OVERRIDES,
|
||||
|
||||
/**
|
||||
* Annotation link.
|
||||
*/
|
||||
ANNOTATION,
|
||||
|
||||
/**
|
||||
* The header for field documentation copied from parent.
|
||||
*/
|
||||
FIELD_DOC_COPY,
|
||||
|
||||
/**
|
||||
* The parent nodes in the class tree.
|
||||
*/
|
||||
CLASS_TREE_PARENT,
|
||||
|
||||
/**
|
||||
* The type parameters of a method or constructor.
|
||||
*/
|
||||
MEMBER_TYPE_PARAMS,
|
||||
|
||||
/**
|
||||
* Indicate that the link appears in class use documentation.
|
||||
*/
|
||||
CLASS_USE_HEADER,
|
||||
|
||||
/**
|
||||
* The header for property documentation copied from parent.
|
||||
*/
|
||||
PROPERTY_DOC_COPY
|
||||
}
|
||||
|
||||
public final ConfigurationImpl configuration;
|
||||
|
||||
/**
|
||||
* The location of the link.
|
||||
*/
|
||||
public Kind context = Kind.DEFAULT;
|
||||
|
||||
/**
|
||||
* The value of the marker #.
|
||||
*/
|
||||
public String where = "";
|
||||
|
||||
/**
|
||||
* String style of text defined in style sheet.
|
||||
*/
|
||||
public String styleName = "";
|
||||
|
||||
/**
|
||||
* The value of the target.
|
||||
*/
|
||||
public String target = "";
|
||||
|
||||
/**
|
||||
* Construct a LinkInfo object.
|
||||
*
|
||||
* @param configuration the configuration data for the doclet
|
||||
* @param context the context of the link.
|
||||
* @param context the context of the link.
|
||||
* @param executableMemberDoc the member to link to.
|
||||
*/
|
||||
public LinkInfoImpl(ConfigurationImpl configuration,
|
||||
Kind context, ExecutableMemberDoc executableMemberDoc) {
|
||||
this.configuration = configuration;
|
||||
this.executableMemberDoc = executableMemberDoc;
|
||||
setContext(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inherotDoc}
|
||||
*/
|
||||
protected Content newContent() {
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a LinkInfo object.
|
||||
*
|
||||
* @param configuration the configuration data for the doclet
|
||||
* @param context the context of the link.
|
||||
* @param classDoc the class to link to.
|
||||
*/
|
||||
public LinkInfoImpl(ConfigurationImpl configuration,
|
||||
Kind context, ClassDoc classDoc) {
|
||||
this.configuration = configuration;
|
||||
this.classDoc = classDoc;
|
||||
setContext(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a LinkInfo object.
|
||||
*
|
||||
* @param configuration the configuration data for the doclet
|
||||
* @param context the context of the link.
|
||||
* @param type the class to link to.
|
||||
*/
|
||||
public LinkInfoImpl(ConfigurationImpl configuration,
|
||||
Kind context, Type type) {
|
||||
this.configuration = configuration;
|
||||
this.type = type;
|
||||
setContext(context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the label for the link.
|
||||
* @param label plain-text label for the link
|
||||
*/
|
||||
public LinkInfoImpl label(String label) {
|
||||
this.label = new StringContent(label);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the label for the link.
|
||||
*/
|
||||
public LinkInfoImpl label(Content label) {
|
||||
this.label = label;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not the link should be strong.
|
||||
*/
|
||||
public LinkInfoImpl strong(boolean strong) {
|
||||
this.isStrong = strong;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the style to be used for the link.
|
||||
* @param styleName String style of text defined in style sheet.
|
||||
*/
|
||||
public LinkInfoImpl styleName(String styleName) {
|
||||
this.styleName = styleName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the target to be used for the link.
|
||||
* @param styleName String style of text defined in style sheet.
|
||||
*/
|
||||
public LinkInfoImpl target(String target) {
|
||||
this.target = target;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not this is a link to a varargs parameter.
|
||||
*/
|
||||
public LinkInfoImpl varargs(boolean varargs) {
|
||||
this.isVarArg = varargs;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the fragment specifier for the link.
|
||||
*/
|
||||
public LinkInfoImpl where(String where) {
|
||||
this.where = where;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Kind getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* This method sets the link attributes to the appropriate values
|
||||
* based on the context.
|
||||
*
|
||||
* @param c the context id to set.
|
||||
*/
|
||||
public final void setContext(Kind c) {
|
||||
//NOTE: Put context specific link code here.
|
||||
switch (c) {
|
||||
case ALL_CLASSES_FRAME:
|
||||
case PACKAGE_FRAME:
|
||||
case IMPLEMENTED_CLASSES:
|
||||
case SUBCLASSES:
|
||||
case METHOD_DOC_COPY:
|
||||
case FIELD_DOC_COPY:
|
||||
case PROPERTY_DOC_COPY:
|
||||
case CLASS_USE_HEADER:
|
||||
includeTypeInClassLinkLabel = false;
|
||||
break;
|
||||
|
||||
case ANNOTATION:
|
||||
excludeTypeParameterLinks = true;
|
||||
excludeTypeBounds = true;
|
||||
break;
|
||||
|
||||
case IMPLEMENTED_INTERFACES:
|
||||
case SUPER_INTERFACES:
|
||||
case SUBINTERFACES:
|
||||
case CLASS_TREE_PARENT:
|
||||
case TREE:
|
||||
case CLASS_SIGNATURE_PARENT_NAME:
|
||||
excludeTypeParameterLinks = true;
|
||||
excludeTypeBounds = true;
|
||||
includeTypeInClassLinkLabel = false;
|
||||
includeTypeAsSepLink = true;
|
||||
break;
|
||||
|
||||
case PACKAGE:
|
||||
case CLASS_USE:
|
||||
case CLASS_HEADER:
|
||||
case CLASS_SIGNATURE:
|
||||
excludeTypeParameterLinks = true;
|
||||
includeTypeAsSepLink = true;
|
||||
includeTypeInClassLinkLabel = false;
|
||||
break;
|
||||
|
||||
case MEMBER_TYPE_PARAMS:
|
||||
includeTypeAsSepLink = true;
|
||||
includeTypeInClassLinkLabel = false;
|
||||
break;
|
||||
|
||||
case RETURN_TYPE:
|
||||
case SUMMARY_RETURN_TYPE:
|
||||
excludeTypeBounds = true;
|
||||
break;
|
||||
case EXECUTABLE_MEMBER_PARAM:
|
||||
excludeTypeBounds = true;
|
||||
break;
|
||||
}
|
||||
context = c;
|
||||
if (type != null &&
|
||||
type.asTypeVariable()!= null &&
|
||||
type.asTypeVariable().owner() instanceof ExecutableMemberDoc) {
|
||||
excludeTypeParameterLinks = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this link is linkable and false if we can't link to the
|
||||
* desired place.
|
||||
*
|
||||
* @return true if this link is linkable and false if we can't link to the
|
||||
* desired place.
|
||||
*/
|
||||
public boolean isLinkable() {
|
||||
return Util.isLinkable(classDoc, configuration);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, 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.links.*;
|
||||
|
||||
/**
|
||||
* Stores output of a link.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @since 1.5
|
||||
*/
|
||||
public class LinkOutputImpl implements LinkOutput {
|
||||
|
||||
/**
|
||||
* The output of the link.
|
||||
*/
|
||||
public StringBuilder output;
|
||||
|
||||
/**
|
||||
* Construct a new LinkOutputImpl.
|
||||
*/
|
||||
public LinkOutputImpl() {
|
||||
output = new StringBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void append(Object o) {
|
||||
output.append(o instanceof String ?
|
||||
(String) o : ((LinkOutputImpl)o).toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void insert(int offset, Object o) {
|
||||
output.insert(offset, o.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String toString() {
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,412 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, 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 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.javac.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Writes method documentation in HTML format.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Robert Field
|
||||
* @author Atul M Dambalkar
|
||||
* @author Jamie Ho (rewrite)
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
implements MethodWriter, MemberSummaryWriter {
|
||||
|
||||
/**
|
||||
* Construct a new MethodWriterImpl.
|
||||
*
|
||||
* @param writer the writer for the class that the methods belong to.
|
||||
* @param classDoc the class being documented.
|
||||
*/
|
||||
public MethodWriterImpl(SubWriterHolderWriter writer, ClassDoc classDoc) {
|
||||
super(writer, classDoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new MethodWriterImpl.
|
||||
*
|
||||
* @param writer The writer for the class that the methods belong to.
|
||||
*/
|
||||
public MethodWriterImpl(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
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 Content getMethodDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree) {
|
||||
memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS);
|
||||
Content methodDetailsTree = writer.getMemberTreeHeader();
|
||||
methodDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.METHOD_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.methodDetailsLabel);
|
||||
methodDetailsTree.addContent(heading);
|
||||
return methodDetailsTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMethodDocTreeHeader(MethodDoc method,
|
||||
Content methodDetailsTree) {
|
||||
String erasureAnchor;
|
||||
if ((erasureAnchor = getErasureAnchor(method)) != null) {
|
||||
methodDetailsTree.addContent(writer.getMarkerAnchor((erasureAnchor)));
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the signature for the given method.
|
||||
*
|
||||
* @param method the method being documented.
|
||||
* @return a content object for the signature
|
||||
*/
|
||||
public Content getSignature(MethodDoc method) {
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
writer.addAnnotationInfo(method, pre);
|
||||
addModifiers(method, pre);
|
||||
addTypeParameters(method, pre);
|
||||
addReturnType(method, pre);
|
||||
if (configuration.linksource) {
|
||||
Content methodName = new StringContent(method.name());
|
||||
writer.addSrcLink(method, methodName, pre);
|
||||
} else {
|
||||
addName(method.name(), pre);
|
||||
}
|
||||
int indent = pre.charCount();
|
||||
addParameters(method, pre, indent);
|
||||
addExceptions(method, pre, indent);
|
||||
return pre;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addDeprecated(MethodDoc method, Content methodDocTree) {
|
||||
addDeprecatedInfo(method, methodDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addComments(Type holder, MethodDoc method, Content methodDocTree) {
|
||||
ClassDoc holderClassDoc = holder.asClassDoc();
|
||||
if (method.inlineTags().length > 0) {
|
||||
if (holder.asClassDoc().equals(classdoc) ||
|
||||
(! (holderClassDoc.isPublic() ||
|
||||
Util.isLinkable(holderClassDoc, configuration)))) {
|
||||
writer.addInlineComment(method, methodDocTree);
|
||||
} else {
|
||||
Content link =
|
||||
writer.getDocLink(LinkInfoImpl.Kind.METHOD_DOC_COPY,
|
||||
holder.asClassDoc(), method,
|
||||
holder.asClassDoc().isIncluded() ?
|
||||
holder.typeName() : holder.qualifiedTypeName(),
|
||||
false);
|
||||
Content codelLink = HtmlTree.CODE(link);
|
||||
Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel, holder.asClassDoc().isClass()?
|
||||
writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
|
||||
descfrmLabel.addContent(writer.getSpace());
|
||||
descfrmLabel.addContent(codelLink);
|
||||
methodDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel));
|
||||
writer.addInlineComment(method, methodDocTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addTags(MethodDoc method, Content methodDocTree) {
|
||||
writer.addTagsInfo(method, methodDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMethodDetails(Content methodDetailsTree) {
|
||||
return getMemberTree(methodDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMethodDoc(Content methodDocTree,
|
||||
boolean isLastContent) {
|
||||
return getMemberTree(methodDocTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
public int getMemberKind() {
|
||||
return VisibleMemberMap.METHODS;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Method_Summary"));
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Method_Summary"),
|
||||
configuration.getText("doclet.methods"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("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"))
|
||||
};
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
|
||||
memberTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.METHOD_SUMMARY));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
|
||||
inheritedTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.METHODS_INHERITANCE, configuration.getClassName(cd)));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
|
||||
Content classLink = writer.getPreQualifiedClassLink(
|
||||
LinkInfoImpl.Kind.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);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
|
||||
MethodDoc meth = (MethodDoc)member;
|
||||
addModifierAndType(meth, meth.returnType(), tdSummaryType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected static void addOverridden(HtmlDocletWriter writer,
|
||||
Type overriddenType, MethodDoc method, Content dl) {
|
||||
if (writer.configuration.nocomment) {
|
||||
return;
|
||||
}
|
||||
ClassDoc holderClassDoc = overriddenType.asClassDoc();
|
||||
if (! (holderClassDoc.isPublic() ||
|
||||
Util.isLinkable(holderClassDoc, writer.configuration))) {
|
||||
//This is an implementation detail that should not be documented.
|
||||
return;
|
||||
}
|
||||
if (overriddenType.asClassDoc().isIncluded() && ! method.isIncluded()) {
|
||||
//The class is included but the method is not. That means that it
|
||||
//is not visible so don't document this.
|
||||
return;
|
||||
}
|
||||
Content label = writer.overridesLabel;
|
||||
LinkInfoImpl.Kind context = LinkInfoImpl.Kind.METHOD_OVERRIDES;
|
||||
|
||||
if (method != null) {
|
||||
if (overriddenType.asClassDoc().isAbstract() && method.isAbstract()){
|
||||
//Abstract method is implemented from abstract class,
|
||||
//not overridden
|
||||
label = writer.specifiedByLabel;
|
||||
context = LinkInfoImpl.Kind.METHOD_SPECIFIED_BY;
|
||||
}
|
||||
Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, label));
|
||||
dl.addContent(dt);
|
||||
Content overriddenTypeLink =
|
||||
writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType));
|
||||
Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink);
|
||||
String name = method.name();
|
||||
Content methlink = writer.getLink(
|
||||
new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER,
|
||||
overriddenType.asClassDoc())
|
||||
.where(writer.getName(writer.getAnchor(method))).label(name));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected static void addImplementsInfo(HtmlDocletWriter writer,
|
||||
MethodDoc method, Content dl) {
|
||||
if(writer.configuration.nocomment){
|
||||
return;
|
||||
}
|
||||
ImplementedMethods implementedMethodsFinder =
|
||||
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);
|
||||
Content intfaclink = writer.getLink(new LinkInfoImpl(
|
||||
writer.configuration, LinkInfoImpl.Kind.METHOD_SPECIFIED_BY, intfac));
|
||||
Content codeIntfacLink = HtmlTree.CODE(intfaclink);
|
||||
Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.overrideSpecifyLabel, writer.specifiedByLabel));
|
||||
dl.addContent(dt);
|
||||
Content methlink = writer.getDocLink(
|
||||
LinkInfoImpl.Kind.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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
Content linkContent = writer.getLink(
|
||||
new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
|
||||
htmltree.addContent(linkContent);
|
||||
htmltree.addContent(writer.getSpace());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
|
||||
if (link) {
|
||||
if (cd == null) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.METHOD_SUMMARY,
|
||||
writer.getResource("doclet.navMethod"));
|
||||
} else {
|
||||
return writer.getHyperLink(
|
||||
SectionName.METHODS_INHERITANCE,
|
||||
configuration.getClassName(cd), writer.getResource("doclet.navMethod"));
|
||||
}
|
||||
} else {
|
||||
return writer.getResource("doclet.navMethod");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavDetailLink(boolean link, Content liNav) {
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.METHOD_DETAIL, writer.getResource("doclet.navMethod")));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navMethod"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Writes nested class documentation in HTML format.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Robert Field
|
||||
* @author Atul M Dambalkar
|
||||
* @author Jamie Ho (rewrite)
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class NestedClassWriterImpl extends AbstractMemberWriter
|
||||
implements MemberSummaryWriter {
|
||||
|
||||
public NestedClassWriterImpl(SubWriterHolderWriter writer,
|
||||
ClassDoc classdoc) {
|
||||
super(writer, classdoc);
|
||||
}
|
||||
|
||||
public NestedClassWriterImpl(SubWriterHolderWriter writer) {
|
||||
super(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
public int getMemberKind() {
|
||||
return VisibleMemberMap.INNERCLASSES;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Nested_Class_Summary"));
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Nested_Class_Summary"),
|
||||
configuration.getText("doclet.nested_classes"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Nested_Classes");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String[] getSummaryTableHeader(ProgramElementDoc member) {
|
||||
String[] header;
|
||||
if (member.isInterface()) {
|
||||
header = new String[] {
|
||||
writer.getModifierTypeHeader(),
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Interface"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
}
|
||||
else {
|
||||
header = new String[] {
|
||||
writer.getModifierTypeHeader(),
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Class"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
}
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
|
||||
memberTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.NESTED_CLASS_SUMMARY));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
|
||||
inheritedTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.NESTED_CLASSES_INHERITANCE,
|
||||
cd.qualifiedName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
|
||||
Content classLink = writer.getPreQualifiedClassLink(
|
||||
LinkInfoImpl.Kind.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);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
|
||||
Content tdSummary) {
|
||||
Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
|
||||
writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member)));
|
||||
Content code = HtmlTree.CODE(memberLink);
|
||||
tdSummary.addContent(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addInheritedSummaryLink(ClassDoc cd,
|
||||
ProgramElementDoc member, Content linksTree) {
|
||||
linksTree.addContent(
|
||||
writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER,
|
||||
(ClassDoc)member)));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryType(ProgramElementDoc member,
|
||||
Content tdSummaryType) {
|
||||
ClassDoc cd = (ClassDoc)member;
|
||||
addModifierAndType(cd, null, tdSummaryType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getDeprecatedLink(ProgramElementDoc member) {
|
||||
return writer.getQualifiedClassLink(LinkInfoImpl.Kind.MEMBER,
|
||||
(ClassDoc)member);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
|
||||
if (link) {
|
||||
if (cd == null) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.NESTED_CLASS_SUMMARY,
|
||||
writer.getResource("doclet.navNested"));
|
||||
} else {
|
||||
return writer.getHyperLink(
|
||||
SectionName.NESTED_CLASSES_INHERITANCE,
|
||||
cd.qualifiedName(), writer.getResource("doclet.navNested"));
|
||||
}
|
||||
} else {
|
||||
return writer.getResource("doclet.navNested");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavDetailLink(boolean link, Content liNav) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class PackageFrameWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* The package being documented.
|
||||
*/
|
||||
private PackageDoc packageDoc;
|
||||
|
||||
/**
|
||||
* The classes to be documented. Use this to filter out classes
|
||||
* that will not be documented.
|
||||
*/
|
||||
private Set<ClassDoc> documentedClasses;
|
||||
|
||||
/**
|
||||
* Constructor to construct PackageFrameWriter object and to generate
|
||||
* "package-frame.html" file in the respective package directory.
|
||||
* For example for package "java.lang" this will generate file
|
||||
* "package-frame.html" file in the "java/lang" directory. It will also
|
||||
* create "java/lang" directory in the current or the destination directory
|
||||
* if it doesn't exist.
|
||||
*
|
||||
* @param configuration the configuration of the doclet.
|
||||
* @param packageDoc PackageDoc under consideration.
|
||||
*/
|
||||
public PackageFrameWriter(ConfigurationImpl configuration,
|
||||
PackageDoc packageDoc)
|
||||
throws IOException {
|
||||
super(configuration, DocPath.forPackage(packageDoc).resolve(DocPaths.PACKAGE_FRAME));
|
||||
this.packageDoc = packageDoc;
|
||||
if (configuration.root.specifiedPackages().length == 0) {
|
||||
documentedClasses = new HashSet<ClassDoc>(Arrays.asList(configuration.root.classes()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a package summary page for the left-hand bottom frame. Construct
|
||||
* the PackageFrameWriter object and then uses it generate the file.
|
||||
*
|
||||
* @param configuration the current configuration of the doclet.
|
||||
* @param packageDoc The package for which "pacakge-frame.html" is to be generated.
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration,
|
||||
PackageDoc packageDoc) {
|
||||
PackageFrameWriter packgen;
|
||||
try {
|
||||
packgen = new PackageFrameWriter(configuration, packageDoc);
|
||||
String pkgName = Util.getPackageName(packageDoc);
|
||||
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(), DocPaths.PACKAGE_FRAME.getPath());
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 addClassListing(Content contentTree) {
|
||||
Configuration config = configuration;
|
||||
if (packageDoc.isIncluded()) {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 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 addClassKindListing(ClassDoc[] arr, Content labelContent,
|
||||
Content contentTree) {
|
||||
arr = Util.filterOutPrivateClasses(arr, configuration.javafx);
|
||||
if(arr.length > 0) {
|
||||
Arrays.sort(arr);
|
||||
boolean printedHeader = false;
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(labelContent);
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (documentedClasses != null &&
|
||||
!documentedClasses.contains(arr[i])) {
|
||||
continue;
|
||||
}
|
||||
if (!Util.isCoreClass(arr[i]) || !
|
||||
configuration.isGeneratedDoc(arr[i])) {
|
||||
continue;
|
||||
}
|
||||
if (!printedHeader) {
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
true, labelContent);
|
||||
contentTree.addContent(heading);
|
||||
printedHeader = true;
|
||||
}
|
||||
Content arr_i_name = new StringContent(arr[i].name());
|
||||
if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
|
||||
Content li = HtmlTree.LI(link);
|
||||
ul.addContent(li);
|
||||
}
|
||||
contentTree.addContent(ul);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Generate the package index for the left-hand frame in the generated output.
|
||||
* A click on the package name in this frame will update the page in the bottom
|
||||
* left hand frame with the listing of contents of the clicked package.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
*/
|
||||
public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
|
||||
|
||||
/**
|
||||
* Construct the PackageIndexFrameWriter object.
|
||||
*
|
||||
* @param filename Name of the package index file to be generated.
|
||||
*/
|
||||
public PackageIndexFrameWriter(ConfigurationImpl configuration,
|
||||
DocPath filename) throws IOException {
|
||||
super(configuration, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the package index file named "overview-frame.html".
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration) {
|
||||
PackageIndexFrameWriter packgen;
|
||||
DocPath filename = DocPaths.OVERVIEW_FRAME;
|
||||
try {
|
||||
packgen = new PackageIndexFrameWriter(configuration, filename);
|
||||
packgen.buildPackageIndexFile("doclet.Window_Overview", false);
|
||||
packgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
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.setTitle(packagesLabel);
|
||||
for(int i = 0; i < packages.length; i++) {
|
||||
// Do not list the package if -nodeprecated option is set and the
|
||||
// package is marked as deprecated.
|
||||
if (packages[i] != null &&
|
||||
(!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
|
||||
ul.addContent(getPackage(packages[i]));
|
||||
}
|
||||
}
|
||||
div.addContent(ul);
|
||||
body.addContent(div);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets each package name as a separate link.
|
||||
*
|
||||
* @param pd PackageDoc
|
||||
* @return content for the package link
|
||||
*/
|
||||
protected Content getPackage(PackageDoc pd) {
|
||||
Content packageLinkContent;
|
||||
Content packageLabel;
|
||||
if (pd.name().length() > 0) {
|
||||
packageLabel = getPackageLabel(pd.name());
|
||||
packageLinkContent = getHyperLink(pathString(pd,
|
||||
DocPaths.PACKAGE_FRAME), packageLabel, "",
|
||||
"packageFrame");
|
||||
} else {
|
||||
packageLabel = new StringContent("<unnamed package>");
|
||||
packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
|
||||
packageLabel, "", "packageFrame");
|
||||
}
|
||||
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 addOverviewHeader(Content body) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Classes" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param div the Content object to which the all classes link should be added
|
||||
*/
|
||||
protected void addAllClassesLink(Content div) {
|
||||
Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
|
||||
allclassesLabel, "", "packageFrame");
|
||||
Content span = HtmlTree.SPAN(linkContent);
|
||||
div.addContent(span);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Profiles" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param div the Content object to which the all profiles link should be added
|
||||
*/
|
||||
protected void addAllProfilesLink(Content div) {
|
||||
Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
|
||||
allprofilesLabel, "", "packageListFrame");
|
||||
Content span = HtmlTree.SPAN(linkContent);
|
||||
div.addContent(span);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavigationBarFooter(Content body) {
|
||||
Content p = HtmlTree.P(getSpace());
|
||||
body.addContent(p);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Generate the package index page "overview-summary.html" for the right-hand
|
||||
* frame. A click on the package name on this page will update the same frame
|
||||
* with the "package-summary.html" file for the clicked package.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class PackageIndexWriter extends AbstractPackageIndexWriter {
|
||||
|
||||
/**
|
||||
* Root of the program structure. Used for "overview" documentation.
|
||||
*/
|
||||
private RootDoc root;
|
||||
|
||||
/**
|
||||
* Map representing the group of packages as specified on the command line.
|
||||
*
|
||||
* @see Group
|
||||
*/
|
||||
private Map<String,List<PackageDoc>> groupPackageMap;
|
||||
|
||||
/**
|
||||
* List to store the order groups as specified on the command line.
|
||||
*/
|
||||
private List<String> groupList;
|
||||
|
||||
/**
|
||||
* Construct the PackageIndexWriter. Also constructs the grouping
|
||||
* information as provided on the command line by "-group" option. Stores
|
||||
* the order of groups specified by the user.
|
||||
*
|
||||
* @see Group
|
||||
*/
|
||||
public PackageIndexWriter(ConfigurationImpl configuration,
|
||||
DocPath filename)
|
||||
throws IOException {
|
||||
super(configuration, filename);
|
||||
this.root = configuration.root;
|
||||
groupPackageMap = configuration.group.groupPackages(packages);
|
||||
groupList = configuration.group.getGroupList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the package index page for the right-hand frame.
|
||||
*
|
||||
* @param configuration the current configuration of the doclet.
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration) {
|
||||
PackageIndexWriter packgen;
|
||||
DocPath filename = DocPaths.OVERVIEW_SUMMARY;
|
||||
try {
|
||||
packgen = new PackageIndexWriter(configuration, filename);
|
||||
packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
|
||||
packgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 addIndex(Content body) {
|
||||
for (int i = 0; i < groupList.size(); i++) {
|
||||
String groupname = groupList.get(i);
|
||||
List<PackageDoc> list = groupPackageMap.get(groupname);
|
||||
if (list != null && list.size() > 0) {
|
||||
addIndexContents(list.toArray(new PackageDoc[list.size()]),
|
||||
groupname, configuration.getText("doclet.Member_Table_Summary",
|
||||
groupname, configuration.getText("doclet.packages")), body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addProfilesList(Content profileSummary, Content body) {
|
||||
Content h2 = HtmlTree.HEADING(HtmlTag.H2, profileSummary);
|
||||
Content profilesDiv = HtmlTree.DIV(h2);
|
||||
Content ul = new HtmlTree(HtmlTag.UL);
|
||||
String profileName;
|
||||
for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
|
||||
profileName = Profile.lookup(i).name;
|
||||
// If the profile has valid packages to be documented, add it to the
|
||||
// profiles list on overview-summary.html page.
|
||||
if (configuration.shouldDocumentProfile(profileName)) {
|
||||
Content profileLinkContent = getTargetProfileLink("classFrame",
|
||||
new StringContent(profileName), profileName);
|
||||
Content li = HtmlTree.LI(profileLinkContent);
|
||||
ul.addContent(li);
|
||||
}
|
||||
}
|
||||
profilesDiv.addContent(ul);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, profilesDiv);
|
||||
body.addContent(div);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addPackagesList(PackageDoc[] packages, String text,
|
||||
String tableSummary, Content body) {
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
|
||||
getTableCaption(new RawHtml(text)));
|
||||
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
addPackagesList(packages, tbody);
|
||||
table.addContent(tbody);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
|
||||
body.addContent(div);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds list of packages in the index table. Generate link to each package.
|
||||
*
|
||||
* @param packages Packages to which link is to be generated
|
||||
* @param tbody the documentation tree to which the list will be added
|
||||
*/
|
||||
protected void addPackagesList(PackageDoc[] packages, Content tbody) {
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
if (packages[i] != null && packages[i].name().length() > 0) {
|
||||
if (configuration.nodeprecated && Util.isDeprecated(packages[i]))
|
||||
continue;
|
||||
Content packageLinkContent = getPackageLink(packages[i],
|
||||
getPackageName(packages[i]));
|
||||
Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
|
||||
HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
|
||||
tdSummary.addStyle(HtmlStyle.colLast);
|
||||
addSummaryComment(packages[i], tdSummary);
|
||||
HtmlTree tr = HtmlTree.TR(tdPackage);
|
||||
tr.addContent(tdSummary);
|
||||
if (i%2 == 0)
|
||||
tr.addStyle(HtmlStyle.altColor);
|
||||
else
|
||||
tr.addStyle(HtmlStyle.rowColor);
|
||||
tbody.addContent(tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the overview summary comment for this documentation. Add one line
|
||||
* summary at the top of the page and generate a link to the description,
|
||||
* which is added at the end of this page.
|
||||
*
|
||||
* @param body the documentation tree to which the overview header will be added
|
||||
*/
|
||||
protected void addOverviewHeader(Content body) {
|
||||
if (root.inlineTags().length > 0) {
|
||||
HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV);
|
||||
subTitleDiv.addStyle(HtmlStyle.subTitle);
|
||||
addSummaryComment(root, subTitleDiv);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, subTitleDiv);
|
||||
Content see = seeLabel;
|
||||
see.addContent(" ");
|
||||
Content descPara = HtmlTree.P(see);
|
||||
Content descLink = getHyperLink(getDocLink(
|
||||
SectionName.OVERVIEW_DESCRIPTION),
|
||||
descriptionLabel, "", "");
|
||||
descPara.addContent(descLink);
|
||||
div.addContent(descPara);
|
||||
body.addContent(div);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the overview comment as provided in the file specified by the
|
||||
* "-overview" option on the command line.
|
||||
*
|
||||
* @param htmltree the documentation tree to which the overview comment will
|
||||
* be added
|
||||
*/
|
||||
protected void addOverviewComment(Content htmltree) {
|
||||
if (root.inlineTags().length > 0) {
|
||||
htmltree.addContent(
|
||||
getMarkerAnchor(SectionName.OVERVIEW_DESCRIPTION));
|
||||
addInlineComment(root, htmltree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the tag information as provided in the file specified by the
|
||||
* "-overview" option on the command line.
|
||||
*
|
||||
* @param body the documentation tree to which the overview will be added
|
||||
*/
|
||||
protected void addOverview(Content body) throws IOException {
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.contentContainer);
|
||||
addOverviewComment(div);
|
||||
addTagsInfo(root, div);
|
||||
body.addContent(div);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the top text (from the -top option), the upper
|
||||
* navigation bar, and then the title (from the"-title"
|
||||
* option), at the top of page.
|
||||
*
|
||||
* @body the documentation tree to which the navigation bar header will be added
|
||||
*/
|
||||
protected void addNavigationBarHeader(Content body) {
|
||||
addTop(body);
|
||||
addNavLinks(true, body);
|
||||
addConfigurationTitle(body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the lower navigation bar and the bottom text
|
||||
* (from the -bottom option) at the bottom of page.
|
||||
*
|
||||
* @param body the documentation tree to which the navigation bar footer will be added
|
||||
*/
|
||||
protected void addNavigationBarFooter(Content body) {
|
||||
addNavLinks(false, body);
|
||||
addBottom(body);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Class to generate Tree page for a package. The name of the file generated is
|
||||
* "package-tree.html" and it is generated in the respective package directory.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class PackageTreeWriter extends AbstractTreeWriter {
|
||||
|
||||
/**
|
||||
* Package for which tree is to be generated.
|
||||
*/
|
||||
protected PackageDoc packagedoc;
|
||||
|
||||
/**
|
||||
* The previous package name in the alpha-order list.
|
||||
*/
|
||||
protected PackageDoc prev;
|
||||
|
||||
/**
|
||||
* The next package name in the alpha-order list.
|
||||
*/
|
||||
protected PackageDoc next;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @throws IOException
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public PackageTreeWriter(ConfigurationImpl configuration,
|
||||
DocPath path,
|
||||
PackageDoc packagedoc,
|
||||
PackageDoc prev, PackageDoc next)
|
||||
throws IOException {
|
||||
super(configuration, path,
|
||||
new ClassTree(
|
||||
configuration.classDocCatalog.allClasses(packagedoc),
|
||||
configuration));
|
||||
this.packagedoc = packagedoc;
|
||||
this.prev = prev;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a PackageTreeWriter object and then use it to generate the
|
||||
* package tree page.
|
||||
*
|
||||
* @param pkg Package for which tree file is to be generated.
|
||||
* @param prev Previous package in the alpha-ordered list.
|
||||
* @param next Next package in the alpha-ordered list.
|
||||
* @param noDeprecated If true, do not generate any information for
|
||||
* deprecated classe or interfaces.
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration,
|
||||
PackageDoc pkg, PackageDoc prev,
|
||||
PackageDoc next, boolean noDeprecated) {
|
||||
PackageTreeWriter packgen;
|
||||
DocPath path = DocPath.forPackage(pkg).resolve(DocPaths.PACKAGE_TREE);
|
||||
try {
|
||||
packgen = new PackageTreeWriter(configuration, path, pkg,
|
||||
prev, next);
|
||||
packgen.generatePackageTreeFile();
|
||||
packgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), path.getPath());
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a separate tree file for each package.
|
||||
*/
|
||||
protected void generatePackageTreeFile() throws IOException {
|
||||
Content body = getPackageTreeHeader();
|
||||
Content headContent = getResource("doclet.Hierarchy_For_Package",
|
||||
Util.getPackageName(packagedoc));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
|
||||
HtmlStyle.title, headContent);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
if (configuration.packages.length > 1) {
|
||||
addLinkToMainTree(div);
|
||||
}
|
||||
body.addContent(div);
|
||||
HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
|
||||
divTree.addStyle(HtmlStyle.contentContainer);
|
||||
addTree(classtree.baseclasses(), "doclet.Class_Hierarchy", divTree);
|
||||
addTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy", divTree);
|
||||
addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", divTree);
|
||||
addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", divTree);
|
||||
body.addContent(divTree);
|
||||
addNavLinks(false, body);
|
||||
addBottom(body);
|
||||
printHtmlDocument(null, true, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the package tree header.
|
||||
*
|
||||
* @return a content tree for the header
|
||||
*/
|
||||
protected Content getPackageTreeHeader() {
|
||||
String title = packagedoc.name() + " " +
|
||||
configuration.getText("doclet.Window_Class_Hierarchy");
|
||||
Content bodyTree = getBody(true, getWindowTitle(title));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
return bodyTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a link to the tree for all the packages.
|
||||
*
|
||||
* @param div the content tree to which the link will be added
|
||||
*/
|
||||
protected void addLinkToMainTree(Content div) {
|
||||
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
|
||||
getResource("doclet.Package_Hierarchies"));
|
||||
div.addContent(span);
|
||||
HtmlTree ul = new HtmlTree (HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.horizontal);
|
||||
ul.addContent(getNavLinkMainTree(configuration.getText("doclet.All_Packages")));
|
||||
div.addContent(ul);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link for the previous package tree file.
|
||||
*
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
protected Content getNavLinkPrevious() {
|
||||
if (prev == null) {
|
||||
return getNavLinkPrevious(null);
|
||||
} else {
|
||||
DocPath path = DocPath.relativePath(packagedoc, prev);
|
||||
return getNavLinkPrevious(path.resolve(DocPaths.PACKAGE_TREE));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link for the next package tree file.
|
||||
*
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
protected Content getNavLinkNext() {
|
||||
if (next == null) {
|
||||
return getNavLinkNext(null);
|
||||
} else {
|
||||
DocPath path = DocPath.relativePath(packagedoc, next);
|
||||
return getNavLinkNext(path.resolve(DocPaths.PACKAGE_TREE));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to the package summary page for the package of this tree.
|
||||
*
|
||||
* @return a content tree for the package link
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
|
||||
packageLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,319 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Generate package usage information.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Robert G. Field
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
|
||||
final PackageDoc pkgdoc;
|
||||
final SortedMap<String,Set<ClassDoc>> usingPackageToUsedClasses = new TreeMap<String,Set<ClassDoc>>();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param filename the file to be generated.
|
||||
* @throws IOException
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public PackageUseWriter(ConfigurationImpl configuration,
|
||||
ClassUseMapper mapper, DocPath filename,
|
||||
PackageDoc pkgdoc) throws IOException {
|
||||
super(configuration, DocPath.forPackage(pkgdoc).resolve(filename));
|
||||
this.pkgdoc = pkgdoc;
|
||||
|
||||
// by examining all classes in this package, find what packages
|
||||
// use these classes - produce a map between using package and
|
||||
// used classes.
|
||||
ClassDoc[] content = pkgdoc.allClasses();
|
||||
for (int i = 0; i < content.length; ++i) {
|
||||
ClassDoc usedClass = content[i];
|
||||
Set<ClassDoc> usingClasses = mapper.classToClass.get(usedClass.qualifiedName());
|
||||
if (usingClasses != null) {
|
||||
for (Iterator<ClassDoc> it = usingClasses.iterator(); it.hasNext(); ) {
|
||||
ClassDoc usingClass = it.next();
|
||||
PackageDoc usingPackage = usingClass.containingPackage();
|
||||
Set<ClassDoc> usedClasses = usingPackageToUsedClasses
|
||||
.get(usingPackage.name());
|
||||
if (usedClasses == null) {
|
||||
usedClasses = new TreeSet<ClassDoc>();
|
||||
usingPackageToUsedClasses.put(Util.getPackageName(usingPackage),
|
||||
usedClasses);
|
||||
}
|
||||
usedClasses.add(usedClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a class page.
|
||||
*
|
||||
* @param configuration the current configuration of the doclet.
|
||||
* @param mapper the mapping of the class usage.
|
||||
* @param pkgdoc the package doc being documented.
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration,
|
||||
ClassUseMapper mapper, PackageDoc pkgdoc) {
|
||||
PackageUseWriter pkgusegen;
|
||||
DocPath filename = DocPaths.PACKAGE_USE;
|
||||
try {
|
||||
pkgusegen = new PackageUseWriter(configuration,
|
||||
mapper, filename, pkgdoc);
|
||||
pkgusegen.generatePackageUseFile();
|
||||
pkgusegen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate the package use list.
|
||||
*/
|
||||
protected void generatePackageUseFile() throws IOException {
|
||||
Content body = getPackageUseHeader();
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.contentContainer);
|
||||
if (usingPackageToUsedClasses.isEmpty()) {
|
||||
div.addContent(getResource(
|
||||
"doclet.ClassUse_No.usage.of.0", pkgdoc.name()));
|
||||
} else {
|
||||
addPackageUse(div);
|
||||
}
|
||||
body.addContent(div);
|
||||
addNavLinks(false, body);
|
||||
addBottom(body);
|
||||
printHtmlDocument(null, true, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the package use information.
|
||||
*
|
||||
* @param contentTree the content tree to which the package use information will be added
|
||||
*/
|
||||
protected void addPackageUse(Content contentTree) throws IOException {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
if (configuration.packages.length > 1) {
|
||||
addPackageList(ul);
|
||||
}
|
||||
addClassList(ul);
|
||||
contentTree.addContent(ul);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the list of packages that use the given package.
|
||||
*
|
||||
* @param contentTree the content tree to which the package list will be added
|
||||
*/
|
||||
protected void addPackageList(Content contentTree) throws IOException {
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary,
|
||||
getTableCaption(configuration.getResource(
|
||||
"doclet.ClassUse_Packages.that.use.0",
|
||||
getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)))));
|
||||
table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
Iterator<String> it = usingPackageToUsedClasses.keySet().iterator();
|
||||
for (int i = 0; it.hasNext(); i++) {
|
||||
PackageDoc pkg = configuration.root.packageNamed(it.next());
|
||||
HtmlTree tr = new HtmlTree(HtmlTag.TR);
|
||||
if (i % 2 == 0) {
|
||||
tr.addStyle(HtmlStyle.altColor);
|
||||
} else {
|
||||
tr.addStyle(HtmlStyle.rowColor);
|
||||
}
|
||||
addPackageUse(pkg, tr);
|
||||
tbody.addContent(tr);
|
||||
}
|
||||
table.addContent(tbody);
|
||||
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
|
||||
contentTree.addContent(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the list of classes that use the given package.
|
||||
*
|
||||
* @param contentTree the content tree to which the class list will be added
|
||||
*/
|
||||
protected void addClassList(Content contentTree) throws IOException {
|
||||
String[] classTableHeader = new String[] {
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Class"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
Iterator<String> itp = usingPackageToUsedClasses.keySet().iterator();
|
||||
while (itp.hasNext()) {
|
||||
String packageName = itp.next();
|
||||
PackageDoc usingPackage = configuration.root.packageNamed(packageName);
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
if (usingPackage != null) {
|
||||
li.addContent(getMarkerAnchor(usingPackage.name()));
|
||||
}
|
||||
String tableSummary = configuration.getText("doclet.Use_Table_Summary",
|
||||
configuration.getText("doclet.classes"));
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, tableSummary,
|
||||
getTableCaption(configuration.getResource(
|
||||
"doclet.ClassUse_Classes.in.0.used.by.1",
|
||||
getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)),
|
||||
getPackageLink(usingPackage, Util.getPackageName(usingPackage)))));
|
||||
table.addContent(getSummaryTableHeader(classTableHeader, "col"));
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
Iterator<ClassDoc> itc =
|
||||
usingPackageToUsedClasses.get(packageName).iterator();
|
||||
for (int i = 0; itc.hasNext(); i++) {
|
||||
HtmlTree tr = new HtmlTree(HtmlTag.TR);
|
||||
if (i % 2 == 0) {
|
||||
tr.addStyle(HtmlStyle.altColor);
|
||||
} else {
|
||||
tr.addStyle(HtmlStyle.rowColor);
|
||||
}
|
||||
addClassRow(itc.next(), packageName, tr);
|
||||
tbody.addContent(tr);
|
||||
}
|
||||
table.addContent(tbody);
|
||||
li.addContent(table);
|
||||
contentTree.addContent(li);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a row for the class that uses the given package.
|
||||
*
|
||||
* @param usedClass the class that uses the given package
|
||||
* @param packageName the name of the package to which the class belongs
|
||||
* @param contentTree the content tree to which the row will be added
|
||||
*/
|
||||
protected void addClassRow(ClassDoc usedClass, String packageName,
|
||||
Content contentTree) {
|
||||
DocPath dp = pathString(usedClass,
|
||||
DocPaths.CLASS_USE.resolve(DocPath.forName(usedClass)));
|
||||
Content td = HtmlTree.TD(HtmlStyle.colOne,
|
||||
getHyperLink(dp.fragment(packageName), new StringContent(usedClass.name())));
|
||||
addIndexComment(usedClass, td);
|
||||
contentTree.addContent(td);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the package use information.
|
||||
*
|
||||
* @param pkg the package that used the given package
|
||||
* @param contentTree the content tree to which the information will be added
|
||||
*/
|
||||
protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
|
||||
Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
|
||||
getHyperLink(Util.getPackageName(pkg),
|
||||
new StringContent(Util.getPackageName(pkg))));
|
||||
contentTree.addContent(tdFirst);
|
||||
HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
|
||||
tdLast.addStyle(HtmlStyle.colLast);
|
||||
if (pkg != null && pkg.name().length() != 0) {
|
||||
addSummaryComment(pkg, tdLast);
|
||||
} else {
|
||||
tdLast.addContent(getSpace());
|
||||
}
|
||||
contentTree.addContent(tdLast);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the header for the package use listing.
|
||||
*
|
||||
* @return a content tree representing the package use header
|
||||
*/
|
||||
protected Content getPackageUseHeader() {
|
||||
String packageText = configuration.getText("doclet.Package");
|
||||
String name = pkgdoc.name();
|
||||
String title = configuration.getText("doclet.Window_ClassUse_Header",
|
||||
packageText, name);
|
||||
Content bodyTree = getBody(true, getWindowTitle(title));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
ContentBuilder headContent = new ContentBuilder();
|
||||
headContent.addContent(getResource("doclet.ClassUse_Title", packageText));
|
||||
headContent.addContent(new HtmlTree(HtmlTag.BR));
|
||||
headContent.addContent(name);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, headContent);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
bodyTree.addContent(div);
|
||||
return bodyTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this package link.
|
||||
*
|
||||
* @return a content tree for the package link
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
|
||||
packageLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the use link.
|
||||
*
|
||||
* @return a content tree for the use link
|
||||
*/
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, useLabel);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tree link.
|
||||
*
|
||||
* @return a content tree for the tree link
|
||||
*/
|
||||
protected Content getNavLinkTree() {
|
||||
Content linkContent = getHyperLink(DocPaths.PACKAGE_TREE,
|
||||
treeLabel);
|
||||
Content li = HtmlTree.LI(linkContent);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Class to generate file for each package contents in the right-hand
|
||||
* frame. This will list all the Class Kinds in the package. A click on any
|
||||
* class-kind will update the frame with the clicked class-kind page.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class PackageWriterImpl extends HtmlDocletWriter
|
||||
implements PackageSummaryWriter {
|
||||
|
||||
/**
|
||||
* The prev package name in the alpha-order list.
|
||||
*/
|
||||
protected PackageDoc prev;
|
||||
|
||||
/**
|
||||
* The next package name in the alpha-order list.
|
||||
*/
|
||||
protected PackageDoc next;
|
||||
|
||||
/**
|
||||
* The package being documented.
|
||||
*/
|
||||
protected PackageDoc packageDoc;
|
||||
|
||||
/**
|
||||
* Constructor to construct PackageWriter object and to generate
|
||||
* "package-summary.html" file in the respective package directory.
|
||||
* For example for package "java.lang" this will generate file
|
||||
* "package-summary.html" file in the "java/lang" directory. It will also
|
||||
* create "java/lang" directory in the current or the destination directory
|
||||
* if it doesn't exist.
|
||||
*
|
||||
* @param configuration the configuration of the doclet.
|
||||
* @param packageDoc PackageDoc under consideration.
|
||||
* @param prev Previous package in the sorted array.
|
||||
* @param next Next package in the sorted array.
|
||||
*/
|
||||
public PackageWriterImpl(ConfigurationImpl configuration,
|
||||
PackageDoc packageDoc, PackageDoc prev, PackageDoc next)
|
||||
throws IOException {
|
||||
super(configuration, DocPath.forPackage(packageDoc).resolve(DocPaths.PACKAGE_SUMMARY));
|
||||
this.prev = prev;
|
||||
this.next = next;
|
||||
this.packageDoc = packageDoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getPackageHeader(String heading) {
|
||||
String pkgName = packageDoc.name();
|
||||
Content bodyTree = getBody(true, getWindowTitle(pkgName));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.header);
|
||||
Content annotationContent = new HtmlTree(HtmlTag.P);
|
||||
addAnnotationInfo(packageDoc, annotationContent);
|
||||
div.addContent(annotationContent);
|
||||
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, packageLabel);
|
||||
tHeading.addContent(getSpace());
|
||||
Content packageHead = new StringContent(heading);
|
||||
tHeading.addContent(packageHead);
|
||||
div.addContent(tHeading);
|
||||
addDeprecationInfo(div);
|
||||
if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
|
||||
HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV);
|
||||
docSummaryDiv.addStyle(HtmlStyle.docSummary);
|
||||
addSummaryComment(packageDoc, docSummaryDiv);
|
||||
div.addContent(docSummaryDiv);
|
||||
Content space = getSpace();
|
||||
Content descLink = getHyperLink(getDocLink(
|
||||
SectionName.PACKAGE_DESCRIPTION),
|
||||
descriptionLabel, "", "");
|
||||
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
|
||||
div.addContent(descPara);
|
||||
}
|
||||
bodyTree.addContent(div);
|
||||
return bodyTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getContentHeader() {
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.contentContainer);
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the package deprecation information to the documentation tree.
|
||||
*
|
||||
* @param div the content tree to which the deprecation information will be added
|
||||
*/
|
||||
public void addDeprecationInfo(Content div) {
|
||||
Tag[] deprs = packageDoc.tags("deprecated");
|
||||
if (Util.isDeprecated(packageDoc)) {
|
||||
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
|
||||
deprDiv.addStyle(HtmlStyle.deprecatedContent);
|
||||
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
deprDiv.addContent(deprPhrase);
|
||||
if (deprs.length > 0) {
|
||||
Tag[] commentTags = deprs[0].inlineTags();
|
||||
if (commentTags.length > 0) {
|
||||
addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv);
|
||||
}
|
||||
}
|
||||
div.addContent(deprDiv);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getSummaryHeader() {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
return ul;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addClassesSummary(ClassDoc[] classes, String label,
|
||||
String tableSummary, String[] tableHeader, Content summaryContentTree) {
|
||||
if(classes.length > 0) {
|
||||
Arrays.sort(classes);
|
||||
Content caption = getTableCaption(new RawHtml(label));
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.typeSummary, 0, 3, 0,
|
||||
tableSummary, caption);
|
||||
table.addContent(getSummaryTableHeader(tableHeader, "col"));
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
if (!Util.isCoreClass(classes[i]) ||
|
||||
!configuration.isGeneratedDoc(classes[i])) {
|
||||
continue;
|
||||
}
|
||||
Content classContent = getLink(new LinkInfoImpl(
|
||||
configuration, LinkInfoImpl.Kind.PACKAGE, classes[i]));
|
||||
Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
|
||||
HtmlTree tr = HtmlTree.TR(tdClass);
|
||||
if (i%2 == 0)
|
||||
tr.addStyle(HtmlStyle.altColor);
|
||||
else
|
||||
tr.addStyle(HtmlStyle.rowColor);
|
||||
HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
|
||||
tdClassDescription.addStyle(HtmlStyle.colLast);
|
||||
if (Util.isDeprecated(classes[i])) {
|
||||
tdClassDescription.addContent(deprecatedLabel);
|
||||
if (classes[i].tags("deprecated").length > 0) {
|
||||
addSummaryDeprecatedComment(classes[i],
|
||||
classes[i].tags("deprecated")[0], tdClassDescription);
|
||||
}
|
||||
}
|
||||
else
|
||||
addSummaryComment(classes[i], tdClassDescription);
|
||||
tr.addContent(tdClassDescription);
|
||||
tbody.addContent(tr);
|
||||
}
|
||||
table.addContent(tbody);
|
||||
Content li = HtmlTree.LI(HtmlStyle.blockList, table);
|
||||
summaryContentTree.addContent(li);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addPackageDescription(Content packageContentTree) {
|
||||
if (packageDoc.inlineTags().length > 0) {
|
||||
packageContentTree.addContent(
|
||||
getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION));
|
||||
Content h2Content = new StringContent(
|
||||
configuration.getText("doclet.Package_Description",
|
||||
packageDoc.name()));
|
||||
packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
|
||||
true, h2Content));
|
||||
addInlineComment(packageDoc, packageContentTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addPackageTags(Content packageContentTree) {
|
||||
addTagsInfo(packageDoc, packageContentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addPackageFooter(Content contentTree) {
|
||||
addNavLinks(false, contentTree);
|
||||
addBottom(contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void printDocument(Content contentTree) throws IOException {
|
||||
printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc),
|
||||
true, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "Use" link for this pacakge in the navigation bar.
|
||||
*
|
||||
* @return a content tree for the class use link
|
||||
*/
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
|
||||
useLabel, "", "");
|
||||
Content li = HtmlTree.LI(useLink);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "PREV PACKAGE" link in the navigation bar.
|
||||
*
|
||||
* @return a content tree for the previous link
|
||||
*/
|
||||
public Content getNavLinkPrevious() {
|
||||
Content li;
|
||||
if (prev == null) {
|
||||
li = HtmlTree.LI(prevpackageLabel);
|
||||
} else {
|
||||
DocPath path = DocPath.relativePath(packageDoc, prev);
|
||||
li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.PACKAGE_SUMMARY),
|
||||
prevpackageLabel, "", ""));
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "NEXT PACKAGE" link in the navigation bar.
|
||||
*
|
||||
* @return a content tree for the next link
|
||||
*/
|
||||
public Content getNavLinkNext() {
|
||||
Content li;
|
||||
if (next == null) {
|
||||
li = HtmlTree.LI(nextpackageLabel);
|
||||
} else {
|
||||
DocPath path = DocPath.relativePath(packageDoc, next);
|
||||
li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.PACKAGE_SUMMARY),
|
||||
nextpackageLabel, "", ""));
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "Tree" link in the navigation bar. This will be link to the package
|
||||
* tree file.
|
||||
*
|
||||
* @return a content tree for the tree link
|
||||
*/
|
||||
protected Content getNavLinkTree() {
|
||||
Content useLink = getHyperLink(DocPaths.PACKAGE_TREE,
|
||||
treeLabel, "", "");
|
||||
Content li = HtmlTree.LI(useLink);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlight "Package" in the navigation bar, as this is the package page.
|
||||
*
|
||||
* @return a content tree for the package link
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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 java.io.*;
|
||||
|
||||
import com.sun.tools.javac.sym.Profiles;
|
||||
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.javac.jvm.Profile;
|
||||
|
||||
/**
|
||||
* Generate the profile index for the left-hand frame in the generated output.
|
||||
* A click on the profile name in this frame will update the page in the top
|
||||
* left hand frame with the listing of packages of the clicked profile.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter {
|
||||
|
||||
/**
|
||||
* Construct the ProfileIndexFrameWriter object.
|
||||
*
|
||||
* @param configuration the configuration object
|
||||
* @param filename Name of the profile index file to be generated.
|
||||
*/
|
||||
public ProfileIndexFrameWriter(ConfigurationImpl configuration,
|
||||
DocPath filename) throws IOException {
|
||||
super(configuration, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the profile index file named "profile-overview-frame.html".
|
||||
* @throws DocletAbortException
|
||||
* @param configuration the configuration object
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration) {
|
||||
ProfileIndexFrameWriter profilegen;
|
||||
DocPath filename = DocPaths.PROFILE_OVERVIEW_FRAME;
|
||||
try {
|
||||
profilegen = new ProfileIndexFrameWriter(configuration, filename);
|
||||
profilegen.buildProfileIndexFile("doclet.Window_Overview", false);
|
||||
profilegen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addProfilesList(Profiles profiles, String text,
|
||||
String tableSummary, Content body) {
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true,
|
||||
profilesLabel);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(profilesLabel);
|
||||
String profileName;
|
||||
for (int i = 1; i < profiles.getProfileCount(); i++) {
|
||||
profileName = (Profile.lookup(i)).name;
|
||||
// If the profile has valid packages to be documented, add it to the
|
||||
// left-frame generated for profile index.
|
||||
if (configuration.shouldDocumentProfile(profileName))
|
||||
ul.addContent(getProfile(profileName));
|
||||
}
|
||||
div.addContent(ul);
|
||||
body.addContent(div);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets each profile name as a separate link.
|
||||
*
|
||||
* @param profileName the profile being documented
|
||||
* @return content for the profile link
|
||||
*/
|
||||
protected Content getProfile(String profileName) {
|
||||
Content profileLinkContent;
|
||||
Content profileLabel;
|
||||
profileLabel = new StringContent(profileName);
|
||||
profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "",
|
||||
"packageListFrame");
|
||||
Content li = HtmlTree.LI(profileLinkContent);
|
||||
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 addOverviewHeader(Content body) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Classes" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param div the Content object to which the all classes link should be added
|
||||
*/
|
||||
protected void addAllClassesLink(Content div) {
|
||||
Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
|
||||
allclassesLabel, "", "packageFrame");
|
||||
Content span = HtmlTree.SPAN(linkContent);
|
||||
div.addContent(span);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Packages" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param div the Content object to which the all packages link should be added
|
||||
*/
|
||||
protected void addAllPackagesLink(Content div) {
|
||||
Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
|
||||
allpackagesLabel, "", "packageListFrame");
|
||||
Content span = HtmlTree.SPAN(linkContent);
|
||||
div.addContent(span);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavigationBarFooter(Content body) {
|
||||
Content p = HtmlTree.P(getSpace());
|
||||
body.addContent(p);
|
||||
}
|
||||
|
||||
protected void addProfilePackagesList(Profiles profiles, String text,
|
||||
String tableSummary, Content body, String profileName) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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 java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Class to generate file for each package contents of a profile in the left-hand bottom
|
||||
* frame. This will list all the Class Kinds in the package for a profile. A click on any
|
||||
* class-kind will update the right-hand frame with the clicked class-kind page.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public class ProfilePackageFrameWriter extends HtmlDocletWriter {
|
||||
|
||||
/**
|
||||
* The package being documented.
|
||||
*/
|
||||
private PackageDoc packageDoc;
|
||||
|
||||
/**
|
||||
* Constructor to construct ProfilePackageFrameWriter object and to generate
|
||||
* "profilename-package-frame.html" file in the respective package directory.
|
||||
* For example for profile compact1 and package "java.lang" this will generate file
|
||||
* "compact1-package-frame.html" file in the "java/lang" directory. It will also
|
||||
* create "java/lang" directory in the current or the destination directory
|
||||
* if it doesn't exist.
|
||||
*
|
||||
* @param configuration the configuration of the doclet.
|
||||
* @param packageDoc PackageDoc under consideration.
|
||||
* @param profileName the name of the profile being documented
|
||||
*/
|
||||
public ProfilePackageFrameWriter(ConfigurationImpl configuration,
|
||||
PackageDoc packageDoc, String profileName)
|
||||
throws IOException {
|
||||
super(configuration, DocPath.forPackage(packageDoc).resolve(
|
||||
DocPaths.profilePackageFrame(profileName)));
|
||||
this.packageDoc = packageDoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a profile package summary page for the left-hand bottom frame. Construct
|
||||
* the ProfilePackageFrameWriter object and then uses it generate the file.
|
||||
*
|
||||
* @param configuration the current configuration of the doclet.
|
||||
* @param packageDoc The package for which "profilename-package-frame.html" is to be generated.
|
||||
* @param profileValue the value of the profile being documented
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration,
|
||||
PackageDoc packageDoc, int profileValue) {
|
||||
ProfilePackageFrameWriter profpackgen;
|
||||
try {
|
||||
String profileName = Profile.lookup(profileValue).name;
|
||||
profpackgen = new ProfilePackageFrameWriter(configuration, packageDoc,
|
||||
profileName);
|
||||
StringBuilder winTitle = new StringBuilder(profileName);
|
||||
String sep = " - ";
|
||||
winTitle.append(sep);
|
||||
String pkgName = Util.getPackageName(packageDoc);
|
||||
winTitle.append(pkgName);
|
||||
Content body = profpackgen.getBody(false,
|
||||
profpackgen.getWindowTitle(winTitle.toString()));
|
||||
Content profName = new StringContent(profileName);
|
||||
Content sepContent = new StringContent(sep);
|
||||
Content pkgNameContent = new RawHtml(pkgName);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
|
||||
profpackgen.getTargetProfileLink("classFrame", profName, profileName));
|
||||
heading.addContent(sepContent);
|
||||
heading.addContent(profpackgen.getTargetProfilePackageLink(packageDoc,
|
||||
"classFrame", pkgNameContent, profileName));
|
||||
body.addContent(heading);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.indexContainer);
|
||||
profpackgen.addClassListing(div, profileValue);
|
||||
body.addContent(div);
|
||||
profpackgen.printHtmlDocument(
|
||||
configuration.metakeywords.getMetaKeywords(packageDoc), false, body);
|
||||
profpackgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), DocPaths.PACKAGE_FRAME.getPath());
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param profileValue the value of the profile being documented
|
||||
*/
|
||||
protected void addClassListing(Content contentTree, int profileValue) {
|
||||
if (packageDoc.isIncluded()) {
|
||||
addClassKindListing(packageDoc.interfaces(),
|
||||
getResource("doclet.Interfaces"), contentTree, profileValue);
|
||||
addClassKindListing(packageDoc.ordinaryClasses(),
|
||||
getResource("doclet.Classes"), contentTree, profileValue);
|
||||
addClassKindListing(packageDoc.enums(),
|
||||
getResource("doclet.Enums"), contentTree, profileValue);
|
||||
addClassKindListing(packageDoc.exceptions(),
|
||||
getResource("doclet.Exceptions"), contentTree, profileValue);
|
||||
addClassKindListing(packageDoc.errors(),
|
||||
getResource("doclet.Errors"), contentTree, profileValue);
|
||||
addClassKindListing(packageDoc.annotationTypes(),
|
||||
getResource("doclet.AnnotationTypes"), contentTree, profileValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 labelContent content tree of the label to be added
|
||||
* @param contentTree the content tree to which the class kind listing will be added
|
||||
* @param profileValue the value of the profile being documented
|
||||
*/
|
||||
protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
|
||||
Content contentTree, int profileValue) {
|
||||
if(arr.length > 0) {
|
||||
Arrays.sort(arr);
|
||||
boolean printedHeader = false;
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(labelContent);
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (!isTypeInProfile(arr[i], profileValue)) {
|
||||
continue;
|
||||
}
|
||||
if (!Util.isCoreClass(arr[i]) || !
|
||||
configuration.isGeneratedDoc(arr[i])) {
|
||||
continue;
|
||||
}
|
||||
if (!printedHeader) {
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
true, labelContent);
|
||||
contentTree.addContent(heading);
|
||||
printedHeader = true;
|
||||
}
|
||||
Content arr_i_name = new StringContent(arr[i].name());
|
||||
if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
|
||||
Content li = HtmlTree.LI(link);
|
||||
ul.addContent(li);
|
||||
}
|
||||
contentTree.addContent(ul);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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 java.io.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.javac.sym.Profiles;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Generate the profile package index for the left-hand frame in the generated output.
|
||||
* A click on the package name in this frame will update the page in the bottom
|
||||
* left hand frame with the listing of contents of the clicked profile package.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter {
|
||||
|
||||
/**
|
||||
* Construct the ProfilePackageIndexFrameWriter object.
|
||||
*
|
||||
* @param configuration the configuration object
|
||||
* @param filename Name of the package index file to be generated.
|
||||
*/
|
||||
public ProfilePackageIndexFrameWriter(ConfigurationImpl configuration,
|
||||
DocPath filename) throws IOException {
|
||||
super(configuration, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the profile package index file.
|
||||
* @throws DocletAbortException
|
||||
* @param configuration the configuration object
|
||||
* @param profileName the name of the profile being documented
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration, String profileName) {
|
||||
ProfilePackageIndexFrameWriter profpackgen;
|
||||
DocPath filename = DocPaths.profileFrame(profileName);
|
||||
try {
|
||||
profpackgen = new ProfilePackageIndexFrameWriter(configuration, filename);
|
||||
profpackgen.buildProfilePackagesIndexFile("doclet.Window_Overview", false, profileName);
|
||||
profpackgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addProfilePackagesList(Profiles profiles, String text,
|
||||
String tableSummary, Content body, String profileName) {
|
||||
Content profNameContent = new StringContent(profileName);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
|
||||
getTargetProfileLink("classFrame", profNameContent, profileName));
|
||||
heading.addContent(getSpace());
|
||||
heading.addContent(packagesLabel);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(packagesLabel);
|
||||
PackageDoc[] packages = configuration.profilePackages.get(profileName);
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
if ((!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
|
||||
ul.addContent(getPackage(packages[i], profileName));
|
||||
}
|
||||
}
|
||||
div.addContent(ul);
|
||||
body.addContent(div);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets each package name as a separate link.
|
||||
*
|
||||
* @param pd PackageDoc
|
||||
* @param profileName the name of the profile being documented
|
||||
* @return content for the package link
|
||||
*/
|
||||
protected Content getPackage(PackageDoc pd, String profileName) {
|
||||
Content packageLinkContent;
|
||||
Content pkgLabel;
|
||||
if (pd.name().length() > 0) {
|
||||
pkgLabel = getPackageLabel(pd.name());
|
||||
packageLinkContent = getHyperLink(pathString(pd,
|
||||
DocPaths.profilePackageFrame(profileName)), pkgLabel, "",
|
||||
"packageFrame");
|
||||
} else {
|
||||
pkgLabel = new StringContent("<unnamed package>");
|
||||
packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
|
||||
pkgLabel, "", "packageFrame");
|
||||
}
|
||||
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 addOverviewHeader(Content body) {
|
||||
}
|
||||
|
||||
protected void addProfilesList(Profiles profiles, String text,
|
||||
String tableSummary, Content body) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Classes" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param div the Content object to which the all classes link should be added
|
||||
*/
|
||||
protected void addAllClassesLink(Content div) {
|
||||
Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
|
||||
allclassesLabel, "", "packageFrame");
|
||||
Content span = HtmlTree.SPAN(linkContent);
|
||||
div.addContent(span);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Packages" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param div the Content object to which the all packages link should be added
|
||||
*/
|
||||
protected void addAllPackagesLink(Content div) {
|
||||
Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
|
||||
allpackagesLabel, "", "packageListFrame");
|
||||
Content span = HtmlTree.SPAN(linkContent);
|
||||
div.addContent(span);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "All Profiles" link for the top of the left-hand frame page to the
|
||||
* documentation tree.
|
||||
*
|
||||
* @param div the Content object to which the all profiles link should be added
|
||||
*/
|
||||
protected void addAllProfilesLink(Content div) {
|
||||
Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME,
|
||||
allprofilesLabel, "", "packageListFrame");
|
||||
Content span = HtmlTree.SPAN(linkContent);
|
||||
div.addContent(span);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavigationBarFooter(Content body) {
|
||||
Content p = HtmlTree.P(getSpace());
|
||||
body.addContent(p);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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 java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Class to generate file for each profile package contents in the right-hand
|
||||
* frame. This will list all the Class Kinds in the package. A click on any
|
||||
* class-kind will update the frame with the clicked class-kind page.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public class ProfilePackageWriterImpl extends HtmlDocletWriter
|
||||
implements ProfilePackageSummaryWriter {
|
||||
|
||||
/**
|
||||
* The prev package name in the alpha-order list.
|
||||
*/
|
||||
protected PackageDoc prev;
|
||||
|
||||
/**
|
||||
* The next package name in the alpha-order list.
|
||||
*/
|
||||
protected PackageDoc next;
|
||||
|
||||
/**
|
||||
* The profile package being documented.
|
||||
*/
|
||||
protected PackageDoc packageDoc;
|
||||
|
||||
/**
|
||||
* The name of the profile being documented.
|
||||
*/
|
||||
protected String profileName;
|
||||
|
||||
/**
|
||||
* The value of the profile being documented.
|
||||
*/
|
||||
protected int profileValue;
|
||||
|
||||
/**
|
||||
* Constructor to construct ProfilePackageWriter object and to generate
|
||||
* "profilename-package-summary.html" file in the respective package directory.
|
||||
* For example for profile compact1 and package "java.lang" this will generate file
|
||||
* "compact1-package-summary.html" file in the "java/lang" directory. It will also
|
||||
* create "java/lang" directory in the current or the destination directory
|
||||
* if it doesn't exist.
|
||||
*
|
||||
* @param configuration the configuration of the doclet.
|
||||
* @param packageDoc PackageDoc under consideration.
|
||||
* @param prev Previous package in the sorted array.
|
||||
* @param next Next package in the sorted array.
|
||||
* @param profile The profile being documented.
|
||||
*/
|
||||
public ProfilePackageWriterImpl(ConfigurationImpl configuration,
|
||||
PackageDoc packageDoc, PackageDoc prev, PackageDoc next,
|
||||
Profile profile) throws IOException {
|
||||
super(configuration, DocPath.forPackage(packageDoc).resolve(
|
||||
DocPaths.profilePackageSummary(profile.name)));
|
||||
this.prev = prev;
|
||||
this.next = next;
|
||||
this.packageDoc = packageDoc;
|
||||
this.profileName = profile.name;
|
||||
this.profileValue = profile.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getPackageHeader(String heading) {
|
||||
String pkgName = packageDoc.name();
|
||||
Content bodyTree = getBody(true, getWindowTitle(pkgName));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.header);
|
||||
Content profileContent = new StringContent(profileName);
|
||||
Content profileNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, profileContent);
|
||||
div.addContent(profileNameDiv);
|
||||
Content annotationContent = new HtmlTree(HtmlTag.P);
|
||||
addAnnotationInfo(packageDoc, annotationContent);
|
||||
div.addContent(annotationContent);
|
||||
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, packageLabel);
|
||||
tHeading.addContent(getSpace());
|
||||
Content packageHead = new RawHtml(heading);
|
||||
tHeading.addContent(packageHead);
|
||||
div.addContent(tHeading);
|
||||
addDeprecationInfo(div);
|
||||
if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
|
||||
HtmlTree docSummaryDiv = new HtmlTree(HtmlTag.DIV);
|
||||
docSummaryDiv.addStyle(HtmlStyle.docSummary);
|
||||
addSummaryComment(packageDoc, docSummaryDiv);
|
||||
div.addContent(docSummaryDiv);
|
||||
Content space = getSpace();
|
||||
Content descLink = getHyperLink(getDocLink(
|
||||
SectionName.PACKAGE_DESCRIPTION),
|
||||
descriptionLabel, "", "");
|
||||
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
|
||||
div.addContent(descPara);
|
||||
}
|
||||
bodyTree.addContent(div);
|
||||
return bodyTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getContentHeader() {
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.contentContainer);
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the package deprecation information to the documentation tree.
|
||||
*
|
||||
* @param div the content tree to which the deprecation information will be added
|
||||
*/
|
||||
public void addDeprecationInfo(Content div) {
|
||||
Tag[] deprs = packageDoc.tags("deprecated");
|
||||
if (Util.isDeprecated(packageDoc)) {
|
||||
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
|
||||
deprDiv.addStyle(HtmlStyle.deprecatedContent);
|
||||
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
deprDiv.addContent(deprPhrase);
|
||||
if (deprs.length > 0) {
|
||||
Tag[] commentTags = deprs[0].inlineTags();
|
||||
if (commentTags.length > 0) {
|
||||
addInlineDeprecatedComment(packageDoc, deprs[0], deprDiv);
|
||||
}
|
||||
}
|
||||
div.addContent(deprDiv);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addClassesSummary(ClassDoc[] classes, String label,
|
||||
String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
addClassesSummary(classes, label, tableSummary, tableHeader,
|
||||
li, profileValue);
|
||||
packageSummaryContentTree.addContent(li);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getSummaryHeader() {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
return ul;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addPackageDescription(Content packageContentTree) {
|
||||
if (packageDoc.inlineTags().length > 0) {
|
||||
packageContentTree.addContent(
|
||||
getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION));
|
||||
Content h2Content = new StringContent(
|
||||
configuration.getText("doclet.Package_Description",
|
||||
packageDoc.name()));
|
||||
packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
|
||||
true, h2Content));
|
||||
addInlineComment(packageDoc, packageContentTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addPackageTags(Content packageContentTree) {
|
||||
addTagsInfo(packageDoc, packageContentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addPackageFooter(Content contentTree) {
|
||||
addNavLinks(false, contentTree);
|
||||
addBottom(contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void printDocument(Content contentTree) throws IOException {
|
||||
printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc),
|
||||
true, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "Use" link for this package in the navigation bar.
|
||||
*
|
||||
* @return a content tree for the class use link
|
||||
*/
|
||||
protected Content getNavLinkClassUse() {
|
||||
Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
|
||||
useLabel, "", "");
|
||||
Content li = HtmlTree.LI(useLink);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "PREV PACKAGE" link in the navigation bar.
|
||||
*
|
||||
* @return a content tree for the previous link
|
||||
*/
|
||||
public Content getNavLinkPrevious() {
|
||||
Content li;
|
||||
if (prev == null) {
|
||||
li = HtmlTree.LI(prevpackageLabel);
|
||||
} else {
|
||||
DocPath path = DocPath.relativePath(packageDoc, prev);
|
||||
li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
|
||||
prevpackageLabel, "", ""));
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "NEXT PACKAGE" link in the navigation bar.
|
||||
*
|
||||
* @return a content tree for the next link
|
||||
*/
|
||||
public Content getNavLinkNext() {
|
||||
Content li;
|
||||
if (next == null) {
|
||||
li = HtmlTree.LI(nextpackageLabel);
|
||||
} else {
|
||||
DocPath path = DocPath.relativePath(packageDoc, next);
|
||||
li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.profilePackageSummary(profileName)),
|
||||
nextpackageLabel, "", ""));
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "Tree" link in the navigation bar. This will be link to the package
|
||||
* tree file.
|
||||
*
|
||||
* @return a content tree for the tree link
|
||||
*/
|
||||
protected Content getNavLinkTree() {
|
||||
Content useLink = getHyperLink(DocPaths.PACKAGE_TREE,
|
||||
treeLabel, "", "");
|
||||
Content li = HtmlTree.LI(useLink);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlight "Package" in the navigation bar, as this is the package page.
|
||||
*
|
||||
* @return a content tree for the package link
|
||||
*/
|
||||
protected Content getNavLinkPackage() {
|
||||
Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
|
||||
return li;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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 java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Class to generate file for each profile contents in the right-hand
|
||||
* frame. This will list all the packages and Class Kinds in the profile. A click on any
|
||||
* class-kind will update the frame with the clicked class-kind page. A click on any
|
||||
* package will update the frame with the clicked profile package page.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public class ProfileWriterImpl extends HtmlDocletWriter
|
||||
implements ProfileSummaryWriter {
|
||||
|
||||
/**
|
||||
* The prev profile name in the alpha-order list.
|
||||
*/
|
||||
protected Profile prevProfile;
|
||||
|
||||
/**
|
||||
* The next profile name in the alpha-order list.
|
||||
*/
|
||||
protected Profile nextProfile;
|
||||
|
||||
/**
|
||||
* The profile being documented.
|
||||
*/
|
||||
protected Profile profile;
|
||||
|
||||
/**
|
||||
* Constructor to construct ProfileWriter object and to generate
|
||||
* "profileName-summary.html" file.
|
||||
*
|
||||
* @param configuration the configuration of the doclet.
|
||||
* @param profile Profile under consideration.
|
||||
* @param prevProfile Previous profile in the sorted array.
|
||||
* @param nextProfile Next profile in the sorted array.
|
||||
*/
|
||||
public ProfileWriterImpl(ConfigurationImpl configuration,
|
||||
Profile profile, Profile prevProfile, Profile nextProfile)
|
||||
throws IOException {
|
||||
super(configuration, DocPaths.profileSummary(profile.name));
|
||||
this.prevProfile = prevProfile;
|
||||
this.nextProfile = nextProfile;
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getProfileHeader(String heading) {
|
||||
String profileName = profile.name;
|
||||
Content bodyTree = getBody(true, getWindowTitle(profileName));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.header);
|
||||
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, profileLabel);
|
||||
tHeading.addContent(getSpace());
|
||||
Content profileHead = new RawHtml(heading);
|
||||
tHeading.addContent(profileHead);
|
||||
div.addContent(tHeading);
|
||||
bodyTree.addContent(div);
|
||||
return bodyTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getContentHeader() {
|
||||
HtmlTree div = new HtmlTree(HtmlTag.DIV);
|
||||
div.addStyle(HtmlStyle.contentContainer);
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getSummaryHeader() {
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getSummaryTree(Content summaryContentTree) {
|
||||
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
|
||||
HtmlTree div = HtmlTree.DIV(HtmlStyle.summary, ul);
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getPackageSummaryHeader(PackageDoc pkg) {
|
||||
Content pkgName = getTargetProfilePackageLink(pkg,
|
||||
"classFrame", new StringContent(pkg.name()), profile.name);
|
||||
Content heading = HtmlTree.HEADING(HtmlTag.H3, pkgName);
|
||||
HtmlTree li = HtmlTree.LI(HtmlStyle.blockList, heading);
|
||||
addPackageDeprecationInfo(li, pkg);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getPackageSummaryTree(Content packageSummaryContentTree) {
|
||||
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, packageSummaryContentTree);
|
||||
return ul;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addClassesSummary(ClassDoc[] classes, String label,
|
||||
String tableSummary, String[] tableHeader, Content packageSummaryContentTree) {
|
||||
addClassesSummary(classes, label, tableSummary, tableHeader,
|
||||
packageSummaryContentTree, profile.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addProfileFooter(Content contentTree) {
|
||||
addNavLinks(false, contentTree);
|
||||
addBottom(contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void printDocument(Content contentTree) throws IOException {
|
||||
printHtmlDocument(configuration.metakeywords.getMetaKeywords(profile),
|
||||
true, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the profile package deprecation information to the documentation tree.
|
||||
*
|
||||
* @param li the content tree to which the deprecation information will be added
|
||||
* @param pkg the PackageDoc that is added
|
||||
*/
|
||||
public void addPackageDeprecationInfo(Content li, PackageDoc pkg) {
|
||||
Tag[] deprs;
|
||||
if (Util.isDeprecated(pkg)) {
|
||||
deprs = pkg.tags("deprecated");
|
||||
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
|
||||
deprDiv.addStyle(HtmlStyle.deprecatedContent);
|
||||
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
deprDiv.addContent(deprPhrase);
|
||||
if (deprs.length > 0) {
|
||||
Tag[] commentTags = deprs[0].inlineTags();
|
||||
if (commentTags.length > 0) {
|
||||
addInlineDeprecatedComment(pkg, deprs[0], deprDiv);
|
||||
}
|
||||
}
|
||||
li.addContent(deprDiv);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "PREV PROFILE" link in the navigation bar.
|
||||
*
|
||||
* @return a content tree for the previous link
|
||||
*/
|
||||
public Content getNavLinkPrevious() {
|
||||
Content li;
|
||||
if (prevProfile == null) {
|
||||
li = HtmlTree.LI(prevprofileLabel);
|
||||
} else {
|
||||
li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
|
||||
prevProfile.name)), prevprofileLabel, "", ""));
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get "NEXT PROFILE" link in the navigation bar.
|
||||
*
|
||||
* @return a content tree for the next link
|
||||
*/
|
||||
public Content getNavLinkNext() {
|
||||
Content li;
|
||||
if (nextProfile == null) {
|
||||
li = HtmlTree.LI(nextprofileLabel);
|
||||
} else {
|
||||
li = HtmlTree.LI(getHyperLink(pathToRoot.resolve(DocPaths.profileSummary(
|
||||
nextProfile.name)), nextprofileLabel, "", ""));
|
||||
}
|
||||
return li;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,329 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Writes property documentation in HTML format.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Robert Field
|
||||
* @author Atul M Dambalkar
|
||||
* @author Jamie Ho (rewrite)
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class PropertyWriterImpl extends AbstractMemberWriter
|
||||
implements PropertyWriter, MemberSummaryWriter {
|
||||
|
||||
public PropertyWriterImpl(SubWriterHolderWriter writer, ClassDoc classdoc) {
|
||||
super(writer, classdoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getMemberSummaryHeader(ClassDoc classDoc,
|
||||
Content memberSummaryTree) {
|
||||
memberSummaryTree.addContent(HtmlConstants.START_OF_PROPERTY_SUMMARY);
|
||||
Content memberTree = writer.getMemberTreeHeader();
|
||||
writer.addSummaryHeader(this, classDoc, memberTree);
|
||||
return memberTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getPropertyDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree) {
|
||||
memberDetailsTree.addContent(HtmlConstants.START_OF_PROPERTY_DETAILS);
|
||||
Content propertyDetailsTree = writer.getMemberTreeHeader();
|
||||
propertyDetailsTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.PROPERTY_DETAIL));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
|
||||
writer.propertyDetailsLabel);
|
||||
propertyDetailsTree.addContent(heading);
|
||||
return propertyDetailsTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getPropertyDocTreeHeader(MethodDoc property,
|
||||
Content propertyDetailsTree) {
|
||||
propertyDetailsTree.addContent(
|
||||
writer.getMarkerAnchor(property.name()));
|
||||
Content propertyDocTree = writer.getMemberTreeHeader();
|
||||
Content heading = new HtmlTree(HtmlConstants.MEMBER_HEADING);
|
||||
heading.addContent(property.name().substring(0, property.name().lastIndexOf("Property")));
|
||||
propertyDocTree.addContent(heading);
|
||||
return propertyDocTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getSignature(MethodDoc property) {
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
writer.addAnnotationInfo(property, pre);
|
||||
addModifiers(property, pre);
|
||||
Content propertylink = writer.getLink(new LinkInfoImpl(
|
||||
configuration, LinkInfoImpl.Kind.MEMBER,
|
||||
property.returnType()));
|
||||
pre.addContent(propertylink);
|
||||
pre.addContent(" ");
|
||||
if (configuration.linksource) {
|
||||
Content propertyName = new StringContent(property.name());
|
||||
writer.addSrcLink(property, propertyName, pre);
|
||||
} else {
|
||||
addName(property.name(), pre);
|
||||
}
|
||||
return pre;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addDeprecated(MethodDoc property, Content propertyDocTree) {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addComments(MethodDoc property, Content propertyDocTree) {
|
||||
ClassDoc holder = property.containingClass();
|
||||
if (property.inlineTags().length > 0) {
|
||||
if (holder.equals(classdoc) ||
|
||||
(! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
|
||||
writer.addInlineComment(property, propertyDocTree);
|
||||
} else {
|
||||
Content link =
|
||||
writer.getDocLink(LinkInfoImpl.Kind.PROPERTY_DOC_COPY,
|
||||
holder, property,
|
||||
holder.isIncluded() ?
|
||||
holder.typeName() : holder.qualifiedTypeName(),
|
||||
false);
|
||||
Content codeLink = HtmlTree.CODE(link);
|
||||
Content descfrmLabel = HtmlTree.SPAN(HtmlStyle.descfrmTypeLabel, holder.isClass()?
|
||||
writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
|
||||
descfrmLabel.addContent(writer.getSpace());
|
||||
descfrmLabel.addContent(codeLink);
|
||||
propertyDocTree.addContent(HtmlTree.DIV(HtmlStyle.block, descfrmLabel));
|
||||
writer.addInlineComment(property, propertyDocTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addTags(MethodDoc property, Content propertyDocTree) {
|
||||
writer.addTagsInfo(property, propertyDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getPropertyDetails(Content propertyDetailsTree) {
|
||||
return getMemberTree(propertyDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getPropertyDoc(Content propertyDocTree,
|
||||
boolean isLastContent) {
|
||||
return getMemberTree(propertyDocTree, isLastContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
public int getMemberKind() {
|
||||
return VisibleMemberMap.PROPERTIES;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryLabel(Content memberTree) {
|
||||
Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
|
||||
writer.getResource("doclet.Property_Summary"));
|
||||
memberTree.addContent(label);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getTableSummary() {
|
||||
return configuration.getText("doclet.Member_Table_Summary",
|
||||
configuration.getText("doclet.Property_Summary"),
|
||||
configuration.getText("doclet.properties"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getCaption() {
|
||||
return configuration.getResource("doclet.Properties");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String[] getSummaryTableHeader(ProgramElementDoc member) {
|
||||
String[] header = new String[] {
|
||||
configuration.getText("doclet.Type"),
|
||||
configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Property"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
return header;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
|
||||
memberTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.PROPERTY_SUMMARY));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
|
||||
inheritedTree.addContent(writer.getMarkerAnchor(
|
||||
SectionName.PROPERTIES_INHERITANCE,
|
||||
configuration.getClassName(cd)));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
|
||||
Content classLink = writer.getPreQualifiedClassLink(
|
||||
LinkInfoImpl.Kind.MEMBER, cd, false);
|
||||
Content label = new StringContent(cd.isClass() ?
|
||||
configuration.getText("doclet.Properties_Inherited_From_Class") :
|
||||
configuration.getText("doclet.Properties_Inherited_From_Interface"));
|
||||
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
|
||||
label);
|
||||
labelHeading.addContent(writer.getSpace());
|
||||
labelHeading.addContent(classLink);
|
||||
inheritedTree.addContent(labelHeading);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
|
||||
Content tdSummary) {
|
||||
Content memberLink = HtmlTree.SPAN(HtmlStyle.memberNameLink,
|
||||
writer.getDocLink(context, cd,
|
||||
(MemberDoc) member,
|
||||
member.name().substring(0, member.name().lastIndexOf("Property")),
|
||||
false,
|
||||
true));
|
||||
|
||||
Content code = HtmlTree.CODE(memberLink);
|
||||
tdSummary.addContent(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addInheritedSummaryLink(ClassDoc cd,
|
||||
ProgramElementDoc member, Content linksTree) {
|
||||
linksTree.addContent(
|
||||
writer.getDocLink(LinkInfoImpl.Kind.MEMBER, cd, (MemberDoc)member,
|
||||
((member.name().lastIndexOf("Property") != -1) && configuration.javafx)
|
||||
? member.name().substring(0, member.name().length() - "Property".length())
|
||||
: member.name(),
|
||||
false, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addSummaryType(ProgramElementDoc member, Content tdSummaryType) {
|
||||
MethodDoc property = (MethodDoc)member;
|
||||
addModifierAndType(property, property.returnType(), tdSummaryType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getDeprecatedLink(ProgramElementDoc member) {
|
||||
return writer.getDocLink(LinkInfoImpl.Kind.MEMBER,
|
||||
(MemberDoc) member, ((MethodDoc)member).qualifiedName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
|
||||
if (link) {
|
||||
if (cd == null) {
|
||||
return writer.getHyperLink(
|
||||
SectionName.PROPERTY_SUMMARY,
|
||||
writer.getResource("doclet.navProperty"));
|
||||
} else {
|
||||
return writer.getHyperLink(
|
||||
SectionName.PROPERTIES_INHERITANCE,
|
||||
configuration.getClassName(cd), writer.getResource("doclet.navProperty"));
|
||||
}
|
||||
} else {
|
||||
return writer.getResource("doclet.navProperty");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected void addNavDetailLink(boolean link, Content liNav) {
|
||||
if (link) {
|
||||
liNav.addContent(writer.getHyperLink(
|
||||
SectionName.PROPERTY_DETAIL,
|
||||
writer.getResource("doclet.navProperty")));
|
||||
} else {
|
||||
liNav.addContent(writer.getResource("doclet.navProperty"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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;
|
||||
|
||||
/**
|
||||
* Enum representing various section names of generated API documentation.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public enum SectionName {
|
||||
|
||||
ANNOTATION_TYPE_ELEMENT_DETAIL("annotation.type.element.detail"),
|
||||
ANNOTATION_TYPE_FIELD_DETAIL("annotation.type.field.detail"),
|
||||
ANNOTATION_TYPE_FIELD_SUMMARY("annotation.type.field.summary"),
|
||||
ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY("annotation.type.optional.element.summary"),
|
||||
ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY("annotation.type.required.element.summary"),
|
||||
CONSTRUCTOR_DETAIL("constructor.detail"),
|
||||
CONSTRUCTOR_SUMMARY("constructor.summary"),
|
||||
ENUM_CONSTANT_DETAIL("enum.constant.detail"),
|
||||
ENUM_CONSTANTS_INHERITANCE("enum.constants.inherited.from.class."),
|
||||
ENUM_CONSTANT_SUMMARY("enum.constant.summary"),
|
||||
FIELD_DETAIL("field.detail"),
|
||||
FIELDS_INHERITANCE("fields.inherited.from.class."),
|
||||
FIELD_SUMMARY("field.summary"),
|
||||
METHOD_DETAIL("method.detail"),
|
||||
METHODS_INHERITANCE("methods.inherited.from.class."),
|
||||
METHOD_SUMMARY("method.summary"),
|
||||
NAVBAR_BOTTOM("navbar.bottom"),
|
||||
NAVBAR_BOTTOM_FIRSTROW("navbar.bottom.firstrow"),
|
||||
NAVBAR_TOP("navbar.top"),
|
||||
NAVBAR_TOP_FIRSTROW("navbar.top.firstrow"),
|
||||
NESTED_CLASSES_INHERITANCE("nested.classes.inherited.from.class."),
|
||||
NESTED_CLASS_SUMMARY("nested.class.summary"),
|
||||
OVERVIEW_DESCRIPTION("overview.description"),
|
||||
PACKAGE_DESCRIPTION("package.description"),
|
||||
PROPERTY_DETAIL("property.detail"),
|
||||
PROPERTIES_INHERITANCE("properties.inherited.from.class."),
|
||||
PROPERTY_SUMMARY("property.summary"),
|
||||
SKIP_NAVBAR_BOTTOM("skip.navbar.bottom"),
|
||||
SKIP_NAVBAR_TOP("skip.navbar.top"),
|
||||
UNNAMED_PACKAGE_ANCHOR("unnamed.package");
|
||||
|
||||
private final String value;
|
||||
|
||||
SectionName(String sName) {
|
||||
this.value = sName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 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.DocPaths;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.DocletAbortException;
|
||||
|
||||
/**
|
||||
* Generate the Serialized Form Information Page.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
*/
|
||||
public class SerializedFormWriterImpl extends SubWriterHolderWriter
|
||||
implements SerializedFormWriter {
|
||||
|
||||
/**
|
||||
* @param configuration the configuration data for the doclet
|
||||
* @throws IOException
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public SerializedFormWriterImpl(ConfigurationImpl configuration)
|
||||
throws IOException {
|
||||
super(configuration, DocPaths.SERIALIZED_FORM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the given header.
|
||||
*
|
||||
* @param header the header to write
|
||||
* @return the body content tree
|
||||
*/
|
||||
public Content getHeader(String header) {
|
||||
Content bodyTree = getBody(true, getWindowTitle(header));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
Content h1Content = new StringContent(header);
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
|
||||
HtmlStyle.title, h1Content);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
bodyTree.addContent(div);
|
||||
return bodyTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serialized form summaries header.
|
||||
*
|
||||
* @return the serialized form summary header tree
|
||||
*/
|
||||
public Content getSerializedSummariesHeader() {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
return ul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the package serialized form header.
|
||||
*
|
||||
* @return the package serialized form header tree
|
||||
*/
|
||||
public Content getPackageSerializedHeader() {
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the given package header.
|
||||
*
|
||||
* @param packageName the package header to write
|
||||
* @return a content tree for the package header
|
||||
*/
|
||||
public Content getPackageHeader(String packageName) {
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
|
||||
packageLabel);
|
||||
heading.addContent(getSpace());
|
||||
heading.addContent(packageName);
|
||||
return heading;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serialized class header.
|
||||
*
|
||||
* @return a content tree for the serialized class header
|
||||
*/
|
||||
public Content getClassSerializedHeader() {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
return ul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serializable class heading.
|
||||
*
|
||||
* @param classDoc the class being processed
|
||||
* @return a content tree for the class header
|
||||
*/
|
||||
public Content getClassHeader(ClassDoc classDoc) {
|
||||
Content classLink = (classDoc.isPublic() || classDoc.isProtected()) ?
|
||||
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, classDoc)
|
||||
.label(configuration.getClassName(classDoc))) :
|
||||
new StringContent(classDoc.qualifiedName());
|
||||
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
|
||||
classDoc.qualifiedName()));
|
||||
Content superClassLink =
|
||||
classDoc.superclassType() != null ?
|
||||
getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.SERIALIZED_FORM,
|
||||
classDoc.superclassType())) :
|
||||
null;
|
||||
|
||||
//Print the heading.
|
||||
Content className = superClassLink == null ?
|
||||
configuration.getResource(
|
||||
"doclet.Class_0_implements_serializable", classLink) :
|
||||
configuration.getResource(
|
||||
"doclet.Class_0_extends_implements_serializable", classLink,
|
||||
superClassLink);
|
||||
li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
|
||||
className));
|
||||
return li;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serial UID info header.
|
||||
*
|
||||
* @return a content tree for the serial uid info header
|
||||
*/
|
||||
public Content getSerialUIDInfoHeader() {
|
||||
HtmlTree dl = new HtmlTree(HtmlTag.DL);
|
||||
dl.addStyle(HtmlStyle.nameValue);
|
||||
return dl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the serial UID info.
|
||||
*
|
||||
* @param header the header that will show up before the UID.
|
||||
* @param serialUID the serial UID to print.
|
||||
* @param serialUidTree the serial UID content tree to which the serial UID
|
||||
* content will be added
|
||||
*/
|
||||
public void addSerialUIDInfo(String header, String serialUID,
|
||||
Content serialUidTree) {
|
||||
Content headerContent = new StringContent(header);
|
||||
serialUidTree.addContent(HtmlTree.DT(headerContent));
|
||||
Content serialContent = new StringContent(serialUID);
|
||||
serialUidTree.addContent(HtmlTree.DD(serialContent));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class serialize content header.
|
||||
*
|
||||
* @return a content tree for the class serialize content header
|
||||
*/
|
||||
public Content getClassContentHeader() {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
return ul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serialized content tree section.
|
||||
*
|
||||
* @param serializedTreeContent the serialized content tree to be added
|
||||
* @return a div content tree
|
||||
*/
|
||||
public Content getSerializedContent(Content serializedTreeContent) {
|
||||
Content divContent = HtmlTree.DIV(HtmlStyle.serializedFormContainer,
|
||||
serializedTreeContent);
|
||||
return divContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the footer.
|
||||
*
|
||||
* @param serializedTree the serialized tree to be added
|
||||
*/
|
||||
public void addFooter(Content serializedTree) {
|
||||
addNavLinks(false, serializedTree);
|
||||
addBottom(serializedTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void printDocument(Content serializedTree) throws IOException {
|
||||
printHtmlDocument(null, true, serializedTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of a SerialFieldWriter.
|
||||
*
|
||||
* @return an instance of a SerialFieldWriter.
|
||||
*/
|
||||
public SerialFieldWriter getSerialFieldWriter(ClassDoc classDoc) {
|
||||
return new HtmlSerialFieldWriter(this, classDoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of a SerialMethodWriter.
|
||||
*
|
||||
* @return an instance of a SerialMethodWriter.
|
||||
*/
|
||||
public SerialMethodWriter getSerialMethodWriter(ClassDoc classDoc) {
|
||||
return new HtmlSerialMethodWriter(this, classDoc);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 java.io.*;
|
||||
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Generate only one index file for all the Member Names with Indexing in
|
||||
* Unicode Order. The name of the generated file is "index-all.html" and it is
|
||||
* generated in current or the destination directory.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @see java.lang.Character
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class SingleIndexWriter extends AbstractIndexWriter {
|
||||
|
||||
/**
|
||||
* Construct the SingleIndexWriter with filename "index-all.html" and the
|
||||
* {@link IndexBuilder}
|
||||
*
|
||||
* @param filename Name of the index file to be generated.
|
||||
* @param indexbuilder Unicode based Index from {@link IndexBuilder}
|
||||
*/
|
||||
public SingleIndexWriter(ConfigurationImpl configuration,
|
||||
DocPath filename,
|
||||
IndexBuilder indexbuilder) throws IOException {
|
||||
super(configuration, filename, indexbuilder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate single index file, for all Unicode characters.
|
||||
*
|
||||
* @param indexbuilder IndexBuilder built by {@link IndexBuilder}
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration,
|
||||
IndexBuilder indexbuilder) {
|
||||
SingleIndexWriter indexgen;
|
||||
DocPath filename = DocPaths.INDEX_ALL;
|
||||
try {
|
||||
indexgen = new SingleIndexWriter(configuration,
|
||||
filename, indexbuilder);
|
||||
indexgen.generateIndexFile();
|
||||
indexgen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the contents of each index file, with Header, Footer,
|
||||
* Member Field, Method and Constructor Description.
|
||||
*/
|
||||
protected void generateIndexFile() throws IOException {
|
||||
String title = configuration.getText("doclet.Window_Single_Index");
|
||||
Content body = getBody(true, getWindowTitle(title));
|
||||
addTop(body);
|
||||
addNavLinks(true, body);
|
||||
HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
|
||||
divTree.addStyle(HtmlStyle.contentContainer);
|
||||
addLinksForIndexes(divTree);
|
||||
for (int i = 0; i < indexbuilder.elements().length; i++) {
|
||||
Character unicode = (Character)((indexbuilder.elements())[i]);
|
||||
addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
|
||||
}
|
||||
addLinksForIndexes(divTree);
|
||||
body.addContent(divTree);
|
||||
addNavLinks(false, body);
|
||||
addBottom(body);
|
||||
printHtmlDocument(null, true, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 addLinksForIndexes(Content contentTree) {
|
||||
for (int i = 0; i < indexbuilder.elements().length; i++) {
|
||||
String unicode = (indexbuilder.elements())[i].toString();
|
||||
contentTree.addContent(
|
||||
getHyperLink(getNameForIndex(unicode),
|
||||
new StringContent(unicode)));
|
||||
contentTree.addContent(getSpace());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2013, 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 java.io.*;
|
||||
|
||||
import javax.tools.FileObject;
|
||||
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* Converts Java Source Code to HTML.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.4
|
||||
*/
|
||||
public class SourceToHTMLConverter {
|
||||
|
||||
/**
|
||||
* The number of trailing blank lines at the end of the page.
|
||||
* This is inserted so that anchors at the bottom of small pages
|
||||
* can be reached.
|
||||
*/
|
||||
private static final int NUM_BLANK_LINES = 60;
|
||||
|
||||
/**
|
||||
* New line to be added to the documentation.
|
||||
*/
|
||||
private static final String NEW_LINE = DocletConstants.NL;
|
||||
|
||||
private final ConfigurationImpl configuration;
|
||||
|
||||
private final RootDoc rootDoc;
|
||||
|
||||
private DocPath outputdir;
|
||||
|
||||
/**
|
||||
* Relative path from the documentation root to the file that is being
|
||||
* generated.
|
||||
*/
|
||||
private DocPath relativePath = DocPath.empty;
|
||||
|
||||
private SourceToHTMLConverter(ConfigurationImpl configuration, RootDoc rd,
|
||||
DocPath outputdir) {
|
||||
this.configuration = configuration;
|
||||
this.rootDoc = rd;
|
||||
this.outputdir = outputdir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the Classes in the given RootDoc to an HTML.
|
||||
*
|
||||
* @param configuration the configuration.
|
||||
* @param rd the RootDoc to convert.
|
||||
* @param outputdir the name of the directory to output to.
|
||||
*/
|
||||
public static void convertRoot(ConfigurationImpl configuration, RootDoc rd,
|
||||
DocPath outputdir) {
|
||||
new SourceToHTMLConverter(configuration, rd, outputdir).generate();
|
||||
}
|
||||
|
||||
void generate() {
|
||||
if (rootDoc == null || outputdir == null) {
|
||||
return;
|
||||
}
|
||||
PackageDoc[] pds = rootDoc.specifiedPackages();
|
||||
for (int i = 0; i < pds.length; i++) {
|
||||
// If -nodeprecated option is set and the package is marked as deprecated,
|
||||
// do not convert the package files to HTML.
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(pds[i])))
|
||||
convertPackage(pds[i], outputdir);
|
||||
}
|
||||
ClassDoc[] cds = rootDoc.specifiedClasses();
|
||||
for (int i = 0; i < cds.length; i++) {
|
||||
// If -nodeprecated option is set and the class is marked as deprecated
|
||||
// or the containing package is deprecated, do not convert the
|
||||
// package files to HTML.
|
||||
if (!(configuration.nodeprecated &&
|
||||
(Util.isDeprecated(cds[i]) || Util.isDeprecated(cds[i].containingPackage()))))
|
||||
convertClass(cds[i], outputdir);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the Classes in the given Package to an HTML.
|
||||
*
|
||||
* @param pd the Package to convert.
|
||||
* @param outputdir the name of the directory to output to.
|
||||
*/
|
||||
public void convertPackage(PackageDoc pd, DocPath outputdir) {
|
||||
if (pd == null) {
|
||||
return;
|
||||
}
|
||||
ClassDoc[] cds = pd.allClasses();
|
||||
for (int i = 0; i < cds.length; i++) {
|
||||
// If -nodeprecated option is set and the class is marked as deprecated,
|
||||
// do not convert the package files to HTML. We do not check for
|
||||
// containing package deprecation since it is already check in
|
||||
// the calling method above.
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(cds[i])))
|
||||
convertClass(cds[i], outputdir);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given Class to an HTML.
|
||||
*
|
||||
* @param cd the class to convert.
|
||||
* @param outputdir the name of the directory to output to.
|
||||
*/
|
||||
public void convertClass(ClassDoc cd, DocPath outputdir) {
|
||||
if (cd == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
SourcePosition sp = cd.position();
|
||||
if (sp == null)
|
||||
return;
|
||||
Reader r;
|
||||
// temp hack until we can update SourcePosition API.
|
||||
if (sp instanceof com.sun.tools.javadoc.SourcePositionImpl) {
|
||||
FileObject fo = ((com.sun.tools.javadoc.SourcePositionImpl) sp).fileObject();
|
||||
if (fo == null)
|
||||
return;
|
||||
r = fo.openReader(true);
|
||||
} else {
|
||||
File file = sp.file();
|
||||
if (file == null)
|
||||
return;
|
||||
r = new FileReader(file);
|
||||
}
|
||||
LineNumberReader reader = new LineNumberReader(r);
|
||||
int lineno = 1;
|
||||
String line;
|
||||
relativePath = DocPaths.SOURCE_OUTPUT
|
||||
.resolve(DocPath.forPackage(cd))
|
||||
.invert();
|
||||
Content body = getHeader();
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
try {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
addLineNo(pre, lineno);
|
||||
addLine(pre, line, lineno);
|
||||
lineno++;
|
||||
}
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
addBlankLines(pre);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
|
||||
body.addContent(div);
|
||||
writeToFile(body, outputdir.resolve(DocPath.forClass(cd)));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the output to the file.
|
||||
*
|
||||
* @param body the documentation content to be written to the file.
|
||||
* @param path the path for the file.
|
||||
*/
|
||||
private void writeToFile(Content body, DocPath path) throws IOException {
|
||||
Content htmlDocType = DocType.TRANSITIONAL;
|
||||
Content head = new HtmlTree(HtmlTag.HEAD);
|
||||
head.addContent(HtmlTree.TITLE(new StringContent(
|
||||
configuration.getText("doclet.Window_Source_title"))));
|
||||
head.addContent(getStyleSheetProperties());
|
||||
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
|
||||
head, body);
|
||||
Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
|
||||
configuration.message.notice("doclet.Generating_0", path.getPath());
|
||||
DocFile df = DocFile.createFileForOutput(configuration, path);
|
||||
Writer w = df.openWriter();
|
||||
try {
|
||||
htmlDocument.write(w, true);
|
||||
} finally {
|
||||
w.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a link to the stylesheet file.
|
||||
*
|
||||
* @return an HtmlTree for the lINK tag which provides the stylesheet location
|
||||
*/
|
||||
public HtmlTree getStyleSheetProperties() {
|
||||
String filename = configuration.stylesheetfile;
|
||||
DocPath stylesheet;
|
||||
if (filename.length() > 0) {
|
||||
DocFile file = DocFile.createFileForInput(configuration, filename);
|
||||
stylesheet = DocPath.create(file.getName());
|
||||
} else {
|
||||
stylesheet = DocPaths.STYLESHEET;
|
||||
}
|
||||
DocPath p = relativePath.resolve(stylesheet);
|
||||
HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", p.getPath(), "Style");
|
||||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the header.
|
||||
*
|
||||
* @return the header content for the HTML file
|
||||
*/
|
||||
private static Content getHeader() {
|
||||
return new HtmlTree(HtmlTag.BODY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
private static void addLineNo(Content pre, int lineno) {
|
||||
HtmlTree span = new HtmlTree(HtmlTag.SPAN);
|
||||
span.addStyle(HtmlStyle.sourceLineNo);
|
||||
if (lineno < 10) {
|
||||
span.addContent("00" + Integer.toString(lineno));
|
||||
} else if (lineno < 100) {
|
||||
span.addContent("0" + Integer.toString(lineno));
|
||||
} else {
|
||||
span.addContent(Integer.toString(lineno));
|
||||
}
|
||||
pre.addContent(span);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a line from source to the HTML file that is generated.
|
||||
*
|
||||
* @param pre the content tree to which the line will be added.
|
||||
* @param line the string to format.
|
||||
* @param currentLineNo the current number.
|
||||
*/
|
||||
private void addLine(Content pre, String line, int currentLineNo) {
|
||||
if (line != null) {
|
||||
pre.addContent(Util.replaceTabs(configuration, line));
|
||||
Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
|
||||
pre.addContent(anchor);
|
||||
pre.addContent(NEW_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add trailing blank lines at the end of the page.
|
||||
*
|
||||
* @param pre the content tree to which the blank lines will be added.
|
||||
*/
|
||||
private static void addBlankLines(Content pre) {
|
||||
for (int i = 0; i < NUM_BLANK_LINES; i++) {
|
||||
pre.addContent(NEW_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a <code>Doc</code>, return an anchor name for it.
|
||||
*
|
||||
* @param d the <code>Doc</code> to check.
|
||||
* @return the name of the anchor.
|
||||
*/
|
||||
public static String getAnchorName(Doc d) {
|
||||
return "line." + d.position().line();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, 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 java.io.*;
|
||||
|
||||
import com.sun.tools.doclets.formats.html.markup.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Generate Separate Index Files for all the member names with Indexing in
|
||||
* Unicode Order. This will create "index-files" directory in the current or
|
||||
* destination directory and will generate separate file for each unicode index.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @see java.lang.Character
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class SplitIndexWriter extends AbstractIndexWriter {
|
||||
|
||||
/**
|
||||
* Previous unicode character index in the built index.
|
||||
*/
|
||||
protected int prev;
|
||||
|
||||
/**
|
||||
* Next unicode character in the built index.
|
||||
*/
|
||||
protected int next;
|
||||
|
||||
/**
|
||||
* Construct the SplitIndexWriter. Uses path to this file and relative path
|
||||
* from this file.
|
||||
*
|
||||
* @param path Path to the file which is getting generated.
|
||||
* @param indexbuilder Unicode based Index from {@link IndexBuilder}
|
||||
*/
|
||||
public SplitIndexWriter(ConfigurationImpl configuration,
|
||||
DocPath path,
|
||||
IndexBuilder indexbuilder,
|
||||
int prev, int next) throws IOException {
|
||||
super(configuration, path, indexbuilder);
|
||||
this.prev = prev;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate separate index files, for each Unicode character, listing all
|
||||
* the members starting with the particular unicode character.
|
||||
*
|
||||
* @param indexbuilder IndexBuilder built by {@link IndexBuilder}
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration,
|
||||
IndexBuilder indexbuilder) {
|
||||
SplitIndexWriter indexgen;
|
||||
DocPath filename = DocPath.empty;
|
||||
DocPath path = DocPaths.INDEX_FILES;
|
||||
try {
|
||||
for (int i = 0; i < indexbuilder.elements().length; i++) {
|
||||
int j = i + 1;
|
||||
int prev = (j == 1)? -1: i;
|
||||
int next = (j == indexbuilder.elements().length)? -1: j + 1;
|
||||
filename = DocPaths.indexN(j);
|
||||
indexgen = new SplitIndexWriter(configuration,
|
||||
path.resolve(filename),
|
||||
indexbuilder, prev, next);
|
||||
indexgen.generateIndexFile((Character)indexbuilder.
|
||||
elements()[i]);
|
||||
indexgen.close();
|
||||
}
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename.getPath());
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the contents of each index file, with Header, Footer,
|
||||
* Member Field, Method and Constructor Description.
|
||||
*
|
||||
* @param unicode Unicode character referring to the character for the
|
||||
* index.
|
||||
*/
|
||||
protected void generateIndexFile(Character unicode) throws IOException {
|
||||
String title = configuration.getText("doclet.Window_Split_Index",
|
||||
unicode.toString());
|
||||
Content body = getBody(true, getWindowTitle(title));
|
||||
addTop(body);
|
||||
addNavLinks(true, body);
|
||||
HtmlTree 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 addLinksForIndexes(Content contentTree) {
|
||||
Object[] unicodeChars = indexbuilder.elements();
|
||||
for (int i = 0; i < unicodeChars.length; i++) {
|
||||
int j = i + 1;
|
||||
contentTree.addContent(getHyperLink(DocPaths.indexN(j),
|
||||
new StringContent(unicodeChars[i].toString())));
|
||||
contentTree.addContent(getSpace());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to the previous unicode character.
|
||||
*
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
public Content getNavLinkPrevious() {
|
||||
Content prevletterLabel = getResource("doclet.Prev_Letter");
|
||||
if (prev == -1) {
|
||||
return HtmlTree.LI(prevletterLabel);
|
||||
}
|
||||
else {
|
||||
Content prevLink = getHyperLink(DocPaths.indexN(prev),
|
||||
prevletterLabel);
|
||||
return HtmlTree.LI(prevLink);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link to the next unicode character.
|
||||
*
|
||||
* @return a content tree for the link
|
||||
*/
|
||||
public Content getNavLinkNext() {
|
||||
Content nextletterLabel = getResource("doclet.Next_Letter");
|
||||
if (next == -1) {
|
||||
return HtmlTree.LI(nextletterLabel);
|
||||
}
|
||||
else {
|
||||
Content nextLink = getHyperLink(DocPaths.indexN(next),
|
||||
nextletterLabel);
|
||||
return HtmlTree.LI(nextLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* This abstract class exists to provide functionality needed in the
|
||||
* the formatting of member information. Since AbstractSubWriter and its
|
||||
* subclasses control this, they would be the logical place to put this.
|
||||
* However, because each member type has its own subclass, subclassing
|
||||
* can not be used effectively to change formatting. The concrete
|
||||
* class subclass of this class can be subclassed to change formatting.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @see AbstractMemberWriter
|
||||
* @see ClassWriterImpl
|
||||
*
|
||||
* @author Robert Field
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
|
||||
|
||||
public SubWriterHolderWriter(ConfigurationImpl configuration, DocPath filename)
|
||||
throws IOException {
|
||||
super(configuration, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param tableContents list of summary table contents
|
||||
* @param showTabs true if the table needs to show tabs
|
||||
* @return the content tree for the summary table
|
||||
*/
|
||||
public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd,
|
||||
List<Content> tableContents, boolean showTabs) {
|
||||
Content caption;
|
||||
if (showTabs) {
|
||||
caption = getTableCaption(mw.methodTypes);
|
||||
generateMethodTypesScript(mw.typeMap, mw.methodTypes);
|
||||
}
|
||||
else {
|
||||
caption = getTableCaption(mw.getCaption());
|
||||
}
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.memberSummary, 0, 3, 0,
|
||||
mw.getTableSummary(), caption);
|
||||
table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col"));
|
||||
for (int i = 0; i < tableContents.size(); i++) {
|
||||
table.addContent(tableContents.get(i));
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the summary table caption.
|
||||
*
|
||||
* @param methodTypes set comprising of method types to show as table caption
|
||||
* @return the caption for the summary table
|
||||
*/
|
||||
public Content getTableCaption(Set<MethodTypes> methodTypes) {
|
||||
Content tabbedCaption = new HtmlTree(HtmlTag.CAPTION);
|
||||
for (MethodTypes type : methodTypes) {
|
||||
Content captionSpan;
|
||||
Content span;
|
||||
if (type.isDefaultTab()) {
|
||||
captionSpan = HtmlTree.SPAN(configuration.getResource(type.resourceKey()));
|
||||
span = HtmlTree.SPAN(type.tabId(),
|
||||
HtmlStyle.activeTableTab, captionSpan);
|
||||
} else {
|
||||
captionSpan = HtmlTree.SPAN(getMethodTypeLinks(type));
|
||||
span = HtmlTree.SPAN(type.tabId(),
|
||||
HtmlStyle.tableTab, captionSpan);
|
||||
}
|
||||
Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, getSpace());
|
||||
span.addContent(tabSpan);
|
||||
tabbedCaption.addContent(span);
|
||||
}
|
||||
return tabbedCaption;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the method type links for the table caption.
|
||||
*
|
||||
* @param methodType the method type to be displayed as link
|
||||
* @return the content tree for the method type link
|
||||
*/
|
||||
public Content getMethodTypeLinks(MethodTypes methodType) {
|
||||
String jsShow = "javascript:show(" + methodType.value() +");";
|
||||
HtmlTree link = HtmlTree.A(jsShow, configuration.getResource(methodType.resourceKey()));
|
||||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
|
||||
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 deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
|
||||
div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
|
||||
div.addContent(getSpace());
|
||||
tdSummary.addContent(div);
|
||||
}
|
||||
}
|
||||
addSummaryComment(member, firstSentenceTags, tdSummary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
linksTree.addContent(", ");
|
||||
}
|
||||
mw.addInheritedSummaryLink(cd, member, linksTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,353 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, 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.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
|
||||
import com.sun.tools.doclets.formats.html.markup.HtmlStyle;
|
||||
import com.sun.tools.doclets.formats.html.markup.HtmlTree;
|
||||
import com.sun.tools.doclets.formats.html.markup.RawHtml;
|
||||
import com.sun.tools.doclets.formats.html.markup.StringContent;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder;
|
||||
import com.sun.tools.doclets.internal.toolkit.taglets.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* The taglet writer that writes HTML.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @since 1.5
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
|
||||
public class TagletWriterImpl extends TagletWriter {
|
||||
|
||||
private final HtmlDocletWriter htmlWriter;
|
||||
private final ConfigurationImpl configuration;
|
||||
|
||||
public TagletWriterImpl(HtmlDocletWriter htmlWriter, boolean isFirstSentence) {
|
||||
super(isFirstSentence);
|
||||
this.htmlWriter = htmlWriter;
|
||||
configuration = htmlWriter.configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getOutputInstance() {
|
||||
return new ContentBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content codeTagOutput(Tag tag) {
|
||||
Content result = HtmlTree.CODE(new StringContent(Util.normalizeNewlines(tag.text())));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getDocRootOutput() {
|
||||
String path;
|
||||
if (htmlWriter.pathToRoot.isEmpty())
|
||||
path = ".";
|
||||
else
|
||||
path = htmlWriter.pathToRoot.getPath();
|
||||
return new StringContent(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content deprecatedTagOutput(Doc doc) {
|
||||
ContentBuilder result = new ContentBuilder();
|
||||
Tag[] deprs = doc.tags("deprecated");
|
||||
if (doc instanceof ClassDoc) {
|
||||
if (Util.isDeprecated((ProgramElementDoc) doc)) {
|
||||
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
|
||||
new StringContent(configuration.getText("doclet.Deprecated"))));
|
||||
result.addContent(RawHtml.nbsp);
|
||||
if (deprs.length > 0) {
|
||||
Tag[] commentTags = deprs[0].inlineTags();
|
||||
if (commentTags.length > 0) {
|
||||
result.addContent(commentTagsToOutput(null, doc,
|
||||
deprs[0].inlineTags(), false)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
MemberDoc member = (MemberDoc) doc;
|
||||
if (Util.isDeprecated((ProgramElementDoc) doc)) {
|
||||
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
|
||||
new StringContent(configuration.getText("doclet.Deprecated"))));
|
||||
result.addContent(RawHtml.nbsp);
|
||||
if (deprs.length > 0) {
|
||||
Content body = commentTagsToOutput(null, doc,
|
||||
deprs[0].inlineTags(), false);
|
||||
if (!body.isEmpty())
|
||||
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body));
|
||||
}
|
||||
} else {
|
||||
if (Util.isDeprecated(member.containingClass())) {
|
||||
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
|
||||
new StringContent(configuration.getText("doclet.Deprecated"))));
|
||||
result.addContent(RawHtml.nbsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected Content literalTagOutput(Tag tag) {
|
||||
Content result = new StringContent(Util.normalizeNewlines(tag.text()));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public MessageRetriever getMsgRetriever() {
|
||||
return configuration.message;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getParamHeader(String header) {
|
||||
HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.paramLabel,
|
||||
new StringContent(header)));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content paramTagOutput(ParamTag paramTag, String paramName) {
|
||||
ContentBuilder body = new ContentBuilder();
|
||||
body.addContent(HtmlTree.CODE(new RawHtml(paramName)));
|
||||
body.addContent(" - ");
|
||||
body.addContent(htmlWriter.commentTagsToContent(paramTag, null, paramTag.inlineTags(), false));
|
||||
HtmlTree result = HtmlTree.DD(body);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content propertyTagOutput(Tag tag, String prefix) {
|
||||
Content body = new ContentBuilder();
|
||||
body.addContent(new RawHtml(prefix));
|
||||
body.addContent(" ");
|
||||
body.addContent(HtmlTree.CODE(new RawHtml(tag.text())));
|
||||
body.addContent(".");
|
||||
Content result = HtmlTree.P(body);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content returnTagOutput(Tag returnTag) {
|
||||
ContentBuilder result = new ContentBuilder();
|
||||
result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.returnLabel,
|
||||
new StringContent(configuration.getText("doclet.Returns")))));
|
||||
result.addContent(HtmlTree.DD(htmlWriter.commentTagsToContent(
|
||||
returnTag, null, returnTag.inlineTags(), false)));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content seeTagOutput(Doc holder, SeeTag[] seeTags) {
|
||||
ContentBuilder body = new ContentBuilder();
|
||||
if (seeTags.length > 0) {
|
||||
for (int i = 0; i < seeTags.length; ++i) {
|
||||
appendSeparatorIfNotEmpty(body);
|
||||
body.addContent(htmlWriter.seeTagToContent(seeTags[i]));
|
||||
}
|
||||
}
|
||||
if (holder.isField() && ((FieldDoc)holder).constantValue() != null &&
|
||||
htmlWriter instanceof ClassWriterImpl) {
|
||||
//Automatically add link to constant values page for constant fields.
|
||||
appendSeparatorIfNotEmpty(body);
|
||||
DocPath constantsPath =
|
||||
htmlWriter.pathToRoot.resolve(DocPaths.CONSTANT_VALUES);
|
||||
String whichConstant =
|
||||
((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName() + "." + ((FieldDoc) holder).name();
|
||||
DocLink link = constantsPath.fragment(whichConstant);
|
||||
body.addContent(htmlWriter.getHyperLink(link,
|
||||
new StringContent(configuration.getText("doclet.Constants_Summary"))));
|
||||
}
|
||||
if (holder.isClass() && ((ClassDoc)holder).isSerializable()) {
|
||||
//Automatically add link to serialized form page for serializable classes.
|
||||
if ((SerializedFormBuilder.serialInclude(holder) &&
|
||||
SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) {
|
||||
appendSeparatorIfNotEmpty(body);
|
||||
DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM);
|
||||
DocLink link = serialPath.fragment(((ClassDoc)holder).qualifiedName());
|
||||
body.addContent(htmlWriter.getHyperLink(link,
|
||||
new StringContent(configuration.getText("doclet.Serialized_Form"))));
|
||||
}
|
||||
}
|
||||
if (body.isEmpty())
|
||||
return body;
|
||||
|
||||
ContentBuilder result = new ContentBuilder();
|
||||
result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.seeLabel,
|
||||
new StringContent(configuration.getText("doclet.See_Also")))));
|
||||
result.addContent(HtmlTree.DD(body));
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private void appendSeparatorIfNotEmpty(ContentBuilder body) {
|
||||
if (!body.isEmpty()) {
|
||||
body.addContent(", ");
|
||||
body.addContent(DocletConstants.NL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content simpleTagOutput(Tag[] simpleTags, String header) {
|
||||
ContentBuilder result = new ContentBuilder();
|
||||
result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.simpleTagLabel, new RawHtml(header))));
|
||||
ContentBuilder body = new ContentBuilder();
|
||||
for (int i = 0; i < simpleTags.length; i++) {
|
||||
if (i > 0) {
|
||||
body.addContent(", ");
|
||||
}
|
||||
body.addContent(htmlWriter.commentTagsToContent(
|
||||
simpleTags[i], null, simpleTags[i].inlineTags(), false));
|
||||
}
|
||||
result.addContent(HtmlTree.DD(body));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content simpleTagOutput(Tag simpleTag, String header) {
|
||||
ContentBuilder result = new ContentBuilder();
|
||||
result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.simpleTagLabel, new RawHtml(header))));
|
||||
Content body = htmlWriter.commentTagsToContent(
|
||||
simpleTag, null, simpleTag.inlineTags(), false);
|
||||
result.addContent(HtmlTree.DD(body));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content getThrowsHeader() {
|
||||
HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.throwsLabel,
|
||||
new StringContent(configuration.getText("doclet.Throws"))));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content throwsTagOutput(ThrowsTag throwsTag) {
|
||||
ContentBuilder body = new ContentBuilder();
|
||||
Content excName = (throwsTag.exceptionType() == null) ?
|
||||
new RawHtml(throwsTag.exceptionName()) :
|
||||
htmlWriter.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER,
|
||||
throwsTag.exceptionType()));
|
||||
body.addContent(HtmlTree.CODE(excName));
|
||||
Content desc = htmlWriter.commentTagsToContent(throwsTag, null,
|
||||
throwsTag.inlineTags(), false);
|
||||
if (desc != null && !desc.isEmpty()) {
|
||||
body.addContent(" - ");
|
||||
body.addContent(desc);
|
||||
}
|
||||
HtmlTree result = HtmlTree.DD(body);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content throwsTagOutput(Type throwsType) {
|
||||
HtmlTree result = HtmlTree.DD(HtmlTree.CODE(htmlWriter.getLink(
|
||||
new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, throwsType))));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content valueTagOutput(FieldDoc field, String constantVal,
|
||||
boolean includeLink) {
|
||||
return includeLink ?
|
||||
htmlWriter.getDocLink(LinkInfoImpl.Kind.VALUE_TAG, field,
|
||||
constantVal, false) : new RawHtml(constantVal);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content commentTagsToOutput(Tag holderTag, Tag[] tags) {
|
||||
return commentTagsToOutput(holderTag, null, tags, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content commentTagsToOutput(Doc holderDoc, Tag[] tags) {
|
||||
return commentTagsToOutput(null, holderDoc, tags, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Content commentTagsToOutput(Tag holderTag,
|
||||
Doc holderDoc, Tag[] tags, boolean isFirstSentence) {
|
||||
return htmlWriter.commentTagsToContent(
|
||||
holderTag, holderDoc, tags, isFirstSentence);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Configuration configuration() {
|
||||
return configuration;
|
||||
}
|
||||
}
|
||||
171
jdkSrc/jdk8/com/sun/tools/doclets/formats/html/TreeWriter.java
Normal file
171
jdkSrc/jdk8/com/sun/tools/doclets/formats/html/TreeWriter.java
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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 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.*;
|
||||
|
||||
/**
|
||||
* Generate Class Hierarchy page for all the Classes in this run. Use
|
||||
* ClassTree for building the Tree. The name of
|
||||
* the generated file is "overview-tree.html" and it is generated in the
|
||||
* current or the destination directory.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class TreeWriter extends AbstractTreeWriter {
|
||||
|
||||
/**
|
||||
* Packages in this run.
|
||||
*/
|
||||
private PackageDoc[] packages;
|
||||
|
||||
/**
|
||||
* True if there are no packages specified on the command line,
|
||||
* False otherwise.
|
||||
*/
|
||||
private boolean classesonly;
|
||||
|
||||
/**
|
||||
* Constructor to construct TreeWriter object.
|
||||
*
|
||||
* @param configuration the current configuration of the doclet.
|
||||
* @param filename String filename
|
||||
* @param classtree the tree being built.
|
||||
*/
|
||||
public TreeWriter(ConfigurationImpl configuration,
|
||||
DocPath filename, ClassTree classtree)
|
||||
throws IOException {
|
||||
super(configuration, filename, classtree);
|
||||
packages = configuration.packages;
|
||||
classesonly = packages.length == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a TreeWriter object and use it to generate the
|
||||
* "overview-tree.html" file.
|
||||
*
|
||||
* @param classtree the class tree being documented.
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public static void generate(ConfigurationImpl configuration,
|
||||
ClassTree classtree) {
|
||||
TreeWriter treegen;
|
||||
DocPath filename = DocPaths.OVERVIEW_TREE;
|
||||
try {
|
||||
treegen = new TreeWriter(configuration, filename, classtree);
|
||||
treegen.generateTreeFile();
|
||||
treegen.close();
|
||||
} catch (IOException exc) {
|
||||
configuration.standardmessage.error(
|
||||
"doclet.exception_encountered",
|
||||
exc.toString(), filename);
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the interface hierarchy and class hierarchy.
|
||||
*/
|
||||
public void generateTreeFile() throws IOException {
|
||||
Content body = getTreeHeader();
|
||||
Content headContent = getResource("doclet.Hierarchy_For_All_Packages");
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
|
||||
HtmlStyle.title, headContent);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.header, heading);
|
||||
addPackageTreeLinks(div);
|
||||
body.addContent(div);
|
||||
HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
|
||||
divTree.addStyle(HtmlStyle.contentContainer);
|
||||
addTree(classtree.baseclasses(), "doclet.Class_Hierarchy", divTree);
|
||||
addTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy", divTree);
|
||||
addTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy", divTree);
|
||||
addTree(classtree.baseEnums(), "doclet.Enum_Hierarchy", divTree);
|
||||
body.addContent(divTree);
|
||||
addNavLinks(false, body);
|
||||
addBottom(body);
|
||||
printHtmlDocument(null, true, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the links to all the package tree files.
|
||||
*
|
||||
* @param contentTree the content tree to which the links will be added
|
||||
*/
|
||||
protected void addPackageTreeLinks(Content contentTree) {
|
||||
//Do nothing if only unnamed package is used
|
||||
if (packages.length == 1 && packages[0].name().length() == 0) {
|
||||
return;
|
||||
}
|
||||
if (!classesonly) {
|
||||
Content span = HtmlTree.SPAN(HtmlStyle.packageHierarchyLabel,
|
||||
getResource("doclet.Package_Hierarchies"));
|
||||
contentTree.addContent(span);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.horizontal);
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
// If the package name length is 0 or if -nodeprecated option
|
||||
// is set and the package is marked as deprecated, do not include
|
||||
// the page in the list of package hierarchies.
|
||||
if (packages[i].name().length() == 0 ||
|
||||
(configuration.nodeprecated && Util.isDeprecated(packages[i]))) {
|
||||
continue;
|
||||
}
|
||||
DocPath link = pathString(packages[i], DocPaths.PACKAGE_TREE);
|
||||
Content li = HtmlTree.LI(getHyperLink(
|
||||
link, new StringContent(packages[i].name())));
|
||||
if (i < packages.length - 1) {
|
||||
li.addContent(", ");
|
||||
}
|
||||
ul.addContent(li);
|
||||
}
|
||||
contentTree.addContent(ul);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tree header.
|
||||
*
|
||||
* @return a content tree for the tree header
|
||||
*/
|
||||
protected Content getTreeHeader() {
|
||||
String title = configuration.getText("doclet.Window_Class_Hierarchy");
|
||||
Content bodyTree = getBody(true, getWindowTitle(title));
|
||||
addTop(bodyTree);
|
||||
addNavLinks(true, bodyTree);
|
||||
return bodyTree;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, 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 java.io.IOException;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* The factory that returns HTML writers.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @since 1.5
|
||||
*/
|
||||
public class WriterFactoryImpl implements WriterFactory {
|
||||
|
||||
private final ConfigurationImpl configuration;
|
||||
|
||||
public WriterFactoryImpl(ConfigurationImpl configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public ConstantsSummaryWriter getConstantsSummaryWriter() throws Exception {
|
||||
return new ConstantsSummaryWriterImpl(configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public PackageSummaryWriter getPackageSummaryWriter(PackageDoc packageDoc,
|
||||
PackageDoc prevPkg, PackageDoc nextPkg) throws Exception {
|
||||
return new PackageWriterImpl(configuration, packageDoc,
|
||||
prevPkg, nextPkg);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public ProfileSummaryWriter getProfileSummaryWriter(Profile profile,
|
||||
Profile prevProfile, Profile nextProfile) throws Exception {
|
||||
return new ProfileWriterImpl(configuration, profile,
|
||||
prevProfile, nextProfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public ProfilePackageSummaryWriter getProfilePackageSummaryWriter(PackageDoc packageDoc,
|
||||
PackageDoc prevPkg, PackageDoc nextPkg, Profile profile) throws Exception {
|
||||
return new ProfilePackageWriterImpl(configuration, packageDoc,
|
||||
prevPkg, nextPkg, profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public ClassWriter getClassWriter(ClassDoc classDoc, ClassDoc prevClass,
|
||||
ClassDoc nextClass, ClassTree classTree) throws IOException {
|
||||
return new ClassWriterImpl(configuration, classDoc,
|
||||
prevClass, nextClass, classTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public AnnotationTypeWriter getAnnotationTypeWriter(
|
||||
AnnotationTypeDoc annotationType, Type prevType, Type nextType)
|
||||
throws Exception {
|
||||
return new AnnotationTypeWriterImpl(configuration,
|
||||
annotationType, prevType, nextType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public AnnotationTypeFieldWriter
|
||||
getAnnotationTypeFieldWriter(AnnotationTypeWriter annotationTypeWriter) throws Exception {
|
||||
return new AnnotationTypeFieldWriterImpl(
|
||||
(SubWriterHolderWriter) annotationTypeWriter,
|
||||
annotationTypeWriter.getAnnotationTypeDoc());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public AnnotationTypeOptionalMemberWriter
|
||||
getAnnotationTypeOptionalMemberWriter(
|
||||
AnnotationTypeWriter annotationTypeWriter) throws Exception {
|
||||
return new AnnotationTypeOptionalMemberWriterImpl(
|
||||
(SubWriterHolderWriter) annotationTypeWriter,
|
||||
annotationTypeWriter.getAnnotationTypeDoc());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public AnnotationTypeRequiredMemberWriter
|
||||
getAnnotationTypeRequiredMemberWriter(AnnotationTypeWriter annotationTypeWriter) throws Exception {
|
||||
return new AnnotationTypeRequiredMemberWriterImpl(
|
||||
(SubWriterHolderWriter) annotationTypeWriter,
|
||||
annotationTypeWriter.getAnnotationTypeDoc());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public EnumConstantWriterImpl getEnumConstantWriter(ClassWriter classWriter)
|
||||
throws Exception {
|
||||
return new EnumConstantWriterImpl((SubWriterHolderWriter) classWriter,
|
||||
classWriter.getClassDoc());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public FieldWriterImpl getFieldWriter(ClassWriter classWriter)
|
||||
throws Exception {
|
||||
return new FieldWriterImpl((SubWriterHolderWriter) classWriter,
|
||||
classWriter.getClassDoc());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public PropertyWriterImpl getPropertyWriter(ClassWriter classWriter)
|
||||
throws Exception {
|
||||
return new PropertyWriterImpl((SubWriterHolderWriter) classWriter,
|
||||
classWriter.getClassDoc());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public MethodWriterImpl getMethodWriter(ClassWriter classWriter)
|
||||
throws Exception {
|
||||
return new MethodWriterImpl((SubWriterHolderWriter) classWriter,
|
||||
classWriter.getClassDoc());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public ConstructorWriterImpl getConstructorWriter(ClassWriter classWriter)
|
||||
throws Exception {
|
||||
return new ConstructorWriterImpl((SubWriterHolderWriter) classWriter,
|
||||
classWriter.getClassDoc());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public MemberSummaryWriter getMemberSummaryWriter(
|
||||
ClassWriter classWriter, int memberType)
|
||||
throws Exception {
|
||||
switch (memberType) {
|
||||
case VisibleMemberMap.CONSTRUCTORS:
|
||||
return getConstructorWriter(classWriter);
|
||||
case VisibleMemberMap.ENUM_CONSTANTS:
|
||||
return getEnumConstantWriter(classWriter);
|
||||
case VisibleMemberMap.FIELDS:
|
||||
return getFieldWriter(classWriter);
|
||||
case VisibleMemberMap.PROPERTIES:
|
||||
return getPropertyWriter(classWriter);
|
||||
case VisibleMemberMap.INNERCLASSES:
|
||||
return new NestedClassWriterImpl((SubWriterHolderWriter)
|
||||
classWriter, classWriter.getClassDoc());
|
||||
case VisibleMemberMap.METHODS:
|
||||
return getMethodWriter(classWriter);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public MemberSummaryWriter getMemberSummaryWriter(
|
||||
AnnotationTypeWriter annotationTypeWriter, int memberType)
|
||||
throws Exception {
|
||||
switch (memberType) {
|
||||
case VisibleMemberMap.ANNOTATION_TYPE_FIELDS:
|
||||
return (AnnotationTypeFieldWriterImpl)
|
||||
getAnnotationTypeFieldWriter(annotationTypeWriter);
|
||||
case VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL:
|
||||
return (AnnotationTypeOptionalMemberWriterImpl)
|
||||
getAnnotationTypeOptionalMemberWriter(annotationTypeWriter);
|
||||
case VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED:
|
||||
return (AnnotationTypeRequiredMemberWriterImpl)
|
||||
getAnnotationTypeRequiredMemberWriter(annotationTypeWriter);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public SerializedFormWriter getSerializedFormWriter() throws Exception {
|
||||
return new SerializedFormWriterImpl(configuration);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Class for generating a comment for HTML pages of javadoc output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public class Comment extends Content {
|
||||
|
||||
private String commentText;
|
||||
|
||||
/**
|
||||
* Constructor to construct a Comment object.
|
||||
*
|
||||
* @param comment comment text for the comment
|
||||
*/
|
||||
public Comment(String comment) {
|
||||
commentText = nullCheck(comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is not supported by the class.
|
||||
*
|
||||
* @param content content that needs to be added
|
||||
* @throws DocletAbortException this method will always throw a
|
||||
* DocletAbortException because it
|
||||
* is not supported.
|
||||
*/
|
||||
public void addContent(Content content) {
|
||||
throw new DocletAbortException("not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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("not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return commentText.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean write(Writer out, boolean atNewline) throws IOException {
|
||||
if (!atNewline)
|
||||
out.write(DocletConstants.NL);
|
||||
out.write("<!-- ");
|
||||
out.write(commentText);
|
||||
out.write(" -->" + DocletConstants.NL);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
|
||||
/**
|
||||
* A sequence of Content nodes.
|
||||
*/
|
||||
public class ContentBuilder extends Content {
|
||||
protected List<Content> contents = Collections.<Content>emptyList();
|
||||
|
||||
@Override
|
||||
public void addContent(Content content) {
|
||||
nullCheck(content);
|
||||
ensureMutableContents();
|
||||
if (content instanceof ContentBuilder) {
|
||||
contents.addAll(((ContentBuilder) content).contents);
|
||||
} else
|
||||
contents.add(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContent(String text) {
|
||||
if (text.isEmpty())
|
||||
return;
|
||||
ensureMutableContents();
|
||||
Content c = contents.isEmpty() ? null : contents.get(contents.size() - 1);
|
||||
StringContent sc;
|
||||
if (c != null && c instanceof StringContent) {
|
||||
sc = (StringContent) c;
|
||||
} else {
|
||||
contents.add(sc = new StringContent());
|
||||
}
|
||||
sc.addContent(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(Writer writer, boolean atNewline) throws IOException {
|
||||
for (Content content: contents) {
|
||||
atNewline = content.write(writer, atNewline);
|
||||
}
|
||||
return atNewline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
for (Content content: contents) {
|
||||
if (!content.isEmpty())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int charCount() {
|
||||
int n = 0;
|
||||
for (Content c : contents)
|
||||
n += c.charCount();
|
||||
return n;
|
||||
}
|
||||
|
||||
private void ensureMutableContents() {
|
||||
if (contents.isEmpty())
|
||||
contents = new ArrayList<Content>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Class for generating document type for HTML pages of javadoc output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public class DocType extends Content {
|
||||
|
||||
private String docType;
|
||||
|
||||
public static final DocType TRANSITIONAL =
|
||||
new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd");
|
||||
|
||||
public static final DocType FRAMESET =
|
||||
new DocType("Frameset", "http://www.w3.org/TR/html4/frameset.dtd");
|
||||
|
||||
/**
|
||||
* Constructor to construct a DocType object.
|
||||
*
|
||||
* @param type the doctype to be added
|
||||
*/
|
||||
private DocType(String type, String dtd) {
|
||||
docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " + type +
|
||||
"//EN\" \"" + dtd + "\">" + DocletConstants.NL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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("not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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("not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return (docType.length() == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean write(Writer out, boolean atNewline) throws IOException {
|
||||
out.write(docType);
|
||||
return true; // guaranteed by constructor
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, 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.javac.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Enum representing HTML tag attributes.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public enum HtmlAttr {
|
||||
ALT,
|
||||
BORDER,
|
||||
CELLPADDING,
|
||||
CELLSPACING,
|
||||
CLASS,
|
||||
CLEAR,
|
||||
COLS,
|
||||
CONTENT,
|
||||
HREF,
|
||||
HTTP_EQUIV("http-equiv"),
|
||||
ID,
|
||||
LANG,
|
||||
NAME,
|
||||
ONLOAD,
|
||||
REL,
|
||||
ROWS,
|
||||
SCOPE,
|
||||
SCROLLING,
|
||||
SRC,
|
||||
SUMMARY,
|
||||
TARGET,
|
||||
TITLE,
|
||||
TYPE,
|
||||
WIDTH;
|
||||
|
||||
private final String value;
|
||||
|
||||
HtmlAttr() {
|
||||
this.value = StringUtils.toLowerCase(name());
|
||||
}
|
||||
|
||||
HtmlAttr(String name) {
|
||||
this.value = name;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
|
||||
/**
|
||||
* Stores constants for Html Doclet.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public class HtmlConstants {
|
||||
|
||||
/**
|
||||
* Marker to identify start of top navigation bar.
|
||||
*/
|
||||
public static final Content START_OF_TOP_NAVBAR =
|
||||
new Comment("========= START OF TOP NAVBAR =======");
|
||||
|
||||
/**
|
||||
* Marker to identify start of bottom navigation bar.
|
||||
*/
|
||||
public static final Content START_OF_BOTTOM_NAVBAR =
|
||||
new Comment("======= START OF BOTTOM NAVBAR ======");
|
||||
|
||||
/**
|
||||
* Marker to identify end of top navigation bar.
|
||||
*/
|
||||
public static final Content END_OF_TOP_NAVBAR =
|
||||
new Comment("========= END OF TOP NAVBAR =========");
|
||||
|
||||
/**
|
||||
* Marker to identify end of bottom navigation bar.
|
||||
*/
|
||||
public static final Content END_OF_BOTTOM_NAVBAR =
|
||||
new Comment("======== END OF BOTTOM NAVBAR =======");
|
||||
|
||||
/**
|
||||
* Marker to identify start of class data.
|
||||
*/
|
||||
public static final Content START_OF_CLASS_DATA =
|
||||
new Comment("======== START OF CLASS DATA ========");
|
||||
|
||||
/**
|
||||
* Marker to identify end of class data.
|
||||
*/
|
||||
public static final Content END_OF_CLASS_DATA =
|
||||
new Comment("========= END OF CLASS DATA =========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of nested class summary.
|
||||
*/
|
||||
public static final Content START_OF_NESTED_CLASS_SUMMARY =
|
||||
new Comment("======== NESTED CLASS SUMMARY ========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of annotation type optional member summary.
|
||||
*/
|
||||
public static final Content START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY =
|
||||
new Comment("=========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY ===========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of annotation type required member summary.
|
||||
*/
|
||||
public static final Content START_OF_ANNOTATION_TYPE_REQUIRED_MEMBER_SUMMARY =
|
||||
new Comment("=========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY ===========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of annotation type required member summary.
|
||||
*/
|
||||
public static final Content START_OF_ANNOTATION_TYPE_FIELD_SUMMARY =
|
||||
new Comment("=========== ANNOTATION TYPE FIELD SUMMARY ===========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of constructor summary.
|
||||
*/
|
||||
public static final Content START_OF_CONSTRUCTOR_SUMMARY =
|
||||
new Comment("======== CONSTRUCTOR SUMMARY ========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of enum constants summary.
|
||||
*/
|
||||
public static final Content START_OF_ENUM_CONSTANT_SUMMARY =
|
||||
new Comment("=========== ENUM CONSTANT SUMMARY ===========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of field summary.
|
||||
*/
|
||||
public static final Content START_OF_FIELD_SUMMARY =
|
||||
new Comment("=========== FIELD SUMMARY ===========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of properties summary.
|
||||
*/
|
||||
public static final Content START_OF_PROPERTY_SUMMARY =
|
||||
new Comment("=========== PROPERTY SUMMARY ===========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of method summary.
|
||||
*/
|
||||
public static final Content START_OF_METHOD_SUMMARY =
|
||||
new Comment("========== METHOD SUMMARY ===========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of annotation type details.
|
||||
*/
|
||||
public static final Content START_OF_ANNOTATION_TYPE_DETAILS =
|
||||
new Comment("============ ANNOTATION TYPE MEMBER DETAIL ===========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of annotation type field details.
|
||||
*/
|
||||
public static final Content START_OF_ANNOTATION_TYPE_FIELD_DETAILS =
|
||||
new Comment("============ ANNOTATION TYPE FIELD DETAIL ===========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of method details.
|
||||
*/
|
||||
public static final Content START_OF_METHOD_DETAILS =
|
||||
new Comment("============ METHOD DETAIL ==========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of field details.
|
||||
*/
|
||||
public static final Content START_OF_FIELD_DETAILS =
|
||||
new Comment("============ FIELD DETAIL ===========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of property details.
|
||||
*/
|
||||
public static final Content START_OF_PROPERTY_DETAILS =
|
||||
new Comment("============ PROPERTY DETAIL ===========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of constructor details.
|
||||
*/
|
||||
public static final Content START_OF_CONSTRUCTOR_DETAILS =
|
||||
new Comment("========= CONSTRUCTOR DETAIL ========");
|
||||
|
||||
/**
|
||||
* Marker to identify start of enum constants details.
|
||||
*/
|
||||
public static final Content START_OF_ENUM_CONSTANT_DETAILS =
|
||||
new Comment("============ ENUM CONSTANT DETAIL ===========");
|
||||
|
||||
/**
|
||||
* Html tag for the page title heading.
|
||||
*/
|
||||
public static final HtmlTag TITLE_HEADING = HtmlTag.H1;
|
||||
|
||||
/**
|
||||
* Html tag for the class page title heading.
|
||||
*/
|
||||
public static final HtmlTag CLASS_PAGE_HEADING = HtmlTag.H2;
|
||||
|
||||
/**
|
||||
* Html tag for the content heading.
|
||||
*/
|
||||
public static final HtmlTag CONTENT_HEADING = HtmlTag.H2;
|
||||
|
||||
/**
|
||||
* Html tag for the package name heading.
|
||||
*/
|
||||
public static final HtmlTag PACKAGE_HEADING = HtmlTag.H2;
|
||||
|
||||
/**
|
||||
* Html tag for the profile name heading.
|
||||
*/
|
||||
public static final HtmlTag PROFILE_HEADING = HtmlTag.H2;
|
||||
|
||||
/**
|
||||
* Html tag for the member summary heading.
|
||||
*/
|
||||
public static final HtmlTag SUMMARY_HEADING = HtmlTag.H3;
|
||||
|
||||
/**
|
||||
* Html tag for the inherited member summary heading.
|
||||
*/
|
||||
public static final HtmlTag INHERITED_SUMMARY_HEADING = HtmlTag.H3;
|
||||
|
||||
/**
|
||||
* Html tag for the member details heading.
|
||||
*/
|
||||
public static final HtmlTag DETAILS_HEADING = HtmlTag.H3;
|
||||
|
||||
/**
|
||||
* Html tag for the serialized member heading.
|
||||
*/
|
||||
public static final HtmlTag SERIALIZED_MEMBER_HEADING = HtmlTag.H3;
|
||||
|
||||
/**
|
||||
* Html tag for the member heading.
|
||||
*/
|
||||
public static final HtmlTag MEMBER_HEADING = HtmlTag.H4;
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.formats.html.ConfigurationImpl;
|
||||
import com.sun.tools.doclets.formats.html.SectionName;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.DocFile;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.DocLink;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.DocPath;
|
||||
|
||||
|
||||
/**
|
||||
* Class for the Html Format Code Generation specific to JavaDoc.
|
||||
* This Class contains methods related to the Html Code Generation which
|
||||
* are used by the Sub-Classes in the package com.sun.tools.doclets.standard
|
||||
* and com.sun.tools.doclets.oneone.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @since 1.2
|
||||
* @author Atul M Dambalkar
|
||||
* @author Robert Field
|
||||
*/
|
||||
public abstract class HtmlDocWriter extends HtmlWriter {
|
||||
|
||||
public static final String CONTENT_TYPE = "text/html";
|
||||
|
||||
/**
|
||||
* Constructor. Initializes the destination file name through the super
|
||||
* class HtmlWriter.
|
||||
*
|
||||
* @param filename String file name.
|
||||
*/
|
||||
public HtmlDocWriter(Configuration configuration, DocPath filename)
|
||||
throws IOException {
|
||||
super(configuration, filename);
|
||||
configuration.message.notice("doclet.Generating_0",
|
||||
DocFile.createFileForOutput(configuration, filename).getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for configuration.
|
||||
*/
|
||||
public abstract Configuration configuration();
|
||||
|
||||
public Content getHyperLink(DocPath link, String label) {
|
||||
return getHyperLink(link, new StringContent(label), false, "", "", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Html Hyper Link Content.
|
||||
*
|
||||
* @param where Position of the link in the file. Character '#' is not
|
||||
* needed.
|
||||
* @param label Tag for the link.
|
||||
* @return a content tree for the hyper link
|
||||
*/
|
||||
public Content getHyperLink(String where,
|
||||
Content label) {
|
||||
return getHyperLink(getDocLink(where), label, "", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Html Hyper Link Content.
|
||||
*
|
||||
* @param sectionName The section name to which the link will be created.
|
||||
* @param label Tag for the link.
|
||||
* @return a content tree for the hyper link
|
||||
*/
|
||||
public Content getHyperLink(SectionName sectionName,
|
||||
Content label) {
|
||||
return getHyperLink(getDocLink(sectionName), label, "", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Html Hyper Link Content.
|
||||
*
|
||||
* @param sectionName The section name combined with where to which the link
|
||||
* will be created.
|
||||
* @param where The fragment combined with sectionName to which the link
|
||||
* will be created.
|
||||
* @param label Tag for the link.
|
||||
* @return a content tree for the hyper link
|
||||
*/
|
||||
public Content getHyperLink(SectionName sectionName, String where,
|
||||
Content label) {
|
||||
return getHyperLink(getDocLink(sectionName, where), label, "", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the link.
|
||||
*
|
||||
* @param where Position of the link in the file.
|
||||
* @return a DocLink object for the hyper link
|
||||
*/
|
||||
public DocLink getDocLink(String where) {
|
||||
return DocLink.fragment(getName(where));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the link.
|
||||
*
|
||||
* @param sectionName The section name to which the link will be created.
|
||||
* @return a DocLink object for the hyper link
|
||||
*/
|
||||
public DocLink getDocLink(SectionName sectionName) {
|
||||
return DocLink.fragment(sectionName.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the link.
|
||||
*
|
||||
* @param sectionName The section name combined with where to which the link
|
||||
* will be created.
|
||||
* @param where The fragment combined with sectionName to which the link
|
||||
* will be created.
|
||||
* @return a DocLink object for the hyper link
|
||||
*/
|
||||
public DocLink getDocLink(SectionName sectionName, String where) {
|
||||
return DocLink.fragment(sectionName.getName() + getName(where));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the name to a valid HTML name.
|
||||
*
|
||||
* @param name the name that needs to be converted to valid HTML name.
|
||||
* @return a valid HTML name string.
|
||||
*/
|
||||
public String getName(String name) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
char ch;
|
||||
/* The HTML 4 spec at http://www.w3.org/TR/html4/types.html#h-6.2 mentions
|
||||
* that the name/id should begin with a letter followed by other valid characters.
|
||||
* The HTML 5 spec (draft) is more permissive on names/ids where the only restriction
|
||||
* is that it should be at least one character long and should not contain spaces.
|
||||
* The spec draft is @ http://www.w3.org/html/wg/drafts/html/master/dom.html#the-id-attribute.
|
||||
*
|
||||
* For HTML 4, we need to check for non-characters at the beginning of the name and
|
||||
* substitute it accordingly, "_" and "$" can appear at the beginning of a member name.
|
||||
* The method substitutes "$" with "Z:Z:D" and will prefix "_" with "Z:Z".
|
||||
*/
|
||||
for (int i = 0; i < name.length(); i++) {
|
||||
ch = name.charAt(i);
|
||||
switch (ch) {
|
||||
case '(':
|
||||
case ')':
|
||||
case '<':
|
||||
case '>':
|
||||
case ',':
|
||||
sb.append('-');
|
||||
break;
|
||||
case ' ':
|
||||
case '[':
|
||||
break;
|
||||
case ']':
|
||||
sb.append(":A");
|
||||
break;
|
||||
// Any appearance of $ needs to be substituted with ":D" and not with hyphen
|
||||
// since a field name "P$$ and a method P(), both valid member names, can end
|
||||
// up as "P--". A member name beginning with $ needs to be substituted with
|
||||
// "Z:Z:D".
|
||||
case '$':
|
||||
if (i == 0)
|
||||
sb.append("Z:Z");
|
||||
sb.append(":D");
|
||||
break;
|
||||
// A member name beginning with _ needs to be prefixed with "Z:Z" since valid anchor
|
||||
// names can only begin with a letter.
|
||||
case '_':
|
||||
if (i == 0)
|
||||
sb.append("Z:Z");
|
||||
sb.append(ch);
|
||||
break;
|
||||
default:
|
||||
sb.append(ch);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Html hyperlink.
|
||||
*
|
||||
* @param link path of the file.
|
||||
* @param label Tag for the link.
|
||||
* @return a content tree for the hyper link
|
||||
*/
|
||||
public Content getHyperLink(DocPath link, Content label) {
|
||||
return getHyperLink(link, label, "", "");
|
||||
}
|
||||
|
||||
public Content getHyperLink(DocLink link, Content label) {
|
||||
return getHyperLink(link, label, "", "");
|
||||
}
|
||||
|
||||
public Content getHyperLink(DocPath link,
|
||||
Content label, boolean strong,
|
||||
String stylename, String title, String target) {
|
||||
return getHyperLink(new DocLink(link), label, strong,
|
||||
stylename, title, target);
|
||||
}
|
||||
|
||||
public Content getHyperLink(DocLink link,
|
||||
Content label, boolean strong,
|
||||
String stylename, String title, String target) {
|
||||
Content body = label;
|
||||
if (strong) {
|
||||
body = HtmlTree.SPAN(HtmlStyle.typeNameLink, body);
|
||||
}
|
||||
if (stylename != null && stylename.length() != 0) {
|
||||
HtmlTree t = new HtmlTree(HtmlTag.FONT, body);
|
||||
t.addAttr(HtmlAttr.CLASS, stylename);
|
||||
body = t;
|
||||
}
|
||||
HtmlTree l = HtmlTree.A(link.toString(), body);
|
||||
if (title != null && title.length() != 0) {
|
||||
l.addAttr(HtmlAttr.TITLE, title);
|
||||
}
|
||||
if (target != null && target.length() != 0) {
|
||||
l.addAttr(HtmlAttr.TARGET, target);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Html Hyper Link.
|
||||
*
|
||||
* @param link String name of the file.
|
||||
* @param label Tag for the link.
|
||||
* @param title String that describes the link's content for accessibility.
|
||||
* @param target Target frame.
|
||||
* @return a content tree for the hyper link.
|
||||
*/
|
||||
public Content getHyperLink(DocPath link,
|
||||
Content label, String title, String target) {
|
||||
return getHyperLink(new DocLink(link), label, title, target);
|
||||
}
|
||||
|
||||
public Content getHyperLink(DocLink link,
|
||||
Content label, String title, String target) {
|
||||
HtmlTree anchor = HtmlTree.A(link.toString(), label);
|
||||
if (title != null && title.length() != 0) {
|
||||
anchor.addAttr(HtmlAttr.TITLE, title);
|
||||
}
|
||||
if (target != null && target.length() != 0) {
|
||||
anchor.addAttr(HtmlAttr.TARGET, target);
|
||||
}
|
||||
return anchor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the package, this class is in.
|
||||
*
|
||||
* @param cd ClassDoc.
|
||||
*/
|
||||
public String getPkgName(ClassDoc cd) {
|
||||
String pkgName = cd.containingPackage().name();
|
||||
if (pkgName.length() > 0) {
|
||||
pkgName += ".";
|
||||
return pkgName;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean getMemberDetailsListPrinted() {
|
||||
return memberDetailsListPrinted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the frameset version of the Html file header.
|
||||
* Called only when generating an HTML frameset file.
|
||||
*
|
||||
* @param title Title of this HTML document
|
||||
* @param noTimeStamp If true, don't print time stamp in header
|
||||
* @param frameset the frameset to be added to the HTML document
|
||||
*/
|
||||
public void printFramesetDocument(String title, boolean noTimeStamp,
|
||||
Content frameset) throws IOException {
|
||||
Content htmlDocType = DocType.FRAMESET;
|
||||
Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
|
||||
Content head = new HtmlTree(HtmlTag.HEAD);
|
||||
head.addContent(getGeneratedBy(!noTimeStamp));
|
||||
if (configuration.charset.length() > 0) {
|
||||
Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
|
||||
configuration.charset);
|
||||
head.addContent(meta);
|
||||
}
|
||||
Content windowTitle = HtmlTree.TITLE(new StringContent(title));
|
||||
head.addContent(windowTitle);
|
||||
head.addContent(getFramesetJavaScript());
|
||||
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
|
||||
head, frameset);
|
||||
Content htmlDocument = new HtmlDocument(htmlDocType,
|
||||
htmlComment, htmlTree);
|
||||
write(htmlDocument);
|
||||
}
|
||||
|
||||
protected Comment getGeneratedBy(boolean timestamp) {
|
||||
String text = "Generated by javadoc"; // marker string, deliberately not localized
|
||||
if (timestamp) {
|
||||
Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
|
||||
Date today = calendar.getTime();
|
||||
text += " ("+ configuration.getDocletSpecificBuildDate() + ") on " + today;
|
||||
}
|
||||
return new Comment(text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Class for generating an HTML document for javadoc output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public class HtmlDocument extends Content {
|
||||
|
||||
private List<Content> docContent = Collections.<Content>emptyList();
|
||||
|
||||
/**
|
||||
* Constructor to construct an HTML document.
|
||||
*
|
||||
* @param docType document type for the HTML document
|
||||
* @param docComment comment for the document
|
||||
* @param htmlTree HTML tree of the document
|
||||
*/
|
||||
public HtmlDocument(Content docType, Content docComment, Content htmlTree) {
|
||||
docContent = new ArrayList<Content>();
|
||||
addContent(nullCheck(docType));
|
||||
addContent(nullCheck(docComment));
|
||||
addContent(nullCheck(htmlTree));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor to construct an HTML document.
|
||||
*
|
||||
* @param docType document type for the HTML document
|
||||
* @param htmlTree HTML tree of the document
|
||||
*/
|
||||
public HtmlDocument(Content docType, Content htmlTree) {
|
||||
docContent = new ArrayList<Content>();
|
||||
addContent(nullCheck(docType));
|
||||
addContent(nullCheck(htmlTree));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds content for the HTML document.
|
||||
*
|
||||
* @param htmlContent html content to be added
|
||||
*/
|
||||
public final void addContent(Content htmlContent) {
|
||||
if (htmlContent.isValid())
|
||||
docContent.add(htmlContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is not supported by the class.
|
||||
*
|
||||
* @param stringContent string content that needs to be added
|
||||
* @throws DocletAbortException this method will always throw a
|
||||
* DocletAbortException because it
|
||||
* is not supported.
|
||||
*/
|
||||
public void addContent(String stringContent) {
|
||||
throw new DocletAbortException("not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return (docContent.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean write(Writer out, boolean atNewline) throws IOException {
|
||||
for (Content c : docContent)
|
||||
atNewline = c.write(out, atNewline);
|
||||
return atNewline;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
|
||||
/**
|
||||
* Enum representing HTML styles. The name map to values in the CSS file.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public enum HtmlStyle {
|
||||
aboutLanguage,
|
||||
activeTableTab,
|
||||
altColor,
|
||||
bar,
|
||||
block,
|
||||
blockList,
|
||||
blockListLast,
|
||||
bottomNav,
|
||||
classUseContainer,
|
||||
colFirst,
|
||||
colLast,
|
||||
colOne,
|
||||
constantsSummary,
|
||||
constantValuesContainer,
|
||||
contentContainer,
|
||||
deprecatedContent,
|
||||
deprecatedLabel,
|
||||
deprecatedSummary,
|
||||
deprecationComment,
|
||||
description,
|
||||
descfrmTypeLabel,
|
||||
details,
|
||||
docSummary,
|
||||
emphasizedPhrase,
|
||||
header,
|
||||
horizontal,
|
||||
footer,
|
||||
indexContainer,
|
||||
indexHeader,
|
||||
inheritance,
|
||||
interfaceName,
|
||||
legalCopy,
|
||||
memberNameLabel,
|
||||
memberNameLink,
|
||||
memberSummary,
|
||||
nameValue,
|
||||
navBarCell1Rev,
|
||||
navList,
|
||||
overrideSpecifyLabel,
|
||||
overviewSummary,
|
||||
packageHierarchyLabel,
|
||||
paramLabel,
|
||||
returnLabel,
|
||||
rowColor,
|
||||
seeLabel,
|
||||
serializedFormContainer,
|
||||
simpleTagLabel,
|
||||
skipNav,
|
||||
sourceContainer,
|
||||
sourceLineNo,
|
||||
subNav,
|
||||
subNavList,
|
||||
subTitle,
|
||||
summary,
|
||||
tabEnd,
|
||||
tableTab,
|
||||
throwsLabel,
|
||||
title,
|
||||
topNav,
|
||||
typeNameLabel,
|
||||
typeNameLink,
|
||||
typeSummary,
|
||||
useSummary;
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, 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.javac.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Enum representing HTML tags.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public enum HtmlTag {
|
||||
A(BlockType.INLINE, EndTag.END),
|
||||
BLOCKQUOTE,
|
||||
BODY(BlockType.OTHER, EndTag.END),
|
||||
BR(BlockType.INLINE, EndTag.NOEND),
|
||||
CAPTION,
|
||||
CENTER,
|
||||
CODE(BlockType.INLINE, EndTag.END),
|
||||
DD,
|
||||
DIR,
|
||||
DIV,
|
||||
DL,
|
||||
DT,
|
||||
EM(BlockType.INLINE, EndTag.END),
|
||||
FONT(BlockType.INLINE, EndTag.END),
|
||||
FRAME(BlockType.OTHER, EndTag.NOEND),
|
||||
FRAMESET(BlockType.OTHER, EndTag.END),
|
||||
H1,
|
||||
H2,
|
||||
H3,
|
||||
H4,
|
||||
H5,
|
||||
H6,
|
||||
HEAD(BlockType.OTHER, EndTag.END),
|
||||
HR(BlockType.BLOCK, EndTag.NOEND),
|
||||
HTML(BlockType.OTHER, EndTag.END),
|
||||
I(BlockType.INLINE, EndTag.END),
|
||||
IMG(BlockType.INLINE, EndTag.NOEND),
|
||||
LI,
|
||||
LISTING,
|
||||
LINK(BlockType.OTHER, EndTag.NOEND),
|
||||
MENU,
|
||||
META(BlockType.OTHER, EndTag.NOEND),
|
||||
NOFRAMES(BlockType.OTHER, EndTag.END),
|
||||
NOSCRIPT(BlockType.OTHER, EndTag.END),
|
||||
OL,
|
||||
P,
|
||||
PRE,
|
||||
SCRIPT(BlockType.OTHER, EndTag.END),
|
||||
SMALL(BlockType.INLINE, EndTag.END),
|
||||
SPAN(BlockType.INLINE, EndTag.END),
|
||||
STRONG(BlockType.INLINE, EndTag.END),
|
||||
SUB(BlockType.INLINE, EndTag.END),
|
||||
TABLE,
|
||||
TBODY,
|
||||
TD,
|
||||
TH,
|
||||
TITLE(BlockType.OTHER, EndTag.END),
|
||||
TR,
|
||||
TT(BlockType.INLINE, EndTag.END),
|
||||
UL;
|
||||
|
||||
public final BlockType blockType;
|
||||
public final EndTag endTag;
|
||||
public final String value;
|
||||
|
||||
/**
|
||||
* Enum representing the type of HTML element.
|
||||
*/
|
||||
public static enum BlockType {
|
||||
BLOCK,
|
||||
INLINE,
|
||||
OTHER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum representing HTML end tag requirement.
|
||||
*/
|
||||
public static enum EndTag {
|
||||
END,
|
||||
NOEND;
|
||||
}
|
||||
|
||||
HtmlTag() {
|
||||
this(BlockType.BLOCK, EndTag.END);
|
||||
}
|
||||
|
||||
HtmlTag(BlockType blockType, EndTag endTag ) {
|
||||
this.blockType = blockType;
|
||||
this.endTag = endTag;
|
||||
this.value = StringUtils.toLowerCase(name());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the end tag is required. This is specific to the standard
|
||||
* doclet and does not exactly resemble the W3C specifications.
|
||||
*
|
||||
* @return true if end tag needs to be displayed else return false
|
||||
*/
|
||||
public boolean endTagRequired() {
|
||||
return (endTag == EndTag.END);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,869 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.*;
|
||||
import java.nio.charset.*;
|
||||
|
||||
import com.sun.tools.doclets.internal.toolkit.Content;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Class for generating HTML tree for javadoc output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public class HtmlTree extends Content {
|
||||
|
||||
private HtmlTag htmlTag;
|
||||
private Map<HtmlAttr,String> attrs = Collections.<HtmlAttr,String>emptyMap();
|
||||
private List<Content> content = Collections.<Content>emptyList();
|
||||
public static final Content EMPTY = new StringContent("");
|
||||
|
||||
/**
|
||||
* Constructor to construct HtmlTree object.
|
||||
*
|
||||
* @param tag HTML tag for the HtmlTree object
|
||||
*/
|
||||
public HtmlTree(HtmlTag tag) {
|
||||
htmlTag = nullCheck(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor to construct HtmlTree object.
|
||||
*
|
||||
* @param tag HTML tag for the HtmlTree object
|
||||
* @param contents contents to be added to the tree
|
||||
*/
|
||||
public HtmlTree(HtmlTag tag, Content... contents) {
|
||||
this(tag);
|
||||
for (Content content: contents)
|
||||
addContent(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an attribute for the HTML tag.
|
||||
*
|
||||
* @param attrName name of the attribute
|
||||
* @param attrValue value of the attribute
|
||||
*/
|
||||
public void addAttr(HtmlAttr attrName, String attrValue) {
|
||||
if (attrs.isEmpty())
|
||||
attrs = new LinkedHashMap<HtmlAttr,String>(3);
|
||||
attrs.put(nullCheck(attrName), escapeHtmlChars(attrValue));
|
||||
}
|
||||
|
||||
public void setTitle(Content body) {
|
||||
addAttr(HtmlAttr.TITLE, stripHtml(body));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a style for the HTML tag.
|
||||
*
|
||||
* @param style style to be added
|
||||
*/
|
||||
public void addStyle(HtmlStyle style) {
|
||||
addAttr(HtmlAttr.CLASS, style.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds content for the HTML tag.
|
||||
*
|
||||
* @param tagContent tag content to be added
|
||||
*/
|
||||
public void addContent(Content tagContent) {
|
||||
if (tagContent instanceof ContentBuilder) {
|
||||
for (Content content: ((ContentBuilder)tagContent).contents) {
|
||||
addContent(content);
|
||||
}
|
||||
}
|
||||
else if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
|
||||
if (content.isEmpty())
|
||||
content = new ArrayList<Content>();
|
||||
content.add(tagContent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method adds a string content to the htmltree. If the last content member
|
||||
* added is a StringContent, append the string to that StringContent or else
|
||||
* create a new StringContent and add it to the html tree.
|
||||
*
|
||||
* @param stringContent string content that needs to be added
|
||||
*/
|
||||
public void addContent(String stringContent) {
|
||||
if (!content.isEmpty()) {
|
||||
Content lastContent = content.get(content.size() - 1);
|
||||
if (lastContent instanceof StringContent)
|
||||
lastContent.addContent(stringContent);
|
||||
else
|
||||
addContent(new StringContent(stringContent));
|
||||
}
|
||||
else
|
||||
addContent(new StringContent(stringContent));
|
||||
}
|
||||
|
||||
public int charCount() {
|
||||
int n = 0;
|
||||
for (Content c : content)
|
||||
n += c.charCount();
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a string, escape all special html characters and
|
||||
* return the result.
|
||||
*
|
||||
* @param s The string to check.
|
||||
* @return the original string with all of the HTML characters escaped.
|
||||
*/
|
||||
private static String escapeHtmlChars(String s) {
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
switch (ch) {
|
||||
// only start building a new string if we need to
|
||||
case '<': case '>': case '&':
|
||||
StringBuilder sb = new StringBuilder(s.substring(0, i));
|
||||
for ( ; i < s.length(); i++) {
|
||||
ch = s.charAt(i);
|
||||
switch (ch) {
|
||||
case '<': sb.append("<"); break;
|
||||
case '>': sb.append(">"); break;
|
||||
case '&': sb.append("&"); break;
|
||||
default: sb.append(ch); break;
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* A set of ASCII URI characters to be left unencoded.
|
||||
*/
|
||||
public static final BitSet NONENCODING_CHARS = new BitSet(256);
|
||||
|
||||
static {
|
||||
// alphabetic characters
|
||||
for (int i = 'a'; i <= 'z'; i++) {
|
||||
NONENCODING_CHARS.set(i);
|
||||
}
|
||||
for (int i = 'A'; i <= 'Z'; i++) {
|
||||
NONENCODING_CHARS.set(i);
|
||||
}
|
||||
// numeric characters
|
||||
for (int i = '0'; i <= '9'; i++) {
|
||||
NONENCODING_CHARS.set(i);
|
||||
}
|
||||
// Reserved characters as per RFC 3986. These are set of delimiting characters.
|
||||
String noEnc = ":/?#[]@!$&'()*+,;=";
|
||||
// Unreserved characters as per RFC 3986 which should not be percent encoded.
|
||||
noEnc += "-._~";
|
||||
for (int i = 0; i < noEnc.length(); i++) {
|
||||
NONENCODING_CHARS.set(noEnc.charAt(i));
|
||||
}
|
||||
}
|
||||
|
||||
private static String encodeURL(String url) {
|
||||
byte[] urlBytes = url.getBytes(Charset.forName("UTF-8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < urlBytes.length; i++) {
|
||||
int c = urlBytes[i];
|
||||
if (NONENCODING_CHARS.get(c & 0xFF)) {
|
||||
sb.append((char) c);
|
||||
} else {
|
||||
sb.append(String.format("%%%02X", c & 0xFF));
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an HTML anchor tag.
|
||||
*
|
||||
* @param ref reference url for the anchor tag
|
||||
* @param body content for the anchor tag
|
||||
* @return an HtmlTree object
|
||||
*/
|
||||
public static HtmlTree A(String ref, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body));
|
||||
htmltree.addAttr(HtmlAttr.HREF, encodeURL(ref));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an HTML anchor tag with name attribute and content.
|
||||
*
|
||||
* @param name name for the anchor tag
|
||||
* @param body content for the anchor tag
|
||||
* @return an HtmlTree object
|
||||
*/
|
||||
public static HtmlTree A_NAME(String name, Content body) {
|
||||
HtmlTree htmltree = HtmlTree.A_NAME(name);
|
||||
htmltree.addContent(nullCheck(body));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an HTML anchor tag with name attribute.
|
||||
*
|
||||
* @param name name for the anchor tag
|
||||
* @return an HtmlTree object
|
||||
*/
|
||||
public static HtmlTree A_NAME(String name) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.A);
|
||||
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a CAPTION tag with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the CAPTION tag
|
||||
*/
|
||||
public static HtmlTree CAPTION(Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.CAPTION, nullCheck(body));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a CODE tag with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the CODE tag
|
||||
*/
|
||||
public static HtmlTree CODE(Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.CODE, nullCheck(body));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a DD tag with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the DD tag
|
||||
*/
|
||||
public static HtmlTree DD(Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.DD, nullCheck(body));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a DL tag with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the DL tag
|
||||
*/
|
||||
public static HtmlTree DL(Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.DL, nullCheck(body));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a DIV tag with the style class attributes. It also encloses
|
||||
* a content.
|
||||
*
|
||||
* @param styleClass stylesheet class for the tag
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the DIV tag
|
||||
*/
|
||||
public static HtmlTree DIV(HtmlStyle styleClass, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.DIV, nullCheck(body));
|
||||
if (styleClass != null)
|
||||
htmltree.addStyle(styleClass);
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a DIV tag with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the DIV tag
|
||||
*/
|
||||
public static HtmlTree DIV(Content body) {
|
||||
return DIV(null, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a DT tag with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the DT tag
|
||||
*/
|
||||
public static HtmlTree DT(Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.DT, nullCheck(body));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a FRAME tag.
|
||||
*
|
||||
* @param src the url of the document to be shown in the frame
|
||||
* @param name specifies the name of the frame
|
||||
* @param title the title for the frame
|
||||
* @param scrolling specifies whether to display scrollbars in the frame
|
||||
* @return an HtmlTree object for the FRAME tag
|
||||
*/
|
||||
public static HtmlTree FRAME(String src, String name, String title, String scrolling) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAME);
|
||||
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
|
||||
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
|
||||
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
|
||||
if (scrolling != null)
|
||||
htmltree.addAttr(HtmlAttr.SCROLLING, scrolling);
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a Frame tag.
|
||||
*
|
||||
* @param src the url of the document to be shown in the frame
|
||||
* @param name specifies the name of the frame
|
||||
* @param title the title for the frame
|
||||
* @return an HtmlTree object for the SPAN tag
|
||||
*/
|
||||
public static HtmlTree FRAME(String src, String name, String title) {
|
||||
return FRAME(src, name, title, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a FRAMESET tag.
|
||||
*
|
||||
* @param cols the size of columns in the frameset
|
||||
* @param rows the size of rows in the frameset
|
||||
* @param title the title for the frameset
|
||||
* @param onload the script to run when the document loads
|
||||
* @return an HtmlTree object for the FRAMESET tag
|
||||
*/
|
||||
public static HtmlTree FRAMESET(String cols, String rows, String title, String onload) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAMESET);
|
||||
if (cols != null)
|
||||
htmltree.addAttr(HtmlAttr.COLS, cols);
|
||||
if (rows != null)
|
||||
htmltree.addAttr(HtmlAttr.ROWS, rows);
|
||||
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
|
||||
htmltree.addAttr(HtmlAttr.ONLOAD, nullCheck(onload));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a heading tag (h1 to h6) with the title and style class attributes. It also encloses
|
||||
* a content.
|
||||
*
|
||||
* @param headingTag the heading tag to be generated
|
||||
* @param printTitle true if title for the tag needs to be printed else false
|
||||
* @param styleClass stylesheet class for the tag
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the tag
|
||||
*/
|
||||
public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle,
|
||||
HtmlStyle styleClass, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body));
|
||||
if (printTitle)
|
||||
htmltree.setTitle(body);
|
||||
if (styleClass != null)
|
||||
htmltree.addStyle(styleClass);
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a heading tag (h1 to h6) with style class attribute. It also encloses
|
||||
* a content.
|
||||
*
|
||||
* @param headingTag the heading tag to be generated
|
||||
* @param styleClass stylesheet class for the tag
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the tag
|
||||
*/
|
||||
public static HtmlTree HEADING(HtmlTag headingTag, HtmlStyle styleClass, Content body) {
|
||||
return HEADING(headingTag, false, styleClass, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a heading tag (h1 to h6) with the title attribute. It also encloses
|
||||
* a content.
|
||||
*
|
||||
* @param headingTag the heading tag to be generated
|
||||
* @param printTitle true if the title for the tag needs to be printed else false
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the tag
|
||||
*/
|
||||
public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle, Content body) {
|
||||
return HEADING(headingTag, printTitle, null, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a heading tag (h1 to h6) with some content.
|
||||
*
|
||||
* @param headingTag the heading tag to be generated
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the tag
|
||||
*/
|
||||
public static HtmlTree HEADING(HtmlTag headingTag, Content body) {
|
||||
return HEADING(headingTag, false, null, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an HTML tag with lang attribute. It also adds head and body
|
||||
* content to the HTML tree.
|
||||
*
|
||||
* @param lang language for the HTML document
|
||||
* @param head head for the HTML tag
|
||||
* @param body body for the HTML tag
|
||||
* @return an HtmlTree object for the HTML tag
|
||||
*/
|
||||
public static HtmlTree HTML(String lang, Content head, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.HTML, nullCheck(head), nullCheck(body));
|
||||
htmltree.addAttr(HtmlAttr.LANG, nullCheck(lang));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a LI tag with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the LI tag
|
||||
*/
|
||||
public static HtmlTree LI(Content body) {
|
||||
return LI(null, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a LI tag with some content.
|
||||
*
|
||||
* @param styleClass style for the tag
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the LI tag
|
||||
*/
|
||||
public static HtmlTree LI(HtmlStyle styleClass, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.LI, nullCheck(body));
|
||||
if (styleClass != null)
|
||||
htmltree.addStyle(styleClass);
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a LINK tag with the rel, type, href and title attributes.
|
||||
*
|
||||
* @param rel relevance of the link
|
||||
* @param type type of link
|
||||
* @param href the path for the link
|
||||
* @param title title for the link
|
||||
* @return an HtmlTree object for the LINK tag
|
||||
*/
|
||||
public static HtmlTree LINK(String rel, String type, String href, String title) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.LINK);
|
||||
htmltree.addAttr(HtmlAttr.REL, nullCheck(rel));
|
||||
htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
|
||||
htmltree.addAttr(HtmlAttr.HREF, nullCheck(href));
|
||||
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a META tag with the http-equiv, content and charset attributes.
|
||||
*
|
||||
* @param httpEquiv http equiv attribute for the META tag
|
||||
* @param content type of content
|
||||
* @param charSet character set used
|
||||
* @return an HtmlTree object for the META tag
|
||||
*/
|
||||
public static HtmlTree META(String httpEquiv, String content, String charSet) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.META);
|
||||
String contentCharset = content + "; charset=" + charSet;
|
||||
htmltree.addAttr(HtmlAttr.HTTP_EQUIV, nullCheck(httpEquiv));
|
||||
htmltree.addAttr(HtmlAttr.CONTENT, contentCharset);
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a META tag with the name and content attributes.
|
||||
*
|
||||
* @param name name attribute
|
||||
* @param content type of content
|
||||
* @return an HtmlTree object for the META tag
|
||||
*/
|
||||
public static HtmlTree META(String name, String content) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.META);
|
||||
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
|
||||
htmltree.addAttr(HtmlAttr.CONTENT, nullCheck(content));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a NOSCRIPT tag with some content.
|
||||
*
|
||||
* @param body content of the noscript tag
|
||||
* @return an HtmlTree object for the NOSCRIPT tag
|
||||
*/
|
||||
public static HtmlTree NOSCRIPT(Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.NOSCRIPT, nullCheck(body));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a P tag with some content.
|
||||
*
|
||||
* @param body content of the Paragraph tag
|
||||
* @return an HtmlTree object for the P tag
|
||||
*/
|
||||
public static HtmlTree P(Content body) {
|
||||
return P(null, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a P tag with some content.
|
||||
*
|
||||
* @param styleClass style of the Paragraph tag
|
||||
* @param body content of the Paragraph tag
|
||||
* @return an HtmlTree object for the P tag
|
||||
*/
|
||||
public static HtmlTree P(HtmlStyle styleClass, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.P, nullCheck(body));
|
||||
if (styleClass != null)
|
||||
htmltree.addStyle(styleClass);
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a SCRIPT tag with the type and src attributes.
|
||||
*
|
||||
* @param type type of link
|
||||
* @param src the path for the script
|
||||
* @return an HtmlTree object for the SCRIPT tag
|
||||
*/
|
||||
public static HtmlTree SCRIPT(String type, String src) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.SCRIPT);
|
||||
htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
|
||||
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a SMALL tag with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the SMALL tag
|
||||
*/
|
||||
public static HtmlTree SMALL(Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.SMALL, nullCheck(body));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a SPAN tag with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the SPAN tag
|
||||
*/
|
||||
public static HtmlTree SPAN(Content body) {
|
||||
return SPAN(null, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a SPAN tag with style class attribute and some content.
|
||||
*
|
||||
* @param styleClass style class for the tag
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the SPAN tag
|
||||
*/
|
||||
public static HtmlTree SPAN(HtmlStyle styleClass, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
|
||||
if (styleClass != null)
|
||||
htmltree.addStyle(styleClass);
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a SPAN tag with id and style class attributes. It also encloses
|
||||
* a content.
|
||||
*
|
||||
* @param id the id for the tag
|
||||
* @param styleClass stylesheet class for the tag
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the SPAN tag
|
||||
*/
|
||||
public static HtmlTree SPAN(String id, HtmlStyle styleClass, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
|
||||
htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
|
||||
if (styleClass != null)
|
||||
htmltree.addStyle(styleClass);
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a Table tag with style class, border, cell padding,
|
||||
* cellspacing and summary attributes and some content.
|
||||
*
|
||||
* @param styleClass style of the table
|
||||
* @param border border for the table
|
||||
* @param cellPadding cell padding for the table
|
||||
* @param cellSpacing cell spacing for the table
|
||||
* @param summary summary for the table
|
||||
* @param body content for the table
|
||||
* @return an HtmlTree object for the TABLE tag
|
||||
*/
|
||||
public static HtmlTree TABLE(HtmlStyle styleClass, int border, int cellPadding,
|
||||
int cellSpacing, String summary, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
|
||||
if (styleClass != null)
|
||||
htmltree.addStyle(styleClass);
|
||||
htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border));
|
||||
htmltree.addAttr(HtmlAttr.CELLPADDING, Integer.toString(cellPadding));
|
||||
htmltree.addAttr(HtmlAttr.CELLSPACING, Integer.toString(cellSpacing));
|
||||
htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a TD tag with style class attribute and some content.
|
||||
*
|
||||
* @param styleClass style for the tag
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the TD tag
|
||||
*/
|
||||
public static HtmlTree TD(HtmlStyle styleClass, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.TD, nullCheck(body));
|
||||
if (styleClass != null)
|
||||
htmltree.addStyle(styleClass);
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a TD tag for an HTML table with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the TD tag
|
||||
*/
|
||||
public static HtmlTree TD(Content body) {
|
||||
return TD(null, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a TH tag with style class and scope attributes and some content.
|
||||
*
|
||||
* @param styleClass style for the tag
|
||||
* @param scope scope of the tag
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the TH tag
|
||||
*/
|
||||
public static HtmlTree TH(HtmlStyle styleClass, String scope, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.TH, nullCheck(body));
|
||||
if (styleClass != null)
|
||||
htmltree.addStyle(styleClass);
|
||||
htmltree.addAttr(HtmlAttr.SCOPE, nullCheck(scope));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a TH tag with scope attribute and some content.
|
||||
*
|
||||
* @param scope scope of the tag
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the TH tag
|
||||
*/
|
||||
public static HtmlTree TH(String scope, Content body) {
|
||||
return TH(null, scope, body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a TITLE tag with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the TITLE tag
|
||||
*/
|
||||
public static HtmlTree TITLE(Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.TITLE, nullCheck(body));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a TR tag for an HTML table with some content.
|
||||
*
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the TR tag
|
||||
*/
|
||||
public static HtmlTree TR(Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.TR, nullCheck(body));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a UL tag with the style class attribute and some content.
|
||||
*
|
||||
* @param styleClass style for the tag
|
||||
* @param body content for the tag
|
||||
* @return an HtmlTree object for the UL tag
|
||||
*/
|
||||
public static HtmlTree UL(HtmlStyle styleClass, Content body) {
|
||||
HtmlTree htmltree = new HtmlTree(HtmlTag.UL, nullCheck(body));
|
||||
htmltree.addStyle(nullCheck(styleClass));
|
||||
return htmltree;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return (!hasContent() && !hasAttrs());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the HTML tree has content.
|
||||
*
|
||||
* @return true if the HTML tree has content else return false
|
||||
*/
|
||||
public boolean hasContent() {
|
||||
return (!content.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the HTML tree has attributes.
|
||||
*
|
||||
* @return true if the HTML tree has attributes else return false
|
||||
*/
|
||||
public boolean hasAttrs() {
|
||||
return (!attrs.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the HTML tree has a specific attribute.
|
||||
*
|
||||
* @param attrName name of the attribute to check within the HTML tree
|
||||
* @return true if the HTML tree has the specified attribute else return false
|
||||
*/
|
||||
public boolean hasAttr(HtmlAttr attrName) {
|
||||
return (attrs.containsKey(attrName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the HTML tree is valid. This check is more specific to
|
||||
* standard doclet and not exactly similar to W3C specifications. But it
|
||||
* ensures HTML validation.
|
||||
*
|
||||
* @return true if the HTML tree is valid
|
||||
*/
|
||||
public boolean isValid() {
|
||||
switch (htmlTag) {
|
||||
case A :
|
||||
return (hasAttr(HtmlAttr.NAME) || (hasAttr(HtmlAttr.HREF) && hasContent()));
|
||||
case BR :
|
||||
return (!hasContent() && (!hasAttrs() || hasAttr(HtmlAttr.CLEAR)));
|
||||
case FRAME :
|
||||
return (hasAttr(HtmlAttr.SRC) && !hasContent());
|
||||
case HR :
|
||||
return (!hasContent());
|
||||
case IMG :
|
||||
return (hasAttr(HtmlAttr.SRC) && hasAttr(HtmlAttr.ALT) && !hasContent());
|
||||
case LINK :
|
||||
return (hasAttr(HtmlAttr.HREF) && !hasContent());
|
||||
case META :
|
||||
return (hasAttr(HtmlAttr.CONTENT) && !hasContent());
|
||||
case SCRIPT :
|
||||
return ((hasAttr(HtmlAttr.TYPE) && hasAttr(HtmlAttr.SRC) && !hasContent()) ||
|
||||
(hasAttr(HtmlAttr.TYPE) && hasContent()));
|
||||
default :
|
||||
return hasContent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the element is an inline element.
|
||||
*
|
||||
* @return true if the HTML tag is an inline element
|
||||
*/
|
||||
public boolean isInline() {
|
||||
return (htmlTag.blockType == HtmlTag.BlockType.INLINE);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean write(Writer out, boolean atNewline) throws IOException {
|
||||
if (!isInline() && !atNewline)
|
||||
out.write(DocletConstants.NL);
|
||||
String tagString = htmlTag.toString();
|
||||
out.write("<");
|
||||
out.write(tagString);
|
||||
Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
|
||||
HtmlAttr key;
|
||||
String value;
|
||||
while (iterator.hasNext()) {
|
||||
key = iterator.next();
|
||||
value = attrs.get(key);
|
||||
out.write(" ");
|
||||
out.write(key.toString());
|
||||
if (!value.isEmpty()) {
|
||||
out.write("=\"");
|
||||
out.write(value);
|
||||
out.write("\"");
|
||||
}
|
||||
}
|
||||
out.write(">");
|
||||
boolean nl = false;
|
||||
for (Content c : content)
|
||||
nl = c.write(out, nl);
|
||||
if (htmlTag.endTagRequired()) {
|
||||
out.write("</");
|
||||
out.write(tagString);
|
||||
out.write(">");
|
||||
}
|
||||
if (!isInline()) {
|
||||
out.write(DocletConstants.NL);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a Content node, strips all html characters and
|
||||
* return the result.
|
||||
*
|
||||
* @param body The content node to check.
|
||||
* @return the plain text from the content node
|
||||
*
|
||||
*/
|
||||
private static String stripHtml(Content body) {
|
||||
String rawString = body.toString();
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,547 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Class for the Html format code generation.
|
||||
* Initializes PrintWriter with FileWriter, to enable print
|
||||
* related methods to generate the code to the named File through FileWriter.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @since 1.2
|
||||
* @author Atul M Dambalkar
|
||||
* @author Bhavesh Patel (Modified)
|
||||
*/
|
||||
public class HtmlWriter {
|
||||
|
||||
/**
|
||||
* The window title of this file
|
||||
*/
|
||||
protected String winTitle;
|
||||
|
||||
/**
|
||||
* The configuration
|
||||
*/
|
||||
protected Configuration configuration;
|
||||
|
||||
/**
|
||||
* The flag to indicate whether a member details list is printed or not.
|
||||
*/
|
||||
protected boolean memberDetailsListPrinted;
|
||||
|
||||
/**
|
||||
* Header for table displaying profiles and description..
|
||||
*/
|
||||
protected final String[] profileTableHeader;
|
||||
|
||||
/**
|
||||
* Header for tables displaying packages and description..
|
||||
*/
|
||||
protected final String[] packageTableHeader;
|
||||
|
||||
/**
|
||||
* Summary for use tables displaying class and package use.
|
||||
*/
|
||||
protected final String useTableSummary;
|
||||
|
||||
/**
|
||||
* Column header for class docs displaying Modifier and Type header.
|
||||
*/
|
||||
protected final String modifierTypeHeader;
|
||||
|
||||
public final Content overviewLabel;
|
||||
|
||||
public final Content defaultPackageLabel;
|
||||
|
||||
public final Content packageLabel;
|
||||
|
||||
public final Content profileLabel;
|
||||
|
||||
public final Content useLabel;
|
||||
|
||||
public final Content prevLabel;
|
||||
|
||||
public final Content nextLabel;
|
||||
|
||||
public final Content prevclassLabel;
|
||||
|
||||
public final Content nextclassLabel;
|
||||
|
||||
public final Content summaryLabel;
|
||||
|
||||
public final Content detailLabel;
|
||||
|
||||
public final Content framesLabel;
|
||||
|
||||
public final Content noframesLabel;
|
||||
|
||||
public final Content treeLabel;
|
||||
|
||||
public final Content classLabel;
|
||||
|
||||
public final Content deprecatedLabel;
|
||||
|
||||
public final Content deprecatedPhrase;
|
||||
|
||||
public final Content allclassesLabel;
|
||||
|
||||
public final Content allpackagesLabel;
|
||||
|
||||
public final Content allprofilesLabel;
|
||||
|
||||
public final Content indexLabel;
|
||||
|
||||
public final Content helpLabel;
|
||||
|
||||
public final Content seeLabel;
|
||||
|
||||
public final Content descriptionLabel;
|
||||
|
||||
public final Content prevpackageLabel;
|
||||
|
||||
public final Content nextpackageLabel;
|
||||
|
||||
public final Content prevprofileLabel;
|
||||
|
||||
public final Content nextprofileLabel;
|
||||
|
||||
public final Content packagesLabel;
|
||||
|
||||
public final Content profilesLabel;
|
||||
|
||||
public final Content methodDetailsLabel;
|
||||
|
||||
public final Content annotationTypeDetailsLabel;
|
||||
|
||||
public final Content fieldDetailsLabel;
|
||||
|
||||
public final Content propertyDetailsLabel;
|
||||
|
||||
public final Content constructorDetailsLabel;
|
||||
|
||||
public final Content enumConstantsDetailsLabel;
|
||||
|
||||
public final Content specifiedByLabel;
|
||||
|
||||
public final Content overridesLabel;
|
||||
|
||||
public final Content descfrmClassLabel;
|
||||
|
||||
public final Content descfrmInterfaceLabel;
|
||||
|
||||
private final DocFile file;
|
||||
|
||||
private Writer writer;
|
||||
|
||||
private Content script;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param path The directory path to be created for this file
|
||||
* or null if none to be created.
|
||||
* @exception IOException Exception raised by the FileWriter is passed on
|
||||
* to next level.
|
||||
* @exception UnsupportedEncodingException Exception raised by the
|
||||
* OutputStreamWriter is passed on to next level.
|
||||
*/
|
||||
public HtmlWriter(Configuration configuration, DocPath path)
|
||||
throws IOException, UnsupportedEncodingException {
|
||||
file = DocFile.createFileForOutput(configuration, path);
|
||||
this.configuration = configuration;
|
||||
this.memberDetailsListPrinted = false;
|
||||
profileTableHeader = new String[] {
|
||||
configuration.getText("doclet.Profile"),
|
||||
configuration.getText("doclet.Description")
|
||||
};
|
||||
packageTableHeader = new String[] {
|
||||
configuration.getText("doclet.Package"),
|
||||
configuration.getText("doclet.Description")
|
||||
};
|
||||
useTableSummary = configuration.getText("doclet.Use_Table_Summary",
|
||||
configuration.getText("doclet.packages"));
|
||||
modifierTypeHeader = configuration.getText("doclet.0_and_1",
|
||||
configuration.getText("doclet.Modifier"),
|
||||
configuration.getText("doclet.Type"));
|
||||
overviewLabel = getResource("doclet.Overview");
|
||||
defaultPackageLabel = new StringContent(DocletConstants.DEFAULT_PACKAGE_NAME);
|
||||
packageLabel = getResource("doclet.Package");
|
||||
profileLabel = getResource("doclet.Profile");
|
||||
useLabel = getResource("doclet.navClassUse");
|
||||
prevLabel = getResource("doclet.Prev");
|
||||
nextLabel = getResource("doclet.Next");
|
||||
prevclassLabel = getNonBreakResource("doclet.Prev_Class");
|
||||
nextclassLabel = getNonBreakResource("doclet.Next_Class");
|
||||
summaryLabel = getResource("doclet.Summary");
|
||||
detailLabel = getResource("doclet.Detail");
|
||||
framesLabel = getResource("doclet.Frames");
|
||||
noframesLabel = getNonBreakResource("doclet.No_Frames");
|
||||
treeLabel = getResource("doclet.Tree");
|
||||
classLabel = getResource("doclet.Class");
|
||||
deprecatedLabel = getResource("doclet.navDeprecated");
|
||||
deprecatedPhrase = getResource("doclet.Deprecated");
|
||||
allclassesLabel = getNonBreakResource("doclet.All_Classes");
|
||||
allpackagesLabel = getNonBreakResource("doclet.All_Packages");
|
||||
allprofilesLabel = getNonBreakResource("doclet.All_Profiles");
|
||||
indexLabel = getResource("doclet.Index");
|
||||
helpLabel = getResource("doclet.Help");
|
||||
seeLabel = getResource("doclet.See");
|
||||
descriptionLabel = getResource("doclet.Description");
|
||||
prevpackageLabel = getNonBreakResource("doclet.Prev_Package");
|
||||
nextpackageLabel = getNonBreakResource("doclet.Next_Package");
|
||||
prevprofileLabel = getNonBreakResource("doclet.Prev_Profile");
|
||||
nextprofileLabel = getNonBreakResource("doclet.Next_Profile");
|
||||
packagesLabel = getResource("doclet.Packages");
|
||||
profilesLabel = getResource("doclet.Profiles");
|
||||
methodDetailsLabel = getResource("doclet.Method_Detail");
|
||||
annotationTypeDetailsLabel = getResource("doclet.Annotation_Type_Member_Detail");
|
||||
fieldDetailsLabel = getResource("doclet.Field_Detail");
|
||||
propertyDetailsLabel = getResource("doclet.Property_Detail");
|
||||
constructorDetailsLabel = getResource("doclet.Constructor_Detail");
|
||||
enumConstantsDetailsLabel = getResource("doclet.Enum_Constant_Detail");
|
||||
specifiedByLabel = getResource("doclet.Specified_By");
|
||||
overridesLabel = getResource("doclet.Overrides");
|
||||
descfrmClassLabel = getResource("doclet.Description_From_Class");
|
||||
descfrmInterfaceLabel = getResource("doclet.Description_From_Interface");
|
||||
}
|
||||
|
||||
public void write(Content c) throws IOException {
|
||||
writer = file.openWriter();
|
||||
c.write(writer, true);
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key) {
|
||||
return configuration.getResource(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content, replacing spaces
|
||||
* with non-breaking spaces.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getNonBreakResource(String key) {
|
||||
String text = configuration.getText(key);
|
||||
Content c = configuration.newContent();
|
||||
int start = 0;
|
||||
int p;
|
||||
while ((p = text.indexOf(" ", start)) != -1) {
|
||||
c.addContent(text.substring(start, p));
|
||||
c.addContent(RawHtml.nbsp);
|
||||
start = p + 1;
|
||||
}
|
||||
c.addContent(text.substring(start));
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param o string or content argument added to configuration text
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key, Object o) {
|
||||
return configuration.getResource(key, o);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param o1 string or content argument added to configuration text
|
||||
* @param o2 string or content argument added to configuration text
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key, Object o0, Object o1) {
|
||||
return configuration.getResource(key, o0, o1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an HtmlTree for the SCRIPT tag.
|
||||
*
|
||||
* @return an HtmlTree for the SCRIPT tag
|
||||
*/
|
||||
protected HtmlTree getWinTitleScript(){
|
||||
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
|
||||
if(winTitle != null && winTitle.length() > 0) {
|
||||
script.addAttr(HtmlAttr.TYPE, "text/javascript");
|
||||
String scriptCode = "<!--" + DocletConstants.NL +
|
||||
" try {" + DocletConstants.NL +
|
||||
" if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
|
||||
" parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" catch(err) {" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
"//-->" + DocletConstants.NL;
|
||||
RawHtml scriptContent = new RawHtml(scriptCode);
|
||||
script.addContent(scriptContent);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String with escaped special JavaScript characters.
|
||||
*
|
||||
* @param s String that needs to be escaped
|
||||
* @return a valid escaped JavaScript string
|
||||
*/
|
||||
private static String escapeJavaScriptChars(String s) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
switch (ch) {
|
||||
case '\b':
|
||||
sb.append("\\b");
|
||||
break;
|
||||
case '\t':
|
||||
sb.append("\\t");
|
||||
break;
|
||||
case '\n':
|
||||
sb.append("\\n");
|
||||
break;
|
||||
case '\f':
|
||||
sb.append("\\f");
|
||||
break;
|
||||
case '\r':
|
||||
sb.append("\\r");
|
||||
break;
|
||||
case '"':
|
||||
sb.append("\\\"");
|
||||
break;
|
||||
case '\'':
|
||||
sb.append("\\\'");
|
||||
break;
|
||||
case '\\':
|
||||
sb.append("\\\\");
|
||||
break;
|
||||
default:
|
||||
if (ch < 32 || ch >= 127) {
|
||||
sb.append(String.format("\\u%04X", (int)ch));
|
||||
} else {
|
||||
sb.append(ch);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a content tree for the SCRIPT tag for the main page(index.html).
|
||||
*
|
||||
* @return a content for the SCRIPT tag
|
||||
*/
|
||||
protected Content getFramesetJavaScript() {
|
||||
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
|
||||
script.addAttr(HtmlAttr.TYPE, "text/javascript");
|
||||
String scriptCode = DocletConstants.NL +
|
||||
" tmpTargetPage = \"\" + window.location.search;" + DocletConstants.NL +
|
||||
" if (tmpTargetPage != \"\" && tmpTargetPage != \"undefined\")" + DocletConstants.NL +
|
||||
" tmpTargetPage = tmpTargetPage.substring(1);" + DocletConstants.NL +
|
||||
" if (tmpTargetPage.indexOf(\":\") != -1 || (tmpTargetPage != \"\" && !validURL(tmpTargetPage)))" + DocletConstants.NL +
|
||||
" tmpTargetPage = \"undefined\";" + DocletConstants.NL +
|
||||
" targetPage = tmpTargetPage;" + DocletConstants.NL +
|
||||
" function validURL(url) {" + DocletConstants.NL +
|
||||
" try {" + DocletConstants.NL +
|
||||
" url = decodeURIComponent(url);" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" catch (error) {" + DocletConstants.NL +
|
||||
" return false;" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" var pos = url.indexOf(\".html\");" + DocletConstants.NL +
|
||||
" if (pos == -1 || pos != url.length - 5)" + DocletConstants.NL +
|
||||
" return false;" + DocletConstants.NL +
|
||||
" var allowNumber = false;" + DocletConstants.NL +
|
||||
" var allowSep = false;" + DocletConstants.NL +
|
||||
" var seenDot = false;" + DocletConstants.NL +
|
||||
" for (var i = 0; i < url.length - 5; i++) {" + DocletConstants.NL +
|
||||
" var ch = url.charAt(i);" + DocletConstants.NL +
|
||||
" if ('a' <= ch && ch <= 'z' ||" + DocletConstants.NL +
|
||||
" 'A' <= ch && ch <= 'Z' ||" + DocletConstants.NL +
|
||||
" ch == '$' ||" + DocletConstants.NL +
|
||||
" ch == '_' ||" + DocletConstants.NL +
|
||||
" ch.charCodeAt(0) > 127) {" + DocletConstants.NL +
|
||||
" allowNumber = true;" + DocletConstants.NL +
|
||||
" allowSep = true;" + DocletConstants.NL +
|
||||
" } else if ('0' <= ch && ch <= '9'" + DocletConstants.NL +
|
||||
" || ch == '-') {" + DocletConstants.NL +
|
||||
" if (!allowNumber)" + DocletConstants.NL +
|
||||
" return false;" + DocletConstants.NL +
|
||||
" } else if (ch == '/' || ch == '.') {" + DocletConstants.NL +
|
||||
" if (!allowSep)" + DocletConstants.NL +
|
||||
" return false;" + DocletConstants.NL +
|
||||
" allowNumber = false;" + DocletConstants.NL +
|
||||
" allowSep = false;" + DocletConstants.NL +
|
||||
" if (ch == '.')" + DocletConstants.NL +
|
||||
" seenDot = true;" + DocletConstants.NL +
|
||||
" if (ch == '/' && seenDot)" + DocletConstants.NL +
|
||||
" return false;" + DocletConstants.NL +
|
||||
" } else {" + DocletConstants.NL +
|
||||
" return false;"+ DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" return true;" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL +
|
||||
" function loadFrames() {" + DocletConstants.NL +
|
||||
" if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
|
||||
" top.classFrame.location = top.targetPage;" + DocletConstants.NL +
|
||||
" }" + DocletConstants.NL;
|
||||
RawHtml scriptContent = new RawHtml(scriptCode);
|
||||
script.addContent(scriptContent);
|
||||
return script;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an HtmlTree for the BODY tag.
|
||||
*
|
||||
* @param includeScript set true if printing windowtitle script
|
||||
* @param title title for the window
|
||||
* @return an HtmlTree for the BODY tag
|
||||
*/
|
||||
public HtmlTree getBody(boolean includeScript, String title) {
|
||||
HtmlTree body = new HtmlTree(HtmlTag.BODY);
|
||||
// Set window title string which is later printed
|
||||
this.winTitle = title;
|
||||
// Don't print windowtitle script for overview-frame, allclasses-frame
|
||||
// and package-frame
|
||||
if (includeScript) {
|
||||
this.script = getWinTitleScript();
|
||||
body.addContent(script);
|
||||
Content noScript = HtmlTree.NOSCRIPT(
|
||||
HtmlTree.DIV(getResource("doclet.No_Script_Message")));
|
||||
body.addContent(noScript);
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generated javascript variables for the document.
|
||||
*
|
||||
* @param typeMap map comprising of method and type relationship
|
||||
* @param methodTypes set comprising of all methods types for this class
|
||||
*/
|
||||
public void generateMethodTypesScript(Map<String,Integer> typeMap,
|
||||
Set<MethodTypes> methodTypes) {
|
||||
String sep = "";
|
||||
StringBuilder vars = new StringBuilder("var methods = {");
|
||||
for (Map.Entry<String,Integer> entry : typeMap.entrySet()) {
|
||||
vars.append(sep);
|
||||
sep = ",";
|
||||
vars.append("\"")
|
||||
.append(entry.getKey())
|
||||
.append("\":")
|
||||
.append(entry.getValue());
|
||||
}
|
||||
vars.append("};").append(DocletConstants.NL);
|
||||
sep = "";
|
||||
vars.append("var tabs = {");
|
||||
for (MethodTypes entry : methodTypes) {
|
||||
vars.append(sep);
|
||||
sep = ",";
|
||||
vars.append(entry.value())
|
||||
.append(":")
|
||||
.append("[")
|
||||
.append("\"")
|
||||
.append(entry.tabId())
|
||||
.append("\"")
|
||||
.append(sep)
|
||||
.append("\"")
|
||||
.append(configuration.getText(entry.resourceKey()))
|
||||
.append("\"]");
|
||||
}
|
||||
vars.append("};")
|
||||
.append(DocletConstants.NL);
|
||||
addStyles(HtmlStyle.altColor, vars);
|
||||
addStyles(HtmlStyle.rowColor, vars);
|
||||
addStyles(HtmlStyle.tableTab, vars);
|
||||
addStyles(HtmlStyle.activeTableTab, vars);
|
||||
script.addContent(new RawHtml(vars.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds javascript style variables to the document.
|
||||
*
|
||||
* @param style style to be added as a javascript variable
|
||||
* @param vars variable string to which the style variable will be added
|
||||
*/
|
||||
public void addStyles(HtmlStyle style, StringBuilder vars) {
|
||||
vars.append("var ").append(style).append(" = \"").append(style)
|
||||
.append("\";").append(DocletConstants.NL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an HtmlTree for the TITLE tag.
|
||||
*
|
||||
* @return an HtmlTree for the TITLE tag
|
||||
*/
|
||||
public HtmlTree getTitle() {
|
||||
HtmlTree title = HtmlTree.TITLE(new StringContent(winTitle));
|
||||
return title;
|
||||
}
|
||||
|
||||
public String codeText(String text) {
|
||||
return "<code>" + text + "</code>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return "&nbsp;", non-breaking space.
|
||||
*/
|
||||
public Content getSpace() {
|
||||
return RawHtml.nbsp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a header for Modifier and Type column of a table.
|
||||
*/
|
||||
public String getModifierTypeHeader() {
|
||||
return modifierTypeHeader;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
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.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @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("not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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("not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return rawHtmlContent.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return rawHtmlContent;
|
||||
}
|
||||
|
||||
private enum State { TEXT, ENTITY, TAG, STRING };
|
||||
|
||||
@Override
|
||||
public int charCount() {
|
||||
return charCount(rawHtmlContent);
|
||||
}
|
||||
|
||||
static int charCount(String htmlText) {
|
||||
State state = State.TEXT;
|
||||
int count = 0;
|
||||
for (int i = 0; i < htmlText.length(); i++) {
|
||||
char c = htmlText.charAt(i);
|
||||
switch (state) {
|
||||
case TEXT:
|
||||
switch (c) {
|
||||
case '<':
|
||||
state = State.TAG;
|
||||
break;
|
||||
case '&':
|
||||
state = State.ENTITY;
|
||||
count++;
|
||||
break;
|
||||
default:
|
||||
count++;
|
||||
}
|
||||
break;
|
||||
|
||||
case ENTITY:
|
||||
if (!Character.isLetterOrDigit(c))
|
||||
state = State.TEXT;
|
||||
break;
|
||||
|
||||
case TAG:
|
||||
switch (c) {
|
||||
case '"':
|
||||
state = State.STRING;
|
||||
break;
|
||||
case '>':
|
||||
state = State.TEXT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case STRING:
|
||||
switch (c) {
|
||||
case '"':
|
||||
state = State.TAG;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean write(Writer out, boolean atNewline) throws IOException {
|
||||
out.write(rawHtmlContent);
|
||||
return rawHtmlContent.endsWith(DocletConstants.NL);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
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.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @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();
|
||||
appendChars(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.
|
||||
*/
|
||||
@Override
|
||||
public void addContent(Content content) {
|
||||
throw new DocletAbortException("not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@Override
|
||||
public void addContent(String strContent) {
|
||||
appendChars(strContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return (stringContent.length() == 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int charCount() {
|
||||
return RawHtml.charCount(stringContent.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return stringContent.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean write(Writer out, boolean atNewline) throws IOException {
|
||||
String s = stringContent.toString();
|
||||
out.write(s);
|
||||
return s.endsWith(DocletConstants.NL);
|
||||
}
|
||||
|
||||
private void appendChars(String s) {
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
switch (ch) {
|
||||
case '<': stringContent.append("<"); break;
|
||||
case '>': stringContent.append(">"); break;
|
||||
case '&': stringContent.append("&"); break;
|
||||
default: stringContent.append(ch); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
This package contains classes that write HTML markup tags.
|
||||
|
||||
<p><b>This is NOT part of any supported API.
|
||||
If you write code that depends on this, you do so at your own risk.
|
||||
This code and its internal interfaces are subject to change or
|
||||
deletion without notice.</b>
|
||||
*/
|
||||
@jdk.Exported(false)
|
||||
package com.sun.tools.doclets.formats.html.markup;
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
This is the default doclet provided with JDK that produces Javadoc's
|
||||
default HTML-formatted API output. For more documentation
|
||||
on this doclet, please refer to the link below.
|
||||
|
||||
@see <a href="http://www.java.sun.com/javadoc/standard-doclet.html">
|
||||
http://www.java.sun.com/javadoc/standard-doclet.html </a>
|
||||
|
||||
<p><b>This is NOT part of any supported API.
|
||||
If you write code that depends on this, you do so at your own risk.
|
||||
This code and its internal interfaces are subject to change or
|
||||
deletion without notice.</b>
|
||||
*/
|
||||
@jdk.Exported(false)
|
||||
package com.sun.tools.doclets.formats.html;
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.sun.tools.doclets.formats.html.resources;
|
||||
|
||||
public final class standard extends java.util.ListResourceBundle {
|
||||
protected final Object[][] getContents() {
|
||||
return new Object[][] {
|
||||
{ "doclet.All_Packages", "All Packages" },
|
||||
{ "doclet.All_Profiles", "All Profiles" },
|
||||
{ "doclet.Annotation_Type_Hierarchy", "Annotation Type Hierarchy" },
|
||||
{ "doclet.ClassUse_Annotation", "Classes in {1} with annotations of type {0}" },
|
||||
{ "doclet.ClassUse_Classes.in.0.used.by.1", "Classes in {0} used by {1}" },
|
||||
{ "doclet.ClassUse_ConstructorAnnotations", "Constructors in {1} with annotations of type {0}" },
|
||||
{ "doclet.ClassUse_ConstructorArgs", "Constructors in {1} with parameters of type {0}" },
|
||||
{ "doclet.ClassUse_ConstructorArgsTypeParameters", "Constructor parameters in {1} with type arguments of type {0}" },
|
||||
{ "doclet.ClassUse_ConstructorParameterAnnotations", "Constructor parameters in {1} with annotations of type {0}" },
|
||||
{ "doclet.ClassUse_ConstructorThrows", "Constructors in {1} that throw {0}" },
|
||||
{ "doclet.ClassUse_Field", "Fields in {1} declared as {0}" },
|
||||
{ "doclet.ClassUse_FieldAnnotations", "Fields in {1} with annotations of type {0}" },
|
||||
{ "doclet.ClassUse_FieldTypeParameter", "Fields in {1} with type parameters of type {0}" },
|
||||
{ "doclet.ClassUse_ImplementingClass", "Classes in {1} that implement {0}" },
|
||||
{ "doclet.ClassUse_MethodAnnotations", "Methods in {1} with annotations of type {0}" },
|
||||
{ "doclet.ClassUse_MethodArgs", "Methods in {1} with parameters of type {0}" },
|
||||
{ "doclet.ClassUse_MethodArgsTypeParameters", "Method parameters in {1} with type arguments of type {0}" },
|
||||
{ "doclet.ClassUse_MethodParameterAnnotations", "Method parameters in {1} with annotations of type {0}" },
|
||||
{ "doclet.ClassUse_MethodReturn", "Methods in {1} that return {0}" },
|
||||
{ "doclet.ClassUse_MethodReturnTypeParameter", "Methods in {1} that return types with arguments of type {0}" },
|
||||
{ "doclet.ClassUse_MethodThrows", "Methods in {1} that throw {0}" },
|
||||
{ "doclet.ClassUse_MethodTypeParameter", "Methods in {1} with type parameters of type {0}" },
|
||||
{ "doclet.ClassUse_No.usage.of.0", "No usage of {0}" },
|
||||
{ "doclet.ClassUse_PackageAnnotation", "Packages with annotations of type {0}" },
|
||||
{ "doclet.ClassUse_Packages.that.use.0", "Packages that use {0}" },
|
||||
{ "doclet.ClassUse_Subclass", "Subclasses of {0} in {1}" },
|
||||
{ "doclet.ClassUse_Subinterface", "Subinterfaces of {0} in {1}" },
|
||||
{ "doclet.ClassUse_Title", "Uses of {0}" },
|
||||
{ "doclet.ClassUse_TypeParameter", "Classes in {1} with type parameters of type {0}" },
|
||||
{ "doclet.ClassUse_Uses.of.0.in.1", "Uses of {0} in {1}" },
|
||||
{ "doclet.Class_Hierarchy", "Class Hierarchy" },
|
||||
{ "doclet.Constructor_for", "Constructor for {0}" },
|
||||
{ "doclet.Contents", "Contents" },
|
||||
{ "doclet.Deprecated_API", "Deprecated API" },
|
||||
{ "doclet.Deprecated_Annotation_Type_Members", "Deprecated Annotation Type Elements" },
|
||||
{ "doclet.Deprecated_Annotation_Types", "Deprecated Annotation Types" },
|
||||
{ "doclet.Deprecated_Classes", "Deprecated Classes" },
|
||||
{ "doclet.Deprecated_Constructors", "Deprecated Constructors" },
|
||||
{ "doclet.Deprecated_Enum_Constants", "Deprecated Enum Constants" },
|
||||
{ "doclet.Deprecated_Enums", "Deprecated Enums" },
|
||||
{ "doclet.Deprecated_Errors", "Deprecated Errors" },
|
||||
{ "doclet.Deprecated_Exceptions", "Deprecated Exceptions" },
|
||||
{ "doclet.Deprecated_Fields", "Deprecated Fields" },
|
||||
{ "doclet.Deprecated_Interfaces", "Deprecated Interfaces" },
|
||||
{ "doclet.Deprecated_Methods", "Deprecated Methods" },
|
||||
{ "doclet.Deprecated_Packages", "Deprecated Packages" },
|
||||
{ "doclet.Description", "Description" },
|
||||
{ "doclet.Description_From_Class", "Description copied from class:" },
|
||||
{ "doclet.Description_From_Interface", "Description copied from interface:" },
|
||||
{ "doclet.Detail", "Detail:" },
|
||||
{ "doclet.Enclosing_Class", "Enclosing class:" },
|
||||
{ "doclet.Enclosing_Interface", "Enclosing interface:" },
|
||||
{ "doclet.Enum_Hierarchy", "Enum Hierarchy" },
|
||||
{ "doclet.Error_in_packagelist", "Error in using -group option: {0} {1}" },
|
||||
{ "doclet.File_error", "Error reading file: {0}" },
|
||||
{ "doclet.Frame_Alert", "Frame Alert" },
|
||||
{ "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. Link to {0}." },
|
||||
{ "doclet.Frames", "Frames" },
|
||||
{ "doclet.Functional_Interface", "Functional Interface:" },
|
||||
{ "doclet.Functional_Interface_Message", "This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference." },
|
||||
{ "doclet.Generated_Docs_Untitled", "Generated Documentation (Untitled)" },
|
||||
{ "doclet.Groupname_already_used", "In -group option, groupname already used: {0}" },
|
||||
{ "doclet.Help", "Help" },
|
||||
{ "doclet.Help_annotation_type_line_1", "Each annotation type has its own separate page with the following sections:" },
|
||||
{ "doclet.Help_annotation_type_line_2", "Annotation Type declaration" },
|
||||
{ "doclet.Help_annotation_type_line_3", "Annotation Type description" },
|
||||
{ "doclet.Help_enum_line_1", "Each enum has its own separate page with the following sections:" },
|
||||
{ "doclet.Help_enum_line_2", "Enum declaration" },
|
||||
{ "doclet.Help_enum_line_3", "Enum description" },
|
||||
{ "doclet.Help_line_1", "How This API Document Is Organized" },
|
||||
{ "doclet.Help_line_10", "All Known Implementing Classes" },
|
||||
{ "doclet.Help_line_11", "Class/interface declaration" },
|
||||
{ "doclet.Help_line_12", "Class/interface description" },
|
||||
{ "doclet.Help_line_13", "Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer." },
|
||||
{ "doclet.Help_line_14", "Use" },
|
||||
{ "doclet.Help_line_15", "Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the \"Use\" link in the navigation bar." },
|
||||
{ "doclet.Help_line_16", "Tree (Class Hierarchy)" },
|
||||
{ "doclet.Help_line_17_with_tree_link", "There is a {0} page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with {1}. The interfaces do not inherit from {1}." },
|
||||
{ "doclet.Help_line_18", "When viewing the Overview page, clicking on \"Tree\" displays the hierarchy for all packages." },
|
||||
{ "doclet.Help_line_19", "When viewing a particular package, class or interface page, clicking \"Tree\" displays the hierarchy for only that package." },
|
||||
{ "doclet.Help_line_2", "This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows." },
|
||||
{ "doclet.Help_line_20_with_deprecated_api_link", "The {0} page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations." },
|
||||
{ "doclet.Help_line_21", "Index" },
|
||||
{ "doclet.Help_line_22", "The {0} contains an alphabetic list of all classes, interfaces, constructors, methods, and fields." },
|
||||
{ "doclet.Help_line_23", "Prev/Next" },
|
||||
{ "doclet.Help_line_24", "These links take you to the next or previous class, interface, package, or related page." },
|
||||
{ "doclet.Help_line_25", "Frames/No Frames" },
|
||||
{ "doclet.Help_line_26", "These links show and hide the HTML frames. All pages are available with or without frames." },
|
||||
{ "doclet.Help_line_27", "The {0} link shows all classes and interfaces except non-static nested types." },
|
||||
{ "doclet.Help_line_28", "Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking \"Serialized Form\" in the \"See also\" section of the class description." },
|
||||
{ "doclet.Help_line_29", "The {0} page lists the static final fields and their values." },
|
||||
{ "doclet.Help_line_3", "The {0} page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages." },
|
||||
{ "doclet.Help_line_30", "This help file applies to API documentation generated using the standard doclet." },
|
||||
{ "doclet.Help_line_4", "Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:" },
|
||||
{ "doclet.Help_line_5", "Class/Interface" },
|
||||
{ "doclet.Help_line_6", "Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:" },
|
||||
{ "doclet.Help_line_7", "Class inheritance diagram" },
|
||||
{ "doclet.Help_line_8", "Direct Subclasses" },
|
||||
{ "doclet.Help_line_9", "All Known Subinterfaces" },
|
||||
{ "doclet.Hierarchy_For_All_Packages", "Hierarchy For All Packages" },
|
||||
{ "doclet.Hierarchy_For_Package", "Hierarchy For Package {0}" },
|
||||
{ "doclet.Href_Annotation_Title", "annotation in {0}" },
|
||||
{ "doclet.Href_Class_Or_Interface_Title", "class or interface in {0}" },
|
||||
{ "doclet.Href_Class_Title", "class in {0}" },
|
||||
{ "doclet.Href_Enum_Title", "enum in {0}" },
|
||||
{ "doclet.Href_Interface_Title", "interface in {0}" },
|
||||
{ "doclet.Href_Type_Param_Title", "type parameter in {0}" },
|
||||
{ "doclet.Implementing_Classes", "All Known Implementing Classes:" },
|
||||
{ "doclet.Index", "Index" },
|
||||
{ "doclet.Interface_Hierarchy", "Interface Hierarchy" },
|
||||
{ "doclet.Interfaces_Italic", "Interfaces (italic)" },
|
||||
{ "doclet.MalformedURL", "Malformed URL: {0}" },
|
||||
{ "doclet.Method_in", "Method in {0}" },
|
||||
{ "doclet.Navigation", "Navigation" },
|
||||
{ "doclet.New_Page", "NewPage" },
|
||||
{ "doclet.Next", "Next" },
|
||||
{ "doclet.Next_Class", "Next Class" },
|
||||
{ "doclet.Next_Letter", "Next Letter" },
|
||||
{ "doclet.Next_Package", "Next Package" },
|
||||
{ "doclet.Next_Profile", "Next Profile" },
|
||||
{ "doclet.No_Frames", "No Frames" },
|
||||
{ "doclet.No_Non_Deprecated_Classes_To_Document", "No non-deprecated classes found to document." },
|
||||
{ "doclet.No_Script_Message", "JavaScript is disabled on your browser." },
|
||||
{ "doclet.Non_Frame_Version", "Non-frame version" },
|
||||
{ "doclet.Other_Packages", "Other Packages" },
|
||||
{ "doclet.Overrides", "Overrides:" },
|
||||
{ "doclet.Overview", "Overview" },
|
||||
{ "doclet.Package", "Package" },
|
||||
{ "doclet.Package_Description", "Package {0} Description" },
|
||||
{ "doclet.Package_Hierarchies", "Package Hierarchies:" },
|
||||
{ "doclet.Prev", "Prev" },
|
||||
{ "doclet.Prev_Class", "Prev Class" },
|
||||
{ "doclet.Prev_Letter", "Prev Letter" },
|
||||
{ "doclet.Prev_Package", "Prev Package" },
|
||||
{ "doclet.Prev_Profile", "Prev Profile" },
|
||||
{ "doclet.Profile", "Profile" },
|
||||
{ "doclet.Same_package_name_used", "Package name format used twice: {0}" },
|
||||
{ "doclet.Skip_navigation_links", "Skip navigation links" },
|
||||
{ "doclet.Specified_By", "Specified by:" },
|
||||
{ "doclet.Static_method_in", "Static method in {0}" },
|
||||
{ "doclet.Static_variable_in", "Static variable in {0}" },
|
||||
{ "doclet.Subclasses", "Direct Known Subclasses:" },
|
||||
{ "doclet.Subinterfaces", "All Known Subinterfaces:" },
|
||||
{ "doclet.Summary", "Summary:" },
|
||||
{ "doclet.Tree", "Tree" },
|
||||
{ "doclet.URL_error", "Error fetching URL: {0}" },
|
||||
{ "doclet.Variable_in", "Variable in {0}" },
|
||||
{ "doclet.Window_ClassUse_Header", "Uses of {0} {1}" },
|
||||
{ "doclet.Window_Class_Hierarchy", "Class Hierarchy" },
|
||||
{ "doclet.Window_Deprecated_List", "Deprecated List" },
|
||||
{ "doclet.Window_Help_title", "API Help" },
|
||||
{ "doclet.Window_Overview", "Overview List" },
|
||||
{ "doclet.Window_Overview_Summary", "Overview" },
|
||||
{ "doclet.Window_Single_Index", "Index" },
|
||||
{ "doclet.Window_Source_title", "Source code" },
|
||||
{ "doclet.Window_Split_Index", "{0}-Index" },
|
||||
{ "doclet.X.usage", "Provided by standard doclet:\n -Xdocrootparent <url> Replaces all appearances of @docRoot followed\n by /.. in doc comments with <url>\n -Xdoclint Enable recommended checks for problems in javadoc comments\n -Xdoclint:(all|none|[-]<group>) \n Enable or disable specific checks for problems in javadoc comments,\n where <group> is one of accessibility, html, missing, reference, or syntax.\n" },
|
||||
{ "doclet.also", "also" },
|
||||
{ "doclet.build_version", "Standard Doclet version {0}" },
|
||||
{ "doclet.deprecated_annotation_type_members", "deprecated annotation type elements" },
|
||||
{ "doclet.deprecated_annotation_types", "deprecated annotation types" },
|
||||
{ "doclet.deprecated_classes", "deprecated classes" },
|
||||
{ "doclet.deprecated_constructors", "deprecated constructors" },
|
||||
{ "doclet.deprecated_enum_constants", "deprecated enum constants" },
|
||||
{ "doclet.deprecated_enums", "deprecated enums" },
|
||||
{ "doclet.deprecated_errors", "deprecated errors" },
|
||||
{ "doclet.deprecated_exceptions", "deprecated exceptions" },
|
||||
{ "doclet.deprecated_fields", "deprecated fields" },
|
||||
{ "doclet.deprecated_interfaces", "deprecated interfaces" },
|
||||
{ "doclet.deprecated_methods", "deprecated methods" },
|
||||
{ "doclet.deprecated_packages", "deprecated packages" },
|
||||
{ "doclet.exception_encountered", "Exception encountered while processing {1}\n{0}" },
|
||||
{ "doclet.in_class", "in class" },
|
||||
{ "doclet.in_interface", "in interface" },
|
||||
{ "doclet.navAnnotationTypeMember", "Element" },
|
||||
{ "doclet.navAnnotationTypeOptionalMember", "Optional" },
|
||||
{ "doclet.navAnnotationTypeRequiredMember", "Required" },
|
||||
{ "doclet.navClassUse", "Use" },
|
||||
{ "doclet.navConstructor", "Constr" },
|
||||
{ "doclet.navDeprecated", "Deprecated" },
|
||||
{ "doclet.navEnum", "Enum Constants" },
|
||||
{ "doclet.navField", "Field" },
|
||||
{ "doclet.navMethod", "Method" },
|
||||
{ "doclet.navNested", "Nested" },
|
||||
{ "doclet.navProperty", "Property" },
|
||||
{ "doclet.package", "package" },
|
||||
{ "doclet.see.class_or_package_not_accessible", "Tag {0}: reference not accessible: {1}" },
|
||||
{ "doclet.see.class_or_package_not_found", "Tag {0}: reference not found: {1}" },
|
||||
{ "doclet.usage", "Provided by Standard doclet:\n -d <directory> Destination directory for output files\n -use Create class and package usage pages\n -version Include @version paragraphs\n -author Include @author paragraphs\n -docfilessubdirs Recursively copy doc-file subdirectories\n -splitindex Split index into one file per letter\n -windowtitle <text> Browser window title for the documentation\n -doctitle <html-code> Include title for the overview page\n -header <html-code> Include header text for each page\n -footer <html-code> Include footer text for each page\n -top <html-code> Include top text for each page\n -bottom <html-code> Include bottom text for each page\n -link <url> Create links to javadoc output at <url>\n -linkoffline <url> <url2> Link to docs at <url> using package list at <url2>\n -excludedocfilessubdir <name1>:.. Exclude any doc-files subdirectories with given name.\n -group <name> <p1>:<p2>.. Group specified packages together in overview page\n -nocomment Suppress description and tags, generate only declarations.\n -nodeprecated Do not include @deprecated information\n -noqualifier <name1>:<name2>:... Exclude the list of qualifiers from the output.\n -nosince Do not include @since information\n -notimestamp Do not include hidden time stamp\n -nodeprecatedlist Do not generate deprecated list\n -notree Do not generate class hierarchy\n -noindex Do not generate index\n -nohelp Do not generate help link\n -nonavbar Do not generate navigation bar\n -serialwarn Generate warning about @serial tag\n -tag <name>:<locations>:<header> Specify single argument custom tags\n -taglet The fully qualified name of Taglet to register\n -tagletpath The path to Taglets\n -charset <charset> Charset for cross-platform viewing of generated documentation.\n -helpfile <file> Include file that help link links to\n -linksource Generate source in HTML\n -sourcetab <tab length> Specify the number of spaces each tab takes up in the source\n -keywords Include HTML meta tags with package, class and member info\n -stylesheetfile <path> File to change style of the generated documentation\n -docencoding <name> Specify the character encoding for the output" },
|
||||
};
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,197 @@
|
||||
package com.sun.tools.doclets.formats.html.resources;
|
||||
|
||||
public final class standard_zh_CN extends java.util.ListResourceBundle {
|
||||
protected final Object[][] getContents() {
|
||||
return new Object[][] {
|
||||
{ "doclet.All_Packages", "\u6240\u6709\u7A0B\u5E8F\u5305" },
|
||||
{ "doclet.All_Profiles", "\u6240\u6709\u914D\u7F6E\u6587\u4EF6" },
|
||||
{ "doclet.Annotation_Type_Hierarchy", "\u6CE8\u91CA\u7C7B\u578B\u5206\u5C42\u7ED3\u6784" },
|
||||
{ "doclet.ClassUse_Annotation", "\u6CE8\u91CA\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u7C7B" },
|
||||
{ "doclet.ClassUse_Classes.in.0.used.by.1", "{1}\u4F7F\u7528\u7684{0}\u4E2D\u7684\u7C7B" },
|
||||
{ "doclet.ClassUse_ConstructorAnnotations", "\u6CE8\u91CA\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u6784\u9020\u5668" },
|
||||
{ "doclet.ClassUse_ConstructorArgs", "\u53C2\u6570\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u6784\u9020\u5668" },
|
||||
{ "doclet.ClassUse_ConstructorArgsTypeParameters", "\u7C7B\u578B\u53D8\u91CF\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u6784\u9020\u5668\u53C2\u6570" },
|
||||
{ "doclet.ClassUse_ConstructorParameterAnnotations", "\u6CE8\u91CA\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u6784\u9020\u5668\u53C2\u6570" },
|
||||
{ "doclet.ClassUse_ConstructorThrows", "\u629B\u51FA{0}\u7684{1}\u4E2D\u7684\u6784\u9020\u5668" },
|
||||
{ "doclet.ClassUse_Field", "\u58F0\u660E\u4E3A{0}\u7684{1}\u4E2D\u7684\u5B57\u6BB5" },
|
||||
{ "doclet.ClassUse_FieldAnnotations", "\u6CE8\u91CA\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u5B57\u6BB5" },
|
||||
{ "doclet.ClassUse_FieldTypeParameter", "\u7C7B\u578B\u53C2\u6570\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u5B57\u6BB5" },
|
||||
{ "doclet.ClassUse_ImplementingClass", "\u5B9E\u73B0{0}\u7684{1}\u4E2D\u7684\u7C7B" },
|
||||
{ "doclet.ClassUse_MethodAnnotations", "\u6CE8\u91CA\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u65B9\u6CD5" },
|
||||
{ "doclet.ClassUse_MethodArgs", "\u53C2\u6570\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u65B9\u6CD5" },
|
||||
{ "doclet.ClassUse_MethodArgsTypeParameters", "\u7C7B\u578B\u53D8\u91CF\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u65B9\u6CD5\u53C2\u6570" },
|
||||
{ "doclet.ClassUse_MethodParameterAnnotations", "\u6CE8\u91CA\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u65B9\u6CD5\u53C2\u6570" },
|
||||
{ "doclet.ClassUse_MethodReturn", "\u8FD4\u56DE{0}\u7684{1}\u4E2D\u7684\u65B9\u6CD5" },
|
||||
{ "doclet.ClassUse_MethodReturnTypeParameter", "\u8FD4\u56DE\u53D8\u91CF\u7C7B\u578B\u4E3A{0}\u7684\u7C7B\u578B\u7684{1}\u4E2D\u7684\u65B9\u6CD5" },
|
||||
{ "doclet.ClassUse_MethodThrows", "\u629B\u51FA{0}\u7684{1}\u4E2D\u7684\u65B9\u6CD5" },
|
||||
{ "doclet.ClassUse_MethodTypeParameter", "\u7C7B\u578B\u53C2\u6570\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u65B9\u6CD5" },
|
||||
{ "doclet.ClassUse_No.usage.of.0", "\u6CA1\u6709{0}\u7684\u7528\u6CD5" },
|
||||
{ "doclet.ClassUse_PackageAnnotation", "\u6CE8\u91CA\u7C7B\u578B\u4E3A{0}\u7684\u7A0B\u5E8F\u5305" },
|
||||
{ "doclet.ClassUse_Packages.that.use.0", "\u4F7F\u7528{0}\u7684\u7A0B\u5E8F\u5305" },
|
||||
{ "doclet.ClassUse_Subclass", "{1}\u4E2D{0}\u7684\u5B50\u7C7B" },
|
||||
{ "doclet.ClassUse_Subinterface", "{1}\u4E2D{0}\u7684\u5B50\u63A5\u53E3" },
|
||||
{ "doclet.ClassUse_Title", "{0}\u7684\u4F7F\u7528" },
|
||||
{ "doclet.ClassUse_TypeParameter", "\u7C7B\u578B\u53C2\u6570\u7C7B\u578B\u4E3A{0}\u7684{1}\u4E2D\u7684\u7C7B" },
|
||||
{ "doclet.ClassUse_Uses.of.0.in.1", "{1}\u4E2D{0}\u7684\u4F7F\u7528" },
|
||||
{ "doclet.Class_Hierarchy", "\u7C7B\u5206\u5C42\u7ED3\u6784" },
|
||||
{ "doclet.Constructor_for", "{0}\u7684\u6784\u9020\u5668" },
|
||||
{ "doclet.Contents", "\u76EE\u5F55" },
|
||||
{ "doclet.Deprecated_API", "\u5DF2\u8FC7\u65F6\u7684 API" },
|
||||
{ "doclet.Deprecated_Annotation_Type_Members", "\u5DF2\u8FC7\u65F6\u7684\u6CE8\u91CA\u7C7B\u578B\u5143\u7D20" },
|
||||
{ "doclet.Deprecated_Annotation_Types", "\u5DF2\u8FC7\u65F6\u7684\u6CE8\u91CA\u7C7B\u578B" },
|
||||
{ "doclet.Deprecated_Classes", "\u5DF2\u8FC7\u65F6\u7684\u7C7B" },
|
||||
{ "doclet.Deprecated_Constructors", "\u5DF2\u8FC7\u65F6\u7684\u6784\u9020\u5668" },
|
||||
{ "doclet.Deprecated_Enum_Constants", "\u5DF2\u8FC7\u65F6\u7684\u679A\u4E3E\u5E38\u91CF" },
|
||||
{ "doclet.Deprecated_Enums", "\u5DF2\u8FC7\u65F6\u7684\u679A\u4E3E" },
|
||||
{ "doclet.Deprecated_Errors", "\u5DF2\u8FC7\u65F6\u7684\u9519\u8BEF" },
|
||||
{ "doclet.Deprecated_Exceptions", "\u5DF2\u8FC7\u65F6\u7684\u5F02\u5E38\u9519\u8BEF" },
|
||||
{ "doclet.Deprecated_Fields", "\u5DF2\u8FC7\u65F6\u7684\u5B57\u6BB5" },
|
||||
{ "doclet.Deprecated_Interfaces", "\u5DF2\u8FC7\u65F6\u7684\u63A5\u53E3" },
|
||||
{ "doclet.Deprecated_Methods", "\u5DF2\u8FC7\u65F6\u7684\u65B9\u6CD5" },
|
||||
{ "doclet.Deprecated_Packages", "\u5DF2\u8FC7\u65F6\u7A0B\u5E8F\u5305" },
|
||||
{ "doclet.Description", "\u8BF4\u660E" },
|
||||
{ "doclet.Description_From_Class", "\u4ECE\u7C7B\u590D\u5236\u7684\u8BF4\u660E:" },
|
||||
{ "doclet.Description_From_Interface", "\u4ECE\u63A5\u53E3\u590D\u5236\u7684\u8BF4\u660E:" },
|
||||
{ "doclet.Detail", "\u8BE6\u7EC6\u8D44\u6599:" },
|
||||
{ "doclet.Enclosing_Class", "\u5C01\u95ED\u7C7B:" },
|
||||
{ "doclet.Enclosing_Interface", "\u5C01\u95ED\u63A5\u53E3:" },
|
||||
{ "doclet.Enum_Hierarchy", "\u679A\u4E3E\u5206\u5C42\u7ED3\u6784" },
|
||||
{ "doclet.Error_in_packagelist", "\u4F7F\u7528 -group \u9009\u9879\u65F6\u51FA\u9519: {0} {1}" },
|
||||
{ "doclet.File_error", "\u8BFB\u53D6\u6587\u4EF6\u65F6\u51FA\u9519: {0}" },
|
||||
{ "doclet.Frame_Alert", "\u6846\u67B6\u9884\u8B66" },
|
||||
{ "doclet.Frame_Warning_Message", "\u8BF7\u4F7F\u7528\u6846\u67B6\u529F\u80FD\u67E5\u770B\u6B64\u6587\u6863\u3002\u5982\u679C\u770B\u5230\u6B64\u6D88\u606F, \u5219\u8868\u660E\u60A8\u4F7F\u7528\u7684\u662F\u4E0D\u652F\u6301\u6846\u67B6\u7684 Web \u5BA2\u6237\u673A\u3002\u94FE\u63A5\u5230{0}\u3002" },
|
||||
{ "doclet.Frames", "\u6846\u67B6" },
|
||||
{ "doclet.Functional_Interface", "\u51FD\u6570\u63A5\u53E3:" },
|
||||
{ "doclet.Functional_Interface_Message", "\u8FD9\u662F\u4E00\u4E2A\u51FD\u6570\u63A5\u53E3, \u56E0\u6B64\u53EF\u7528\u4F5C lambda \u8868\u8FBE\u5F0F\u6216\u65B9\u6CD5\u5F15\u7528\u7684\u8D4B\u503C\u76EE\u6807\u3002" },
|
||||
{ "doclet.Generated_Docs_Untitled", "\u751F\u6210\u7684\u6587\u6863 (\u65E0\u6807\u9898)" },
|
||||
{ "doclet.Groupname_already_used", "\u5728 -group \u9009\u9879\u4E2D, groupname \u5DF2\u4F7F\u7528: {0}" },
|
||||
{ "doclet.Help", "\u5E2E\u52A9" },
|
||||
{ "doclet.Help_annotation_type_line_1", "\u6BCF\u4E2A\u6CE8\u91CA\u7C7B\u578B\u90FD\u6709\u5404\u81EA\u7684\u9875\u9762, \u5176\u4E2D\u5305\u542B\u4EE5\u4E0B\u90E8\u5206:" },
|
||||
{ "doclet.Help_annotation_type_line_2", "\u6CE8\u91CA\u7C7B\u578B\u58F0\u660E" },
|
||||
{ "doclet.Help_annotation_type_line_3", "\u6CE8\u91CA\u7C7B\u578B\u8BF4\u660E" },
|
||||
{ "doclet.Help_enum_line_1", "\u6BCF\u4E2A\u679A\u4E3E\u90FD\u6709\u5404\u81EA\u7684\u9875\u9762, \u5176\u4E2D\u5305\u542B\u4EE5\u4E0B\u90E8\u5206:" },
|
||||
{ "doclet.Help_enum_line_2", "\u679A\u4E3E\u58F0\u660E" },
|
||||
{ "doclet.Help_enum_line_3", "\u679A\u4E3E\u8BF4\u660E" },
|
||||
{ "doclet.Help_line_1", "\u6B64 API \u6587\u6863\u7684\u7EC4\u7EC7\u65B9\u5F0F" },
|
||||
{ "doclet.Help_line_10", "\u6240\u6709\u5DF2\u77E5\u5B9E\u73B0\u7C7B" },
|
||||
{ "doclet.Help_line_11", "\u7C7B/\u63A5\u53E3\u58F0\u660E" },
|
||||
{ "doclet.Help_line_12", "\u7C7B/\u63A5\u53E3\u8BF4\u660E" },
|
||||
{ "doclet.Help_line_13", "\u6BCF\u4E2A\u6982\u8981\u6761\u76EE\u90FD\u5305\u542B\u8BE5\u9879\u76EE\u7684\u8BE6\u7EC6\u8BF4\u660E\u7684\u7B2C\u4E00\u53E5\u3002\u6982\u8981\u6761\u76EE\u6309\u5B57\u6BCD\u987A\u5E8F\u6392\u5217, \u800C\u8BE6\u7EC6\u8BF4\u660E\u5219\u6309\u5176\u5728\u6E90\u4EE3\u7801\u4E2D\u51FA\u73B0\u7684\u987A\u5E8F\u6392\u5217\u3002\u8FD9\u6837\u4FDD\u6301\u4E86\u7A0B\u5E8F\u5458\u6240\u5EFA\u7ACB\u7684\u903B\u8F91\u5206\u7EC4\u3002" },
|
||||
{ "doclet.Help_line_14", "\u4F7F\u7528" },
|
||||
{ "doclet.Help_line_15", "\u6BCF\u4E2A\u5DF2\u6587\u6863\u5316\u7684\u7A0B\u5E8F\u5305, \u7C7B\u548C\u63A5\u53E3\u90FD\u6709\u5404\u81EA\u7684\u201C\u4F7F\u7528\u201D\u9875\u9762\u3002\u6B64\u9875\u9762\u4ECB\u7ECD\u4E86\u4F7F\u7528\u7ED9\u5B9A\u7C7B\u6216\u7A0B\u5E8F\u5305\u7684\u4EFB\u4F55\u90E8\u5206\u7684\u7A0B\u5E8F\u5305, \u7C7B, \u65B9\u6CD5, \u6784\u9020\u5668\u548C\u5B57\u6BB5\u3002\u5BF9\u4E8E\u7ED9\u5B9A\u7684\u7C7B\u6216\u63A5\u53E3 A, \u5176\u201C\u4F7F\u7528\u201D\u9875\u9762\u5305\u542B A \u7684\u5B50\u7C7B, \u58F0\u660E\u4E3A A \u7684\u5B57\u6BB5, \u8FD4\u56DE A \u7684\u65B9\u6CD5, \u4EE5\u53CA\u5E26\u6709\u7C7B\u578B\u4E3A A \u7684\u53C2\u6570\u7684\u65B9\u6CD5\u548C\u6784\u9020\u5668\u3002\u8BBF\u95EE\u6B64\u9875\u9762\u7684\u65B9\u6CD5\u662F: \u9996\u5148\u8F6C\u81F3\u7A0B\u5E8F\u5305, \u7C7B\u6216\u63A5\u53E3, \u7136\u540E\u5355\u51FB\u5BFC\u822A\u680F\u4E2D\u7684 \"\u4F7F\u7528\" \u94FE\u63A5\u3002" },
|
||||
{ "doclet.Help_line_16", "\u6811 (\u7C7B\u5206\u5C42\u7ED3\u6784)" },
|
||||
{ "doclet.Help_line_17_with_tree_link", "\u5BF9\u4E8E\u6240\u6709\u7A0B\u5E8F\u5305, \u6709\u4E00\u4E2A{0}\u9875\u9762, \u4EE5\u53CA\u6BCF\u4E2A\u7A0B\u5E8F\u5305\u7684\u5206\u5C42\u7ED3\u6784\u3002\u6BCF\u4E2A\u5206\u5C42\u7ED3\u6784\u9875\u9762\u90FD\u5305\u542B\u7C7B\u7684\u5217\u8868\u548C\u63A5\u53E3\u7684\u5217\u8868\u3002\u4ECE{1}\u5F00\u59CB, \u6309\u7EE7\u627F\u7ED3\u6784\u5BF9\u7C7B\u8FDB\u884C\u6392\u5217\u3002\u63A5\u53E3\u4E0D\u4ECE{1}\u7EE7\u627F\u3002" },
|
||||
{ "doclet.Help_line_18", "\u67E5\u770B\u201C\u6982\u89C8\u201D\u9875\u9762\u65F6, \u5355\u51FB \"\u6811\" \u5C06\u663E\u793A\u6240\u6709\u7A0B\u5E8F\u5305\u7684\u5206\u5C42\u7ED3\u6784\u3002" },
|
||||
{ "doclet.Help_line_19", "\u67E5\u770B\u7279\u5B9A\u7A0B\u5E8F\u5305, \u7C7B\u6216\u63A5\u53E3\u9875\u9762\u65F6, \u5355\u51FB \"\u6811\" \u5C06\u4EC5\u663E\u793A\u8BE5\u7A0B\u5E8F\u5305\u7684\u5206\u5C42\u7ED3\u6784\u3002" },
|
||||
{ "doclet.Help_line_2", "\u6B64 API (\u5E94\u7528\u7A0B\u5E8F\u7F16\u7A0B\u63A5\u53E3) \u6587\u6863\u5305\u542B\u5BF9\u5E94\u4E8E\u5BFC\u822A\u680F\u4E2D\u7684\u9879\u76EE\u7684\u9875\u9762, \u5982\u4E0B\u6240\u8FF0\u3002" },
|
||||
{ "doclet.Help_line_20_with_deprecated_api_link", "{0} \u9875\u9762\u5217\u51FA\u4E86\u6240\u6709\u5DF2\u8FC7\u65F6\u7684 API\u3002\u4E00\u822C\u7531\u4E8E\u8FDB\u884C\u4E86\u6539\u8FDB\u5E76\u4E14\u901A\u5E38\u63D0\u4F9B\u4E86\u66FF\u4EE3\u7684 API, \u6240\u4EE5\u5EFA\u8BAE\u4E0D\u8981\u4F7F\u7528\u5DF2\u8FC7\u65F6\u7684 API\u3002\u5728\u5C06\u6765\u7684\u5B9E\u73B0\u8FC7\u7A0B\u4E2D, \u53EF\u80FD\u4F1A\u5220\u9664\u5DF2\u8FC7\u65F6\u7684 API\u3002" },
|
||||
{ "doclet.Help_line_21", "\u7D22\u5F15" },
|
||||
{ "doclet.Help_line_22", "{0} \u5305\u542B\u6309\u5B57\u6BCD\u987A\u5E8F\u6392\u5217\u7684\u6240\u6709\u7C7B, \u63A5\u53E3, \u6784\u9020\u5668, \u65B9\u6CD5\u548C\u5B57\u6BB5\u7684\u5217\u8868\u3002" },
|
||||
{ "doclet.Help_line_23", "\u4E0A\u4E00\u4E2A/\u4E0B\u4E00\u4E2A" },
|
||||
{ "doclet.Help_line_24", "\u8FD9\u4E9B\u94FE\u63A5\u4F7F\u60A8\u53EF\u4EE5\u8F6C\u81F3\u4E0B\u4E00\u4E2A\u6216\u4E0A\u4E00\u4E2A\u7C7B, \u63A5\u53E3, \u7A0B\u5E8F\u5305\u6216\u76F8\u5173\u9875\u9762\u3002" },
|
||||
{ "doclet.Help_line_25", "\u6846\u67B6/\u65E0\u6846\u67B6" },
|
||||
{ "doclet.Help_line_26", "\u8FD9\u4E9B\u94FE\u63A5\u7528\u4E8E\u663E\u793A\u548C\u9690\u85CF HTML \u6846\u67B6\u3002\u6240\u6709\u9875\u9762\u5747\u5177\u6709\u6709\u6846\u67B6\u548C\u65E0\u6846\u67B6\u4E24\u79CD\u663E\u793A\u65B9\u5F0F\u3002" },
|
||||
{ "doclet.Help_line_27", "{0}\u94FE\u63A5\u663E\u793A\u6240\u6709\u7C7B\u548C\u63A5\u53E3 (\u9664\u4E86\u975E\u9759\u6001\u5D4C\u5957\u7C7B\u578B)\u3002" },
|
||||
{ "doclet.Help_line_28", "\u6BCF\u4E2A\u53EF\u5E8F\u5217\u5316\u6216\u53EF\u5916\u90E8\u5316\u7684\u7C7B\u90FD\u6709\u5176\u5E8F\u5217\u5316\u5B57\u6BB5\u548C\u65B9\u6CD5\u7684\u8BF4\u660E\u3002\u6B64\u4FE1\u606F\u5BF9\u91CD\u65B0\u5B9E\u73B0\u8005\u6709\u7528, \u800C\u5BF9\u4F7F\u7528 API \u7684\u5F00\u53D1\u8005\u5219\u6CA1\u6709\u4EC0\u4E48\u7528\u5904\u3002\u5C3D\u7BA1\u5BFC\u822A\u680F\u4E2D\u6CA1\u6709\u94FE\u63A5, \u4F46\u60A8\u53EF\u4EE5\u901A\u8FC7\u4E0B\u5217\u65B9\u5F0F\u83B7\u53D6\u6B64\u4FE1\u606F: \u8F6C\u81F3\u4EFB\u4F55\u5E8F\u5217\u5316\u7C7B, \u7136\u540E\u5355\u51FB\u7C7B\u8BF4\u660E\u7684 \"\u53E6\u8BF7\u53C2\u9605\" \u90E8\u5206\u4E2D\u7684 \"\u5E8F\u5217\u5316\u8868\u683C\"\u3002" },
|
||||
{ "doclet.Help_line_29", "{0}\u9875\u9762\u5217\u51FA\u4E86\u9759\u6001\u6700\u7EC8\u5B57\u6BB5\u53CA\u5176\u503C\u3002" },
|
||||
{ "doclet.Help_line_3", "{0} \u9875\u9762\u662F\u6B64 API \u6587\u6863\u7684\u9996\u9875, \u63D0\u4F9B\u4E86\u6240\u6709\u7A0B\u5E8F\u5305\u7684\u5217\u8868\u53CA\u5176\u6982\u8981\u3002\u6B64\u9875\u9762\u4E5F\u53EF\u80FD\u5305\u542B\u8FD9\u4E9B\u7A0B\u5E8F\u5305\u7684\u603B\u4F53\u8BF4\u660E\u3002" },
|
||||
{ "doclet.Help_line_30", "\u6B64\u5E2E\u52A9\u6587\u4EF6\u9002\u7528\u4E8E\u4F7F\u7528\u6807\u51C6 doclet \u751F\u6210\u7684 API \u6587\u6863\u3002" },
|
||||
{ "doclet.Help_line_4", "\u6BCF\u4E2A\u7A0B\u5E8F\u5305\u90FD\u6709\u4E00\u4E2A\u9875\u9762, \u5176\u4E2D\u5305\u542B\u5B83\u7684\u7C7B\u548C\u63A5\u53E3\u7684\u5217\u8868\u53CA\u5176\u6982\u8981\u3002\u6B64\u9875\u9762\u53EF\u4EE5\u5305\u542B\u516D\u4E2A\u7C7B\u522B:" },
|
||||
{ "doclet.Help_line_5", "\u7C7B/\u63A5\u53E3" },
|
||||
{ "doclet.Help_line_6", "\u6BCF\u4E2A\u7C7B, \u63A5\u53E3, \u5D4C\u5957\u7C7B\u548C\u5D4C\u5957\u63A5\u53E3\u90FD\u6709\u5404\u81EA\u7684\u9875\u9762\u3002\u5176\u4E2D\u6BCF\u4E2A\u9875\u9762\u90FD\u7531\u4E09\u90E8\u5206 (\u7C7B/\u63A5\u53E3\u8BF4\u660E, \u6982\u8981\u8868, \u4EE5\u53CA\u8BE6\u7EC6\u7684\u6210\u5458\u8BF4\u660E) \u7EC4\u6210:" },
|
||||
{ "doclet.Help_line_7", "\u7C7B\u7EE7\u627F\u56FE" },
|
||||
{ "doclet.Help_line_8", "\u76F4\u63A5\u5B50\u7C7B" },
|
||||
{ "doclet.Help_line_9", "\u6240\u6709\u5DF2\u77E5\u5B50\u63A5\u53E3" },
|
||||
{ "doclet.Hierarchy_For_All_Packages", "\u6240\u6709\u7A0B\u5E8F\u5305\u7684\u5206\u5C42\u7ED3\u6784" },
|
||||
{ "doclet.Hierarchy_For_Package", "\u7A0B\u5E8F\u5305{0}\u7684\u5206\u5C42\u7ED3\u6784" },
|
||||
{ "doclet.Href_Annotation_Title", "{0}\u4E2D\u7684\u6CE8\u91CA" },
|
||||
{ "doclet.Href_Class_Or_Interface_Title", "{0}\u4E2D\u7684\u7C7B\u6216\u63A5\u53E3" },
|
||||
{ "doclet.Href_Class_Title", "{0}\u4E2D\u7684\u7C7B" },
|
||||
{ "doclet.Href_Enum_Title", "{0}\u4E2D\u7684\u679A\u4E3E" },
|
||||
{ "doclet.Href_Interface_Title", "{0}\u4E2D\u7684\u63A5\u53E3" },
|
||||
{ "doclet.Href_Type_Param_Title", "{0}\u4E2D\u7684\u7C7B\u578B\u53C2\u6570" },
|
||||
{ "doclet.Implementing_Classes", "\u6240\u6709\u5DF2\u77E5\u5B9E\u73B0\u7C7B:" },
|
||||
{ "doclet.Index", "\u7D22\u5F15" },
|
||||
{ "doclet.Interface_Hierarchy", "\u63A5\u53E3\u5206\u5C42\u7ED3\u6784" },
|
||||
{ "doclet.Interfaces_Italic", "\u63A5\u53E3 (\u659C\u4F53)" },
|
||||
{ "doclet.MalformedURL", "\u683C\u5F0F\u9519\u8BEF\u7684 URL: {0}" },
|
||||
{ "doclet.Method_in", "{0}\u4E2D\u7684\u65B9\u6CD5" },
|
||||
{ "doclet.Navigation", "\u5BFC\u822A" },
|
||||
{ "doclet.New_Page", "NewPage" },
|
||||
{ "doclet.Next", "\u4E0B\u4E00\u4E2A" },
|
||||
{ "doclet.Next_Class", "\u4E0B\u4E00\u4E2A\u7C7B" },
|
||||
{ "doclet.Next_Letter", "\u4E0B\u4E00\u4E2A\u5B57\u6BCD" },
|
||||
{ "doclet.Next_Package", "\u4E0B\u4E00\u4E2A\u7A0B\u5E8F\u5305" },
|
||||
{ "doclet.Next_Profile", "\u4E0B\u4E00\u914D\u7F6E\u6587\u4EF6" },
|
||||
{ "doclet.No_Frames", "\u65E0\u6846\u67B6" },
|
||||
{ "doclet.No_Non_Deprecated_Classes_To_Document", "\u627E\u4E0D\u5230\u53EF\u4EE5\u6587\u6863\u5316\u7684\u672A\u8FC7\u65F6\u7684\u7C7B\u3002" },
|
||||
{ "doclet.No_Script_Message", "\u60A8\u7684\u6D4F\u89C8\u5668\u5DF2\u7981\u7528 JavaScript\u3002" },
|
||||
{ "doclet.Non_Frame_Version", "\u975E\u6846\u67B6\u7248\u672C" },
|
||||
{ "doclet.Other_Packages", "\u5176\u4ED6\u7A0B\u5E8F\u5305" },
|
||||
{ "doclet.Overrides", "\u8986\u76D6:" },
|
||||
{ "doclet.Overview", "\u6982\u89C8" },
|
||||
{ "doclet.Package", "\u7A0B\u5E8F\u5305" },
|
||||
{ "doclet.Package_Description", "\u7A0B\u5E8F\u5305{0}\u7684\u8BF4\u660E" },
|
||||
{ "doclet.Package_Hierarchies", "\u7A0B\u5E8F\u5305\u5206\u5C42\u7ED3\u6784:" },
|
||||
{ "doclet.Prev", "\u4E0A\u4E00\u4E2A" },
|
||||
{ "doclet.Prev_Class", "\u4E0A\u4E00\u4E2A\u7C7B" },
|
||||
{ "doclet.Prev_Letter", "\u4E0A\u4E00\u4E2A\u5B57\u6BCD" },
|
||||
{ "doclet.Prev_Package", "\u4E0A\u4E00\u4E2A\u7A0B\u5E8F\u5305" },
|
||||
{ "doclet.Prev_Profile", "\u4E0A\u4E00\u914D\u7F6E\u6587\u4EF6" },
|
||||
{ "doclet.Profile", "\u914D\u7F6E\u6587\u4EF6" },
|
||||
{ "doclet.Same_package_name_used", "\u7A0B\u5E8F\u5305\u540D\u79F0\u5F62\u5F0F\u4F7F\u7528\u4E86\u4E24\u6B21: {0}" },
|
||||
{ "doclet.Skip_navigation_links", "\u8DF3\u8FC7\u5BFC\u822A\u94FE\u63A5" },
|
||||
{ "doclet.Specified_By", "\u6307\u5B9A\u8005:" },
|
||||
{ "doclet.Static_method_in", "{0}\u4E2D\u7684\u9759\u6001\u65B9\u6CD5" },
|
||||
{ "doclet.Static_variable_in", "{0}\u4E2D\u7684\u9759\u6001\u53D8\u91CF" },
|
||||
{ "doclet.Subclasses", "\u76F4\u63A5\u5DF2\u77E5\u5B50\u7C7B:" },
|
||||
{ "doclet.Subinterfaces", "\u6240\u6709\u5DF2\u77E5\u5B50\u63A5\u53E3:" },
|
||||
{ "doclet.Summary", "\u6982\u8981:" },
|
||||
{ "doclet.Tree", "\u6811" },
|
||||
{ "doclet.URL_error", "\u83B7\u53D6 URL \u65F6\u51FA\u9519: {0}" },
|
||||
{ "doclet.Variable_in", "{0}\u4E2D\u7684\u53D8\u91CF" },
|
||||
{ "doclet.Window_ClassUse_Header", "{0} {1}\u7684\u4F7F\u7528" },
|
||||
{ "doclet.Window_Class_Hierarchy", "\u7C7B\u5206\u5C42\u7ED3\u6784" },
|
||||
{ "doclet.Window_Deprecated_List", "\u5DF2\u8FC7\u65F6\u7684\u5217\u8868" },
|
||||
{ "doclet.Window_Help_title", "API \u5E2E\u52A9" },
|
||||
{ "doclet.Window_Overview", "\u6982\u89C8\u5217\u8868" },
|
||||
{ "doclet.Window_Overview_Summary", "\u6982\u89C8" },
|
||||
{ "doclet.Window_Single_Index", "\u7D22\u5F15" },
|
||||
{ "doclet.Window_Source_title", "\u6E90\u4EE3\u7801" },
|
||||
{ "doclet.Window_Split_Index", "{0} - \u7D22\u5F15" },
|
||||
{ "doclet.X.usage", "\u901A\u8FC7\u6807\u51C6 doclet \u63D0\u4F9B:\n -Xdocrootparent <url> \u4F7F\u7528 <url> \u66FF\u6362\u6587\u6863\u6CE8\u91CA\u4E2D\u51FA\u73B0\u7684\n \u6240\u6709\u5176\u540E\u8DDF\u968F /.. \u7684 @docRoot\n -Xdoclint \u4E3A javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u5EFA\u8BAE\u7684\u68C0\u67E5\n -Xdoclint:(all|none|[-]<group>) \n \u5BF9 javadoc \u6CE8\u91CA\u4E2D\u7684\u95EE\u9898\u542F\u7528\u6216\u7981\u7528\u7279\u5B9A\u68C0\u67E5\u3002\n \u5176\u4E2D <group> \u662F accessibility, html, missing, reference \u6216 syntax \u4E4B\u4E00\u3002\n" },
|
||||
{ "doclet.also", "\u5E76" },
|
||||
{ "doclet.build_version", "\u6807\u51C6 Doclet \u7248\u672C {0}" },
|
||||
{ "doclet.deprecated_annotation_type_members", "\u5DF2\u8FC7\u65F6\u7684\u6CE8\u91CA\u7C7B\u578B\u5143\u7D20" },
|
||||
{ "doclet.deprecated_annotation_types", "\u5DF2\u8FC7\u65F6\u7684\u6CE8\u91CA\u7C7B\u578B" },
|
||||
{ "doclet.deprecated_classes", "\u5DF2\u8FC7\u65F6\u7684\u7C7B" },
|
||||
{ "doclet.deprecated_constructors", "\u5DF2\u8FC7\u65F6\u7684\u6784\u9020\u5668" },
|
||||
{ "doclet.deprecated_enum_constants", "\u5DF2\u8FC7\u65F6\u7684\u679A\u4E3E\u5E38\u91CF" },
|
||||
{ "doclet.deprecated_enums", "\u5DF2\u8FC7\u65F6\u7684\u679A\u4E3E" },
|
||||
{ "doclet.deprecated_errors", "\u5DF2\u8FC7\u65F6\u7684\u9519\u8BEF" },
|
||||
{ "doclet.deprecated_exceptions", "\u5DF2\u8FC7\u65F6\u7684\u5F02\u5E38\u9519\u8BEF" },
|
||||
{ "doclet.deprecated_fields", "\u5DF2\u8FC7\u65F6\u7684\u5B57\u6BB5" },
|
||||
{ "doclet.deprecated_interfaces", "\u5DF2\u8FC7\u65F6\u7684\u63A5\u53E3" },
|
||||
{ "doclet.deprecated_methods", "\u5DF2\u8FC7\u65F6\u7684\u65B9\u6CD5" },
|
||||
{ "doclet.deprecated_packages", "\u5DF2\u8FC7\u65F6\u7A0B\u5E8F\u5305" },
|
||||
{ "doclet.exception_encountered", "\u5904\u7406{1}\u65F6\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\n{0}" },
|
||||
{ "doclet.in_class", "\u5728\u7C7B\u4E2D" },
|
||||
{ "doclet.in_interface", "\u5728\u63A5\u53E3\u4E2D" },
|
||||
{ "doclet.navAnnotationTypeMember", "\u5143\u7D20" },
|
||||
{ "doclet.navAnnotationTypeOptionalMember", "\u53EF\u9009" },
|
||||
{ "doclet.navAnnotationTypeRequiredMember", "\u5FC5\u9700" },
|
||||
{ "doclet.navClassUse", "\u4F7F\u7528" },
|
||||
{ "doclet.navConstructor", "\u6784\u9020\u5668" },
|
||||
{ "doclet.navDeprecated", "\u5DF2\u8FC7\u65F6" },
|
||||
{ "doclet.navEnum", "\u679A\u4E3E\u5E38\u91CF" },
|
||||
{ "doclet.navField", "\u5B57\u6BB5" },
|
||||
{ "doclet.navMethod", "\u65B9\u6CD5" },
|
||||
{ "doclet.navNested", "\u5D4C\u5957" },
|
||||
{ "doclet.navProperty", "\u5C5E\u6027" },
|
||||
{ "doclet.package", "\u7A0B\u5E8F\u5305" },
|
||||
{ "doclet.see.class_or_package_not_accessible", "\u6807\u8BB0{0}: \u65E0\u6CD5\u8BBF\u95EE\u5F15\u7528: {1}" },
|
||||
{ "doclet.see.class_or_package_not_found", "\u6807\u8BB0{0}: \u627E\u4E0D\u5230\u5F15\u7528: {1}" },
|
||||
{ "doclet.usage", "\u901A\u8FC7\u6807\u51C6 doclet \u63D0\u4F9B:\n -d <directory> \u8F93\u51FA\u6587\u4EF6\u7684\u76EE\u6807\u76EE\u5F55\n -use \u521B\u5EFA\u7C7B\u548C\u7A0B\u5E8F\u5305\u7528\u6CD5\u9875\u9762\n -version \u5305\u542B @version \u6BB5\n -author \u5305\u542B @author \u6BB5\n -docfilessubdirs \u9012\u5F52\u590D\u5236\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\n -splitindex \u5C06\u7D22\u5F15\u5206\u4E3A\u6BCF\u4E2A\u5B57\u6BCD\u5BF9\u5E94\u4E00\u4E2A\u6587\u4EF6\n -windowtitle <text> \u6587\u6863\u7684\u6D4F\u89C8\u5668\u7A97\u53E3\u6807\u9898\n -doctitle <html-code> \u5305\u542B\u6982\u89C8\u9875\u9762\u7684\u6807\u9898\n -header <html-code> \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u7709\u6587\u672C\n -footer <html-code> \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9875\u811A\u6587\u672C\n -top <html-code> \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u9876\u90E8\u6587\u672C\n -bottom <html-code> \u5305\u542B\u6BCF\u4E2A\u9875\u9762\u7684\u5E95\u90E8\u6587\u672C\n -link <url> \u521B\u5EFA\u6307\u5411\u4F4D\u4E8E <url> \u7684 javadoc \u8F93\u51FA\u7684\u94FE\u63A5\n -linkoffline <url> <url2> \u5229\u7528\u4F4D\u4E8E <url2> \u7684\u7A0B\u5E8F\u5305\u5217\u8868\u94FE\u63A5\u81F3\u4F4D\u4E8E <url> \u7684\u6587\u6863\n -excludedocfilessubdir <name1>:.. \u6392\u9664\u5177\u6709\u7ED9\u5B9A\u540D\u79F0\u7684\u6240\u6709\u6587\u6863\u6587\u4EF6\u5B50\u76EE\u5F55\u3002\n -group <name> <p1>:<p2>.. \u5728\u6982\u89C8\u9875\u9762\u4E2D, \u5C06\u6307\u5B9A\u7684\u7A0B\u5E8F\u5305\u5206\u7EC4\n -nocomment \u4E0D\u751F\u6210\u8BF4\u660E\u548C\u6807\u8BB0, \u53EA\u751F\u6210\u58F0\u660E\u3002\n -nodeprecated \u4E0D\u5305\u542B @deprecated \u4FE1\u606F\n -noqualifier <name1>:<name2>:... \u8F93\u51FA\u4E2D\u4E0D\u5305\u62EC\u6307\u5B9A\u9650\u5B9A\u7B26\u7684\u5217\u8868\u3002\n -nosince \u4E0D\u5305\u542B @since \u4FE1\u606F\n -notimestamp \u4E0D\u5305\u542B\u9690\u85CF\u65F6\u95F4\u6233\n -nodeprecatedlist \u4E0D\u751F\u6210\u5DF2\u8FC7\u65F6\u7684\u5217\u8868\n -notree \u4E0D\u751F\u6210\u7C7B\u5206\u5C42\u7ED3\u6784\n -noindex \u4E0D\u751F\u6210\u7D22\u5F15\n -nohelp \u4E0D\u751F\u6210\u5E2E\u52A9\u94FE\u63A5\n -nonavbar \u4E0D\u751F\u6210\u5BFC\u822A\u680F\n -serialwarn \u751F\u6210\u6709\u5173 @serial \u6807\u8BB0\u7684\u8B66\u544A\n -tag <name>:<locations>:<header> \u6307\u5B9A\u5355\u4E2A\u53C2\u6570\u5B9A\u5236\u6807\u8BB0\n -taglet \u8981\u6CE8\u518C\u7684 Taglet \u7684\u5168\u9650\u5B9A\u540D\u79F0\n -tagletpath Taglet \u7684\u8DEF\u5F84\n -charset <charset> \u7528\u4E8E\u8DE8\u5E73\u53F0\u67E5\u770B\u751F\u6210\u7684\u6587\u6863\u7684\u5B57\u7B26\u96C6\u3002\n -helpfile <file> \u5305\u542B\u5E2E\u52A9\u94FE\u63A5\u6240\u94FE\u63A5\u5230\u7684\u6587\u4EF6\n -linksource \u4EE5 HTML \u683C\u5F0F\u751F\u6210\u6E90\u6587\u4EF6\n -sourcetab <tab length> \u6307\u5B9A\u6E90\u4E2D\u6BCF\u4E2A\u5236\u8868\u7B26\u5360\u636E\u7684\u7A7A\u683C\u6570\n -keywords \u4F7F\u7A0B\u5E8F\u5305, \u7C7B\u548C\u6210\u5458\u4FE1\u606F\u9644\u5E26 HTML \u5143\u6807\u8BB0\n -stylesheetfile <path> \u7528\u4E8E\u66F4\u6539\u751F\u6210\u6587\u6863\u7684\u6837\u5F0F\u7684\u6587\u4EF6\n -docencoding <name> \u6307\u5B9A\u8F93\u51FA\u7684\u5B57\u7B26\u7F16\u7801" },
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.builders.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* An abstract implementation of a Doclet.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
*/
|
||||
public abstract class AbstractDoclet {
|
||||
|
||||
/**
|
||||
* The global configuration information for this run.
|
||||
*/
|
||||
public Configuration configuration;
|
||||
|
||||
/**
|
||||
* The only doclet that may use this toolkit is {@value}
|
||||
*/
|
||||
private static final String TOOLKIT_DOCLET_NAME =
|
||||
com.sun.tools.doclets.formats.html.HtmlDoclet.class.getName();
|
||||
|
||||
/**
|
||||
* Verify that the only doclet that is using this toolkit is
|
||||
* {@value #TOOLKIT_DOCLET_NAME}.
|
||||
*/
|
||||
private boolean isValidDoclet(AbstractDoclet doclet) {
|
||||
if (! doclet.getClass().getName().equals(TOOLKIT_DOCLET_NAME)) {
|
||||
configuration.message.error("doclet.Toolkit_Usage_Violation",
|
||||
TOOLKIT_DOCLET_NAME);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The method that starts the execution of the doclet.
|
||||
*
|
||||
* @param doclet the doclet to start the execution for.
|
||||
* @param root the {@link RootDoc} that points to the source to document.
|
||||
* @return true if the doclet executed without error. False otherwise.
|
||||
*/
|
||||
public boolean start(AbstractDoclet doclet, RootDoc root) {
|
||||
configuration = configuration();
|
||||
configuration.root = root;
|
||||
if (! isValidDoclet(doclet)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
doclet.startGeneration(root);
|
||||
} catch (Configuration.Fault f) {
|
||||
root.printError(f.getMessage());
|
||||
return false;
|
||||
} catch (FatalError fe) {
|
||||
return false;
|
||||
} catch (DocletAbortException e) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause != null) {
|
||||
if (cause.getLocalizedMessage() != null) {
|
||||
root.printError(cause.getLocalizedMessage());
|
||||
} else {
|
||||
root.printError(cause.toString());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (Exception exc) {
|
||||
exc.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that this doclet supports the 1.5 language features.
|
||||
* @return JAVA_1_5, indicating that the new features are supported.
|
||||
*/
|
||||
public static LanguageVersion languageVersion() {
|
||||
return LanguageVersion.JAVA_1_5;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the configuration instance and returns it.
|
||||
* @return the configuration of the doclet.
|
||||
*/
|
||||
public abstract Configuration configuration();
|
||||
|
||||
/**
|
||||
* Start the generation of files. Call generate methods in the individual
|
||||
* writers, which will in turn generate the documentation files. Call the
|
||||
* TreeWriter generation first to ensure the Class Hierarchy is built
|
||||
* first and then can be used in the later generation.
|
||||
*
|
||||
* @see com.sun.javadoc.RootDoc
|
||||
*/
|
||||
private void startGeneration(RootDoc root) throws Configuration.Fault, Exception {
|
||||
if (root.classes().length == 0) {
|
||||
configuration.message.
|
||||
error("doclet.No_Public_Classes_To_Document");
|
||||
return;
|
||||
}
|
||||
configuration.setOptions();
|
||||
configuration.getDocletSpecificMsg().notice("doclet.build_version",
|
||||
configuration.getDocletSpecificBuildDate());
|
||||
ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
|
||||
|
||||
generateClassFiles(root, classtree);
|
||||
Util.copyDocFiles(configuration, DocPaths.DOC_FILES);
|
||||
|
||||
PackageListWriter.generate(configuration);
|
||||
generatePackageFiles(classtree);
|
||||
generateProfileFiles();
|
||||
|
||||
generateOtherFiles(root, classtree);
|
||||
configuration.tagletManager.printReport();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate additional documentation that is added to the API documentation.
|
||||
*
|
||||
* @param root the RootDoc of source to document.
|
||||
* @param classtree the data structure representing the class tree.
|
||||
*/
|
||||
protected void generateOtherFiles(RootDoc root, ClassTree classtree) throws Exception {
|
||||
BuilderFactory builderFactory = configuration.getBuilderFactory();
|
||||
AbstractBuilder constantsSummaryBuilder = builderFactory.getConstantsSummaryBuider();
|
||||
constantsSummaryBuilder.build();
|
||||
AbstractBuilder serializedFormBuilder = builderFactory.getSerializedFormBuilder();
|
||||
serializedFormBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the profile documentation.
|
||||
*
|
||||
*/
|
||||
protected abstract void generateProfileFiles() throws Exception;
|
||||
|
||||
/**
|
||||
* Generate the package documentation.
|
||||
*
|
||||
* @param classtree the data structure representing the class tree.
|
||||
*/
|
||||
protected abstract void generatePackageFiles(ClassTree classtree) throws Exception;
|
||||
|
||||
/**
|
||||
* Generate the class documentation.
|
||||
*
|
||||
* @param classtree the data structure representing the class tree.
|
||||
*/
|
||||
protected abstract void generateClassFiles(ClassDoc[] arr, ClassTree classtree);
|
||||
|
||||
/**
|
||||
* Iterate through all classes and construct documentation for them.
|
||||
*
|
||||
* @param root the RootDoc of source to document.
|
||||
* @param classtree the data structure representing the class tree.
|
||||
*/
|
||||
protected void generateClassFiles(RootDoc root, ClassTree classtree) {
|
||||
generateClassFiles(classtree);
|
||||
PackageDoc[] packages = root.specifiedPackages();
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
generateClassFiles(packages[i].allClasses(), classtree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the class files for single classes specified on the command line.
|
||||
*
|
||||
* @param classtree the data structure representing the class tree.
|
||||
*/
|
||||
private void generateClassFiles(ClassTree classtree) {
|
||||
String[] packageNames = configuration.classDocCatalog.packageNames();
|
||||
for (int packageNameIndex = 0; packageNameIndex < packageNames.length;
|
||||
packageNameIndex++) {
|
||||
generateClassFiles(configuration.classDocCatalog.allClasses(
|
||||
packageNames[packageNameIndex]), classtree);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing annotation type field output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
* @since 1.8
|
||||
*/
|
||||
|
||||
public interface AnnotationTypeFieldWriter {
|
||||
|
||||
/**
|
||||
* Add the annotation type member tree header.
|
||||
*
|
||||
* @return content tree for the member tree header
|
||||
*/
|
||||
public Content getMemberTreeHeader();
|
||||
|
||||
/**
|
||||
* Add the annotation type field details marker.
|
||||
*
|
||||
* @param memberDetails the content tree representing field details marker
|
||||
*/
|
||||
public void addAnnotationFieldDetailsMarker(Content memberDetails);
|
||||
|
||||
/**
|
||||
* Add the annotation type details tree header.
|
||||
*
|
||||
* @param classDoc the annotation type being documented
|
||||
* @param memberDetailsTree the content tree representing member details
|
||||
*/
|
||||
public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the annotation type documentation tree header.
|
||||
*
|
||||
* @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 Content getAnnotationDocTreeHeader(MemberDoc member,
|
||||
Content annotationDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the annotation type details tree.
|
||||
*
|
||||
* @param annotationDetailsTree the content tree representing annotation type details
|
||||
* @return content tree for the annotation type details
|
||||
*/
|
||||
public Content getAnnotationDetails(Content annotationDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the annotation type documentation.
|
||||
*
|
||||
* @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 Content getAnnotationDoc(Content annotationDocTree, boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Get the signature for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @return content tree for the annotation type signature
|
||||
*/
|
||||
public Content getSignature(MemberDoc member);
|
||||
|
||||
/**
|
||||
* Add the deprecated output for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param annotationDocTree content tree to which the deprecated information will be added
|
||||
*/
|
||||
public void addDeprecated(MemberDoc member, Content annotationDocTree);
|
||||
|
||||
/**
|
||||
* 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 addComments(MemberDoc member, Content annotationDocTree);
|
||||
|
||||
/**
|
||||
* Add the tags for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param annotationDocTree the content tree to which the tags will be added
|
||||
*/
|
||||
public void addTags(MemberDoc member, Content annotationDocTree);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing annotation type optional member output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface AnnotationTypeOptionalMemberWriter extends
|
||||
AnnotationTypeRequiredMemberWriter {
|
||||
|
||||
/**
|
||||
* 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 addDefaultValueInfo(MemberDoc member, Content annotationDocTree);
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing annotation type required member output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface AnnotationTypeRequiredMemberWriter {
|
||||
|
||||
/**
|
||||
* Add the annotation type member tree header.
|
||||
*
|
||||
* @return content tree for the member tree header
|
||||
*/
|
||||
public Content getMemberTreeHeader();
|
||||
|
||||
/**
|
||||
* Add the annotation type details marker.
|
||||
*
|
||||
* @param memberDetails the content tree representing details marker
|
||||
*/
|
||||
public void addAnnotationDetailsMarker(Content memberDetails);
|
||||
|
||||
/**
|
||||
* Add the annotation type details tree header.
|
||||
*
|
||||
* @param classDoc the annotation type being documented
|
||||
* @param memberDetailsTree the content tree representing member details
|
||||
*/
|
||||
public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the annotation type documentation tree header.
|
||||
*
|
||||
* @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 Content getAnnotationDocTreeHeader(MemberDoc member,
|
||||
Content annotationDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the annotation type details tree.
|
||||
*
|
||||
* @param annotationDetailsTree the content tree representing annotation type details
|
||||
* @return content tree for the annotation type details
|
||||
*/
|
||||
public Content getAnnotationDetails(Content annotationDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the annotation type documentation.
|
||||
*
|
||||
* @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 Content getAnnotationDoc(Content annotationDocTree, boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Get the signature for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @return content tree for the annotation type signature
|
||||
*/
|
||||
public Content getSignature(MemberDoc member);
|
||||
|
||||
/**
|
||||
* Add the deprecated output for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param annotationDocTree content tree to which the deprecated information will be added
|
||||
*/
|
||||
public void addDeprecated(MemberDoc member, Content annotationDocTree);
|
||||
|
||||
/**
|
||||
* 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 addComments(MemberDoc member, Content annotationDocTree);
|
||||
|
||||
/**
|
||||
* Add the tags for the given member.
|
||||
*
|
||||
* @param member the member being documented
|
||||
* @param annotationDocTree the content tree to which the tags will be added
|
||||
*/
|
||||
public void addTags(MemberDoc member, Content annotationDocTree);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing annotation type output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface AnnotationTypeWriter {
|
||||
|
||||
/**
|
||||
* Get the header of the page.
|
||||
*
|
||||
* @param header the header string to write
|
||||
* @return a content tree for the header documentation
|
||||
*/
|
||||
public Content getHeader(String header);
|
||||
|
||||
/**
|
||||
* Get the annotation content header.
|
||||
*
|
||||
* @return annotation content header that needs to be added to the documentation
|
||||
*/
|
||||
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 addAnnotationTypeDescription(Content annotationInfoTree);
|
||||
|
||||
/**
|
||||
* Add the tag information for the current annotation type.
|
||||
*
|
||||
* @param annotationInfoTree content tree to which the tag information will be added
|
||||
*/
|
||||
public void addAnnotationTypeTagInfo(Content annotationInfoTree);
|
||||
|
||||
/**
|
||||
* If this annotation is deprecated, add the appropriate information.
|
||||
*
|
||||
* @param annotationInfoTree content tree to which the deprecated information will be added
|
||||
*/
|
||||
public void addAnnotationTypeDeprecationInfo (Content annotationInfoTree);
|
||||
|
||||
/**
|
||||
* 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) throws IOException;
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
|
||||
/**
|
||||
* Return the {@link AnnotationTypeDoc} being documented.
|
||||
*
|
||||
* @return the AnnotationTypeDoc being documented.
|
||||
*/
|
||||
public AnnotationTypeDoc getAnnotationTypeDoc();
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing class output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface ClassWriter {
|
||||
|
||||
/**
|
||||
* Get the header of the page.
|
||||
*
|
||||
* @param header the header string to write
|
||||
* @return header content that needs to be added to the documentation
|
||||
*/
|
||||
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 functional interface, display appropriate message.
|
||||
*
|
||||
* @param classInfoTree content tree to which the documentation will be added
|
||||
*/
|
||||
public void addFunctionalInterfaceInfo(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 addClassDescription(Content classInfoTree);
|
||||
|
||||
/**
|
||||
* Add the tag information for the current class.
|
||||
*
|
||||
* @param classInfoTree content tree to which the tag information will be added
|
||||
*/
|
||||
public void addClassTagInfo(Content classInfoTree);
|
||||
|
||||
/**
|
||||
* Get the member tree header for the class.
|
||||
*
|
||||
* @return a content tree for the member tree header
|
||||
*/
|
||||
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) throws IOException;
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
|
||||
/**
|
||||
* Return the classDoc being documented.
|
||||
*
|
||||
* @return the classDoc being documented.
|
||||
*/
|
||||
public ClassDoc getClassDoc();
|
||||
|
||||
/**
|
||||
* 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 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);
|
||||
}
|
||||
@@ -0,0 +1,989 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.tools.JavaFileManager;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.javac.sym.Profiles;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory;
|
||||
import com.sun.tools.doclets.internal.toolkit.taglets.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
import com.sun.tools.javac.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Configure the output based on the options. Doclets should sub-class
|
||||
* Configuration, to configure and add their own options. This class contains
|
||||
* all user options which are supported by the 1.1 doclet and the standard
|
||||
* doclet.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Robert Field.
|
||||
* @author Atul Dambalkar.
|
||||
* @author Jamie Ho
|
||||
*/
|
||||
public abstract class Configuration {
|
||||
|
||||
/**
|
||||
* Exception used to report a problem during setOptions.
|
||||
*/
|
||||
public static class Fault extends Exception {
|
||||
private static final long serialVersionUID = 0;
|
||||
|
||||
Fault(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
Fault(String msg, Exception cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The factory for builders.
|
||||
*/
|
||||
protected BuilderFactory builderFactory;
|
||||
|
||||
/**
|
||||
* The taglet manager.
|
||||
*/
|
||||
public TagletManager tagletManager;
|
||||
|
||||
/**
|
||||
* The path to the builder XML input file.
|
||||
*/
|
||||
public String builderXMLPath;
|
||||
|
||||
/**
|
||||
* The default path to the builder XML.
|
||||
*/
|
||||
private static final String DEFAULT_BUILDER_XML = "resources/doclet.xml";
|
||||
|
||||
/**
|
||||
* The path to Taglets
|
||||
*/
|
||||
public String tagletpath = "";
|
||||
|
||||
/**
|
||||
* This is true if option "-serialwarn" is used. Defualt value is false to
|
||||
* suppress excessive warnings about serial tag.
|
||||
*/
|
||||
public boolean serialwarn = false;
|
||||
|
||||
/**
|
||||
* The specified amount of space between tab stops.
|
||||
*/
|
||||
public int sourcetab;
|
||||
|
||||
public String tabSpaces;
|
||||
|
||||
/**
|
||||
* True if we should generate browsable sources.
|
||||
*/
|
||||
public boolean linksource = false;
|
||||
|
||||
/**
|
||||
* True if command line option "-nosince" is used. Default value is
|
||||
* false.
|
||||
*/
|
||||
public boolean nosince = false;
|
||||
|
||||
/**
|
||||
* True if we should recursively copy the doc-file subdirectories
|
||||
*/
|
||||
public boolean copydocfilesubdirs = false;
|
||||
|
||||
/**
|
||||
* The META charset tag used for cross-platform viewing.
|
||||
*/
|
||||
public String charset = "";
|
||||
|
||||
/**
|
||||
* True if user wants to add member names as meta keywords.
|
||||
* Set to false because meta keywords are ignored in general
|
||||
* by most Internet search engines.
|
||||
*/
|
||||
public boolean keywords = false;
|
||||
|
||||
/**
|
||||
* The meta tag keywords instance.
|
||||
*/
|
||||
public final MetaKeywords metakeywords = new MetaKeywords(this);
|
||||
|
||||
/**
|
||||
* The list of doc-file subdirectories to exclude
|
||||
*/
|
||||
protected Set<String> excludedDocFileDirs;
|
||||
|
||||
/**
|
||||
* The list of qualifiers to exclude
|
||||
*/
|
||||
protected Set<String> excludedQualifiers;
|
||||
|
||||
/**
|
||||
* The Root of the generated Program Structure from the Doclet API.
|
||||
*/
|
||||
public RootDoc root;
|
||||
|
||||
/**
|
||||
* Destination directory name, in which doclet will generate the entire
|
||||
* documentation. Default is current directory.
|
||||
*/
|
||||
public String destDirName = "";
|
||||
|
||||
/**
|
||||
* Destination directory name, in which doclet will copy the doc-files to.
|
||||
*/
|
||||
public String docFileDestDirName = "";
|
||||
|
||||
/**
|
||||
* Encoding for this document. Default is default encoding for this
|
||||
* platform.
|
||||
*/
|
||||
public String docencoding = null;
|
||||
|
||||
/**
|
||||
* True if user wants to suppress descriptions and tags.
|
||||
*/
|
||||
public boolean nocomment = false;
|
||||
|
||||
/**
|
||||
* Encoding for this document. Default is default encoding for this
|
||||
* platform.
|
||||
*/
|
||||
public String encoding = null;
|
||||
|
||||
/**
|
||||
* Generate author specific information for all the classes if @author
|
||||
* tag is used in the doc comment and if -author option is used.
|
||||
* <code>showauthor</code> is set to true if -author option is used.
|
||||
* Default is don't show author information.
|
||||
*/
|
||||
public boolean showauthor = false;
|
||||
|
||||
/**
|
||||
* Generate documentation for JavaFX getters and setters automatically
|
||||
* by copying it from the appropriate property definition.
|
||||
*/
|
||||
public boolean javafx = false;
|
||||
|
||||
/**
|
||||
* Generate version specific information for the all the classes
|
||||
* if @version tag is used in the doc comment and if -version option is
|
||||
* used. <code>showversion</code> is set to true if -version option is
|
||||
* used.Default is don't show version information.
|
||||
*/
|
||||
public boolean showversion = false;
|
||||
|
||||
/**
|
||||
* Sourcepath from where to read the source files. Default is classpath.
|
||||
*
|
||||
*/
|
||||
public String sourcepath = "";
|
||||
|
||||
/**
|
||||
* Argument for command line option "-Xprofilespath".
|
||||
*/
|
||||
public String profilespath = "";
|
||||
|
||||
/**
|
||||
* Generate profiles documentation if profilespath is set and valid profiles
|
||||
* are present.
|
||||
*/
|
||||
public boolean showProfiles = false;
|
||||
|
||||
/**
|
||||
* Don't generate deprecated API information at all, if -nodeprecated
|
||||
* option is used. <code>nodepracted</code> is set to true if
|
||||
* -nodeprecated option is used. Default is generate deprected API
|
||||
* information.
|
||||
*/
|
||||
public boolean nodeprecated = false;
|
||||
|
||||
/**
|
||||
* The catalog of classes specified on the command-line
|
||||
*/
|
||||
public ClassDocCatalog classDocCatalog;
|
||||
|
||||
/**
|
||||
* Message Retriever for the doclet, to retrieve message from the resource
|
||||
* file for this Configuration, which is common for 1.1 and standard
|
||||
* doclets.
|
||||
*
|
||||
* TODO: Make this private!!!
|
||||
*/
|
||||
public MessageRetriever message = null;
|
||||
|
||||
/**
|
||||
* True if user wants to suppress time stamp in output.
|
||||
* Default is false.
|
||||
*/
|
||||
public boolean notimestamp= false;
|
||||
|
||||
/**
|
||||
* The package grouping instance.
|
||||
*/
|
||||
public final Group group = new Group(this);
|
||||
|
||||
/**
|
||||
* The tracker of external package links.
|
||||
*/
|
||||
public final Extern extern = new Extern(this);
|
||||
|
||||
/**
|
||||
* Return the build date for the doclet.
|
||||
*/
|
||||
public abstract String getDocletSpecificBuildDate();
|
||||
|
||||
/**
|
||||
* This method should be defined in all those doclets(configurations),
|
||||
* which want to derive themselves from this Configuration. This method
|
||||
* can be used to set its own command line options.
|
||||
*
|
||||
* @param options The array of option names and values.
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public abstract void setSpecificDocletOptions(String[][] options) throws Fault;
|
||||
|
||||
/**
|
||||
* Return the doclet specific {@link MessageRetriever}
|
||||
* @return the doclet specific MessageRetriever.
|
||||
*/
|
||||
public abstract MessageRetriever getDocletSpecificMsg();
|
||||
|
||||
/**
|
||||
* A profiles object used to access profiles across various pages.
|
||||
*/
|
||||
public Profiles profiles;
|
||||
|
||||
/**
|
||||
* An map of the profiles to packages.
|
||||
*/
|
||||
public Map<String,PackageDoc[]> profilePackages;
|
||||
|
||||
/**
|
||||
* An array of the packages specified on the command-line merged
|
||||
* with the array of packages that contain the classes specified on the
|
||||
* command-line. The array is sorted.
|
||||
*/
|
||||
public PackageDoc[] packages;
|
||||
|
||||
/**
|
||||
* Constructor. Constructs the message retriever with resource file.
|
||||
*/
|
||||
public Configuration() {
|
||||
message =
|
||||
new MessageRetriever(this,
|
||||
"com.sun.tools.doclets.internal.toolkit.resources.doclets");
|
||||
excludedDocFileDirs = new HashSet<String>();
|
||||
excludedQualifiers = new HashSet<String>();
|
||||
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the builder factory for this doclet.
|
||||
*
|
||||
* @return the builder factory for this doclet.
|
||||
*/
|
||||
public BuilderFactory getBuilderFactory() {
|
||||
if (builderFactory == null) {
|
||||
builderFactory = new BuilderFactory(this);
|
||||
}
|
||||
return builderFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method should be defined in all those doclets
|
||||
* which want to inherit from this Configuration. This method
|
||||
* should return the number of arguments to the command line
|
||||
* option (including the option name). For example,
|
||||
* -notimestamp is a single-argument option, so this method would
|
||||
* return 1.
|
||||
*
|
||||
* @param option Command line option under consideration.
|
||||
* @return number of arguments to option (including the
|
||||
* option name). Zero return means option not known.
|
||||
* Negative value means error occurred.
|
||||
*/
|
||||
public int optionLength(String option) {
|
||||
option = StringUtils.toLowerCase(option);
|
||||
if (option.equals("-author") ||
|
||||
option.equals("-docfilessubdirs") ||
|
||||
option.equals("-javafx") ||
|
||||
option.equals("-keywords") ||
|
||||
option.equals("-linksource") ||
|
||||
option.equals("-nocomment") ||
|
||||
option.equals("-nodeprecated") ||
|
||||
option.equals("-nosince") ||
|
||||
option.equals("-notimestamp") ||
|
||||
option.equals("-quiet") ||
|
||||
option.equals("-xnodate") ||
|
||||
option.equals("-version")) {
|
||||
return 1;
|
||||
} else if (option.equals("-d") ||
|
||||
option.equals("-docencoding") ||
|
||||
option.equals("-encoding") ||
|
||||
option.equals("-excludedocfilessubdir") ||
|
||||
option.equals("-link") ||
|
||||
option.equals("-sourcetab") ||
|
||||
option.equals("-noqualifier") ||
|
||||
option.equals("-output") ||
|
||||
option.equals("-sourcepath") ||
|
||||
option.equals("-tag") ||
|
||||
option.equals("-taglet") ||
|
||||
option.equals("-tagletpath") ||
|
||||
option.equals("-xprofilespath")) {
|
||||
return 2;
|
||||
} else if (option.equals("-group") ||
|
||||
option.equals("-linkoffline")) {
|
||||
return 3;
|
||||
} else {
|
||||
return -1; // indicate we don't know about it
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform error checking on the given options.
|
||||
*
|
||||
* @param options the given options to check.
|
||||
* @param reporter the reporter used to report errors.
|
||||
*/
|
||||
public abstract boolean validOptions(String options[][],
|
||||
DocErrorReporter reporter);
|
||||
|
||||
private void initProfiles() throws IOException {
|
||||
if (profilespath.isEmpty())
|
||||
return;
|
||||
|
||||
profiles = Profiles.read(new File(profilespath));
|
||||
|
||||
// Group the packages to be documented by the lowest profile (if any)
|
||||
// in which each appears
|
||||
Map<Profile, List<PackageDoc>> interimResults =
|
||||
new EnumMap<Profile, List<PackageDoc>>(Profile.class);
|
||||
for (Profile p: Profile.values())
|
||||
interimResults.put(p, new ArrayList<PackageDoc>());
|
||||
|
||||
for (PackageDoc pkg: packages) {
|
||||
if (nodeprecated && Util.isDeprecated(pkg)) {
|
||||
continue;
|
||||
}
|
||||
// the getProfile method takes a type name, not a package name,
|
||||
// but isn't particularly fussy about the simple name -- so just use *
|
||||
int i = profiles.getProfile(pkg.name().replace(".", "/") + "/*");
|
||||
Profile p = Profile.lookup(i);
|
||||
if (p != null) {
|
||||
List<PackageDoc> pkgs = interimResults.get(p);
|
||||
pkgs.add(pkg);
|
||||
}
|
||||
}
|
||||
|
||||
// Build the profilePackages structure used by the doclet
|
||||
profilePackages = new HashMap<String,PackageDoc[]>();
|
||||
List<PackageDoc> prev = Collections.<PackageDoc>emptyList();
|
||||
int size;
|
||||
for (Map.Entry<Profile,List<PackageDoc>> e: interimResults.entrySet()) {
|
||||
Profile p = e.getKey();
|
||||
List<PackageDoc> pkgs = e.getValue();
|
||||
pkgs.addAll(prev); // each profile contains all lower profiles
|
||||
Collections.sort(pkgs);
|
||||
size = pkgs.size();
|
||||
// For a profile, if there are no packages to be documented, do not add
|
||||
// it to profilePackages map.
|
||||
if (size > 0)
|
||||
profilePackages.put(p.name, pkgs.toArray(new PackageDoc[pkgs.size()]));
|
||||
prev = pkgs;
|
||||
}
|
||||
|
||||
// Generate profiles documentation if any profile contains any
|
||||
// of the packages to be documented.
|
||||
showProfiles = !prev.isEmpty();
|
||||
}
|
||||
|
||||
private void initPackageArray() {
|
||||
Set<PackageDoc> set = new HashSet<PackageDoc>(Arrays.asList(root.specifiedPackages()));
|
||||
ClassDoc[] classes = root.specifiedClasses();
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
set.add(classes[i].containingPackage());
|
||||
}
|
||||
ArrayList<PackageDoc> results = new ArrayList<PackageDoc>(set);
|
||||
Collections.sort(results);
|
||||
packages = results.toArray(new PackageDoc[] {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the command line options supported by this configuration.
|
||||
*
|
||||
* @param options the two dimensional array of options.
|
||||
*/
|
||||
public void setOptions(String[][] options) throws Fault {
|
||||
LinkedHashSet<String[]> customTagStrs = new LinkedHashSet<String[]>();
|
||||
|
||||
// Some options, specifically -link and -linkoffline, require that
|
||||
// the output directory has already been created: so do that first.
|
||||
for (int oi = 0; oi < options.length; ++oi) {
|
||||
String[] os = options[oi];
|
||||
String opt = StringUtils.toLowerCase(os[0]);
|
||||
if (opt.equals("-d")) {
|
||||
destDirName = addTrailingFileSep(os[1]);
|
||||
docFileDestDirName = destDirName;
|
||||
ensureOutputDirExists();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int oi = 0; oi < options.length; ++oi) {
|
||||
String[] os = options[oi];
|
||||
String opt = StringUtils.toLowerCase(os[0]);
|
||||
if (opt.equals("-docfilessubdirs")) {
|
||||
copydocfilesubdirs = true;
|
||||
} else if (opt.equals("-docencoding")) {
|
||||
docencoding = os[1];
|
||||
} else if (opt.equals("-encoding")) {
|
||||
encoding = os[1];
|
||||
} else if (opt.equals("-author")) {
|
||||
showauthor = true;
|
||||
} else if (opt.equals("-javafx")) {
|
||||
javafx = true;
|
||||
} else if (opt.equals("-nosince")) {
|
||||
nosince = true;
|
||||
} else if (opt.equals("-version")) {
|
||||
showversion = true;
|
||||
} else if (opt.equals("-nodeprecated")) {
|
||||
nodeprecated = true;
|
||||
} else if (opt.equals("-sourcepath")) {
|
||||
sourcepath = os[1];
|
||||
} else if ((opt.equals("-classpath") || opt.equals("-cp")) &&
|
||||
sourcepath.length() == 0) {
|
||||
sourcepath = os[1];
|
||||
} else if (opt.equals("-excludedocfilessubdir")) {
|
||||
addToSet(excludedDocFileDirs, os[1]);
|
||||
} else if (opt.equals("-noqualifier")) {
|
||||
addToSet(excludedQualifiers, os[1]);
|
||||
} else if (opt.equals("-linksource")) {
|
||||
linksource = true;
|
||||
} else if (opt.equals("-sourcetab")) {
|
||||
linksource = true;
|
||||
try {
|
||||
setTabWidth(Integer.parseInt(os[1]));
|
||||
} catch (NumberFormatException e) {
|
||||
//Set to -1 so that warning will be printed
|
||||
//to indicate what is valid argument.
|
||||
sourcetab = -1;
|
||||
}
|
||||
if (sourcetab <= 0) {
|
||||
message.warning("doclet.sourcetab_warning");
|
||||
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
|
||||
}
|
||||
} else if (opt.equals("-notimestamp")) {
|
||||
notimestamp = true;
|
||||
} else if (opt.equals("-nocomment")) {
|
||||
nocomment = true;
|
||||
} else if (opt.equals("-tag") || opt.equals("-taglet")) {
|
||||
customTagStrs.add(os);
|
||||
} else if (opt.equals("-tagletpath")) {
|
||||
tagletpath = os[1];
|
||||
} else if (opt.equals("-xprofilespath")) {
|
||||
profilespath = os[1];
|
||||
} else if (opt.equals("-keywords")) {
|
||||
keywords = true;
|
||||
} else if (opt.equals("-serialwarn")) {
|
||||
serialwarn = true;
|
||||
} else if (opt.equals("-group")) {
|
||||
group.checkPackageGroups(os[1], os[2]);
|
||||
} else if (opt.equals("-link")) {
|
||||
String url = os[1];
|
||||
extern.link(url, url, root, false);
|
||||
} else if (opt.equals("-linkoffline")) {
|
||||
String url = os[1];
|
||||
String pkglisturl = os[2];
|
||||
extern.link(url, pkglisturl, root, true);
|
||||
}
|
||||
}
|
||||
if (sourcepath.length() == 0) {
|
||||
sourcepath = System.getProperty("env.class.path") == null ? "" :
|
||||
System.getProperty("env.class.path");
|
||||
}
|
||||
if (docencoding == null) {
|
||||
docencoding = encoding;
|
||||
}
|
||||
|
||||
classDocCatalog = new ClassDocCatalog(root.specifiedClasses(), this);
|
||||
initTagletManager(customTagStrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the command line options supported by this configuration.
|
||||
*
|
||||
* @throws DocletAbortException
|
||||
*/
|
||||
public void setOptions() throws Fault {
|
||||
initPackageArray();
|
||||
setOptions(root.options());
|
||||
try {
|
||||
initProfiles();
|
||||
} catch (Exception e) {
|
||||
throw new DocletAbortException(e);
|
||||
}
|
||||
setSpecificDocletOptions(root.options());
|
||||
}
|
||||
|
||||
private void ensureOutputDirExists() throws Fault {
|
||||
DocFile destDir = DocFile.createFileForDirectory(this, destDirName);
|
||||
if (!destDir.exists()) {
|
||||
//Create the output directory (in case it doesn't exist yet)
|
||||
root.printNotice(getText("doclet.dest_dir_create", destDirName));
|
||||
destDir.mkdirs();
|
||||
} else if (!destDir.isDirectory()) {
|
||||
throw new Fault(getText(
|
||||
"doclet.destination_directory_not_directory_0",
|
||||
destDir.getPath()));
|
||||
} else if (!destDir.canWrite()) {
|
||||
throw new Fault(getText(
|
||||
"doclet.destination_directory_not_writable_0",
|
||||
destDir.getPath()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the taglet manager. The strings to initialize the simple custom tags should
|
||||
* be in the following format: "[tag name]:[location str]:[heading]".
|
||||
* @param customTagStrs the set two dimensional arrays of strings. These arrays contain
|
||||
* either -tag or -taglet arguments.
|
||||
*/
|
||||
private void initTagletManager(Set<String[]> customTagStrs) {
|
||||
tagletManager = tagletManager == null ?
|
||||
new TagletManager(nosince, showversion, showauthor, javafx, message) :
|
||||
tagletManager;
|
||||
String[] args;
|
||||
for (Iterator<String[]> it = customTagStrs.iterator(); it.hasNext(); ) {
|
||||
args = it.next();
|
||||
if (args[0].equals("-taglet")) {
|
||||
tagletManager.addCustomTag(args[1], getFileManager(), tagletpath);
|
||||
continue;
|
||||
}
|
||||
String[] tokens = tokenize(args[1],
|
||||
TagletManager.SIMPLE_TAGLET_OPT_SEPARATOR, 3);
|
||||
if (tokens.length == 1) {
|
||||
String tagName = args[1];
|
||||
if (tagletManager.isKnownCustomTag(tagName)) {
|
||||
//reorder a standard tag
|
||||
tagletManager.addNewSimpleCustomTag(tagName, null, "");
|
||||
} else {
|
||||
//Create a simple tag with the heading that has the same name as the tag.
|
||||
StringBuilder heading = new StringBuilder(tagName + ":");
|
||||
heading.setCharAt(0, Character.toUpperCase(tagName.charAt(0)));
|
||||
tagletManager.addNewSimpleCustomTag(tagName, heading.toString(), "a");
|
||||
}
|
||||
} else if (tokens.length == 2) {
|
||||
//Add simple taglet without heading, probably to excluding it in the output.
|
||||
tagletManager.addNewSimpleCustomTag(tokens[0], tokens[1], "");
|
||||
} else if (tokens.length >= 3) {
|
||||
tagletManager.addNewSimpleCustomTag(tokens[0], tokens[2], tokens[1]);
|
||||
} else {
|
||||
message.error("doclet.Error_invalid_custom_tag_argument", args[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a string, return an array of tokens. The separator can be escaped
|
||||
* with the '\' character. The '\' character may also be escaped by the
|
||||
* '\' character.
|
||||
*
|
||||
* @param s the string to tokenize.
|
||||
* @param separator the separator char.
|
||||
* @param maxTokens the maximum number of tokens returned. If the
|
||||
* max is reached, the remaining part of s is appended
|
||||
* to the end of the last token.
|
||||
*
|
||||
* @return an array of tokens.
|
||||
*/
|
||||
private String[] tokenize(String s, char separator, int maxTokens) {
|
||||
List<String> tokens = new ArrayList<String>();
|
||||
StringBuilder token = new StringBuilder ();
|
||||
boolean prevIsEscapeChar = false;
|
||||
for (int i = 0; i < s.length(); i += Character.charCount(i)) {
|
||||
int currentChar = s.codePointAt(i);
|
||||
if (prevIsEscapeChar) {
|
||||
// Case 1: escaped character
|
||||
token.appendCodePoint(currentChar);
|
||||
prevIsEscapeChar = false;
|
||||
} else if (currentChar == separator && tokens.size() < maxTokens-1) {
|
||||
// Case 2: separator
|
||||
tokens.add(token.toString());
|
||||
token = new StringBuilder();
|
||||
} else if (currentChar == '\\') {
|
||||
// Case 3: escape character
|
||||
prevIsEscapeChar = true;
|
||||
} else {
|
||||
// Case 4: regular character
|
||||
token.appendCodePoint(currentChar);
|
||||
}
|
||||
}
|
||||
if (token.length() > 0) {
|
||||
tokens.add(token.toString());
|
||||
}
|
||||
return tokens.toArray(new String[] {});
|
||||
}
|
||||
|
||||
private void addToSet(Set<String> s, String str){
|
||||
StringTokenizer st = new StringTokenizer(str, ":");
|
||||
String current;
|
||||
while(st.hasMoreTokens()){
|
||||
current = st.nextToken();
|
||||
s.add(current);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a trailing file separator, if not found. Remove superfluous
|
||||
* file separators if any. Preserve the front double file separator for
|
||||
* UNC paths.
|
||||
*
|
||||
* @param path Path under consideration.
|
||||
* @return String Properly constructed path string.
|
||||
*/
|
||||
public static String addTrailingFileSep(String path) {
|
||||
String fs = System.getProperty("file.separator");
|
||||
String dblfs = fs + fs;
|
||||
int indexDblfs;
|
||||
while ((indexDblfs = path.indexOf(dblfs, 1)) >= 0) {
|
||||
path = path.substring(0, indexDblfs) +
|
||||
path.substring(indexDblfs + fs.length());
|
||||
}
|
||||
if (!path.endsWith(fs))
|
||||
path += fs;
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* This checks for the validity of the options used by the user.
|
||||
* This works exactly like
|
||||
* {@link com.sun.javadoc.Doclet#validOptions(String[][],
|
||||
* DocErrorReporter)}. This will validate the options which are shared
|
||||
* by our doclets. For example, this method will flag an error using
|
||||
* the DocErrorReporter if user has used "-nohelp" and "-helpfile" option
|
||||
* together.
|
||||
*
|
||||
* @param options options used on the command line.
|
||||
* @param reporter used to report errors.
|
||||
* @return true if all the options are valid.
|
||||
*/
|
||||
public boolean generalValidOptions(String options[][],
|
||||
DocErrorReporter reporter) {
|
||||
boolean docencodingfound = false;
|
||||
String encoding = "";
|
||||
for (int oi = 0; oi < options.length; oi++) {
|
||||
String[] os = options[oi];
|
||||
String opt = StringUtils.toLowerCase(os[0]);
|
||||
if (opt.equals("-docencoding")) {
|
||||
docencodingfound = true;
|
||||
if (!checkOutputFileEncoding(os[1], reporter)) {
|
||||
return false;
|
||||
}
|
||||
} else if (opt.equals("-encoding")) {
|
||||
encoding = os[1];
|
||||
}
|
||||
}
|
||||
if (!docencodingfound && encoding.length() > 0) {
|
||||
if (!checkOutputFileEncoding(encoding, reporter)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the validity of the given profile. Return false if there are no
|
||||
* valid packages to be documented for the profile.
|
||||
*
|
||||
* @param profileName the profile that needs to be validated.
|
||||
* @return true if the profile has valid packages to be documented.
|
||||
*/
|
||||
public boolean shouldDocumentProfile(String profileName) {
|
||||
return profilePackages.containsKey(profileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the validity of the given Source or Output File encoding on this
|
||||
* platform.
|
||||
*
|
||||
* @param docencoding output file encoding.
|
||||
* @param reporter used to report errors.
|
||||
*/
|
||||
private boolean checkOutputFileEncoding(String docencoding,
|
||||
DocErrorReporter reporter) {
|
||||
OutputStream ost= new ByteArrayOutputStream();
|
||||
OutputStreamWriter osw = null;
|
||||
try {
|
||||
osw = new OutputStreamWriter(ost, docencoding);
|
||||
} catch (UnsupportedEncodingException exc) {
|
||||
reporter.printError(getText("doclet.Encoding_not_supported",
|
||||
docencoding));
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
if (osw != null) {
|
||||
osw.close();
|
||||
}
|
||||
} catch (IOException exc) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given doc-file subdirectory should be excluded and
|
||||
* false otherwise.
|
||||
* @param docfilesubdir the doc-files subdirectory to check.
|
||||
*/
|
||||
public boolean shouldExcludeDocFileDir(String docfilesubdir){
|
||||
if (excludedDocFileDirs.contains(docfilesubdir)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given qualifier should be excluded and false otherwise.
|
||||
* @param qualifier the qualifier to check.
|
||||
*/
|
||||
public boolean shouldExcludeQualifier(String qualifier){
|
||||
if (excludedQualifiers.contains("all") ||
|
||||
excludedQualifiers.contains(qualifier) ||
|
||||
excludedQualifiers.contains(qualifier + ".*")) {
|
||||
return true;
|
||||
} else {
|
||||
int index = -1;
|
||||
while ((index = qualifier.indexOf(".", index + 1)) != -1) {
|
||||
if (excludedQualifiers.contains(qualifier.substring(0, index + 1) + "*")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the qualified name of the <code>ClassDoc</code> if it's qualifier is not excluded. Otherwise,
|
||||
* return the unqualified <code>ClassDoc</code> name.
|
||||
* @param cd the <code>ClassDoc</code> to check.
|
||||
*/
|
||||
public String getClassName(ClassDoc cd) {
|
||||
PackageDoc pd = cd.containingPackage();
|
||||
if (pd != null && shouldExcludeQualifier(cd.containingPackage().name())) {
|
||||
return cd.name();
|
||||
} else {
|
||||
return cd.qualifiedName();
|
||||
}
|
||||
}
|
||||
|
||||
public String getText(String key) {
|
||||
try {
|
||||
//Check the doclet specific properties file.
|
||||
return getDocletSpecificMsg().getText(key);
|
||||
} catch (Exception e) {
|
||||
//Check the shared properties file.
|
||||
return message.getText(key);
|
||||
}
|
||||
}
|
||||
|
||||
public String getText(String key, String a1) {
|
||||
try {
|
||||
//Check the doclet specific properties file.
|
||||
return getDocletSpecificMsg().getText(key, a1);
|
||||
} catch (Exception e) {
|
||||
//Check the shared properties file.
|
||||
return message.getText(key, a1);
|
||||
}
|
||||
}
|
||||
|
||||
public String getText(String key, String a1, String a2) {
|
||||
try {
|
||||
//Check the doclet specific properties file.
|
||||
return getDocletSpecificMsg().getText(key, a1, a2);
|
||||
} catch (Exception e) {
|
||||
//Check the shared properties file.
|
||||
return message.getText(key, a1, a2);
|
||||
}
|
||||
}
|
||||
|
||||
public String getText(String key, String a1, String a2, String a3) {
|
||||
try {
|
||||
//Check the doclet specific properties file.
|
||||
return getDocletSpecificMsg().getText(key, a1, a2, a3);
|
||||
} catch (Exception e) {
|
||||
//Check the shared properties file.
|
||||
return message.getText(key, a1, a2, a3);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract Content newContent();
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key) {
|
||||
Content c = newContent();
|
||||
c.addContent(getText(key));
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param o string or content argument added to configuration text
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key, Object o) {
|
||||
return getResource(key, o, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param o string or content argument added to configuration text
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key, Object o1, Object o2) {
|
||||
return getResource(key, o1, o2, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration string as a content.
|
||||
*
|
||||
* @param key the key to look for in the configuration file
|
||||
* @param o1 string or content argument added to configuration text
|
||||
* @param o2 string or content argument added to configuration text
|
||||
* @return a content tree for the text
|
||||
*/
|
||||
public Content getResource(String key, Object o0, Object o1, Object o2) {
|
||||
Content c = newContent();
|
||||
Pattern p = Pattern.compile("\\{([012])\\}");
|
||||
String text = getText(key);
|
||||
Matcher m = p.matcher(text);
|
||||
int start = 0;
|
||||
while (m.find(start)) {
|
||||
c.addContent(text.substring(start, m.start()));
|
||||
|
||||
Object o = null;
|
||||
switch (m.group(1).charAt(0)) {
|
||||
case '0': o = o0; break;
|
||||
case '1': o = o1; break;
|
||||
case '2': o = o2; break;
|
||||
}
|
||||
|
||||
if (o == null) {
|
||||
c.addContent("{" + m.group(1) + "}");
|
||||
} else if (o instanceof String) {
|
||||
c.addContent((String) o);
|
||||
} else if (o instanceof Content) {
|
||||
c.addContent((Content) o);
|
||||
}
|
||||
|
||||
start = m.end();
|
||||
}
|
||||
|
||||
c.addContent(text.substring(start));
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if the ClassDoc element is getting documented, depending upon
|
||||
* -nodeprecated option and the deprecation information. Return true if
|
||||
* -nodeprecated is not used. Return false if -nodeprecated is used and if
|
||||
* either ClassDoc element is deprecated or the containing package is deprecated.
|
||||
*
|
||||
* @param cd the ClassDoc for which the page generation is checked
|
||||
*/
|
||||
public boolean isGeneratedDoc(ClassDoc cd) {
|
||||
if (!nodeprecated) {
|
||||
return true;
|
||||
}
|
||||
return !(Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the doclet specific instance of a writer factory.
|
||||
* @return the {@link WriterFactory} for the doclet.
|
||||
*/
|
||||
public abstract WriterFactory getWriterFactory();
|
||||
|
||||
/**
|
||||
* Return the input stream to the builder XML.
|
||||
*
|
||||
* @return the input steam to the builder XML.
|
||||
* @throws FileNotFoundException when the given XML file cannot be found.
|
||||
*/
|
||||
public InputStream getBuilderXML() throws IOException {
|
||||
return builderXMLPath == null ?
|
||||
Configuration.class.getResourceAsStream(DEFAULT_BUILDER_XML) :
|
||||
DocFile.createFileForInput(this, builderXMLPath).openInputStream();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Locale for this document.
|
||||
*/
|
||||
public abstract Locale getLocale();
|
||||
|
||||
/**
|
||||
* Return the current file manager.
|
||||
*/
|
||||
public abstract JavaFileManager getFileManager();
|
||||
|
||||
/**
|
||||
* Return the comparator that will be used to sort member documentation.
|
||||
* To no do any sorting, return null.
|
||||
*
|
||||
* @return the {@link java.util.Comparator} used to sort members.
|
||||
*/
|
||||
public abstract Comparator<ProgramElementDoc> getMemberComparator();
|
||||
|
||||
private void setTabWidth(int n) {
|
||||
sourcetab = n;
|
||||
tabSpaces = String.format("%" + n + "s", "");
|
||||
}
|
||||
|
||||
public abstract boolean showMessage(SourcePosition pos, String key);
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing constants summary output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface ConstantsSummaryWriter {
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public abstract void close() throws IOException;
|
||||
|
||||
/**
|
||||
* Get the header for the constant summary documentation.
|
||||
*
|
||||
* @return header that needs to be added to the documentation
|
||||
*/
|
||||
public abstract Content getHeader();
|
||||
|
||||
/**
|
||||
* Get the header for the constant content list.
|
||||
*
|
||||
* @return content header that needs to be added to the documentation
|
||||
*/
|
||||
public abstract Content getContentsHeader();
|
||||
|
||||
/**
|
||||
* 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
|
||||
* name. For example, java.lang.ref would be
|
||||
* indexed as java.lang.*.
|
||||
* @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 addLinkToPackageContent(PackageDoc pkg, String parsedPackageName,
|
||||
Set<String> WriteedPackageHeaders, Content contentListTree);
|
||||
|
||||
/**
|
||||
* Get the content list to be added to the documentation tree.
|
||||
*
|
||||
* @param contentListTree the content that will be added to the list
|
||||
* @return content list that will be added to the documentation tree
|
||||
*/
|
||||
public abstract Content getContentsList(Content contentListTree);
|
||||
|
||||
/**
|
||||
* Get the constant summaries for the document.
|
||||
*
|
||||
* @return constant summaries header to be added to the documentation tree
|
||||
*/
|
||||
public abstract Content getConstantSummaries();
|
||||
|
||||
/**
|
||||
* Adds the given package name.
|
||||
*
|
||||
* @param pkg the {@link PackageDoc} to index.
|
||||
* @param parsedPackageName the parsed package name. We only Write the
|
||||
* first 2 directory levels of the package
|
||||
* name. For example, java.lang.ref would be
|
||||
* indexed as java.lang.*.
|
||||
* @param summariesTree the documentation tree to which the package name will
|
||||
* be written
|
||||
*/
|
||||
public abstract void addPackageName(PackageDoc pkg,
|
||||
String parsedPackageName, Content summariesTree);
|
||||
|
||||
/**
|
||||
* Get the class summary header for the constants summary.
|
||||
*
|
||||
* @return the header content for the class constants summary
|
||||
*/
|
||||
public abstract Content getClassConstantHeader();
|
||||
|
||||
/**
|
||||
* Adds the constant member table to the documentation tree.
|
||||
*
|
||||
* @param cd the class whose constants are being documented.
|
||||
* @param fields the constants being documented.
|
||||
* @param classConstantTree the documentation tree to which theconstant member
|
||||
* table content will be added
|
||||
*/
|
||||
public abstract void addConstantMembers(ClassDoc cd, List<FieldDoc> fields,
|
||||
Content classConstantTree);
|
||||
|
||||
/**
|
||||
* Adds the footer for the summary documentation.
|
||||
*
|
||||
* @param contentTree content tree to which the footer will be added
|
||||
*/
|
||||
public abstract void addFooter(Content contentTree);
|
||||
|
||||
/**
|
||||
* Print the constants summary document.
|
||||
*
|
||||
* @param contentTree content tree which should be printed
|
||||
*/
|
||||
public abstract void printDocument(Content contentTree) throws IOException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing constructor output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface ConstructorWriter {
|
||||
|
||||
/**
|
||||
* Get the constructor details tree header.
|
||||
*
|
||||
* @param classDoc the class being documented
|
||||
* @param memberDetailsTree the content tree representing member details
|
||||
* @return content tree for the constructor details header
|
||||
*/
|
||||
public Content getConstructorDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the constructor documentation tree header.
|
||||
*
|
||||
* @param constructor the constructor being documented
|
||||
* @param constructorDetailsTree the content tree representing constructor details
|
||||
* @return content tree for the constructor documentation header
|
||||
*/
|
||||
public Content getConstructorDocTreeHeader(ConstructorDoc constructor,
|
||||
Content constructorDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the signature for the given constructor.
|
||||
*
|
||||
* @param constructor the constructor being documented
|
||||
* @return content tree for the constructor signature
|
||||
*/
|
||||
public Content getSignature(ConstructorDoc constructor);
|
||||
|
||||
/**
|
||||
* Add the deprecated output for the given constructor.
|
||||
*
|
||||
* @param constructor the constructor being documented
|
||||
* @param constructorDocTree content tree to which the deprecated information will be added
|
||||
*/
|
||||
public void addDeprecated(ConstructorDoc constructor, Content constructorDocTree);
|
||||
|
||||
/**
|
||||
* Add the comments for the given constructor.
|
||||
*
|
||||
* @param constructor the constructor being documented
|
||||
* @param constructorDocTree the content tree to which the comments will be added
|
||||
*/
|
||||
public void addComments(ConstructorDoc constructor, Content constructorDocTree);
|
||||
|
||||
/**
|
||||
* Add the tags for the given constructor.
|
||||
*
|
||||
* @param constructor the constructor being documented
|
||||
* @param constructorDocTree the content tree to which the tags will be added
|
||||
*/
|
||||
public void addTags(ConstructorDoc constructor, Content constructorDocTree);
|
||||
|
||||
/**
|
||||
* Get the constructor details tree.
|
||||
*
|
||||
* @param memberDetailsTree the content tree representing member details
|
||||
* @return content tree for the constructor details
|
||||
*/
|
||||
public Content getConstructorDetails(Content memberDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the constructor documentation.
|
||||
*
|
||||
* @param constructorDocTree the content tree representing constructor documentation
|
||||
* @param isLastContent true if the content to be added is the last content
|
||||
* @return content tree for the constructor documentation
|
||||
*/
|
||||
public Content getConstructorDoc(Content constructorDocTree, boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Let the writer know whether a non public constructor was found.
|
||||
*
|
||||
* @param foundNonPubConstructor true if we found a non public constructor.
|
||||
*/
|
||||
public void setFoundNonPubConstructor(boolean foundNonPubConstructor);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
118
jdkSrc/jdk8/com/sun/tools/doclets/internal/toolkit/Content.java
Normal file
118
jdkSrc/jdk8/com/sun/tools/doclets/internal/toolkit/Content.java
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* A class to create content for javadoc output pages.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
public abstract class Content {
|
||||
|
||||
/**
|
||||
* Returns a string representation of the content.
|
||||
*
|
||||
* @return string representation of the content
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringWriter out = new StringWriter();
|
||||
try {
|
||||
write(out, true);
|
||||
} catch (IOException e) {
|
||||
// cannot happen from StringWriter
|
||||
throw new DocletAbortException(e);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds content to the existing content.
|
||||
*
|
||||
* @param content content that needs to be added
|
||||
*/
|
||||
public abstract void addContent(Content content);
|
||||
|
||||
/**
|
||||
* Adds a string content to the existing content.
|
||||
*
|
||||
* @param stringContent the string content to be added
|
||||
*/
|
||||
public abstract void addContent(String stringContent);
|
||||
|
||||
/**
|
||||
* Writes content to a writer.
|
||||
*
|
||||
*/
|
||||
public abstract boolean write(Writer writer, boolean atNewline) throws IOException ;
|
||||
|
||||
/**
|
||||
* Returns true if the content is empty.
|
||||
*
|
||||
* @return true if no content to be displayed else return false
|
||||
*/
|
||||
public abstract boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Returns true if the content is valid.
|
||||
*
|
||||
* @return true if the content is valid else return false
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return !isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of characters of plain text content in this object
|
||||
* (optional operation.)
|
||||
* @return the number of characters of plain text content in this
|
||||
*/
|
||||
public int charCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for null values.
|
||||
*
|
||||
* @param t reference type to check for null values
|
||||
* @return the reference type if not null or else throws a null pointer exception
|
||||
*/
|
||||
protected static <T> T nullCheck(T t) {
|
||||
t.getClass();
|
||||
return t;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing enum constant output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface EnumConstantWriter {
|
||||
|
||||
/**
|
||||
* Get the enum constants details tree header.
|
||||
*
|
||||
* @param classDoc the class being documented
|
||||
* @param memberDetailsTree the content tree representing member details
|
||||
* @return content tree for the enum constants details header
|
||||
*/
|
||||
public Content getEnumConstantsDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the enum constants documentation tree header.
|
||||
*
|
||||
* @param enumConstant the enum constant being documented
|
||||
* @param enumConstantsDetailsTree the content tree representing enum constant details
|
||||
* @return content tree for the enum constant documentation header
|
||||
*/
|
||||
public Content getEnumConstantsTreeHeader(FieldDoc enumConstant,
|
||||
Content enumConstantsDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the signature for the given enum constant.
|
||||
*
|
||||
* @param enumConstant the enum constant being documented
|
||||
* @return content tree for the enum constant signature
|
||||
*/
|
||||
public Content getSignature(FieldDoc enumConstant);
|
||||
|
||||
/**
|
||||
* Add the deprecated output for the given enum constant.
|
||||
*
|
||||
* @param enumConstant the enum constant being documented
|
||||
* @param enumConstantsTree content tree to which the deprecated information will be added
|
||||
*/
|
||||
public void addDeprecated(FieldDoc enumConstant, Content enumConstantsTree);
|
||||
|
||||
/**
|
||||
* Add the comments for the given enum constant.
|
||||
*
|
||||
* @param enumConstant the enum constant being documented
|
||||
* @param enumConstantsTree the content tree to which the comments will be added
|
||||
*/
|
||||
public void addComments(FieldDoc enumConstant, Content enumConstantsTree);
|
||||
|
||||
/**
|
||||
* Add the tags for the given enum constant.
|
||||
*
|
||||
* @param enumConstant the enum constant being documented
|
||||
* @param enumConstantsTree the content tree to which the tags will be added
|
||||
*/
|
||||
public void addTags(FieldDoc enumConstant, Content enumConstantsTree);
|
||||
|
||||
/**
|
||||
* Get the enum constants details tree.
|
||||
*
|
||||
* @param memberDetailsTree the content tree representing member details
|
||||
* @return content tree for the enum constant details
|
||||
*/
|
||||
public Content getEnumConstantsDetails(Content memberDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the enum constants documentation.
|
||||
*
|
||||
* @param enumConstantsTree the content tree representing enum constants documentation
|
||||
* @param isLastContent true if the content to be added is the last content
|
||||
* @return content tree for the enum constants documentation
|
||||
*/
|
||||
public Content getEnumConstants(Content enumConstantsTree, boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing field output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface FieldWriter {
|
||||
|
||||
/**
|
||||
* Get the field details tree header.
|
||||
*
|
||||
* @param classDoc the class being documented
|
||||
* @param memberDetailsTree the content tree representing member details
|
||||
* @return content tree for the field details header
|
||||
*/
|
||||
public Content getFieldDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the field documentation tree header.
|
||||
*
|
||||
* @param field the constructor being documented
|
||||
* @param fieldDetailsTree the content tree representing field details
|
||||
* @return content tree for the field documentation header
|
||||
*/
|
||||
public Content getFieldDocTreeHeader(FieldDoc field,
|
||||
Content fieldDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the signature for the given field.
|
||||
*
|
||||
* @param field the field being documented
|
||||
* @return content tree for the field signature
|
||||
*/
|
||||
public Content getSignature(FieldDoc field);
|
||||
|
||||
/**
|
||||
* Add the deprecated output for the given field.
|
||||
*
|
||||
* @param field the field being documented
|
||||
* @param fieldDocTree content tree to which the deprecated information will be added
|
||||
*/
|
||||
public void addDeprecated(FieldDoc field, Content fieldDocTree);
|
||||
|
||||
/**
|
||||
* Add the comments for the given field.
|
||||
*
|
||||
* @param field the field being documented
|
||||
* @param fieldDocTree the content tree to which the comments will be added
|
||||
*/
|
||||
public void addComments(FieldDoc field, Content fieldDocTree);
|
||||
|
||||
/**
|
||||
* Add the tags for the given field.
|
||||
*
|
||||
* @param field the field being documented
|
||||
* @param fieldDocTree the content tree to which the tags will be added
|
||||
*/
|
||||
public void addTags(FieldDoc field, Content fieldDocTree);
|
||||
|
||||
/**
|
||||
* Get the field details tree.
|
||||
*
|
||||
* @param memberDetailsTree the content tree representing member details
|
||||
* @return content tree for the field details
|
||||
*/
|
||||
public Content getFieldDetails(Content memberDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the field documentation.
|
||||
*
|
||||
* @param fieldDocTree the content tree representing field documentation
|
||||
* @param isLastContent true if the content to be added is the last content
|
||||
* @return content tree for the field documentation
|
||||
*/
|
||||
public Content getFieldDoc(Content fieldDocTree, boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing member summary output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface MemberSummaryWriter {
|
||||
|
||||
/**
|
||||
* Get the member summary header for the given class.
|
||||
*
|
||||
* @param classDoc the class the summary belongs to
|
||||
* @param memberSummaryTree the content tree to which the member summary will be added
|
||||
* @return a content tree for the member summary header
|
||||
*/
|
||||
public Content getMemberSummaryHeader(ClassDoc classDoc,
|
||||
Content memberSummaryTree);
|
||||
|
||||
/**
|
||||
* Get the summary table for the given class.
|
||||
*
|
||||
* @param classDoc the class the summary table belongs to
|
||||
* @param tableContents list of contents that will be added to the summary table
|
||||
* @return a content tree for the member summary table
|
||||
*/
|
||||
public Content getSummaryTableTree(ClassDoc classDoc,
|
||||
List<Content> tableContents);
|
||||
|
||||
/**
|
||||
* Add the member summary for the given class and member.
|
||||
*
|
||||
* @param classDoc the class the summary belongs to
|
||||
* @param member the member that is documented
|
||||
* @param firstSentenceTags the tags for the sentence being documented
|
||||
* @param tableContents list of contents to which the summary will be added
|
||||
* @param counter the counter for determining id and style for the table row
|
||||
*/
|
||||
public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
|
||||
Tag[] firstSentenceTags, List<Content> tableContents, int counter);
|
||||
|
||||
/**
|
||||
* Get the inherited member summary header for the given class.
|
||||
*
|
||||
* @param classDoc the class the summary belongs to
|
||||
* @return a content tree containing the inherited summary header
|
||||
*/
|
||||
public Content getInheritedSummaryHeader(ClassDoc classDoc);
|
||||
|
||||
/**
|
||||
* Add the inherited member summary for the given class and member.
|
||||
*
|
||||
* @param classDoc the class the inherited member belongs to
|
||||
* @param member the inherited member that is being documented
|
||||
* @param isFirst true if this is the first member in the list
|
||||
* @param isLast true if this is the last member in the list
|
||||
* @param linksTree the content tree to which the links will be added
|
||||
*/
|
||||
public void addInheritedMemberSummary(ClassDoc classDoc,
|
||||
ProgramElementDoc member, boolean isFirst, boolean isLast,
|
||||
Content linksTree);
|
||||
|
||||
/**
|
||||
* Get inherited summary links.
|
||||
*
|
||||
* @return a content tree conatining the inherited summary links
|
||||
*/
|
||||
public Content getInheritedSummaryLinksTree();
|
||||
|
||||
/**
|
||||
* Get the member tree.
|
||||
*
|
||||
* @param memberTree the content tree representating the member
|
||||
* @return a content tree for the member
|
||||
*/
|
||||
public Content getMemberTree(Content memberTree);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing method output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface MethodWriter {
|
||||
|
||||
/**
|
||||
* Get the method details tree header.
|
||||
*
|
||||
* @param classDoc the class being documented
|
||||
* @param memberDetailsTree the content tree representing member details
|
||||
* @return content tree for the method details header
|
||||
*/
|
||||
public Content getMethodDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the method documentation tree header.
|
||||
*
|
||||
* @param method the method being documented
|
||||
* @param methodDetailsTree the content tree representing method details
|
||||
* @return content tree for the method documentation header
|
||||
*/
|
||||
public Content getMethodDocTreeHeader(MethodDoc method,
|
||||
Content methodDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the signature for the given method.
|
||||
*
|
||||
* @param method the method being documented
|
||||
* @return content tree for the method signature
|
||||
*/
|
||||
public Content getSignature(MethodDoc method);
|
||||
|
||||
/**
|
||||
* Add the deprecated output for the given method.
|
||||
*
|
||||
* @param method the method being documented
|
||||
* @param methodDocTree content tree to which the deprecated information will be added
|
||||
*/
|
||||
public void addDeprecated(MethodDoc method, Content methodDocTree);
|
||||
|
||||
/**
|
||||
* Add the comments for the given method.
|
||||
*
|
||||
* @param holder the holder type (not erasure) of the method
|
||||
* @param method the method being documented
|
||||
* @param methodDocTree the content tree to which the comments will be added
|
||||
*/
|
||||
public void addComments(Type holder, MethodDoc method, Content methodDocTree);
|
||||
|
||||
/**
|
||||
* Add the tags for the given method.
|
||||
*
|
||||
* @param method the method being documented
|
||||
* @param methodDocTree the content tree to which the tags will be added
|
||||
*/
|
||||
public void addTags(MethodDoc method, Content methodDocTree);
|
||||
|
||||
/**
|
||||
* Get the method details tree.
|
||||
*
|
||||
* @param methodDetailsTree the content tree representing method details
|
||||
* @return content tree for the method details
|
||||
*/
|
||||
public Content getMethodDetails(Content methodDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the method documentation.
|
||||
*
|
||||
* @param methodDocTree the content tree representing method documentation
|
||||
* @param isLastContent true if the content to be added is the last content
|
||||
* @return content tree for the method documentation
|
||||
*/
|
||||
public Content getMethodDoc(Content methodDocTree, boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* The interface for writing class output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface NestedClassWriter {
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing package summary output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface PackageSummaryWriter {
|
||||
|
||||
/**
|
||||
* Get the header for the summary.
|
||||
*
|
||||
* @param heading Package name.
|
||||
* @return the header to be added to the content tree
|
||||
*/
|
||||
public abstract Content getPackageHeader(String heading);
|
||||
|
||||
/**
|
||||
* Get the header for the package content.
|
||||
*
|
||||
* @return a content tree for the package content header
|
||||
*/
|
||||
public abstract Content getContentHeader();
|
||||
|
||||
/**
|
||||
* Get the header for the package summary.
|
||||
*
|
||||
* @return a content tree with the package summary header
|
||||
*/
|
||||
public abstract Content getSummaryHeader();
|
||||
|
||||
/**
|
||||
* Adds the table of classes to the documentation tree.
|
||||
*
|
||||
* @param classes the array of classes to document.
|
||||
* @param label the label for this table.
|
||||
* @param tableSummary the summary string for the table
|
||||
* @param tableHeader array of table headers
|
||||
* @param summaryContentTree the content tree to which the summaries will be added
|
||||
*/
|
||||
public abstract void addClassesSummary(ClassDoc[] classes, String label,
|
||||
String tableSummary, String[] tableHeader, Content summaryContentTree);
|
||||
|
||||
/**
|
||||
* Adds the package description from the "packages.html" file to the documentation
|
||||
* tree.
|
||||
*
|
||||
* @param packageContentTree the content tree to which the package description
|
||||
* will be added
|
||||
*/
|
||||
public abstract void addPackageDescription(Content packageContentTree);
|
||||
|
||||
/**
|
||||
* Adds the tag information from the "packages.html" file to the documentation
|
||||
* tree.
|
||||
*
|
||||
* @param packageContentTree the content tree to which the package tags will
|
||||
* be added
|
||||
*/
|
||||
public abstract void addPackageTags(Content packageContentTree);
|
||||
|
||||
/**
|
||||
* Adds the footer to the documentation tree.
|
||||
*
|
||||
* @param contentTree the tree to which the footer will be added
|
||||
*/
|
||||
public abstract void addPackageFooter(Content contentTree);
|
||||
|
||||
/**
|
||||
* Print the package summary document.
|
||||
*
|
||||
* @param contentTree the content tree that will be printed
|
||||
*/
|
||||
public abstract void printDocument(Content contentTree) throws IOException;
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public abstract void close() throws IOException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing profile package summary output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
|
||||
public interface ProfilePackageSummaryWriter {
|
||||
|
||||
/**
|
||||
* Get the header for the summary.
|
||||
*
|
||||
* @param heading Package name.
|
||||
* @return the header to be added to the content tree
|
||||
*/
|
||||
public abstract Content getPackageHeader(String heading);
|
||||
|
||||
/**
|
||||
* Get the header for the content.
|
||||
*
|
||||
* @return a content tree for the content header
|
||||
*/
|
||||
public abstract Content getContentHeader();
|
||||
|
||||
/**
|
||||
* Get the header for the package summary.
|
||||
*
|
||||
* @return a content tree with the package summary header
|
||||
*/
|
||||
public abstract Content getSummaryHeader();
|
||||
|
||||
/**
|
||||
* Adds the table of classes to the documentation tree.
|
||||
*
|
||||
* @param classes the array of classes to document.
|
||||
* @param label the label for this table.
|
||||
* @param tableSummary the summary string for the table
|
||||
* @param tableHeader array of table headers
|
||||
* @param summaryContentTree the content tree to which the summaries will be added
|
||||
*/
|
||||
public abstract void addClassesSummary(ClassDoc[] classes, String label,
|
||||
String tableSummary, String[] tableHeader, Content summaryContentTree);
|
||||
|
||||
/**
|
||||
* Adds the package description from the "packages.html" file to the documentation
|
||||
* tree.
|
||||
*
|
||||
* @param packageContentTree the content tree to which the package description
|
||||
* will be added
|
||||
*/
|
||||
public abstract void addPackageDescription(Content packageContentTree);
|
||||
|
||||
/**
|
||||
* Adds the tag information from the "packages.html" file to the documentation
|
||||
* tree.
|
||||
*
|
||||
* @param packageContentTree the content tree to which the package tags will
|
||||
* be added
|
||||
*/
|
||||
public abstract void addPackageTags(Content packageContentTree);
|
||||
|
||||
/**
|
||||
* Adds the footer to the documentation tree.
|
||||
*
|
||||
* @param contentTree the tree to which the footer will be added
|
||||
*/
|
||||
public abstract void addPackageFooter(Content contentTree);
|
||||
|
||||
/**
|
||||
* Print the package summary document.
|
||||
*
|
||||
* @param contentTree the content tree that will be printed
|
||||
*/
|
||||
public abstract void printDocument(Content contentTree) throws IOException;
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public abstract void close() throws IOException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing profile summary output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
*/
|
||||
|
||||
public interface ProfileSummaryWriter {
|
||||
|
||||
/**
|
||||
* Get the header for the summary.
|
||||
*
|
||||
* @param heading profile name.
|
||||
* @return the header to be added to the content tree
|
||||
*/
|
||||
public abstract Content getProfileHeader(String heading);
|
||||
|
||||
/**
|
||||
* Get the header for the profile content.
|
||||
*
|
||||
* @return a content tree for the profile content header
|
||||
*/
|
||||
public abstract Content getContentHeader();
|
||||
|
||||
/**
|
||||
* Get the header for the summary header.
|
||||
*
|
||||
* @return a content tree with the summary header
|
||||
*/
|
||||
public abstract Content getSummaryHeader();
|
||||
|
||||
/**
|
||||
* Get the header for the summary tree.
|
||||
*
|
||||
* @param summaryContentTree the content tree.
|
||||
* @return a content tree with the summary tree
|
||||
*/
|
||||
public abstract Content getSummaryTree(Content summaryContentTree);
|
||||
|
||||
/**
|
||||
* Get the header for the package summary header.
|
||||
*
|
||||
* @return a content tree with the package summary header
|
||||
*/
|
||||
public abstract Content getPackageSummaryHeader(PackageDoc pkg);
|
||||
|
||||
/**
|
||||
* Get the header for the package summary tree.
|
||||
*
|
||||
* @return a content tree with the package summary
|
||||
*/
|
||||
public abstract Content getPackageSummaryTree(Content packageSummaryContentTree);
|
||||
|
||||
/**
|
||||
* Adds the table of classes to the documentation tree.
|
||||
*
|
||||
* @param classes the array of classes to document.
|
||||
* @param label the label for this table.
|
||||
* @param tableSummary the summary string for the table
|
||||
* @param tableHeader array of table headers
|
||||
* @param packageSummaryContentTree the content tree to which the summaries will be added
|
||||
*/
|
||||
public abstract void addClassesSummary(ClassDoc[] classes, String label,
|
||||
String tableSummary, String[] tableHeader, Content packageSummaryContentTree);
|
||||
|
||||
/**
|
||||
* Adds the footer to the documentation tree.
|
||||
*
|
||||
* @param contentTree the tree to which the footer will be added
|
||||
*/
|
||||
public abstract void addProfileFooter(Content contentTree);
|
||||
|
||||
/**
|
||||
* Print the profile summary document.
|
||||
*
|
||||
* @param contentTree the content tree that will be printed
|
||||
*/
|
||||
public abstract void printDocument(Content contentTree) throws IOException;
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public abstract void close() throws IOException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing property output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.7
|
||||
*/
|
||||
|
||||
public interface PropertyWriter {
|
||||
|
||||
/**
|
||||
* Get the property details tree header.
|
||||
*
|
||||
* @param classDoc the class being documented
|
||||
* @param memberDetailsTree the content tree representing member details
|
||||
* @return content tree for the property details header
|
||||
*/
|
||||
public Content getPropertyDetailsTreeHeader(ClassDoc classDoc,
|
||||
Content memberDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the property documentation tree header.
|
||||
*
|
||||
* @param property the property being documented
|
||||
* @param propertyDetailsTree the content tree representing property details
|
||||
* @return content tree for the property documentation header
|
||||
*/
|
||||
public Content getPropertyDocTreeHeader(MethodDoc property,
|
||||
Content propertyDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the signature for the given property.
|
||||
*
|
||||
* @param property the property being documented
|
||||
* @return content tree for the property signature
|
||||
*/
|
||||
public Content getSignature(MethodDoc property);
|
||||
|
||||
/**
|
||||
* Add the deprecated output for the given property.
|
||||
*
|
||||
* @param property the property being documented
|
||||
* @param propertyDocTree content tree to which the deprecated information will be added
|
||||
*/
|
||||
public void addDeprecated(MethodDoc property, Content propertyDocTree);
|
||||
|
||||
/**
|
||||
* Add the comments for the given property.
|
||||
*
|
||||
* @param property the property being documented
|
||||
* @param propertyDocTree the content tree to which the comments will be added
|
||||
*/
|
||||
public void addComments(MethodDoc property, Content propertyDocTree);
|
||||
|
||||
/**
|
||||
* Add the tags for the given property.
|
||||
*
|
||||
* @param property the property being documented
|
||||
* @param propertyDocTree the content tree to which the tags will be added
|
||||
*/
|
||||
public void addTags(MethodDoc property, Content propertyDocTree);
|
||||
|
||||
/**
|
||||
* Get the property details tree.
|
||||
*
|
||||
* @param memberDetailsTree the content tree representing member details
|
||||
* @return content tree for the property details
|
||||
*/
|
||||
public Content getPropertyDetails(Content memberDetailsTree);
|
||||
|
||||
/**
|
||||
* Get the property documentation.
|
||||
*
|
||||
* @param propertyDocTree the content tree representing property documentation
|
||||
* @param isLastContent true if the content to be added is the last content
|
||||
* @return content tree for the property documentation
|
||||
*/
|
||||
public Content getPropertyDoc(Content propertyDocTree, boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public void close() throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
|
||||
/**
|
||||
* The interface for writing serialized form output.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public interface SerializedFormWriter {
|
||||
|
||||
/**
|
||||
* Get the header.
|
||||
*
|
||||
* @param header the header to write.
|
||||
* @return the header content tree
|
||||
*/
|
||||
public Content getHeader(String header);
|
||||
|
||||
/**
|
||||
* Get the serialized form summaries header.
|
||||
*
|
||||
* @return the serialized form summary header tree
|
||||
*/
|
||||
public Content getSerializedSummariesHeader();
|
||||
|
||||
/**
|
||||
* Get the package serialized form header.
|
||||
*
|
||||
* @return the package serialized form header tree
|
||||
*/
|
||||
public Content getPackageSerializedHeader();
|
||||
|
||||
/**
|
||||
* Get the given package header.
|
||||
*
|
||||
* @param packageName the package header to write
|
||||
* @return a content tree for the package header
|
||||
*/
|
||||
public Content getPackageHeader(String packageName);
|
||||
|
||||
/**
|
||||
* Get the serialized class header.
|
||||
*
|
||||
* @return a content tree for the serialized class header
|
||||
*/
|
||||
public Content getClassSerializedHeader();
|
||||
|
||||
/**
|
||||
* Get the heading for the serializable class.
|
||||
*
|
||||
* @param classDoc the class being processed
|
||||
* @return a content tree for the class heading
|
||||
*/
|
||||
public Content getClassHeader(ClassDoc classDoc);
|
||||
|
||||
/**
|
||||
* Get the serial UID info header.
|
||||
*
|
||||
* @return a content tree for the serial uid info header
|
||||
*/
|
||||
public Content getSerialUIDInfoHeader();
|
||||
|
||||
/**
|
||||
* Adds the serial UID info.
|
||||
*
|
||||
* @param header the header that will show up before the UID.
|
||||
* @param serialUID the serial UID to print.
|
||||
* @param serialUidTree the serial UID tree to which the content will be added.
|
||||
*/
|
||||
public void addSerialUIDInfo(String header, String serialUID,
|
||||
Content serialUidTree);
|
||||
|
||||
/**
|
||||
* Get the class serialize content header.
|
||||
*
|
||||
* @return a content tree for the class serialize content header
|
||||
*/
|
||||
public Content getClassContentHeader();
|
||||
|
||||
/**
|
||||
* Return an instance of a SerialFieldWriter.
|
||||
*
|
||||
* @return an instance of a SerialFieldWriter.
|
||||
*/
|
||||
public SerialFieldWriter getSerialFieldWriter(ClassDoc classDoc);
|
||||
|
||||
/**
|
||||
* Return an instance of a SerialMethodWriter.
|
||||
*
|
||||
* @return an instance of a SerialMethodWriter.
|
||||
*/
|
||||
public SerialMethodWriter getSerialMethodWriter(ClassDoc classDoc);
|
||||
|
||||
/**
|
||||
* Close the writer.
|
||||
*/
|
||||
public abstract void close() throws IOException;
|
||||
|
||||
/**
|
||||
* Get the serialized content.
|
||||
*
|
||||
* @param serializedTreeContent content for serialized data
|
||||
* @return a content tree for serialized information
|
||||
*/
|
||||
public Content getSerializedContent(Content serializedTreeContent);
|
||||
|
||||
/**
|
||||
* Add the footer.
|
||||
*
|
||||
* @param serializedTree the serialized tree to be added
|
||||
*/
|
||||
public void addFooter(Content serializedTree);
|
||||
|
||||
/**
|
||||
* Print the serialized form document.
|
||||
*
|
||||
* @param serializedTree the content tree that will be printed
|
||||
*/
|
||||
public abstract void printDocument(Content serializedTree) throws IOException;
|
||||
|
||||
/**
|
||||
* Write the serialized form for a given field.
|
||||
*/
|
||||
public interface SerialFieldWriter {
|
||||
|
||||
/**
|
||||
* Get the serializable field header.
|
||||
*
|
||||
* @return serialized fields header content tree
|
||||
*/
|
||||
public Content getSerializableFieldsHeader();
|
||||
|
||||
/**
|
||||
* Get the field content header.
|
||||
*
|
||||
* @param isLastContent true if this is the last content to be documented
|
||||
* @return fields header content tree
|
||||
*/
|
||||
public Content getFieldsContentHeader(boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Get the fields content.
|
||||
*
|
||||
* @param heading the heading to write.
|
||||
* @param contentTree content tree to which the heading will be added
|
||||
* @return serializable fields content tree
|
||||
*/
|
||||
public Content getSerializableFields(String heading, Content contentTree);
|
||||
|
||||
/**
|
||||
* Adds the deprecated information for this member.
|
||||
*
|
||||
* @param field the field to document.
|
||||
* @param contentTree content tree to which the deprecated information will be added
|
||||
*/
|
||||
public void addMemberDeprecatedInfo(FieldDoc field, Content contentTree);
|
||||
|
||||
/**
|
||||
* Adds the description text for this member.
|
||||
*
|
||||
* @param field the field to document.
|
||||
* @param contentTree content tree to which the member description will be added
|
||||
*/
|
||||
public void addMemberDescription(FieldDoc field, Content contentTree);
|
||||
|
||||
/**
|
||||
* Adds the description text for this member represented by the tag.
|
||||
*
|
||||
* @param serialFieldTag the field to document (represented by tag).
|
||||
* @param contentTree content tree to which the member description will be added
|
||||
*/
|
||||
public void addMemberDescription(SerialFieldTag serialFieldTag, Content contentTree);
|
||||
|
||||
/**
|
||||
* Adds the tag information for this member.
|
||||
*
|
||||
* @param field the field to document.
|
||||
* @param contentTree content tree to which the member tags will be added
|
||||
*/
|
||||
public void addMemberTags(FieldDoc field, Content contentTree);
|
||||
|
||||
/**
|
||||
* Adds the member header.
|
||||
*
|
||||
* @param fieldType the type of the field.
|
||||
* @param fieldTypeStr the type of the field in string format. We will
|
||||
* print this out if we can't link to the type.
|
||||
* @param fieldDimensions the dimensions of the field.
|
||||
* @param fieldName the name of the field.
|
||||
* @param contentTree content tree to which the member header will be added
|
||||
*/
|
||||
public void addMemberHeader(ClassDoc fieldType, String fieldTypeStr,
|
||||
String fieldDimensions, String fieldName, Content contentTree);
|
||||
|
||||
/**
|
||||
* Check to see if overview details should be printed. If
|
||||
* nocomment option set or if there is no text to be printed
|
||||
* for deprecation info, inline comment or tags,
|
||||
* do not print overview details.
|
||||
*
|
||||
* @param field the field to check overview details for.
|
||||
* @return true if overview details need to be printed
|
||||
*/
|
||||
public boolean shouldPrintOverview(FieldDoc field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the serialized form for a given field.
|
||||
*/
|
||||
public interface SerialMethodWriter {
|
||||
|
||||
/**
|
||||
* Get the serializable method header.
|
||||
*
|
||||
* @return serializable methods content tree
|
||||
*/
|
||||
public Content getSerializableMethodsHeader();
|
||||
|
||||
/**
|
||||
* Get the method content header.
|
||||
*
|
||||
* @param isLastContent true if this is the last content to be documented
|
||||
* @return methods content tree
|
||||
*/
|
||||
public Content getMethodsContentHeader(boolean isLastContent);
|
||||
|
||||
/**
|
||||
* Write the given heading.
|
||||
*
|
||||
* @param heading the heading to write
|
||||
* @param serializableMethodTree content tree which will be added
|
||||
* @return serializable methods content tree
|
||||
*/
|
||||
public Content getSerializableMethods(String heading, Content serializableMethodTree);
|
||||
|
||||
/**
|
||||
* Write a warning that no serializable methods exist.
|
||||
*
|
||||
* @param msg the warning to print
|
||||
* @return no customization message tree
|
||||
*/
|
||||
public Content getNoCustomizationMsg(String msg);
|
||||
|
||||
/**
|
||||
* Adds the header.
|
||||
*
|
||||
* @param member the member to write the header for
|
||||
* @param methodsContentTree content tree to which the header will be added
|
||||
*/
|
||||
public void addMemberHeader(MethodDoc member, Content methodsContentTree);
|
||||
|
||||
/**
|
||||
* Adds the deprecated information for this member.
|
||||
*
|
||||
* @param member the member to write the deprecated information for
|
||||
* @param methodsContentTree content tree to which the deprecated
|
||||
* information will be added
|
||||
*/
|
||||
public void addDeprecatedMemberInfo(MethodDoc member, Content methodsContentTree);
|
||||
|
||||
/**
|
||||
* Adds the description for this member.
|
||||
*
|
||||
* @param member the member to write the information for
|
||||
* @param methodsContentTree content tree to which the member
|
||||
* information will be added
|
||||
*/
|
||||
public void addMemberDescription(MethodDoc member, Content methodsContentTree);
|
||||
|
||||
/**
|
||||
* Adds the tag information for this member.
|
||||
*
|
||||
* @param member the member to write the tags information for
|
||||
* @param methodsContentTree content tree to which the tags
|
||||
* information will be added
|
||||
*/
|
||||
public void addMemberTags(MethodDoc member, Content methodsContentTree);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* The interface for a factory creates writers.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @since 1.4
|
||||
*/
|
||||
|
||||
public interface WriterFactory {
|
||||
|
||||
/**
|
||||
* Return the writer for the constant summary.
|
||||
*
|
||||
* @return the writer for the constant summary. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract ConstantsSummaryWriter getConstantsSummaryWriter()
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Return the writer for the package summary.
|
||||
*
|
||||
* @param packageDoc the package being documented.
|
||||
* @param prevPkg the previous package that was documented.
|
||||
* @param nextPkg the next package being documented.
|
||||
* @return the writer for the package summary. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract PackageSummaryWriter getPackageSummaryWriter(PackageDoc
|
||||
packageDoc, PackageDoc prevPkg, PackageDoc nextPkg)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Return the writer for the profile summary.
|
||||
*
|
||||
* @param profile the profile being documented.
|
||||
* @param prevProfile the previous profile that was documented.
|
||||
* @param nextProfile the next profile being documented.
|
||||
* @return the writer for the profile summary. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract ProfileSummaryWriter getProfileSummaryWriter(Profile
|
||||
profile, Profile prevProfile, Profile nextProfile)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Return the writer for the profile package summary.
|
||||
*
|
||||
* @param packageDoc the profile package being documented.
|
||||
* @param prevPkg the previous profile package that was documented.
|
||||
* @param nextPkg the next profile package being documented.
|
||||
* @param profile the profile being documented.
|
||||
* @return the writer for the profile package summary. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract ProfilePackageSummaryWriter getProfilePackageSummaryWriter(
|
||||
PackageDoc packageDoc, PackageDoc prevPkg, PackageDoc nextPkg,
|
||||
Profile profile) throws Exception;
|
||||
|
||||
/**
|
||||
* Return the writer for a class.
|
||||
*
|
||||
* @param classDoc the class being documented.
|
||||
* @param prevClass the previous class that was documented.
|
||||
* @param nextClass the next class being documented.
|
||||
* @param classTree the class tree.
|
||||
* @return the writer for the class. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract ClassWriter getClassWriter(ClassDoc classDoc,
|
||||
ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Return the writer for an annotation type.
|
||||
*
|
||||
* @param annotationType the type being documented.
|
||||
* @param prevType the previous type that was documented.
|
||||
* @param nextType the next type being documented.
|
||||
* @return the writer for the annotation type. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract AnnotationTypeWriter getAnnotationTypeWriter(
|
||||
AnnotationTypeDoc annotationType, Type prevType, Type nextType)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Return the method writer for a given class.
|
||||
*
|
||||
* @param classWriter the writer for the class being documented.
|
||||
* @return the method writer for the give class. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract MethodWriter getMethodWriter(ClassWriter classWriter)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Return the annotation type field writer for a given annotation type.
|
||||
*
|
||||
* @param annotationTypeWriter the writer for the annotation type
|
||||
* being documented.
|
||||
* @return the member writer for the given annotation type. Return null if
|
||||
* this writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract AnnotationTypeFieldWriter
|
||||
getAnnotationTypeFieldWriter(
|
||||
AnnotationTypeWriter annotationTypeWriter) throws Exception;
|
||||
|
||||
/**
|
||||
* Return the annotation type optional member writer for a given annotation
|
||||
* type.
|
||||
*
|
||||
* @param annotationTypeWriter the writer for the annotation type
|
||||
* being documented.
|
||||
* @return the member writer for the given annotation type. Return null if
|
||||
* this writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract AnnotationTypeOptionalMemberWriter
|
||||
getAnnotationTypeOptionalMemberWriter(
|
||||
AnnotationTypeWriter annotationTypeWriter) throws Exception;
|
||||
|
||||
/**
|
||||
* Return the annotation type required member writer for a given annotation type.
|
||||
*
|
||||
* @param annotationTypeWriter the writer for the annotation type
|
||||
* being documented.
|
||||
* @return the member writer for the given annotation type. Return null if
|
||||
* this writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract AnnotationTypeRequiredMemberWriter
|
||||
getAnnotationTypeRequiredMemberWriter(
|
||||
AnnotationTypeWriter annotationTypeWriter) throws Exception;
|
||||
|
||||
/**
|
||||
* Return the enum constant writer for a given class.
|
||||
*
|
||||
* @param classWriter the writer for the class being documented.
|
||||
* @return the enum constant writer for the give class. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract EnumConstantWriter getEnumConstantWriter(
|
||||
ClassWriter classWriter) throws Exception;
|
||||
|
||||
/**
|
||||
* Return the field writer for a given class.
|
||||
*
|
||||
* @param classWriter the writer for the class being documented.
|
||||
* @return the field writer for the give class. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract FieldWriter getFieldWriter(ClassWriter classWriter)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Return the property writer for a given class.
|
||||
*
|
||||
* @param classWriter the writer for the class being documented.
|
||||
* @return the property writer for the give class. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract PropertyWriter getPropertyWriter(ClassWriter classWriter)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Return the constructor writer for a given class.
|
||||
*
|
||||
* @param classWriter the writer for the class being documented.
|
||||
* @return the method writer for the give class. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public abstract ConstructorWriter getConstructorWriter(
|
||||
ClassWriter classWriter)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Return the specified member summary writer for a given class.
|
||||
*
|
||||
* @param classWriter the writer for the class being documented.
|
||||
* @param memberType the {@link VisibleMemberMap} member type indicating
|
||||
* the type of member summary that should be returned.
|
||||
* @return the summary writer for the give class. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*
|
||||
* @see VisibleMemberMap
|
||||
* @throws IllegalArgumentException if memberType is unknown.
|
||||
*/
|
||||
public abstract MemberSummaryWriter getMemberSummaryWriter(
|
||||
ClassWriter classWriter, int memberType)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Return the specified member summary writer for a given annotation type.
|
||||
*
|
||||
* @param annotationTypeWriter the writer for the annotation type being
|
||||
* documented.
|
||||
* @param memberType the {@link VisibleMemberMap} member type indicating
|
||||
* the type of member summary that should be returned.
|
||||
* @return the summary writer for the give class. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*
|
||||
* @see VisibleMemberMap
|
||||
* @throws IllegalArgumentException if memberType is unknown.
|
||||
*/
|
||||
public abstract MemberSummaryWriter getMemberSummaryWriter(
|
||||
AnnotationTypeWriter annotationTypeWriter, int memberType)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
* Return the writer for the serialized form.
|
||||
*
|
||||
* @return the writer for the serialized form.
|
||||
*/
|
||||
public SerializedFormWriter getSerializedFormWriter() throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit.builders;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* The superclass for all builders. A builder is a class that provides
|
||||
* the structure and content of API documentation. A builder is completely
|
||||
* doclet independent which means that any doclet can use builders to
|
||||
* construct documentation, as long as it impelements the appropriate
|
||||
* writer interfaces. For example, if a doclet wanted to use
|
||||
* {@link ConstantsSummaryBuilder} to build a constant summary, all it has to
|
||||
* do is implement the ConstantsSummaryWriter interface and pass it to the
|
||||
* builder using a WriterFactory.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public abstract class AbstractBuilder {
|
||||
public static class Context {
|
||||
/**
|
||||
* The configuration used in this run of the doclet.
|
||||
*/
|
||||
final Configuration configuration;
|
||||
|
||||
/**
|
||||
* Keep track of which packages we have seen for
|
||||
* efficiency purposes. We don't want to copy the
|
||||
* doc files multiple times for a single package.
|
||||
*/
|
||||
final Set<String> containingPackagesSeen;
|
||||
|
||||
/**
|
||||
* Shared parser for the builder XML file
|
||||
*/
|
||||
final LayoutParser layoutParser;
|
||||
|
||||
Context(Configuration configuration,
|
||||
Set<String> containingPackagesSeen,
|
||||
LayoutParser layoutParser) {
|
||||
this.configuration = configuration;
|
||||
this.containingPackagesSeen = containingPackagesSeen;
|
||||
this.layoutParser = layoutParser;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The configuration used in this run of the doclet.
|
||||
*/
|
||||
protected final Configuration configuration;
|
||||
|
||||
/**
|
||||
* Keep track of which packages we have seen for
|
||||
* efficiency purposes. We don't want to copy the
|
||||
* doc files multiple times for a single package.
|
||||
*/
|
||||
protected final Set<String> containingPackagesSeen;
|
||||
|
||||
protected final LayoutParser layoutParser;
|
||||
|
||||
/**
|
||||
* True if we want to print debug output.
|
||||
*/
|
||||
protected static final boolean DEBUG = false;
|
||||
|
||||
/**
|
||||
* Construct a Builder.
|
||||
* @param configuration the configuration used in this run
|
||||
* of the doclet.
|
||||
*/
|
||||
public AbstractBuilder(Context c) {
|
||||
this.configuration = c.configuration;
|
||||
this.containingPackagesSeen = c.containingPackagesSeen;
|
||||
this.layoutParser = c.layoutParser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of this builder.
|
||||
*
|
||||
* @return the name of the builder.
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Build the documentation.
|
||||
*
|
||||
* @throws IOException there was a problem writing the output.
|
||||
*/
|
||||
public abstract void build() throws IOException;
|
||||
|
||||
/**
|
||||
* Build the documentation, as specified by the given XML element.
|
||||
*
|
||||
* @param node the XML element that specifies which component to document.
|
||||
* @param contentTree content tree to which the documentation will be added
|
||||
*/
|
||||
protected void build(XMLNode node, Content contentTree) {
|
||||
String component = node.name;
|
||||
try {
|
||||
invokeMethod("build" + component,
|
||||
new Class<?>[]{XMLNode.class, Content.class},
|
||||
new Object[]{node, contentTree});
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
configuration.root.printError("Unknown element: " + component);
|
||||
throw new DocletAbortException(e);
|
||||
} catch (InvocationTargetException e) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause instanceof FatalError) {
|
||||
throw (FatalError) cause;
|
||||
} else if (cause instanceof DocletAbortException) {
|
||||
throw (DocletAbortException) cause;
|
||||
} else {
|
||||
throw new DocletAbortException(cause);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
configuration.root.printError("Exception " +
|
||||
e.getClass().getName() +
|
||||
" thrown while processing element: " + component);
|
||||
throw new DocletAbortException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the documentation, as specified by the children of the given XML element.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document.
|
||||
* @param contentTree content tree to which the documentation will be added
|
||||
*/
|
||||
protected void buildChildren(XMLNode node, Content contentTree) {
|
||||
for (XMLNode child : node.children)
|
||||
build(child, contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the name and parameters, invoke the method in the builder. This
|
||||
* method is required to invoke the appropriate build method as instructed
|
||||
* by the builder XML file.
|
||||
*
|
||||
* @param methodName the name of the method that we would like to invoke.
|
||||
* @param paramClasses the types for each parameter.
|
||||
* @param params the parameters of the method.
|
||||
*/
|
||||
protected void invokeMethod(String methodName, Class<?>[] paramClasses,
|
||||
Object[] params)
|
||||
throws Exception {
|
||||
if (DEBUG) {
|
||||
configuration.root.printError("DEBUG: " + this.getClass().getName() + "." + methodName);
|
||||
}
|
||||
Method method = this.getClass().getMethod(methodName, paramClasses);
|
||||
method.invoke(this, params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit.builders;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* The superclass for all member builders. Member builders are only executed
|
||||
* within Class Builders. They essentially build sub-components. For example,
|
||||
* method documentation is a sub-component of class documentation.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @since 1.5
|
||||
*/
|
||||
public abstract class AbstractMemberBuilder extends AbstractBuilder {
|
||||
|
||||
/**
|
||||
* Construct a SubBuilder.
|
||||
* @param configuration the configuration used in this run
|
||||
* of the doclet.
|
||||
*/
|
||||
public AbstractMemberBuilder(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is not supported by sub-builders.
|
||||
*
|
||||
* @throws DocletAbortException this method will always throw a
|
||||
* DocletAbortException because it is not supported.
|
||||
*/
|
||||
public void build() throws DocletAbortException {
|
||||
//You may not call the build method in a subbuilder.
|
||||
throw new DocletAbortException("not supported");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build the sub component if there is anything to document.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document.
|
||||
* @param contentTree content tree to which the documentation will be added
|
||||
*/
|
||||
@Override
|
||||
public void build(XMLNode node, Content contentTree) {
|
||||
if (hasMembersToDocument()) {
|
||||
super.build(node, contentTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this subbuilder has anything to document.
|
||||
*
|
||||
* @return true if this subbuilder has anything to document.
|
||||
*/
|
||||
public abstract boolean hasMembersToDocument();
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit.builders;
|
||||
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* Builds the summary for a given annotation type.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
public class AnnotationTypeBuilder extends AbstractBuilder {
|
||||
|
||||
/**
|
||||
* The root element of the annotation type XML is {@value}.
|
||||
*/
|
||||
public static final String ROOT = "AnnotationTypeDoc";
|
||||
|
||||
/**
|
||||
* The annotation type being documented.
|
||||
*/
|
||||
private final AnnotationTypeDoc annotationTypeDoc;
|
||||
|
||||
/**
|
||||
* The doclet specific writer.
|
||||
*/
|
||||
private final AnnotationTypeWriter writer;
|
||||
|
||||
/**
|
||||
* The content tree for the annotation documentation.
|
||||
*/
|
||||
private Content contentTree;
|
||||
|
||||
/**
|
||||
* Construct a new ClassBuilder.
|
||||
*
|
||||
* @param context the build context.
|
||||
* @param annotationTypeDoc the class being documented.
|
||||
* @param writer the doclet specific writer.
|
||||
*/
|
||||
private AnnotationTypeBuilder(Context context,
|
||||
AnnotationTypeDoc annotationTypeDoc,
|
||||
AnnotationTypeWriter writer) {
|
||||
super(context);
|
||||
this.annotationTypeDoc = annotationTypeDoc;
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new ClassBuilder.
|
||||
*
|
||||
* @param context the build context.
|
||||
* @param annotationTypeDoc the class being documented.
|
||||
* @param writer the doclet specific writer.
|
||||
*/
|
||||
public static AnnotationTypeBuilder getInstance(Context context,
|
||||
AnnotationTypeDoc annotationTypeDoc,
|
||||
AnnotationTypeWriter writer)
|
||||
throws Exception {
|
||||
return new AnnotationTypeBuilder(context, annotationTypeDoc, writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void build() throws IOException {
|
||||
build(layoutParser.parseXML(ROOT), contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getName() {
|
||||
return ROOT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the annotation type documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param contentTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception {
|
||||
contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") +
|
||||
" " + annotationTypeDoc.name());
|
||||
Content annotationContentTree = writer.getAnnotationContentHeader();
|
||||
buildChildren(node, annotationContentTree);
|
||||
contentTree.addContent(annotationContentTree);
|
||||
writer.addFooter(contentTree);
|
||||
writer.printDocument(contentTree);
|
||||
writer.close();
|
||||
copyDocFiles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the doc files for the current ClassDoc if necessary.
|
||||
*/
|
||||
private void copyDocFiles() {
|
||||
PackageDoc containingPackage = annotationTypeDoc.containingPackage();
|
||||
if((configuration.packages == null ||
|
||||
Arrays.binarySearch(configuration.packages,
|
||||
containingPackage) < 0) &&
|
||||
! containingPackagesSeen.contains(containingPackage.name())){
|
||||
//Only copy doc files dir if the containing package is not
|
||||
//documented AND if we have not documented a class from the same
|
||||
//package already. Otherwise, we are making duplicate copies.
|
||||
Util.copyDocFiles(configuration, containingPackage);
|
||||
containingPackagesSeen.add(containingPackage.name());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the annotation information tree documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationContentTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeInfo(XMLNode node, Content annotationContentTree) {
|
||||
Content annotationInfoTree = writer.getAnnotationInfoTreeHeader();
|
||||
buildChildren(node, annotationInfoTree);
|
||||
annotationContentTree.addContent(writer.getAnnotationInfo(annotationInfoTree));
|
||||
}
|
||||
|
||||
/**
|
||||
* If this annotation is deprecated, build the appropriate information.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildDeprecationInfo (XMLNode node, Content annotationInfoTree) {
|
||||
writer.addAnnotationTypeDeprecationInfo(annotationInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the signature of the current annotation type.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) {
|
||||
StringBuilder modifiers = new StringBuilder(
|
||||
annotationTypeDoc.modifiers() + " ");
|
||||
writer.addAnnotationTypeSignature(Util.replaceText(
|
||||
modifiers.toString(), "interface", "@interface"), annotationInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the annotation type description.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeDescription(XMLNode node, Content annotationInfoTree) {
|
||||
writer.addAnnotationTypeDescription(annotationInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tag information for the current annotation type.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeTagInfo(XMLNode node, Content annotationInfoTree) {
|
||||
writer.addAnnotationTypeTagInfo(annotationInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the member summary contents of the page.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationContentTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildMemberSummary(XMLNode node, Content annotationContentTree)
|
||||
throws Exception {
|
||||
Content memberSummaryTree = writer.getMemberTreeHeader();
|
||||
configuration.getBuilderFactory().
|
||||
getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
|
||||
annotationContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the member details contents of the page.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationContentTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeMemberDetails(XMLNode node, Content annotationContentTree) {
|
||||
Content memberDetailsTree = writer.getMemberTreeHeader();
|
||||
buildChildren(node, memberDetailsTree);
|
||||
if (memberDetailsTree.isValid()) {
|
||||
annotationContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the annotation type field documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeFieldDetails(XMLNode node, Content memberDetailsTree)
|
||||
throws Exception {
|
||||
configuration.getBuilderFactory().
|
||||
getAnnotationTypeFieldsBuilder(writer).buildChildren(node, memberDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the annotation type optional member documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeOptionalMemberDetails(XMLNode node, Content memberDetailsTree)
|
||||
throws Exception {
|
||||
configuration.getBuilderFactory().
|
||||
getAnnotationTypeOptionalMemberBuilder(writer).buildChildren(node, memberDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the annotation type required member documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeRequiredMemberDetails(XMLNode node, Content memberDetailsTree)
|
||||
throws Exception {
|
||||
configuration.getBuilderFactory().
|
||||
getAnnotationTypeRequiredMemberBuilder(writer).buildChildren(node, memberDetailsTree);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit.builders;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Builds documentation for annotation type fields.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Bhavesh Patel
|
||||
* @since 1.8
|
||||
*/
|
||||
public class AnnotationTypeFieldBuilder extends AbstractMemberBuilder {
|
||||
|
||||
/**
|
||||
* The annotation type whose members are being documented.
|
||||
*/
|
||||
protected ClassDoc classDoc;
|
||||
|
||||
/**
|
||||
* The visible members for the given class.
|
||||
*/
|
||||
protected VisibleMemberMap visibleMemberMap;
|
||||
|
||||
/**
|
||||
* The writer to output the member documentation.
|
||||
*/
|
||||
protected AnnotationTypeFieldWriter writer;
|
||||
|
||||
/**
|
||||
* The list of members being documented.
|
||||
*/
|
||||
protected List<ProgramElementDoc> members;
|
||||
|
||||
/**
|
||||
* The index of the current member that is being documented at this point
|
||||
* in time.
|
||||
*/
|
||||
protected int currentMemberIndex;
|
||||
|
||||
/**
|
||||
* Construct a new AnnotationTypeFieldsBuilder.
|
||||
*
|
||||
* @param context the build context.
|
||||
* @param classDoc the class whose members are being documented.
|
||||
* @param writer the doclet specific writer.
|
||||
* @param memberType the type of member that is being documented.
|
||||
*/
|
||||
protected AnnotationTypeFieldBuilder(Context context,
|
||||
ClassDoc classDoc,
|
||||
AnnotationTypeFieldWriter writer,
|
||||
int memberType) {
|
||||
super(context);
|
||||
this.classDoc = classDoc;
|
||||
this.writer = writer;
|
||||
this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType,
|
||||
configuration);
|
||||
this.members = new ArrayList<ProgramElementDoc>(
|
||||
this.visibleMemberMap.getMembersFor(classDoc));
|
||||
if (configuration.getMemberComparator() != null) {
|
||||
Collections.sort(this.members, configuration.getMemberComparator());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new AnnotationTypeFieldBuilder.
|
||||
*
|
||||
* @param context the build context.
|
||||
* @param classDoc the class whose members are being documented.
|
||||
* @param writer the doclet specific writer.
|
||||
*/
|
||||
public static AnnotationTypeFieldBuilder getInstance(
|
||||
Context context, ClassDoc classDoc,
|
||||
AnnotationTypeFieldWriter writer) {
|
||||
return new AnnotationTypeFieldBuilder(context, classDoc,
|
||||
writer, VisibleMemberMap.ANNOTATION_TYPE_FIELDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getName() {
|
||||
return "AnnotationTypeFieldDetails";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of members that will be documented for the given class.
|
||||
* This information can be used for doclet specific documentation
|
||||
* generation.
|
||||
*
|
||||
* @param classDoc the {@link ClassDoc} we want to check.
|
||||
* @return a list of members that will be documented.
|
||||
*/
|
||||
public List<ProgramElementDoc> members(ClassDoc classDoc) {
|
||||
return visibleMemberMap.getMembersFor(classDoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the visible member map for the members of this class.
|
||||
*
|
||||
* @return the visible member map for the members of this class.
|
||||
*/
|
||||
public VisibleMemberMap getVisibleMemberMap() {
|
||||
return visibleMemberMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* summaryOrder.size()
|
||||
*/
|
||||
public boolean hasMembersToDocument() {
|
||||
return members.size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the annotation type field documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeField(XMLNode node, Content memberDetailsTree) {
|
||||
buildAnnotationTypeMember(node, memberDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the member documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) {
|
||||
if (writer == null) {
|
||||
return;
|
||||
}
|
||||
int size = members.size();
|
||||
if (size > 0) {
|
||||
writer.addAnnotationFieldDetailsMarker(memberDetailsTree);
|
||||
for (currentMemberIndex = 0; currentMemberIndex < size;
|
||||
currentMemberIndex++) {
|
||||
Content detailsTree = writer.getMemberTreeHeader();
|
||||
writer.addAnnotationDetailsTreeHeader(classDoc, detailsTree);
|
||||
Content annotationDocTree = writer.getAnnotationDocTreeHeader(
|
||||
(MemberDoc) members.get(currentMemberIndex),
|
||||
detailsTree);
|
||||
buildChildren(node, annotationDocTree);
|
||||
detailsTree.addContent(writer.getAnnotationDoc(
|
||||
annotationDocTree, (currentMemberIndex == size - 1)));
|
||||
memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the signature.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildSignature(XMLNode node, Content annotationDocTree) {
|
||||
annotationDocTree.addContent(
|
||||
writer.getSignature((MemberDoc) members.get(currentMemberIndex)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the deprecation information.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) {
|
||||
writer.addDeprecated((MemberDoc) members.get(currentMemberIndex),
|
||||
annotationDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the comments for the member. Do nothing if
|
||||
* {@link Configuration#nocomment} is set to true.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildMemberComments(XMLNode node, Content annotationDocTree) {
|
||||
if(! configuration.nocomment){
|
||||
writer.addComments((MemberDoc) members.get(currentMemberIndex),
|
||||
annotationDocTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tag information.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildTagInfo(XMLNode node, Content annotationDocTree) {
|
||||
writer.addTags((MemberDoc) members.get(currentMemberIndex),
|
||||
annotationDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the annotation type field writer for this builder.
|
||||
*
|
||||
* @return the annotation type field writer for this builder.
|
||||
*/
|
||||
public AnnotationTypeFieldWriter getWriter() {
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit.builders;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Builds documentation for optional annotation type members.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
public class AnnotationTypeOptionalMemberBuilder extends
|
||||
AnnotationTypeRequiredMemberBuilder {
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new AnnotationTypeMemberBuilder.
|
||||
*
|
||||
* @param context the build context.
|
||||
* @param classDoc the class whose members are being documented.
|
||||
* @param writer the doclet specific writer.
|
||||
*/
|
||||
private AnnotationTypeOptionalMemberBuilder(Context context,
|
||||
ClassDoc classDoc,
|
||||
AnnotationTypeOptionalMemberWriter writer) {
|
||||
super(context, classDoc, writer,
|
||||
VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new AnnotationTypeMemberBuilder.
|
||||
*
|
||||
* @param context the build context.
|
||||
* @param classDoc the class whose members are being documented.
|
||||
* @param writer the doclet specific writer.
|
||||
*/
|
||||
public static AnnotationTypeOptionalMemberBuilder getInstance(
|
||||
Context context, ClassDoc classDoc,
|
||||
AnnotationTypeOptionalMemberWriter writer) {
|
||||
return new AnnotationTypeOptionalMemberBuilder(context,
|
||||
classDoc, writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AnnotationTypeOptionalMemberDetails";
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the annotation type optional member documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeOptionalMember(XMLNode node, Content memberDetailsTree) {
|
||||
buildAnnotationTypeMember(node, memberDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the default value for this optional member.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildDefaultValueInfo(XMLNode node, Content annotationDocTree) {
|
||||
((AnnotationTypeOptionalMemberWriter) writer).addDefaultValueInfo(
|
||||
(MemberDoc) members.get(currentMemberIndex),
|
||||
annotationDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public AnnotationTypeRequiredMemberWriter getWriter() {
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit.builders;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* Builds documentation for required annotation type members.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
|
||||
|
||||
/**
|
||||
* The annotation type whose members are being documented.
|
||||
*/
|
||||
protected ClassDoc classDoc;
|
||||
|
||||
/**
|
||||
* The visible members for the given class.
|
||||
*/
|
||||
protected VisibleMemberMap visibleMemberMap;
|
||||
|
||||
/**
|
||||
* The writer to output the member documentation.
|
||||
*/
|
||||
protected AnnotationTypeRequiredMemberWriter writer;
|
||||
|
||||
/**
|
||||
* The list of members being documented.
|
||||
*/
|
||||
protected List<ProgramElementDoc> members;
|
||||
|
||||
/**
|
||||
* The index of the current member that is being documented at this point
|
||||
* in time.
|
||||
*/
|
||||
protected int currentMemberIndex;
|
||||
|
||||
/**
|
||||
* Construct a new AnnotationTypeRequiredMemberBuilder.
|
||||
*
|
||||
* @param context the build context.
|
||||
* @param classDoc the class whose members are being documented.
|
||||
* @param writer the doclet specific writer.
|
||||
*/
|
||||
protected AnnotationTypeRequiredMemberBuilder(Context context,
|
||||
ClassDoc classDoc,
|
||||
AnnotationTypeRequiredMemberWriter writer,
|
||||
int memberType) {
|
||||
super(context);
|
||||
this.classDoc = classDoc;
|
||||
this.writer = writer;
|
||||
this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType,
|
||||
configuration);
|
||||
this.members = new ArrayList<ProgramElementDoc>(
|
||||
this.visibleMemberMap.getMembersFor(classDoc));
|
||||
if (configuration.getMemberComparator() != null) {
|
||||
Collections.sort(this.members, configuration.getMemberComparator());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new AnnotationTypeMemberBuilder.
|
||||
*
|
||||
* @param context the build context.
|
||||
* @param classDoc the class whose members are being documented.
|
||||
* @param writer the doclet specific writer.
|
||||
*/
|
||||
public static AnnotationTypeRequiredMemberBuilder getInstance(
|
||||
Context context, ClassDoc classDoc,
|
||||
AnnotationTypeRequiredMemberWriter writer) {
|
||||
return new AnnotationTypeRequiredMemberBuilder(context, classDoc,
|
||||
writer,
|
||||
VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getName() {
|
||||
return "AnnotationTypeRequiredMemberDetails";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of members that will be documented for the given class.
|
||||
* This information can be used for doclet specific documentation
|
||||
* generation.
|
||||
*
|
||||
* @param classDoc the {@link ClassDoc} we want to check.
|
||||
* @return a list of members that will be documented.
|
||||
*/
|
||||
public List<ProgramElementDoc> members(ClassDoc classDoc) {
|
||||
return visibleMemberMap.getMembersFor(classDoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the visible member map for the members of this class.
|
||||
*
|
||||
* @return the visible member map for the members of this class.
|
||||
*/
|
||||
public VisibleMemberMap getVisibleMemberMap() {
|
||||
return visibleMemberMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* summaryOrder.size()
|
||||
*/
|
||||
public boolean hasMembersToDocument() {
|
||||
return members.size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the annotation type required member documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeRequiredMember(XMLNode node, Content memberDetailsTree) {
|
||||
buildAnnotationTypeMember(node, memberDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the member documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) {
|
||||
if (writer == null) {
|
||||
return;
|
||||
}
|
||||
int size = members.size();
|
||||
if (size > 0) {
|
||||
writer.addAnnotationDetailsMarker(memberDetailsTree);
|
||||
for (currentMemberIndex = 0; currentMemberIndex < size;
|
||||
currentMemberIndex++) {
|
||||
Content detailsTree = writer.getMemberTreeHeader();
|
||||
writer.addAnnotationDetailsTreeHeader(classDoc, detailsTree);
|
||||
Content annotationDocTree = writer.getAnnotationDocTreeHeader(
|
||||
(MemberDoc) members.get(currentMemberIndex), detailsTree);
|
||||
buildChildren(node, annotationDocTree);
|
||||
detailsTree.addContent(writer.getAnnotationDoc(
|
||||
annotationDocTree, (currentMemberIndex == size - 1)));
|
||||
memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the signature.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildSignature(XMLNode node, Content annotationDocTree) {
|
||||
annotationDocTree.addContent(
|
||||
writer.getSignature((MemberDoc) members.get(currentMemberIndex)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the deprecation information.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) {
|
||||
writer.addDeprecated((MemberDoc) members.get(currentMemberIndex),
|
||||
annotationDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the comments for the member. Do nothing if
|
||||
* {@link Configuration#nocomment} is set to true.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildMemberComments(XMLNode node, Content annotationDocTree) {
|
||||
if(! configuration.nocomment){
|
||||
writer.addComments((MemberDoc) members.get(currentMemberIndex),
|
||||
annotationDocTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tag information.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param annotationDocTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildTagInfo(XMLNode node, Content annotationDocTree) {
|
||||
writer.addTags((MemberDoc) members.get(currentMemberIndex),
|
||||
annotationDocTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the annotation type required member writer for this builder.
|
||||
*
|
||||
* @return the annotation type required member constant writer for this
|
||||
* builder.
|
||||
*/
|
||||
public AnnotationTypeRequiredMemberWriter getWriter() {
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit.builders;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import com.sun.tools.javac.jvm.Profile;
|
||||
import com.sun.tools.doclets.internal.toolkit.*;
|
||||
import com.sun.tools.doclets.internal.toolkit.util.*;
|
||||
|
||||
/**
|
||||
* The factory for constructing builders.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @since 1.4
|
||||
*/
|
||||
|
||||
public class BuilderFactory {
|
||||
|
||||
/**
|
||||
* The current configuration of the doclet.
|
||||
*/
|
||||
private final Configuration configuration;
|
||||
|
||||
/**
|
||||
* The factory to retrieve the required writers from.
|
||||
*/
|
||||
private final WriterFactory writerFactory;
|
||||
|
||||
private final AbstractBuilder.Context context;
|
||||
|
||||
/**
|
||||
* Construct a builder factory using the given configuration.
|
||||
* @param configuration the configuration for the current doclet
|
||||
* being executed.
|
||||
*/
|
||||
public BuilderFactory (Configuration configuration) {
|
||||
this.configuration = configuration;
|
||||
this.writerFactory = configuration.getWriterFactory();
|
||||
|
||||
Set<String> containingPackagesSeen = new HashSet<String>();
|
||||
context = new AbstractBuilder.Context(configuration, containingPackagesSeen,
|
||||
LayoutParser.getInstance(configuration));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the builder that builds the constant summary.
|
||||
* @return the builder that builds the constant summary.
|
||||
*/
|
||||
public AbstractBuilder getConstantsSummaryBuider() throws Exception {
|
||||
return ConstantsSummaryBuilder.getInstance(context,
|
||||
writerFactory.getConstantsSummaryWriter());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the builder that builds the package summary.
|
||||
*
|
||||
* @param pkg the package being documented.
|
||||
* @param prevPkg the previous package being documented.
|
||||
* @param nextPkg the next package being documented.
|
||||
* @return the builder that builds the constant summary.
|
||||
*/
|
||||
public AbstractBuilder getPackageSummaryBuilder(PackageDoc pkg, PackageDoc prevPkg,
|
||||
PackageDoc nextPkg) throws Exception {
|
||||
return PackageSummaryBuilder.getInstance(context, pkg,
|
||||
writerFactory.getPackageSummaryWriter(pkg, prevPkg, nextPkg));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the builder that builds the profile summary.
|
||||
*
|
||||
* @param profile the profile being documented.
|
||||
* @param prevProfile the previous profile being documented.
|
||||
* @param nextProfile the next profile being documented.
|
||||
* @return the builder that builds the profile summary.
|
||||
*/
|
||||
public AbstractBuilder getProfileSummaryBuilder(Profile profile, Profile prevProfile,
|
||||
Profile nextProfile) throws Exception {
|
||||
return ProfileSummaryBuilder.getInstance(context, profile,
|
||||
writerFactory.getProfileSummaryWriter(profile, prevProfile, nextProfile));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the builder that builds the profile package summary.
|
||||
*
|
||||
* @param pkg the profile package being documented.
|
||||
* @param prevPkg the previous profile package being documented.
|
||||
* @param nextPkg the next profile package being documented.
|
||||
* @param profile the profile being documented.
|
||||
* @return the builder that builds the profile package summary.
|
||||
*/
|
||||
public AbstractBuilder getProfilePackageSummaryBuilder(PackageDoc pkg, PackageDoc prevPkg,
|
||||
PackageDoc nextPkg, Profile profile) throws Exception {
|
||||
return ProfilePackageSummaryBuilder.getInstance(context, pkg,
|
||||
writerFactory.getProfilePackageSummaryWriter(pkg, prevPkg, nextPkg,
|
||||
profile), profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the builder for the class.
|
||||
*
|
||||
* @param classDoc the class being documented.
|
||||
* @param prevClass the previous class that was documented.
|
||||
* @param nextClass the next class being documented.
|
||||
* @param classTree the class tree.
|
||||
* @return the writer for the class. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public AbstractBuilder getClassBuilder(ClassDoc classDoc,
|
||||
ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree)
|
||||
throws Exception {
|
||||
return ClassBuilder.getInstance(context, classDoc,
|
||||
writerFactory.getClassWriter(classDoc, prevClass, nextClass,
|
||||
classTree));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the builder for the annotation type.
|
||||
*
|
||||
* @param annotationType the annotation type being documented.
|
||||
* @param prevType the previous type that was documented.
|
||||
* @param nextType the next type being documented.
|
||||
* @return the writer for the annotation type. Return null if this
|
||||
* writer is not supported by the doclet.
|
||||
*/
|
||||
public AbstractBuilder getAnnotationTypeBuilder(
|
||||
AnnotationTypeDoc annotationType,
|
||||
Type prevType, Type nextType)
|
||||
throws Exception {
|
||||
return AnnotationTypeBuilder.getInstance(context, annotationType,
|
||||
writerFactory.getAnnotationTypeWriter(annotationType, prevType, nextType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of the method builder for the given class.
|
||||
*
|
||||
* @return an instance of the method builder for the given class.
|
||||
*/
|
||||
public AbstractBuilder getMethodBuilder(ClassWriter classWriter)
|
||||
throws Exception {
|
||||
return MethodBuilder.getInstance(context,
|
||||
classWriter.getClassDoc(),
|
||||
writerFactory.getMethodWriter(classWriter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of the annotation type fields builder for the given
|
||||
* class.
|
||||
*
|
||||
* @return an instance of the annotation type field builder for the given
|
||||
* annotation type.
|
||||
*/
|
||||
public AbstractBuilder getAnnotationTypeFieldsBuilder(
|
||||
AnnotationTypeWriter annotationTypeWriter)
|
||||
throws Exception {
|
||||
return AnnotationTypeFieldBuilder.getInstance(context,
|
||||
annotationTypeWriter.getAnnotationTypeDoc(),
|
||||
writerFactory.getAnnotationTypeFieldWriter(
|
||||
annotationTypeWriter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of the annotation type member builder for the given
|
||||
* class.
|
||||
*
|
||||
* @return an instance of the annotation type member builder for the given
|
||||
* annotation type.
|
||||
*/
|
||||
public AbstractBuilder getAnnotationTypeOptionalMemberBuilder(
|
||||
AnnotationTypeWriter annotationTypeWriter)
|
||||
throws Exception {
|
||||
return AnnotationTypeOptionalMemberBuilder.getInstance(context,
|
||||
annotationTypeWriter.getAnnotationTypeDoc(),
|
||||
writerFactory.getAnnotationTypeOptionalMemberWriter(
|
||||
annotationTypeWriter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of the annotation type member builder for the given
|
||||
* class.
|
||||
*
|
||||
* @return an instance of the annotation type member builder for the given
|
||||
* annotation type.
|
||||
*/
|
||||
public AbstractBuilder getAnnotationTypeRequiredMemberBuilder(
|
||||
AnnotationTypeWriter annotationTypeWriter)
|
||||
throws Exception {
|
||||
return AnnotationTypeRequiredMemberBuilder.getInstance(context,
|
||||
annotationTypeWriter.getAnnotationTypeDoc(),
|
||||
writerFactory.getAnnotationTypeRequiredMemberWriter(
|
||||
annotationTypeWriter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of the enum constants builder for the given class.
|
||||
*
|
||||
* @return an instance of the enum constants builder for the given class.
|
||||
*/
|
||||
public AbstractBuilder getEnumConstantsBuilder(ClassWriter classWriter)
|
||||
throws Exception {
|
||||
return EnumConstantBuilder.getInstance(context, classWriter.getClassDoc(),
|
||||
writerFactory.getEnumConstantWriter(classWriter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of the field builder for the given class.
|
||||
*
|
||||
* @return an instance of the field builder for the given class.
|
||||
*/
|
||||
public AbstractBuilder getFieldBuilder(ClassWriter classWriter)
|
||||
throws Exception {
|
||||
return FieldBuilder.getInstance(context, classWriter.getClassDoc(),
|
||||
writerFactory.getFieldWriter(classWriter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of the property builder for the given class.
|
||||
*
|
||||
* @return an instance of the field builder for the given class.
|
||||
*/
|
||||
public AbstractBuilder getPropertyBuilder(ClassWriter classWriter) throws Exception {
|
||||
final PropertyWriter propertyWriter =
|
||||
writerFactory.getPropertyWriter(classWriter);
|
||||
return PropertyBuilder.getInstance(context,
|
||||
classWriter.getClassDoc(),
|
||||
propertyWriter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of the constructor builder for the given class.
|
||||
*
|
||||
* @return an instance of the constructor builder for the given class.
|
||||
*/
|
||||
public AbstractBuilder getConstructorBuilder(ClassWriter classWriter)
|
||||
throws Exception {
|
||||
return ConstructorBuilder.getInstance(context,
|
||||
classWriter.getClassDoc(),
|
||||
writerFactory.getConstructorWriter(classWriter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of the member summary builder for the given class.
|
||||
*
|
||||
* @return an instance of the member summary builder for the given class.
|
||||
*/
|
||||
public AbstractBuilder getMemberSummaryBuilder(ClassWriter classWriter)
|
||||
throws Exception {
|
||||
return MemberSummaryBuilder.getInstance(classWriter, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of the member summary builder for the given annotation
|
||||
* type.
|
||||
*
|
||||
* @return an instance of the member summary builder for the given
|
||||
* annotation type.
|
||||
*/
|
||||
public AbstractBuilder getMemberSummaryBuilder(
|
||||
AnnotationTypeWriter annotationTypeWriter)
|
||||
throws Exception {
|
||||
return MemberSummaryBuilder.getInstance(annotationTypeWriter, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the builder that builds the serialized form.
|
||||
*
|
||||
* @return the builder that builds the serialized form.
|
||||
*/
|
||||
public AbstractBuilder getSerializedFormBuilder()
|
||||
throws Exception {
|
||||
return SerializedFormBuilder.getInstance(context);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,418 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit.builders;
|
||||
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* Builds the summary for a given class.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
public class ClassBuilder extends AbstractBuilder {
|
||||
|
||||
/**
|
||||
* The root element of the class XML is {@value}.
|
||||
*/
|
||||
public static final String ROOT = "ClassDoc";
|
||||
|
||||
/**
|
||||
* The class being documented.
|
||||
*/
|
||||
private final ClassDoc classDoc;
|
||||
|
||||
/**
|
||||
* The doclet specific writer.
|
||||
*/
|
||||
private final ClassWriter writer;
|
||||
|
||||
/**
|
||||
* Keep track of whether or not this classdoc is an interface.
|
||||
*/
|
||||
private final boolean isInterface;
|
||||
|
||||
/**
|
||||
* Keep track of whether or not this classdoc is an enum.
|
||||
*/
|
||||
private final boolean isEnum;
|
||||
|
||||
/**
|
||||
* The content tree for the class documentation.
|
||||
*/
|
||||
private Content contentTree;
|
||||
|
||||
/**
|
||||
* Construct a new ClassBuilder.
|
||||
*
|
||||
* @param context the build context
|
||||
* @param classDoc the class being documented.
|
||||
* @param writer the doclet specific writer.
|
||||
*/
|
||||
private ClassBuilder(Context context,
|
||||
ClassDoc classDoc, ClassWriter writer) {
|
||||
super(context);
|
||||
this.classDoc = classDoc;
|
||||
this.writer = writer;
|
||||
if (classDoc.isInterface()) {
|
||||
isInterface = true;
|
||||
isEnum = false;
|
||||
} else if (classDoc.isEnum()) {
|
||||
isInterface = false;
|
||||
isEnum = true;
|
||||
Util.setEnumDocumentation(configuration, classDoc);
|
||||
} else {
|
||||
isInterface = false;
|
||||
isEnum = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new ClassBuilder.
|
||||
*
|
||||
* @param context the build context
|
||||
* @param classDoc the class being documented.
|
||||
* @param writer the doclet specific writer.
|
||||
*/
|
||||
public static ClassBuilder getInstance(Context context,
|
||||
ClassDoc classDoc, ClassWriter writer) {
|
||||
return new ClassBuilder(context, classDoc, writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void build() throws IOException {
|
||||
build(layoutParser.parseXML(ROOT), contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getName() {
|
||||
return ROOT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the {@literal <ClassDoc>} tag.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param contentTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildClassDoc(XMLNode node, Content contentTree) throws Exception {
|
||||
String key;
|
||||
if (isInterface) {
|
||||
key = "doclet.Interface";
|
||||
} else if (isEnum) {
|
||||
key = "doclet.Enum";
|
||||
} else {
|
||||
key = "doclet.Class";
|
||||
}
|
||||
contentTree = writer.getHeader(configuration.getText(key) + " " +
|
||||
classDoc.name());
|
||||
Content classContentTree = writer.getClassContentHeader();
|
||||
buildChildren(node, classContentTree);
|
||||
contentTree.addContent(classContentTree);
|
||||
writer.addFooter(contentTree);
|
||||
writer.printDocument(contentTree);
|
||||
writer.close();
|
||||
copyDocFiles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the class tree documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classContentTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildClassTree(XMLNode node, Content classContentTree) {
|
||||
writer.addClassTree(classContentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the class information tree documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classContentTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildClassInfo(XMLNode node, Content classContentTree) {
|
||||
Content classInfoTree = writer.getClassInfoTreeHeader();
|
||||
buildChildren(node, classInfoTree);
|
||||
classContentTree.addContent(writer.getClassInfo(classInfoTree));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the typeparameters of this class.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildTypeParamInfo(XMLNode node, Content classInfoTree) {
|
||||
writer.addTypeParamInfo(classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is an interface, list all super interfaces.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildSuperInterfacesInfo(XMLNode node, Content classInfoTree) {
|
||||
writer.addSuperInterfacesInfo(classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is a class, list all interfaces implemented by this class.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildImplementedInterfacesInfo(XMLNode node, Content classInfoTree) {
|
||||
writer.addImplementedInterfacesInfo(classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all the classes extend this one.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildSubClassInfo(XMLNode node, Content classInfoTree) {
|
||||
writer.addSubClassInfo(classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all the interfaces that extend this one.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildSubInterfacesInfo(XMLNode node, Content classInfoTree) {
|
||||
writer.addSubInterfacesInfo(classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is an interface, list all classes that implement this interface.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildInterfaceUsageInfo(XMLNode node, Content classInfoTree) {
|
||||
writer.addInterfaceUsageInfo(classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is an functional interface, display appropriate message.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildFunctionalInterfaceInfo(XMLNode node, Content classInfoTree) {
|
||||
writer.addFunctionalInterfaceInfo(classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this class is deprecated, build the appropriate information.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildDeprecationInfo (XMLNode node, Content classInfoTree) {
|
||||
writer.addClassDeprecationInfo(classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is an inner class or interface, list the enclosing class or interface.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildNestedClassInfo (XMLNode node, Content classInfoTree) {
|
||||
writer.addNestedClassInfo(classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the doc files for the current ClassDoc if necessary.
|
||||
*/
|
||||
private void copyDocFiles() {
|
||||
PackageDoc containingPackage = classDoc.containingPackage();
|
||||
if((configuration.packages == null ||
|
||||
Arrays.binarySearch(configuration.packages,
|
||||
containingPackage) < 0) &&
|
||||
! containingPackagesSeen.contains(containingPackage.name())){
|
||||
//Only copy doc files dir if the containing package is not
|
||||
//documented AND if we have not documented a class from the same
|
||||
//package already. Otherwise, we are making duplicate copies.
|
||||
Util.copyDocFiles(configuration, containingPackage);
|
||||
containingPackagesSeen.add(containingPackage.name());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the signature of the current class.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildClassSignature(XMLNode node, Content classInfoTree) {
|
||||
StringBuilder modifiers = new StringBuilder(classDoc.modifiers());
|
||||
modifiers.append(modifiers.length() == 0 ? "" : " ");
|
||||
if (isEnum) {
|
||||
modifiers.append("enum ");
|
||||
int index;
|
||||
if ((index = modifiers.indexOf("abstract")) >= 0) {
|
||||
modifiers.delete(index, index + "abstract".length());
|
||||
modifiers = new StringBuilder(
|
||||
Util.replaceText(modifiers.toString(), " ", " "));
|
||||
}
|
||||
if ((index = modifiers.indexOf("final")) >= 0) {
|
||||
modifiers.delete(index, index + "final".length());
|
||||
modifiers = new StringBuilder(
|
||||
Util.replaceText(modifiers.toString(), " ", " "));
|
||||
}
|
||||
//} else if (classDoc.isAnnotationType()) {
|
||||
//modifiers.append("@interface ");
|
||||
} else if (! isInterface) {
|
||||
modifiers.append("class ");
|
||||
}
|
||||
writer.addClassSignature(modifiers.toString(), classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the class description.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildClassDescription(XMLNode node, Content classInfoTree) {
|
||||
writer.addClassDescription(classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the tag information for the current class.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classInfoTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildClassTagInfo(XMLNode node, Content classInfoTree) {
|
||||
writer.addClassTagInfo(classInfoTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the member summary contents of the page.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classContentTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildMemberSummary(XMLNode node, Content classContentTree) throws Exception {
|
||||
Content memberSummaryTree = writer.getMemberTreeHeader();
|
||||
configuration.getBuilderFactory().
|
||||
getMemberSummaryBuilder(writer).buildChildren(node, memberSummaryTree);
|
||||
classContentTree.addContent(writer.getMemberSummaryTree(memberSummaryTree));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the member details contents of the page.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classContentTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildMemberDetails(XMLNode node, Content classContentTree) {
|
||||
Content memberDetailsTree = writer.getMemberTreeHeader();
|
||||
buildChildren(node, memberDetailsTree);
|
||||
classContentTree.addContent(writer.getMemberDetailsTree(memberDetailsTree));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the enum constants documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildEnumConstantsDetails(XMLNode node,
|
||||
Content memberDetailsTree) throws Exception {
|
||||
configuration.getBuilderFactory().
|
||||
getEnumConstantsBuilder(writer).buildChildren(node, memberDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the field documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildFieldDetails(XMLNode node,
|
||||
Content memberDetailsTree) throws Exception {
|
||||
configuration.getBuilderFactory().
|
||||
getFieldBuilder(writer).buildChildren(node, memberDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the property documentation.
|
||||
*
|
||||
* @param elements the XML elements that specify how a field is documented.
|
||||
*/
|
||||
public void buildPropertyDetails(XMLNode node,
|
||||
Content memberDetailsTree) throws Exception {
|
||||
configuration.getBuilderFactory().
|
||||
getPropertyBuilder(writer).buildChildren(node, memberDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the constructor documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildConstructorDetails(XMLNode node,
|
||||
Content memberDetailsTree) throws Exception {
|
||||
configuration.getBuilderFactory().
|
||||
getConstructorBuilder(writer).buildChildren(node, memberDetailsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the method documentation.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param memberDetailsTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildMethodDetails(XMLNode node,
|
||||
Content memberDetailsTree) throws Exception {
|
||||
configuration.getBuilderFactory().
|
||||
getMethodBuilder(writer).buildChildren(node, memberDetailsTree);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,386 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.tools.doclets.internal.toolkit.builders;
|
||||
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* Builds the Constants Summary Page.
|
||||
*
|
||||
* <p><b>This is NOT part of any supported API.
|
||||
* If you write code that depends on this, you do so at your own risk.
|
||||
* This code and its internal interfaces are subject to change or
|
||||
* deletion without notice.</b>
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @author Bhavesh Patel (Modified)
|
||||
* @since 1.5
|
||||
*/
|
||||
public class ConstantsSummaryBuilder extends AbstractBuilder {
|
||||
|
||||
/**
|
||||
* The root element of the constant summary XML is {@value}.
|
||||
*/
|
||||
public static final String ROOT = "ConstantSummary";
|
||||
|
||||
/**
|
||||
* The maximum number of package directories shown in the constant
|
||||
* value index.
|
||||
*/
|
||||
public static final int MAX_CONSTANT_VALUE_INDEX_LENGTH = 2;
|
||||
|
||||
/**
|
||||
* The writer used to write the results.
|
||||
*/
|
||||
protected final ConstantsSummaryWriter writer;
|
||||
|
||||
/**
|
||||
* The set of ClassDocs that have constant fields.
|
||||
*/
|
||||
protected final Set<ClassDoc> classDocsWithConstFields;
|
||||
|
||||
/**
|
||||
* The set of printed package headers.
|
||||
*/
|
||||
protected Set<String> printedPackageHeaders;
|
||||
|
||||
/**
|
||||
* The current package being documented.
|
||||
*/
|
||||
private PackageDoc currentPackage;
|
||||
|
||||
/**
|
||||
* The current class being documented.
|
||||
*/
|
||||
private ClassDoc currentClass;
|
||||
|
||||
/**
|
||||
* The content tree for the constant summary documentation.
|
||||
*/
|
||||
private Content contentTree;
|
||||
|
||||
/**
|
||||
* Construct a new ConstantsSummaryBuilder.
|
||||
*
|
||||
* @param context the build context.
|
||||
* @param writer the writer for the summary.
|
||||
*/
|
||||
private ConstantsSummaryBuilder(Context context,
|
||||
ConstantsSummaryWriter writer) {
|
||||
super(context);
|
||||
this.writer = writer;
|
||||
this.classDocsWithConstFields = new HashSet<ClassDoc>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a ConstantsSummaryBuilder.
|
||||
*
|
||||
* @param context the build context.
|
||||
* @param writer the writer for the summary.
|
||||
*/
|
||||
public static ConstantsSummaryBuilder getInstance(Context context,
|
||||
ConstantsSummaryWriter writer) {
|
||||
return new ConstantsSummaryBuilder(context, writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void build() throws IOException {
|
||||
if (writer == null) {
|
||||
//Doclet does not support this output.
|
||||
return;
|
||||
}
|
||||
build(layoutParser.parseXML(ROOT), contentTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public String getName() {
|
||||
return ROOT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the constant summary.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param contentTree the content tree to which the documentation will be added
|
||||
*/
|
||||
public void buildConstantSummary(XMLNode node, Content contentTree) throws Exception {
|
||||
contentTree = writer.getHeader();
|
||||
buildChildren(node, contentTree);
|
||||
writer.addFooter(contentTree);
|
||||
writer.printDocument(contentTree);
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the list of packages.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param contentTree the content tree to which the content list will be added
|
||||
*/
|
||||
public void buildContents(XMLNode node, Content contentTree) {
|
||||
Content contentListTree = writer.getContentsHeader();
|
||||
PackageDoc[] packages = configuration.packages;
|
||||
printedPackageHeaders = new HashSet<String>();
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
if (hasConstantField(packages[i]) && ! hasPrintedPackageIndex(packages[i].name())) {
|
||||
writer.addLinkToPackageContent(packages[i],
|
||||
parsePackageName(packages[i].name()),
|
||||
printedPackageHeaders, contentListTree);
|
||||
}
|
||||
}
|
||||
contentTree.addContent(writer.getContentsList(contentListTree));
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the summary for each documented package.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param contentTree the tree to which the summaries will be added
|
||||
*/
|
||||
public void buildConstantSummaries(XMLNode node, Content contentTree) {
|
||||
PackageDoc[] packages = configuration.packages;
|
||||
printedPackageHeaders = new HashSet<String>();
|
||||
Content summariesTree = writer.getConstantSummaries();
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
if (hasConstantField(packages[i])) {
|
||||
currentPackage = packages[i];
|
||||
//Build the documentation for the current package.
|
||||
buildChildren(node, summariesTree);
|
||||
}
|
||||
}
|
||||
contentTree.addContent(summariesTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the header for the given package.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param summariesTree the tree to which the package header will be added
|
||||
*/
|
||||
public void buildPackageHeader(XMLNode node, Content summariesTree) {
|
||||
String parsedPackageName = parsePackageName(currentPackage.name());
|
||||
if (! printedPackageHeaders.contains(parsedPackageName)) {
|
||||
writer.addPackageName(currentPackage,
|
||||
parsePackageName(currentPackage.name()), summariesTree);
|
||||
printedPackageHeaders.add(parsedPackageName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the summary for the current class.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param summariesTree the tree to which the class constant summary will be added
|
||||
*/
|
||||
public void buildClassConstantSummary(XMLNode node, Content summariesTree) {
|
||||
ClassDoc[] classes = currentPackage.name().length() > 0 ?
|
||||
currentPackage.allClasses() :
|
||||
configuration.classDocCatalog.allClasses(
|
||||
DocletConstants.DEFAULT_PACKAGE_NAME);
|
||||
Arrays.sort(classes);
|
||||
Content classConstantTree = writer.getClassConstantHeader();
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
if (! classDocsWithConstFields.contains(classes[i]) ||
|
||||
! classes[i].isIncluded()) {
|
||||
continue;
|
||||
}
|
||||
currentClass = classes[i];
|
||||
//Build the documentation for the current class.
|
||||
buildChildren(node, classConstantTree);
|
||||
}
|
||||
summariesTree.addContent(classConstantTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the summary of constant members in the class.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classConstantTree the tree to which the constant members table
|
||||
* will be added
|
||||
*/
|
||||
public void buildConstantMembers(XMLNode node, Content classConstantTree) {
|
||||
new ConstantFieldBuilder(currentClass).buildMembersSummary(node, classConstantTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given package has constant fields to document.
|
||||
*
|
||||
* @param pkg the package being checked.
|
||||
* @return true if the given package has constant fields to document.
|
||||
*/
|
||||
private boolean hasConstantField(PackageDoc pkg) {
|
||||
ClassDoc[] classes;
|
||||
if (pkg.name().length() > 0) {
|
||||
classes = pkg.allClasses();
|
||||
} else {
|
||||
classes = configuration.classDocCatalog.allClasses(
|
||||
DocletConstants.DEFAULT_PACKAGE_NAME);
|
||||
}
|
||||
boolean found = false;
|
||||
for (int j = 0; j < classes.length; j++){
|
||||
if (classes[j].isIncluded() && hasConstantField(classes[j])) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given class has constant fields to document.
|
||||
*
|
||||
* @param classDoc the class being checked.
|
||||
* @return true if the given package has constant fields to document.
|
||||
*/
|
||||
private boolean hasConstantField (ClassDoc classDoc) {
|
||||
VisibleMemberMap visibleMemberMapFields = new VisibleMemberMap(classDoc,
|
||||
VisibleMemberMap.FIELDS, configuration);
|
||||
List<?> fields = visibleMemberMapFields.getLeafClassMembers(configuration);
|
||||
for (Iterator<?> iter = fields.iterator(); iter.hasNext(); ) {
|
||||
FieldDoc field = (FieldDoc) iter.next();
|
||||
if (field.constantValueExpression() != null) {
|
||||
classDocsWithConstFields.add(classDoc);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given package name has been printed. Also
|
||||
* return true if the root of this package has been printed.
|
||||
*
|
||||
* @param pkgname the name of the package to check.
|
||||
*/
|
||||
private boolean hasPrintedPackageIndex(String pkgname) {
|
||||
String[] list = printedPackageHeaders.toArray(new String[] {});
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
if (pkgname.startsWith(list[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the table of constants.
|
||||
*
|
||||
* @author Jamie Ho
|
||||
* @since 1.4
|
||||
*/
|
||||
private class ConstantFieldBuilder {
|
||||
|
||||
/**
|
||||
* The map used to get the visible variables.
|
||||
*/
|
||||
protected VisibleMemberMap visibleMemberMapFields = null;
|
||||
|
||||
/**
|
||||
* The map used to get the visible variables.
|
||||
*/
|
||||
protected VisibleMemberMap visibleMemberMapEnumConst = null;
|
||||
|
||||
/**
|
||||
* The classdoc that we are examining constants for.
|
||||
*/
|
||||
protected ClassDoc classdoc;
|
||||
|
||||
/**
|
||||
* Construct a ConstantFieldSubWriter.
|
||||
* @param classdoc the classdoc that we are examining constants for.
|
||||
*/
|
||||
public ConstantFieldBuilder(ClassDoc classdoc) {
|
||||
this.classdoc = classdoc;
|
||||
visibleMemberMapFields = new VisibleMemberMap(classdoc,
|
||||
VisibleMemberMap.FIELDS, configuration);
|
||||
visibleMemberMapEnumConst = new VisibleMemberMap(classdoc,
|
||||
VisibleMemberMap.ENUM_CONSTANTS, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the table of constants for a given class.
|
||||
*
|
||||
* @param node the XML element that specifies which components to document
|
||||
* @param classConstantTree the tree to which the class constants table
|
||||
* will be added
|
||||
*/
|
||||
protected void buildMembersSummary(XMLNode node, Content classConstantTree) {
|
||||
List<FieldDoc> members = new ArrayList<FieldDoc>(members());
|
||||
if (members.size() > 0) {
|
||||
Collections.sort(members);
|
||||
writer.addConstantMembers(classdoc, members, classConstantTree);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of visible constant fields for the given classdoc.
|
||||
* @return the list of visible constant fields for the given classdoc.
|
||||
*/
|
||||
protected List<FieldDoc> members() {
|
||||
List<ProgramElementDoc> l = visibleMemberMapFields.getLeafClassMembers(configuration);
|
||||
l.addAll(visibleMemberMapEnumConst.getLeafClassMembers(configuration));
|
||||
Iterator<ProgramElementDoc> iter;
|
||||
|
||||
if(l != null){
|
||||
iter = l.iterator();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
List<FieldDoc> inclList = new LinkedList<FieldDoc>();
|
||||
FieldDoc member;
|
||||
while(iter.hasNext()){
|
||||
member = (FieldDoc)iter.next();
|
||||
if(member.constantValue() != null){
|
||||
inclList.add(member);
|
||||
}
|
||||
}
|
||||
return inclList;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the package name. We only want to display package name up to
|
||||
* 2 levels.
|
||||
*/
|
||||
private String parsePackageName(String pkgname) {
|
||||
int index = -1;
|
||||
for (int j = 0; j < MAX_CONSTANT_VALUE_INDEX_LENGTH; j++) {
|
||||
index = pkgname.indexOf(".", index + 1);
|
||||
}
|
||||
if (index != -1) {
|
||||
pkgname = pkgname.substring(0, index);
|
||||
}
|
||||
return pkgname;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user