提交 e3702f2a 编写于 作者: L lana

Merge

/* /*
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -37,6 +37,7 @@ import com.sun.tools.javac.api.JavacTool; ...@@ -37,6 +37,7 @@ import com.sun.tools.javac.api.JavacTool;
import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.TypeTag; import com.sun.tools.javac.code.TypeTag;
import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import com.sun.tools.javac.tree.JCTree.JCFieldAccess; import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
import com.sun.tools.javac.tree.JCTree.JCIdent; import com.sun.tools.javac.tree.JCTree.JCIdent;
...@@ -204,6 +205,21 @@ public class GenStubs { ...@@ -204,6 +205,21 @@ public class GenStubs {
tree.docComments = null; tree.docComments = null;
} }
/**
* methods: remove method bodies, make methods native
*/
@Override
public void visitClassDef(JCClassDecl tree) {
long prevClassMods = currClassMods;
currClassMods = tree.mods.flags;
try {
super.visitClassDef(tree);;
} finally {
currClassMods = prevClassMods;
}
}
private long currClassMods = 0;
/** /**
* methods: remove method bodies, make methods native * methods: remove method bodies, make methods native
*/ */
...@@ -215,7 +231,11 @@ public class GenStubs { ...@@ -215,7 +231,11 @@ public class GenStubs {
tree.params = translateVarDefs(tree.params); tree.params = translateVarDefs(tree.params);
tree.thrown = translate(tree.thrown); tree.thrown = translate(tree.thrown);
if (tree.restype != null && tree.body != null) { if (tree.restype != null && tree.body != null) {
tree.mods.flags |= Flags.NATIVE; if ((currClassMods & Flags.INTERFACE) != 0) {
tree.mods.flags &= ~Flags.DEFAULT;
} else {
tree.mods.flags |= Flags.NATIVE;
}
tree.body = null; tree.body = null;
} }
result = tree; result = tree;
......
# #
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -123,10 +123,10 @@ ifeq ($(PROPS_ARE_CREATED),yes) ...@@ -123,10 +123,10 @@ ifeq ($(PROPS_ARE_CREATED),yes)
genstubs.GenStubs genstubs.GenStubs
# We fetch source from the JDK... # We fetch source from the JDK...
JDKS=$(JDK_TOPDIR)/src/share/classes JDKS=$(JDK_TOPDIR)/src/share/classes
# Build the list of classes to generate stubs from. java/util/Objects.java isn't # Build the list of classes to generate stubs from. java/util/function/Predicate.java isn't
# currently needed, but is used as a demo for now. # currently needed, but is used as a demo for now.
STUBSOURCES:=$(shell $(FIND) $(JDKS) -name "*.java" | $(GREP) \ STUBSOURCES:=$(shell $(FIND) $(JDKS) -name "*.java" | $(GREP) \
-e "$(JDKS)/java/util/Objects.java") -e "$(JDKS)/java/util/function/Predicate.java")
# Rewrite the file names into class names because the GenStubs tool require this. # Rewrite the file names into class names because the GenStubs tool require this.
STUBCLASSES:=$(subst /,.,$(patsubst $(JDKS)/%.java,%,$(STUBSOURCES))) STUBCLASSES:=$(subst /,.,$(patsubst $(JDKS)/%.java,%,$(STUBSOURCES)))
......
...@@ -33,6 +33,7 @@ import javax.lang.model.element.Name; ...@@ -33,6 +33,7 @@ import javax.lang.model.element.Name;
* For example: * For example:
* <pre> * <pre>
* <em>modifiers</em> <em>type</em> <em>name</em> <em>initializer</em> ; * <em>modifiers</em> <em>type</em> <em>name</em> <em>initializer</em> ;
* <em>modifiers</em> <em>type</em> <em>qualified-name</em>.this
* </pre> * </pre>
* *
* @jls sections 8.3 and 14.4 * @jls sections 8.3 and 14.4
...@@ -45,6 +46,7 @@ import javax.lang.model.element.Name; ...@@ -45,6 +46,7 @@ import javax.lang.model.element.Name;
public interface VariableTree extends StatementTree { public interface VariableTree extends StatementTree {
ModifiersTree getModifiers(); ModifiersTree getModifiers();
Name getName(); Name getName();
ExpressionTree getNameExpression();
Tree getType(); Tree getType();
ExpressionTree getInitializer(); ExpressionTree getInitializer();
} }
/*
* Copyright (c) 2006, 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.source.util;
import com.sun.source.doctree.DocCommentTree;
import com.sun.source.doctree.DocTree;
import java.util.Iterator;
/**
* A path of tree nodes, typically used to represent the sequence of ancestor
* nodes of a tree node up to the top level DocCommentTree node.
*
* @since 1.8
*/
@jdk.Supported
public class DocTreePath implements Iterable<DocTree> {
/**
* Gets a documentation tree path for a tree node within a compilation unit.
* @return null if the node is not found
*/
public static DocTreePath getPath(TreePath treePath, DocCommentTree doc, DocTree target) {
return getPath(new DocTreePath(treePath, doc), target);
}
/**
* Gets a documentation tree path for a tree node within a subtree identified by a DocTreePath object.
* @return null if the node is not found
*/
public static DocTreePath getPath(DocTreePath path, DocTree target) {
path.getClass();
target.getClass();
class Result extends Error {
static final long serialVersionUID = -5942088234594905625L;
DocTreePath path;
Result(DocTreePath path) {
this.path = path;
}
}
class PathFinder extends DocTreePathScanner<DocTreePath,DocTree> {
public DocTreePath scan(DocTree tree, DocTree target) {
if (tree == target) {
throw new Result(new DocTreePath(getCurrentPath(), target));
}
return super.scan(tree, target);
}
}
if (path.getLeaf() == target) {
return path;
}
try {
new PathFinder().scan(path, target);
} catch (Result result) {
return result.path;
}
return null;
}
/**
* Creates a DocTreePath for a root node.
*
* @param treePath the TreePath from which the root node was created.
* @param t the DocCommentTree to create the path for.
*/
public DocTreePath(TreePath treePath, DocCommentTree t) {
treePath.getClass();
t.getClass();
this.treePath = treePath;
this.docComment = t;
this.parent = null;
this.leaf = t;
}
/**
* Creates a DocTreePath for a child node.
*/
public DocTreePath(DocTreePath p, DocTree t) {
if (t.getKind() == DocTree.Kind.DOC_COMMENT) {
throw new IllegalArgumentException("Use DocTreePath(TreePath, DocCommentTree) to construct DocTreePath for a DocCommentTree.");
} else {
treePath = p.treePath;
docComment = p.docComment;
parent = p;
}
leaf = t;
}
/**
* Get the TreePath associated with this path.
* @return TreePath for this DocTreePath
*/
public TreePath getTreePath() {
return treePath;
}
/**
* Get the DocCommentTree associated with this path.
* @return DocCommentTree for this DocTreePath
*/
public DocCommentTree getDocComment() {
return docComment;
}
/**
* Get the leaf node for this path.
* @return DocTree for this DocTreePath
*/
public DocTree getLeaf() {
return leaf;
}
/**
* Get the path for the enclosing node, or null if there is no enclosing node.
* @return DocTreePath of parent
*/
public DocTreePath getParentPath() {
return parent;
}
public Iterator<DocTree> iterator() {
return new Iterator<DocTree>() {
public boolean hasNext() {
return next != null;
}
public DocTree next() {
DocTree t = next.leaf;
next = next.parent;
return t;
}
public void remove() {
throw new UnsupportedOperationException();
}
private DocTreePath next = DocTreePath.this;
};
}
private final TreePath treePath;
private final DocCommentTree docComment;
private final DocTree leaf;
private final DocTreePath parent;
}
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -22,60 +22,59 @@ ...@@ -22,60 +22,59 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package com.sun.source.util;
package com.sun.tools.doclets.formats.html; import com.sun.source.doctree.DocTree;
import com.sun.tools.doclets.internal.toolkit.taglets.*;
/** /**
* The output for HTML taglets. * A DocTreeVisitor that visits all the child tree nodes, and provides
* * support for maintaining a path for the parent nodes.
* <p><b>This is NOT part of any supported API. * To visit nodes of a particular type, just override the
* If you write code that depends on this, you do so at your own risk. * corresponding visitorXYZ method.
* This code and its internal interfaces are subject to change or * Inside your method, call super.visitXYZ to visit descendant
* deletion without notice.</b> * nodes.
* *
* @since 1.5 * @since 1.8
* @author Jamie Ho
*/ */
@jdk.Supported
public class TagletOutputImpl implements TagletOutput { public class DocTreePathScanner<R, P> extends DocTreeScanner<R, P> {
private StringBuilder output;
public TagletOutputImpl(String o) {
setOutput(o);
}
/** /**
* {@inheritDoc} * Scan a tree from a position identified by a TreePath.
*/ */
public void setOutput (Object o) { public R scan(DocTreePath path, P p) {
output = new StringBuilder(o == null ? "" : (String) o); this.path = path;
try {
return path.getLeaf().accept(this, p);
} finally {
this.path = null;
}
} }
/** /**
* {@inheritDoc} * Scan a single node.
* The current path is updated for the duration of the scan.
*/ */
public void appendOutput(TagletOutput o) { @Override
output.append(o.toString()); public R scan(DocTree tree, P p) {
} if (tree == null)
return null;
/**
* {@inheritDoc}
*/
public boolean hasInheritDocTag() {
return output.indexOf(InheritDocTaglet.INHERIT_DOC_INLINE_TAG) != -1;
}
public String toString() { DocTreePath prev = path;
return output.toString(); path = new DocTreePath(path, tree);
try {
return tree.accept(this, p);
} finally {
path = prev;
}
} }
/** /**
* Check whether the taglet output is empty. * Get the current path for the node, as built up by the currently
* active set of scan calls.
*/ */
public boolean isEmpty() { public DocTreePath getCurrentPath() {
return (toString().trim().isEmpty()); return path;
} }
private DocTreePath path;
} }
...@@ -67,10 +67,10 @@ public abstract class DocTrees extends Trees { ...@@ -67,10 +67,10 @@ public abstract class DocTrees extends Trees {
public abstract DocCommentTree getDocCommentTree(TreePath path); public abstract DocCommentTree getDocCommentTree(TreePath path);
/** /**
* Gets the language model element referred to by a ReferenceTree that * Gets the language model element referred to by the leaf node of the given
* appears on the declaration identified by the given path. * {@link DocTreePath}, or null if unknown.
*/ */
public abstract Element getElement(TreePath path, ReferenceTree reference); public abstract Element getElement(DocTreePath path);
public abstract DocSourcePositions getSourcePositions(); public abstract DocSourcePositions getSourcePositions();
......
...@@ -149,6 +149,7 @@ public class TreeScanner<R,P> implements TreeVisitor<R,P> { ...@@ -149,6 +149,7 @@ public class TreeScanner<R,P> implements TreeVisitor<R,P> {
public R visitVariable(VariableTree node, P p) { public R visitVariable(VariableTree node, P p) {
R r = scan(node.getModifiers(), p); R r = scan(node.getModifiers(), p);
r = scanAndReduce(node.getType(), p, r); r = scanAndReduce(node.getType(), p, r);
r = scanAndReduce(node.getNameExpression(), p, r);
r = scanAndReduce(node.getInitializer(), p, r); r = scanAndReduce(node.getInitializer(), p, r);
return r; return r;
} }
......
...@@ -751,7 +751,7 @@ public class ClassWriter { ...@@ -751,7 +751,7 @@ public class ClassWriter {
break; break;
// exception parameter // exception parameter
case EXCEPTION_PARAMETER: case EXCEPTION_PARAMETER:
out.writeByte(p.exception_index); out.writeShort(p.exception_index);
break; break;
// method receiver // method receiver
case METHOD_RECEIVER: case METHOD_RECEIVER:
...@@ -770,11 +770,11 @@ public class ClassWriter { ...@@ -770,11 +770,11 @@ public class ClassWriter {
break; break;
// class extends or implements clause // class extends or implements clause
case CLASS_EXTENDS: case CLASS_EXTENDS:
out.writeByte(p.type_index); out.writeShort(p.type_index);
break; break;
// throws // throws
case THROWS: case THROWS:
out.writeByte(p.type_index); out.writeShort(p.type_index);
break; break;
// method parameter // method parameter
case METHOD_FORMAL_PARAMETER: case METHOD_FORMAL_PARAMETER:
......
...@@ -111,7 +111,7 @@ public class TypeAnnotation { ...@@ -111,7 +111,7 @@ public class TypeAnnotation {
break; break;
// exception parameter // exception parameter
case EXCEPTION_PARAMETER: case EXCEPTION_PARAMETER:
position.exception_index = cr.readUnsignedByte(); position.exception_index = cr.readUnsignedShort();
break; break;
// method receiver // method receiver
case METHOD_RECEIVER: case METHOD_RECEIVER:
...@@ -198,7 +198,7 @@ public class TypeAnnotation { ...@@ -198,7 +198,7 @@ public class TypeAnnotation {
break; break;
// exception parameter // exception parameter
case EXCEPTION_PARAMETER: case EXCEPTION_PARAMETER:
n += 1; // exception_index n += 2; // exception_index
break; break;
// method receiver // method receiver
case METHOD_RECEIVER: case METHOD_RECEIVER:
......
...@@ -60,17 +60,24 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite ...@@ -60,17 +60,24 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
* @param htmltree the content tree to which the parameters will be added. * @param htmltree the content tree to which the parameters will be added.
* @return the display length required to write this information. * @return the display length required to write this information.
*/ */
protected int addTypeParameters(ExecutableMemberDoc member, Content htmltree) { protected void addTypeParameters(ExecutableMemberDoc member, Content htmltree) {
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, Content typeParameters = getTypeParameters(member);
LinkInfoImpl.CONTEXT_MEMBER_TYPE_PARAMS, member, false); if (!typeParameters.isEmpty()) {
String typeParameters = writer.getTypeParameterLinks(linkInfo); htmltree.addContent(typeParameters);
if (linkInfo.displayLength > 0) {
Content linkContent = new RawHtml(typeParameters);
htmltree.addContent(linkContent);
htmltree.addContent(writer.getSpace()); htmltree.addContent(writer.getSpace());
writer.displayLength += linkInfo.displayLength + 1;
} }
return linkInfo.displayLength; }
/**
* 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);
} }
/** /**
...@@ -78,7 +85,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite ...@@ -78,7 +85,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
*/ */
protected Content getDeprecatedLink(ProgramElementDoc member) { protected Content getDeprecatedLink(ProgramElementDoc member) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)member; ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, (MemberDoc) emd, return writer.getDocLink(LinkInfoImpl.Kind.MEMBER, (MemberDoc) emd,
emd.qualifiedName() + emd.flatSignature()); emd.qualifiedName() + emd.flatSignature());
} }
...@@ -90,16 +97,15 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite ...@@ -90,16 +97,15 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
* @param member the member being linked to * @param member the member being linked to
* @param tdSummary the content tree to which the link will be added * @param tdSummary the content tree to which the link will be added
*/ */
protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member, protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) { Content tdSummary) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)member; ExecutableMemberDoc emd = (ExecutableMemberDoc)member;
String name = emd.name(); String name = emd.name();
Content strong = HtmlTree.STRONG(new RawHtml( Content strong = HtmlTree.STRONG(
writer.getDocLink(context, cd, (MemberDoc) emd, writer.getDocLink(context, cd, (MemberDoc) emd,
name, false))); name, false));
Content code = HtmlTree.CODE(strong); Content code = HtmlTree.CODE(strong);
writer.displayLength = name.length(); addParameters(emd, false, code, name.length() - 1);
addParameters(emd, false, code);
tdSummary.addContent(code); tdSummary.addContent(code);
} }
...@@ -112,9 +118,9 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite ...@@ -112,9 +118,9 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
*/ */
protected void addInheritedSummaryLink(ClassDoc cd, protected void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member, Content linksTree) { ProgramElementDoc member, Content linksTree) {
linksTree.addContent(new RawHtml( linksTree.addContent(
writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc) member, writer.getDocLink(LinkInfoImpl.Kind.MEMBER, cd, (MemberDoc) member,
member.name(), false))); member.name(), false));
} }
/** /**
...@@ -126,11 +132,11 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite ...@@ -126,11 +132,11 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
* @param tree the content tree to which the parameter information will be added. * @param tree the content tree to which the parameter information will be added.
*/ */
protected void addParam(ExecutableMemberDoc member, Parameter param, protected void addParam(ExecutableMemberDoc member, Parameter param,
boolean isVarArg, Content tree) { boolean isVarArg, Content tree) {
if (param.type() != null) { if (param.type() != null) {
Content link = new RawHtml(writer.getLink(new LinkInfoImpl( Content link = writer.getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.CONTEXT_EXECUTABLE_MEMBER_PARAM, configuration, LinkInfoImpl.Kind.EXECUTABLE_MEMBER_PARAM,
param.type(), isVarArg))); param.type()).varargs(isVarArg));
tree.addContent(link); tree.addContent(link);
} }
if(param.name().length() > 0) { if(param.name().length() > 0) {
...@@ -153,8 +159,8 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite ...@@ -153,8 +159,8 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
tree.addContent(writer.getSpace()); tree.addContent(writer.getSpace());
tree.addContent(rcvrType.typeName()); tree.addContent(rcvrType.typeName());
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, rcvrType); LinkInfoImpl.Kind.CLASS_SIGNATURE, rcvrType);
tree.addContent(new RawHtml(writer.getTypeParameterLinks(linkInfo))); tree.addContent(writer.getTypeParameterLinks(linkInfo));
tree.addContent(writer.getSpace()); tree.addContent(writer.getSpace());
tree.addContent("this"); tree.addContent("this");
} }
...@@ -166,8 +172,8 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite ...@@ -166,8 +172,8 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
* @param member the member to write parameters for. * @param member the member to write parameters for.
* @param htmltree the content tree to which the parameters information will be added. * @param htmltree the content tree to which the parameters information will be added.
*/ */
protected void addParameters(ExecutableMemberDoc member, Content htmltree) { protected void addParameters(ExecutableMemberDoc member, Content htmltree, int indentSize) {
addParameters(member, true, htmltree); addParameters(member, true, htmltree, indentSize);
} }
/** /**
...@@ -178,15 +184,11 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite ...@@ -178,15 +184,11 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
* @param htmltree the content tree to which the parameters information will be added. * @param htmltree the content tree to which the parameters information will be added.
*/ */
protected void addParameters(ExecutableMemberDoc member, protected void addParameters(ExecutableMemberDoc member,
boolean includeAnnotations, Content htmltree) { boolean includeAnnotations, Content htmltree, int indentSize) {
htmltree.addContent("("); htmltree.addContent("(");
String sep = ""; String sep = "";
Parameter[] params = member.parameters(); Parameter[] params = member.parameters();
String indent = makeSpace(writer.displayLength); String indent = makeSpace(indentSize + 1);
if (configuration.linksource) {
//add spaces to offset indentation changes caused by link.
indent+= makeSpace(member.name().length());
}
Type rcvrType = member.receiverType(); Type rcvrType = member.receiverType();
if (includeAnnotations && rcvrType instanceof AnnotatedType) { if (includeAnnotations && rcvrType instanceof AnnotatedType) {
AnnotationDesc[] descList = rcvrType.asAnnotatedType().annotations(); AnnotationDesc[] descList = rcvrType.asAnnotatedType().annotations();
...@@ -240,53 +242,30 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite ...@@ -240,53 +242,30 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
* @param member the member to write exceptions for. * @param member the member to write exceptions for.
* @param htmltree the content tree to which the exceptions information will be added. * @param htmltree the content tree to which the exceptions information will be added.
*/ */
protected void addExceptions(ExecutableMemberDoc member, Content htmltree) { protected void addExceptions(ExecutableMemberDoc member, Content htmltree, int indentSize) {
Type[] exceptions = member.thrownExceptionTypes(); Type[] exceptions = member.thrownExceptionTypes();
if(exceptions.length > 0) { if (exceptions.length > 0) {
LinkInfoImpl memberTypeParam = new LinkInfoImpl(configuration, LinkInfoImpl memberTypeParam = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_MEMBER, member, false); LinkInfoImpl.Kind.MEMBER, member);
int retlen = getReturnTypeLength(member); String indent = makeSpace(indentSize + 1 - 7);
writer.getTypeParameterLinks(memberTypeParam);
retlen += memberTypeParam.displayLength == 0 ?
0 : memberTypeParam.displayLength + 1;
String indent = makeSpace(modifierString(member).length() +
member.name().length() + retlen - 4);
htmltree.addContent(DocletConstants.NL); htmltree.addContent(DocletConstants.NL);
htmltree.addContent(indent); htmltree.addContent(indent);
htmltree.addContent("throws "); htmltree.addContent("throws ");
indent += " "; indent = makeSpace(indentSize + 1);
Content link = new RawHtml(writer.getLink(new LinkInfoImpl(configuration, Content link = writer.getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_MEMBER, exceptions[0]))); LinkInfoImpl.Kind.MEMBER, exceptions[0]));
htmltree.addContent(link); htmltree.addContent(link);
for(int i = 1; i < exceptions.length; i++) { for(int i = 1; i < exceptions.length; i++) {
htmltree.addContent(","); htmltree.addContent(",");
htmltree.addContent(DocletConstants.NL); htmltree.addContent(DocletConstants.NL);
htmltree.addContent(indent); htmltree.addContent(indent);
Content exceptionLink = new RawHtml(writer.getLink(new LinkInfoImpl( Content exceptionLink = writer.getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.CONTEXT_MEMBER, exceptions[i]))); configuration, LinkInfoImpl.Kind.MEMBER, exceptions[i]));
htmltree.addContent(exceptionLink); htmltree.addContent(exceptionLink);
} }
} }
} }
protected int getReturnTypeLength(ExecutableMemberDoc member) {
if (member instanceof MethodDoc) {
MethodDoc method = (MethodDoc)member;
Type rettype = method.returnType();
if (rettype.isPrimitive()) {
return rettype.typeName().length() +
rettype.dimension().length();
} else {
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_MEMBER, rettype);
writer.getLink(linkInfo);
return linkInfo.displayLength;
}
} else { // it's a constructordoc
return -1;
}
}
protected ClassDoc implementsMethodInIntfac(MethodDoc method, protected ClassDoc implementsMethodInIntfac(MethodDoc method,
ClassDoc[] intfacs) { ClassDoc[] intfacs) {
for (int i = 0; i < intfacs.length; i++) { for (int i = 0; i < intfacs.length; i++) {
......
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -139,9 +139,8 @@ public class AbstractIndexWriter extends HtmlDocletWriter { ...@@ -139,9 +139,8 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
* @param dlTree the content tree to which the description will be added * @param dlTree the content tree to which the description will be added
*/ */
protected void addDescription(ClassDoc cd, Content dlTree) { protected void addDescription(ClassDoc cd, Content dlTree) {
Content link = new RawHtml( Content link = getLink(new LinkInfoImpl(configuration,
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.INDEX, cd).strong(true));
LinkInfoImpl.CONTEXT_INDEX, cd, true)));
Content dt = HtmlTree.DT(link); Content dt = HtmlTree.DT(link);
dt.addContent(" - "); dt.addContent(" - ");
addClassInfo(cd, dt); addClassInfo(cd, dt);
...@@ -152,7 +151,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter { ...@@ -152,7 +151,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
} }
/** /**
* Add the classkind(class, interface, exception, error of the class * Add the classkind (class, interface, exception), error of the class
* passed. * passed.
* *
* @param cd the class being documented * @param cd the class being documented
...@@ -161,8 +160,9 @@ public class AbstractIndexWriter extends HtmlDocletWriter { ...@@ -161,8 +160,9 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
protected void addClassInfo(ClassDoc cd, Content contentTree) { protected void addClassInfo(ClassDoc cd, Content contentTree) {
contentTree.addContent(getResource("doclet.in", contentTree.addContent(getResource("doclet.in",
Util.getTypeName(configuration, cd, false), Util.getTypeName(configuration, cd, false),
getPackageLinkString(cd.containingPackage(), getPackageLink(cd.containingPackage(),
Util.getPackageName(cd.containingPackage()), false))); Util.getPackageName(cd.containingPackage()))
));
} }
/** /**
...@@ -175,11 +175,8 @@ public class AbstractIndexWriter extends HtmlDocletWriter { ...@@ -175,11 +175,8 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
String name = (member instanceof ExecutableMemberDoc)? String name = (member instanceof ExecutableMemberDoc)?
member.name() + ((ExecutableMemberDoc)member).flatSignature() : member.name() + ((ExecutableMemberDoc)member).flatSignature() :
member.name(); member.name();
if (name.indexOf("<") != -1 || name.indexOf(">") != -1) {
name = Util.escapeHtmlChars(name);
}
Content span = HtmlTree.SPAN(HtmlStyle.strong, Content span = HtmlTree.SPAN(HtmlStyle.strong,
getDocLink(LinkInfoImpl.CONTEXT_INDEX, member, name)); getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
Content dt = HtmlTree.DT(span); Content dt = HtmlTree.DT(span);
dt.addContent(" - "); dt.addContent(" - ");
addMemberDesc(member, dt); addMemberDesc(member, dt);
...@@ -253,7 +250,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter { ...@@ -253,7 +250,7 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
getResource("doclet.Method_in", classdesc)); getResource("doclet.Method_in", classdesc));
} }
} }
addPreQualifiedClassLink(LinkInfoImpl.CONTEXT_INDEX, containing, addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
false, contentTree); false, contentTree);
} }
} }
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -91,7 +91,7 @@ public abstract class AbstractMemberWriter { ...@@ -91,7 +91,7 @@ public abstract class AbstractMemberWriter {
* *
* @return a string for the table caption * @return a string for the table caption
*/ */
public abstract String getCaption(); public abstract Content getCaption();
/** /**
* Get the summary table header for the member. * Get the summary table header for the member.
...@@ -143,7 +143,7 @@ public abstract class AbstractMemberWriter { ...@@ -143,7 +143,7 @@ public abstract class AbstractMemberWriter {
*/ */
protected void addSummaryLink(ClassDoc cd, ProgramElementDoc member, protected void addSummaryLink(ClassDoc cd, ProgramElementDoc member,
Content tdSummary) { Content tdSummary) {
addSummaryLink(LinkInfoImpl.CONTEXT_MEMBER, cd, member, tdSummary); addSummaryLink(LinkInfoImpl.Kind.MEMBER, cd, member, tdSummary);
} }
/** /**
...@@ -154,7 +154,7 @@ public abstract class AbstractMemberWriter { ...@@ -154,7 +154,7 @@ public abstract class AbstractMemberWriter {
* @param member the member to be documented * @param member the member to be documented
* @param tdSummary the content tree to which the summary link will be added * @param tdSummary the content tree to which the summary link will be added
*/ */
protected abstract void addSummaryLink(int context, protected abstract void addSummaryLink(LinkInfoImpl.Kind context,
ClassDoc cd, ProgramElementDoc member, Content tdSummary); ClassDoc cd, ProgramElementDoc member, Content tdSummary);
/** /**
...@@ -193,14 +193,13 @@ public abstract class AbstractMemberWriter { ...@@ -193,14 +193,13 @@ public abstract class AbstractMemberWriter {
protected abstract void addNavDetailLink(boolean link, Content liNav); protected abstract void addNavDetailLink(boolean link, Content liNav);
/** /**
* Add the member name to the content tree and modifies the display length. * Add the member name to the content tree.
* *
* @param name the member name to be added 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. * @param htmltree the content tree to which the name will be added.
*/ */
protected void addName(String name, Content htmltree) { protected void addName(String name, Content htmltree) {
htmltree.addContent(name); htmltree.addContent(name);
writer.displayLength += name.length();
} }
/** /**
...@@ -259,7 +258,7 @@ public abstract class AbstractMemberWriter { ...@@ -259,7 +258,7 @@ public abstract class AbstractMemberWriter {
return ""; return "";
} }
StringBuilder sb = new StringBuilder(len); StringBuilder sb = new StringBuilder(len);
for(int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
sb.append(' '); sb.append(' ');
} }
return sb.toString(); return sb.toString();
...@@ -286,19 +285,22 @@ public abstract class AbstractMemberWriter { ...@@ -286,19 +285,22 @@ public abstract class AbstractMemberWriter {
} else { } else {
if (member instanceof ExecutableMemberDoc && if (member instanceof ExecutableMemberDoc &&
((ExecutableMemberDoc) member).typeParameters().length > 0) { ((ExecutableMemberDoc) member).typeParameters().length > 0) {
Content typeParameters = ((AbstractExecutableMemberWriter) this).getTypeParameters(
(ExecutableMemberDoc) member);
code.addContent(typeParameters);
//Code to avoid ugly wrapping in member summary table. //Code to avoid ugly wrapping in member summary table.
int displayLength = ((AbstractExecutableMemberWriter) this).addTypeParameters( if (typeParameters.charCount() > 10) {
(ExecutableMemberDoc) member, code);
if (displayLength > 10) {
code.addContent(new HtmlTree(HtmlTag.BR)); code.addContent(new HtmlTree(HtmlTag.BR));
} else {
code.addContent(writer.getSpace());
} }
code.addContent(new RawHtml( code.addContent(
writer.getLink(new LinkInfoImpl(configuration, writer.getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)))); LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
} else { } else {
code.addContent(new RawHtml( code.addContent(
writer.getLink(new LinkInfoImpl(configuration, writer.getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)))); LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
} }
} }
...@@ -346,10 +348,10 @@ public abstract class AbstractMemberWriter { ...@@ -346,10 +348,10 @@ public abstract class AbstractMemberWriter {
* @param contentTree the content tree to which the deprecated information will be added. * @param contentTree the content tree to which the deprecated information will be added.
*/ */
protected void addDeprecatedInfo(ProgramElementDoc member, Content contentTree) { protected void addDeprecatedInfo(ProgramElementDoc member, Content contentTree) {
String output = (new DeprecatedTaglet()).getTagletOutput(member, Content output = (new DeprecatedTaglet()).getTagletOutput(member,
writer.getTagletWriterInstance(false)).toString().trim(); writer.getTagletWriterInstance(false));
if (!output.isEmpty()) { if (!output.isEmpty()) {
Content deprecatedContent = new RawHtml(output); Content deprecatedContent = output;
Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent); Content div = HtmlTree.DIV(HtmlStyle.block, deprecatedContent);
contentTree.addContent(div); contentTree.addContent(div);
} }
...@@ -378,7 +380,7 @@ public abstract class AbstractMemberWriter { ...@@ -378,7 +380,7 @@ public abstract class AbstractMemberWriter {
* @return a header content for the section. * @return a header content for the section.
*/ */
protected Content getHead(MemberDoc member) { protected Content getHead(MemberDoc member) {
Content memberContent = new RawHtml(member.name()); Content memberContent = new StringContent(member.name());
Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent); Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent);
return heading; return heading;
} }
...@@ -412,7 +414,7 @@ public abstract class AbstractMemberWriter { ...@@ -412,7 +414,7 @@ public abstract class AbstractMemberWriter {
String tableSummary, String[] tableHeader, Content contentTree) { String tableSummary, String[] tableHeader, Content contentTree) {
if (deprmembers.size() > 0) { if (deprmembers.size() > 0) {
Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
writer.getTableCaption(configuration.getText(headingKey))); writer.getTableCaption(configuration.getResource(headingKey)));
table.addContent(writer.getSummaryTableHeader(tableHeader, "col")); table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY); Content tbody = new HtmlTree(HtmlTag.TBODY);
for (int i = 0; i < deprmembers.size(); i++) { for (int i = 0; i < deprmembers.size(); i++) {
...@@ -444,7 +446,7 @@ public abstract class AbstractMemberWriter { ...@@ -444,7 +446,7 @@ public abstract class AbstractMemberWriter {
* @param contentTree the content tree to which the use information will be added * @param contentTree the content tree to which the use information will be added
*/ */
protected void addUseInfo(List<? extends ProgramElementDoc> mems, protected void addUseInfo(List<? extends ProgramElementDoc> mems,
String heading, String tableSummary, Content contentTree) { Content heading, String tableSummary, Content contentTree) {
if (mems == null) { if (mems == null) {
return; return;
} }
...@@ -483,7 +485,7 @@ public abstract class AbstractMemberWriter { ...@@ -483,7 +485,7 @@ public abstract class AbstractMemberWriter {
tdLast.addContent(name); tdLast.addContent(name);
} }
addSummaryLink(pgmdoc instanceof ClassDoc ? addSummaryLink(pgmdoc instanceof ClassDoc ?
LinkInfoImpl.CONTEXT_CLASS_USE : LinkInfoImpl.CONTEXT_MEMBER, LinkInfoImpl.Kind.CLASS_USE : LinkInfoImpl.Kind.MEMBER,
cd, pgmdoc, tdLast); cd, pgmdoc, tdLast);
writer.addSummaryLinkComment(this, pgmdoc, tdLast); writer.addSummaryLinkComment(this, pgmdoc, tdLast);
tr.addContent(tdLast); tr.addContent(tdLast);
......
...@@ -158,10 +158,10 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter { ...@@ -158,10 +158,10 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
} }
body.addContent(div); body.addContent(div);
if (configuration.showProfiles) { if (configuration.showProfiles) {
String profileSummary = configuration.getText("doclet.Profiles"); Content profileSummary = configuration.getResource("doclet.Profiles");
String profilesTableSummary = configuration.getText("doclet.Member_Table_Summary", Content profilesTableSummary = configuration.getResource("doclet.Member_Table_Summary",
configuration.getText("doclet.Profile_Summary"), configuration.getResource("doclet.Profile_Summary"),
configuration.getText("doclet.profiles")); configuration.getResource("doclet.profiles"));
addProfilesList(profileSummary, profilesTableSummary, body); addProfilesList(profileSummary, profilesTableSummary, body);
} }
addPackagesList(packages, text, tableSummary, body); addPackagesList(packages, text, tableSummary, body);
...@@ -217,7 +217,7 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter { ...@@ -217,7 +217,7 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
* @param profilesTableSummary the profiles table summary information * @param profilesTableSummary the profiles table summary information
* @param body the content tree to which the profiles list will be added * @param body the content tree to which the profiles list will be added
*/ */
protected void addProfilesList(String profileSummary, String profilesTableSummary, protected void addProfilesList(Content profileSummary, Content profilesTableSummary,
Content body) { Content body) {
} }
} }
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -152,7 +152,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter { ...@@ -152,7 +152,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
} else { } else {
contentTree.addContent(", "); contentTree.addContent(", ");
} }
addPreQualifiedClassLink(LinkInfoImpl.CONTEXT_TREE, addPreQualifiedClassLink(LinkInfoImpl.Kind.TREE,
interfaces[i], contentTree); interfaces[i], contentTree);
counter++; counter++;
} }
...@@ -170,7 +170,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter { ...@@ -170,7 +170,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
* @param contentTree the content tree to which the information will be added * @param contentTree the content tree to which the information will be added
*/ */
protected void addPartialInfo(ClassDoc cd, Content contentTree) { protected void addPartialInfo(ClassDoc cd, Content contentTree) {
addPreQualifiedStrongClassLink(LinkInfoImpl.CONTEXT_TREE, cd, contentTree); addPreQualifiedStrongClassLink(LinkInfoImpl.Kind.TREE, cd, contentTree);
} }
/** /**
......
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -156,14 +156,13 @@ public class AllClassesFrameWriter extends HtmlDocletWriter { ...@@ -156,14 +156,13 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
if (!Util.isCoreClass(cd)) { if (!Util.isCoreClass(cd)) {
continue; continue;
} }
String label = italicsClassName(cd, false); Content label = italicsClassName(cd, false);
Content linkContent; Content linkContent;
if(wantFrames){ if (wantFrames) {
linkContent = new RawHtml(getLink(new LinkInfoImpl(configuration, linkContent = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.ALL_CLASSES_FRAME, cd, label, "classFrame"))); LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd).label(label).target("classFrame"));
} else { } else {
linkContent = new RawHtml(getLink(new LinkInfoImpl( linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, cd).label(label));
configuration, cd, label)));
} }
Content li = HtmlTree.LI(linkContent); Content li = HtmlTree.LI(linkContent);
content.addContent(li); content.addContent(li);
......
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -111,8 +111,8 @@ public class AnnotationTypeOptionalMemberWriterImpl extends ...@@ -111,8 +111,8 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public Content getCaption() {
return configuration.getText("doclet.Annotation_Type_Optional_Members"); return configuration.getResource("doclet.Annotation_Type_Optional_Members");
} }
/** /**
......
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -105,9 +105,9 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter ...@@ -105,9 +105,9 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
Content pre = new HtmlTree(HtmlTag.PRE); Content pre = new HtmlTree(HtmlTag.PRE);
writer.addAnnotationInfo(member, pre); writer.addAnnotationInfo(member, pre);
addModifiers(member, pre); addModifiers(member, pre);
Content link = new RawHtml( Content link =
writer.getLink(new LinkInfoImpl(configuration, writer.getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_MEMBER, getType(member)))); LinkInfoImpl.Kind.MEMBER, getType(member)));
pre.addContent(link); pre.addContent(link);
pre.addContent(writer.getSpace()); pre.addContent(writer.getSpace());
if (configuration.linksource) { if (configuration.linksource) {
...@@ -183,8 +183,8 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter ...@@ -183,8 +183,8 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public Content getCaption() {
return configuration.getText("doclet.Annotation_Type_Required_Members"); return configuration.getResource("doclet.Annotation_Type_Required_Members");
} }
/** /**
...@@ -223,10 +223,10 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter ...@@ -223,10 +223,10 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member, protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) { Content tdSummary) {
Content strong = HtmlTree.STRONG(new RawHtml( Content strong = HtmlTree.STRONG(
writer.getDocLink(context, (MemberDoc) member, member.name(), false))); writer.getDocLink(context, (MemberDoc) member, member.name(), false));
Content code = HtmlTree.CODE(strong); Content code = HtmlTree.CODE(strong);
tdSummary.addContent(code); tdSummary.addContent(code);
} }
...@@ -251,7 +251,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter ...@@ -251,7 +251,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
protected Content getDeprecatedLink(ProgramElementDoc member) { protected Content getDeprecatedLink(ProgramElementDoc member) {
return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, return writer.getDocLink(LinkInfoImpl.Kind.MEMBER,
(MemberDoc) member, ((MemberDoc)member).qualifiedName()); (MemberDoc) member, ((MemberDoc)member).qualifiedName());
} }
......
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -116,9 +116,9 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter ...@@ -116,9 +116,9 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
public Content getNavLinkPrevious() { public Content getNavLinkPrevious() {
Content li; Content li;
if (prev != null) { if (prev != null) {
Content prevLink = new RawHtml(getLink(new LinkInfoImpl(configuration, Content prevLink = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS, prev.asClassDoc(), "", LinkInfoImpl.Kind.CLASS, prev.asClassDoc())
configuration.getText("doclet.Prev_Class"), true))); .label(configuration.getText("doclet.Prev_Class")).strong(true));
li = HtmlTree.LI(prevLink); li = HtmlTree.LI(prevLink);
} }
else else
...@@ -134,9 +134,9 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter ...@@ -134,9 +134,9 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
public Content getNavLinkNext() { public Content getNavLinkNext() {
Content li; Content li;
if (next != null) { if (next != null) {
Content nextLink = new RawHtml(getLink(new LinkInfoImpl(configuration, Content nextLink = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS, next.asClassDoc(), "", LinkInfoImpl.Kind.CLASS, next.asClassDoc())
configuration.getText("doclet.Next_Class"), true))); .label(configuration.getText("doclet.Next_Class")).strong(true));
li = HtmlTree.LI(nextLink); li = HtmlTree.LI(nextLink);
} }
else else
...@@ -163,11 +163,11 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter ...@@ -163,11 +163,11 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
div.addContent(pkgNameDiv); div.addContent(pkgNameDiv);
} }
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_HEADER, annotationType, false); LinkInfoImpl.Kind.CLASS_HEADER, annotationType);
Content headerContent = new StringContent(header); Content headerContent = new StringContent(header);
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
HtmlStyle.title, headerContent); HtmlStyle.title, headerContent);
heading.addContent(new RawHtml(getTypeParameterLinks(linkInfo))); heading.addContent(getTypeParameterLinks(linkInfo));
div.addContent(heading); div.addContent(heading);
bodyTree.addContent(div); bodyTree.addContent(div);
return bodyTree; return bodyTree;
...@@ -220,9 +220,9 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter ...@@ -220,9 +220,9 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
addAnnotationInfo(annotationType, pre); addAnnotationInfo(annotationType, pre);
pre.addContent(modifiers); pre.addContent(modifiers);
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false); LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType);
Content annotationName = new StringContent(annotationType.name()); Content annotationName = new StringContent(annotationType.name());
Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo)); Content parameterLinks = getTypeParameterLinks(linkInfo);
if (configuration.linksource) { if (configuration.linksource) {
addSrcLink(annotationType, annotationName, pre); addSrcLink(annotationType, annotationName, pre);
pre.addContent(parameterLinks); pre.addContent(parameterLinks);
......
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -256,10 +256,10 @@ public class ClassUseWriter extends SubWriterHolderWriter { ...@@ -256,10 +256,10 @@ public class ClassUseWriter extends SubWriterHolderWriter {
*/ */
protected void addPackageList(Content contentTree) throws IOException { protected void addPackageList(Content contentTree) throws IOException {
Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary, Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
getTableCaption(configuration.getText( getTableCaption(configuration.getResource(
"doclet.ClassUse_Packages.that.use.0", "doclet.ClassUse_Packages.that.use.0",
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc
false))))); )))));
table.addContent(getSummaryTableHeader(packageTableHeader, "col")); table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY); Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<PackageDoc> it = pkgSet.iterator(); Iterator<PackageDoc> it = pkgSet.iterator();
...@@ -291,10 +291,10 @@ public class ClassUseWriter extends SubWriterHolderWriter { ...@@ -291,10 +291,10 @@ public class ClassUseWriter extends SubWriterHolderWriter {
return; return;
} }
Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary, Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
getTableCaption(configuration.getText( getTableCaption(configuration.getResource(
"doclet.ClassUse_PackageAnnotation", "doclet.ClassUse_PackageAnnotation",
getLink(new LinkInfoImpl(configuration, getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false))))); LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)))));
table.addContent(getSummaryTableHeader(packageTableHeader, "col")); table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY); Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator(); Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
...@@ -331,11 +331,10 @@ public class ClassUseWriter extends SubWriterHolderWriter { ...@@ -331,11 +331,10 @@ public class ClassUseWriter extends SubWriterHolderWriter {
for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) { for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) {
PackageDoc pkg = it.next(); PackageDoc pkg = it.next();
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name())); Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name()));
Content link = new RawHtml( Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
configuration.getText("doclet.ClassUse_Uses.of.0.in.1", getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc)),
classdoc, false)), getPackageLink(pkg, Util.getPackageName(pkg)));
getPackageLinkString(pkg, Util.getPackageName(pkg), false)));
Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link); Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
li.addContent(heading); li.addContent(heading);
addClassUse(pkg, li); addClassUse(pkg, li);
...@@ -368,71 +367,71 @@ public class ClassUseWriter extends SubWriterHolderWriter { ...@@ -368,71 +367,71 @@ public class ClassUseWriter extends SubWriterHolderWriter {
* @param contentTree the content tree to which the class use information will be added * @param contentTree the content tree to which the class use information will be added
*/ */
protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException { protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
String classLink = getLink(new LinkInfoImpl(configuration, Content classLink = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false)); LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc));
String pkgLink = getPackageLinkString(pkg, Util.getPackageName(pkg), false); Content pkgLink = getPackageLink(pkg, Util.getPackageName(pkg));
classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()), classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_Annotation", classLink, configuration.getResource("doclet.ClassUse_Annotation", classLink,
pkgLink), classUseTableSummary, contentTree); pkgLink), classUseTableSummary, contentTree);
classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg.name()), classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_TypeParameter", classLink, configuration.getResource("doclet.ClassUse_TypeParameter", classLink,
pkgLink), classUseTableSummary, contentTree); pkgLink), classUseTableSummary, contentTree);
classSubWriter.addUseInfo(pkgToSubclass.get(pkg.name()), classSubWriter.addUseInfo(pkgToSubclass.get(pkg.name()),
configuration.getText("doclet.ClassUse_Subclass", classLink, configuration.getResource("doclet.ClassUse_Subclass", classLink,
pkgLink), subclassUseTableSummary, contentTree); pkgLink), subclassUseTableSummary, contentTree);
classSubWriter.addUseInfo(pkgToSubinterface.get(pkg.name()), classSubWriter.addUseInfo(pkgToSubinterface.get(pkg.name()),
configuration.getText("doclet.ClassUse_Subinterface", classLink, configuration.getResource("doclet.ClassUse_Subinterface", classLink,
pkgLink), subinterfaceUseTableSummary, contentTree); pkgLink), subinterfaceUseTableSummary, contentTree);
classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg.name()), classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg.name()),
configuration.getText("doclet.ClassUse_ImplementingClass", classLink, configuration.getResource("doclet.ClassUse_ImplementingClass", classLink,
pkgLink), classUseTableSummary, contentTree); pkgLink), classUseTableSummary, contentTree);
fieldSubWriter.addUseInfo(pkgToField.get(pkg.name()), fieldSubWriter.addUseInfo(pkgToField.get(pkg.name()),
configuration.getText("doclet.ClassUse_Field", classLink, configuration.getResource("doclet.ClassUse_Field", classLink,
pkgLink), fieldUseTableSummary, contentTree); pkgLink), fieldUseTableSummary, contentTree);
fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg.name()), fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_FieldAnnotations", classLink, configuration.getResource("doclet.ClassUse_FieldAnnotations", classLink,
pkgLink), fieldUseTableSummary, contentTree); pkgLink), fieldUseTableSummary, contentTree);
fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg.name()), fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_FieldTypeParameter", classLink, configuration.getResource("doclet.ClassUse_FieldTypeParameter", classLink,
pkgLink), fieldUseTableSummary, contentTree); pkgLink), fieldUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodAnnotations", classLink, configuration.getResource("doclet.ClassUse_MethodAnnotations", classLink,
pkgLink), methodUseTableSummary, contentTree); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodParameterAnnotations", classLink, configuration.getResource("doclet.ClassUse_MethodParameterAnnotations", classLink,
pkgLink), methodUseTableSummary, contentTree); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodTypeParameter", classLink, configuration.getResource("doclet.ClassUse_MethodTypeParameter", classLink,
pkgLink), methodUseTableSummary, contentTree); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodReturn", classLink, configuration.getResource("doclet.ClassUse_MethodReturn", classLink,
pkgLink), methodUseTableSummary, contentTree); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodReturnTypeParameter", classLink, configuration.getResource("doclet.ClassUse_MethodReturnTypeParameter", classLink,
pkgLink), methodUseTableSummary, contentTree); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodArgs", classLink, configuration.getResource("doclet.ClassUse_MethodArgs", classLink,
pkgLink), methodUseTableSummary, contentTree); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodArgsTypeParameters", classLink, configuration.getResource("doclet.ClassUse_MethodArgsTypeParameters", classLink,
pkgLink), methodUseTableSummary, contentTree); pkgLink), methodUseTableSummary, contentTree);
methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg.name()), methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg.name()),
configuration.getText("doclet.ClassUse_MethodThrows", classLink, configuration.getResource("doclet.ClassUse_MethodThrows", classLink,
pkgLink), methodUseTableSummary, contentTree); pkgLink), methodUseTableSummary, contentTree);
constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg.name()), constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_ConstructorAnnotations", classLink, configuration.getResource("doclet.ClassUse_ConstructorAnnotations", classLink,
pkgLink), constructorUseTableSummary, contentTree); pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg.name()), constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg.name()),
configuration.getText("doclet.ClassUse_ConstructorParameterAnnotations", classLink, configuration.getResource("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
pkgLink), constructorUseTableSummary, contentTree); pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg.name()), constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg.name()),
configuration.getText("doclet.ClassUse_ConstructorArgs", classLink, configuration.getResource("doclet.ClassUse_ConstructorArgs", classLink,
pkgLink), constructorUseTableSummary, contentTree); pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg.name()), constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg.name()),
configuration.getText("doclet.ClassUse_ConstructorArgsTypeParameters", classLink, configuration.getResource("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
pkgLink), constructorUseTableSummary, contentTree); pkgLink), constructorUseTableSummary, contentTree);
constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg.name()), constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg.name()),
configuration.getText("doclet.ClassUse_ConstructorThrows", classLink, configuration.getResource("doclet.ClassUse_ConstructorThrows", classLink,
pkgLink), constructorUseTableSummary, contentTree); pkgLink), constructorUseTableSummary, contentTree);
} }
...@@ -450,7 +449,10 @@ public class ClassUseWriter extends SubWriterHolderWriter { ...@@ -450,7 +449,10 @@ public class ClassUseWriter extends SubWriterHolderWriter {
Content bodyTree = getBody(true, getWindowTitle(title)); Content bodyTree = getBody(true, getWindowTitle(title));
addTop(bodyTree); addTop(bodyTree);
addNavLinks(true, bodyTree); addNavLinks(true, bodyTree);
Content headContent = getResource("doclet.ClassUse_Title", cltype, clname); 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, Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
true, HtmlStyle.title, headContent); true, HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading); Content div = HtmlTree.DIV(HtmlStyle.header, heading);
...@@ -476,9 +478,9 @@ public class ClassUseWriter extends SubWriterHolderWriter { ...@@ -476,9 +478,9 @@ public class ClassUseWriter extends SubWriterHolderWriter {
* @return a content tree for the class page link * @return a content tree for the class page link
*/ */
protected Content getNavLinkClass() { protected Content getNavLinkClass() {
Content linkContent = new RawHtml(getLink(new LinkInfoImpl( Content linkContent = getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)
"", configuration.getText("doclet.Class"), false))); .label(configuration.getText("doclet.Class")));
Content li = HtmlTree.LI(linkContent); Content li = HtmlTree.LI(linkContent);
return li; return li;
} }
......
...@@ -124,9 +124,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -124,9 +124,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter
public Content getNavLinkPrevious() { public Content getNavLinkPrevious() {
Content li; Content li;
if (prev != null) { if (prev != null) {
Content prevLink = new RawHtml(getLink(new LinkInfoImpl(configuration, Content prevLink = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS, prev, "", LinkInfoImpl.Kind.CLASS, prev)
configuration.getText("doclet.Prev_Class"), true))); .label(configuration.getText("doclet.Prev_Class")).strong(true));
li = HtmlTree.LI(prevLink); li = HtmlTree.LI(prevLink);
} }
else else
...@@ -142,9 +142,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -142,9 +142,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter
public Content getNavLinkNext() { public Content getNavLinkNext() {
Content li; Content li;
if (next != null) { if (next != null) {
Content nextLink = new RawHtml(getLink(new LinkInfoImpl(configuration, Content nextLink = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS, next, "", LinkInfoImpl.Kind.CLASS, next)
configuration.getText("doclet.Next_Class"), true))); .label(configuration.getText("doclet.Next_Class")).strong(true));
li = HtmlTree.LI(nextLink); li = HtmlTree.LI(nextLink);
} }
else else
...@@ -185,13 +185,13 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -185,13 +185,13 @@ public class ClassWriterImpl extends SubWriterHolderWriter
div.addContent(pkgNameDiv); div.addContent(pkgNameDiv);
} }
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_HEADER, classDoc, false); LinkInfoImpl.Kind.CLASS_HEADER, classDoc);
//Let's not link to ourselves in the header. //Let's not link to ourselves in the header.
linkInfo.linkToSelf = false; linkInfo.linkToSelf = false;
Content headerContent = new StringContent(header); Content headerContent = new StringContent(header);
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
HtmlStyle.title, headerContent); HtmlStyle.title, headerContent);
heading.addContent(new RawHtml(getTypeParameterLinks(linkInfo))); heading.addContent(getTypeParameterLinks(linkInfo));
div.addContent(heading); div.addContent(heading);
bodyTree.addContent(div); bodyTree.addContent(div);
return bodyTree; return bodyTree;
...@@ -245,11 +245,11 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -245,11 +245,11 @@ public class ClassWriterImpl extends SubWriterHolderWriter
addAnnotationInfo(classDoc, pre); addAnnotationInfo(classDoc, pre);
pre.addContent(modifiers); pre.addContent(modifiers);
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false); LinkInfoImpl.Kind.CLASS_SIGNATURE, classDoc);
//Let's not link to ourselves in the signature. //Let's not link to ourselves in the signature.
linkInfo.linkToSelf = false; linkInfo.linkToSelf = false;
Content className = new StringContent(classDoc.name()); Content className = new StringContent(classDoc.name());
Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo)); Content parameterLinks = getTypeParameterLinks(linkInfo);
if (configuration.linksource) { if (configuration.linksource) {
addSrcLink(classDoc, className, pre); addSrcLink(classDoc, className, pre);
pre.addContent(parameterLinks); pre.addContent(parameterLinks);
...@@ -264,9 +264,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -264,9 +264,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter
if (superclass != null) { if (superclass != null) {
pre.addContent(DocletConstants.NL); pre.addContent(DocletConstants.NL);
pre.addContent("extends "); pre.addContent("extends ");
Content link = new RawHtml(getLink(new LinkInfoImpl(configuration, Content link = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME, LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
superclass))); superclass));
pre.addContent(link); pre.addContent(link);
} }
} }
...@@ -285,9 +285,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -285,9 +285,9 @@ public class ClassWriterImpl extends SubWriterHolderWriter
} else { } else {
pre.addContent(", "); pre.addContent(", ");
} }
Content link = new RawHtml(getLink(new LinkInfoImpl(configuration, Content link = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME, LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
implIntfacs[i]))); implIntfacs[i]));
pre.addContent(link); pre.addContent(link);
counter++; counter++;
} }
...@@ -360,22 +360,21 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -360,22 +360,21 @@ public class ClassWriterImpl extends SubWriterHolderWriter
private Content getTreeForClassHelper(Type type) { private Content getTreeForClassHelper(Type type) {
Content li = new HtmlTree(HtmlTag.LI); Content li = new HtmlTree(HtmlTag.LI);
if (type.equals(classDoc)) { if (type.equals(classDoc)) {
String typeParameters = getTypeParameterLinks( Content typeParameters = getTypeParameterLinks(
new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_TREE, new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
classDoc, false)); classDoc));
if (configuration.shouldExcludeQualifier( if (configuration.shouldExcludeQualifier(
classDoc.containingPackage().name())) { classDoc.containingPackage().name())) {
li.addContent(type.asClassDoc().name()); li.addContent(type.asClassDoc().name());
li.addContent(new RawHtml(typeParameters)); li.addContent(typeParameters);
} else { } else {
li.addContent(type.asClassDoc().qualifiedName()); li.addContent(type.asClassDoc().qualifiedName());
li.addContent(new RawHtml(typeParameters)); li.addContent(typeParameters);
} }
} else { } else {
Content link = new RawHtml(getLink(new LinkInfoImpl(configuration, Content link = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_TREE_PARENT, LinkInfoImpl.Kind.CLASS_TREE_PARENT, type)
type instanceof ClassDoc ? (ClassDoc) type : type, .label(configuration.getClassName(type.asClassDoc())));
configuration.getClassName(type.asClassDoc()), false)));
li.addContent(link); li.addContent(link);
} }
return li; return li;
...@@ -396,9 +395,8 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -396,9 +395,8 @@ public class ClassWriterImpl extends SubWriterHolderWriter
*/ */
public void addTypeParamInfo(Content classInfoTree) { public void addTypeParamInfo(Content classInfoTree) {
if (classDoc.typeParamTags().length > 0) { if (classDoc.typeParamTags().length > 0) {
TagletOutput output = (new ParamTaglet()).getTagletOutput(classDoc, Content typeParam = (new ParamTaglet()).getTagletOutput(classDoc,
getTagletWriterInstance(false)); getTagletWriterInstance(false));
Content typeParam = new RawHtml(output.toString());
Content dl = HtmlTree.DL(typeParam); Content dl = HtmlTree.DL(typeParam);
classInfoTree.addContent(dl); classInfoTree.addContent(dl);
} }
...@@ -419,7 +417,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -419,7 +417,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
"doclet.Subclasses"); "doclet.Subclasses");
Content dt = HtmlTree.DT(label); Content dt = HtmlTree.DT(label);
Content dl = HtmlTree.DL(dt); Content dl = HtmlTree.DL(dt);
dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUBCLASSES, dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUBCLASSES,
subclasses)); subclasses));
classInfoTree.addContent(dl); classInfoTree.addContent(dl);
} }
...@@ -437,7 +435,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -437,7 +435,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
"doclet.Subinterfaces"); "doclet.Subinterfaces");
Content dt = HtmlTree.DT(label); Content dt = HtmlTree.DT(label);
Content dl = HtmlTree.DL(dt); Content dl = HtmlTree.DL(dt);
dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUBINTERFACES, dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUBINTERFACES,
subInterfaces)); subInterfaces));
classInfoTree.addContent(dl); classInfoTree.addContent(dl);
} }
...@@ -461,7 +459,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -461,7 +459,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
"doclet.Implementing_Classes"); "doclet.Implementing_Classes");
Content dt = HtmlTree.DT(label); Content dt = HtmlTree.DT(label);
Content dl = HtmlTree.DL(dt); Content dl = HtmlTree.DL(dt);
dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_CLASSES, dl.addContent(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_CLASSES,
implcl)); implcl));
classInfoTree.addContent(dl); classInfoTree.addContent(dl);
} }
...@@ -479,7 +477,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -479,7 +477,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
"doclet.All_Implemented_Interfaces"); "doclet.All_Implemented_Interfaces");
Content dt = HtmlTree.DT(label); Content dt = HtmlTree.DT(label);
Content dl = HtmlTree.DL(dt); Content dl = HtmlTree.DL(dt);
dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_IMPLEMENTED_INTERFACES, dl.addContent(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_INTERFACES,
interfaceArray)); interfaceArray));
classInfoTree.addContent(dl); classInfoTree.addContent(dl);
} }
...@@ -497,7 +495,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -497,7 +495,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
"doclet.All_Superinterfaces"); "doclet.All_Superinterfaces");
Content dt = HtmlTree.DT(label); Content dt = HtmlTree.DT(label);
Content dl = HtmlTree.DL(dt); Content dl = HtmlTree.DL(dt);
dl.addContent(getClassLinks(LinkInfoImpl.CONTEXT_SUPER_INTERFACES, dl.addContent(getClassLinks(LinkInfoImpl.Kind.SUPER_INTERFACES,
interfaceArray)); interfaceArray));
classInfoTree.addContent(dl); classInfoTree.addContent(dl);
} }
...@@ -520,8 +518,8 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -520,8 +518,8 @@ public class ClassWriterImpl extends SubWriterHolderWriter
Content dt = HtmlTree.DT(label); Content dt = HtmlTree.DT(label);
Content dl = HtmlTree.DL(dt); Content dl = HtmlTree.DL(dt);
Content dd = new HtmlTree(HtmlTag.DD); Content dd = new HtmlTree(HtmlTag.DD);
dd.addContent(new RawHtml(getLink(new LinkInfoImpl(configuration, dd.addContent(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS, outerClass, false)))); LinkInfoImpl.Kind.CLASS, outerClass)));
dl.addContent(dd); dl.addContent(dd);
classInfoTree.addContent(dl); classInfoTree.addContent(dl);
} }
...@@ -569,7 +567,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -569,7 +567,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
* @param list the list of classes * @param list the list of classes
* @return a content tree for the class list * @return a content tree for the class list
*/ */
private Content getClassLinks(int context, List<?> list) { private Content getClassLinks(LinkInfoImpl.Kind context, List<?> list) {
Object[] typeList = list.toArray(); Object[] typeList = list.toArray();
Content dd = new HtmlTree(HtmlTag.DD); Content dd = new HtmlTree(HtmlTag.DD);
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
...@@ -578,12 +576,12 @@ public class ClassWriterImpl extends SubWriterHolderWriter ...@@ -578,12 +576,12 @@ public class ClassWriterImpl extends SubWriterHolderWriter
dd.addContent(separator); dd.addContent(separator);
} }
if (typeList[i] instanceof ClassDoc) { if (typeList[i] instanceof ClassDoc) {
Content link = new RawHtml(getLink( Content link = getLink(
new LinkInfoImpl(configuration, context, (ClassDoc)(typeList[i])))); new LinkInfoImpl(configuration, context, (ClassDoc)(typeList[i])));
dd.addContent(link); dd.addContent(link);
} else { } else {
Content link = new RawHtml(getLink( Content link = getLink(
new LinkInfoImpl(configuration, context, (Type)(typeList[i])))); new LinkInfoImpl(configuration, context, (Type)(typeList[i])));
dd.addContent(link); dd.addContent(link);
} }
} }
......
...@@ -31,6 +31,7 @@ import java.util.*; ...@@ -31,6 +31,7 @@ import java.util.*;
import javax.tools.JavaFileManager; import javax.tools.JavaFileManager;
import com.sun.javadoc.*; 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.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclint.DocLint; import com.sun.tools.doclint.DocLint;
...@@ -562,4 +563,9 @@ public class ConfigurationImpl extends Configuration { ...@@ -562,4 +563,9 @@ public class ConfigurationImpl extends Configuration {
} }
return true; return true;
} }
@Override
public Content newContent() {
return new ContentBuilder();
}
} }
/* /*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -184,13 +184,17 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter ...@@ -184,13 +184,17 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
*/ */
public Content getConstantMembersHeader(ClassDoc cd) { public Content getConstantMembersHeader(ClassDoc cd) {
//generate links backward only to public classes. //generate links backward only to public classes.
String classlink = (cd.isPublic() || cd.isProtected()) ? Content classlink = (cd.isPublic() || cd.isProtected()) ?
getLink(new LinkInfoImpl(configuration, getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, cd, false)) : LinkInfoImpl.Kind.CONSTANT_SUMMARY, cd)) :
cd.qualifiedName(); new StringContent(cd.qualifiedName());
String name = cd.containingPackage().name(); String name = cd.containingPackage().name();
if (name.length() > 0) { if (name.length() > 0) {
return getClassName(name + "." + classlink); Content cb = new ContentBuilder();
cb.addContent(name);
cb.addContent(".");
cb.addContent(classlink);
return getClassName(cb);
} else { } else {
return getClassName(classlink); return getClassName(classlink);
} }
...@@ -202,7 +206,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter ...@@ -202,7 +206,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
* @param classStr the class name to print. * @param classStr the class name to print.
* @return the table caption and header * @return the table caption and header
*/ */
protected Content getClassName(String classStr) { protected Content getClassName(Content classStr) {
Content table = HtmlTree.TABLE(0, 3, 0, constantsTableSummary, Content table = HtmlTree.TABLE(0, 3, 0, constantsTableSummary,
getTableCaption(classStr)); getTableCaption(classStr));
table.addContent(getSummaryTableHeader(constantsTableHeader, "col")); table.addContent(getSummaryTableHeader(constantsTableHeader, "col"));
...@@ -260,8 +264,8 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter ...@@ -260,8 +264,8 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
code.addContent(modifier); code.addContent(modifier);
code.addContent(getSpace()); code.addContent(getSpace());
} }
Content type = new RawHtml(getLink(new LinkInfoImpl(configuration, Content type = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member.type()))); LinkInfoImpl.Kind.CONSTANT_SUMMARY, member.type()));
code.addContent(type); code.addContent(type);
tdType.addContent(code); tdType.addContent(code);
return tdType; return tdType;
...@@ -274,8 +278,8 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter ...@@ -274,8 +278,8 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
* @return the name column of the constant table row * @return the name column of the constant table row
*/ */
private Content getNameColumn(FieldDoc member) { private Content getNameColumn(FieldDoc member) {
Content nameContent = new RawHtml(getDocLink( Content nameContent = getDocLink(
LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member, member.name(), false)); LinkInfoImpl.Kind.CONSTANT_SUMMARY, member, member.name(), false);
Content code = HtmlTree.CODE(nameContent); Content code = HtmlTree.CODE(nameContent);
return HtmlTree.TD(code); return HtmlTree.TD(code);
} }
......
...@@ -126,7 +126,6 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter ...@@ -126,7 +126,6 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
public Content getSignature(ConstructorDoc constructor) { public Content getSignature(ConstructorDoc constructor) {
writer.displayLength = 0;
Content pre = new HtmlTree(HtmlTag.PRE); Content pre = new HtmlTree(HtmlTag.PRE);
writer.addAnnotationInfo(constructor, pre); writer.addAnnotationInfo(constructor, pre);
addModifiers(constructor, pre); addModifiers(constructor, pre);
...@@ -136,8 +135,9 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter ...@@ -136,8 +135,9 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
} else { } else {
addName(constructor.name(), pre); addName(constructor.name(), pre);
} }
addParameters(constructor, pre); int indent = pre.charCount();
addExceptions(constructor, pre); addParameters(constructor, pre, indent);
addExceptions(constructor, pre, indent);
return pre; return pre;
} }
...@@ -225,8 +225,8 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter ...@@ -225,8 +225,8 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public Content getCaption() {
return configuration.getText("doclet.Constructors"); return configuration.getResource("doclet.Constructors");
} }
/** /**
......
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -101,8 +101,8 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter ...@@ -101,8 +101,8 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
Content pre = new HtmlTree(HtmlTag.PRE); Content pre = new HtmlTree(HtmlTag.PRE);
writer.addAnnotationInfo(enumConstant, pre); writer.addAnnotationInfo(enumConstant, pre);
addModifiers(enumConstant, pre); addModifiers(enumConstant, pre);
Content enumConstantLink = new RawHtml(writer.getLink(new LinkInfoImpl( Content enumConstantLink = writer.getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.CONTEXT_MEMBER, enumConstant.type()))); configuration, LinkInfoImpl.Kind.MEMBER, enumConstant.type()));
pre.addContent(enumConstantLink); pre.addContent(enumConstantLink);
pre.addContent(" "); pre.addContent(" ");
if (configuration.linksource) { if (configuration.linksource) {
...@@ -182,8 +182,8 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter ...@@ -182,8 +182,8 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public Content getCaption() {
return configuration.getText("doclet.Enum_Constants"); return configuration.getResource("doclet.Enum_Constants");
} }
/** /**
...@@ -220,10 +220,10 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter ...@@ -220,10 +220,10 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member, protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) { Content tdSummary) {
Content strong = HtmlTree.STRONG(new RawHtml( Content strong = HtmlTree.STRONG(
writer.getDocLink(context, (MemberDoc) member, member.name(), false))); writer.getDocLink(context, (MemberDoc) member, member.name(), false));
Content code = HtmlTree.CODE(strong); Content code = HtmlTree.CODE(strong);
tdSummary.addContent(code); tdSummary.addContent(code);
} }
...@@ -254,7 +254,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter ...@@ -254,7 +254,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
protected Content getDeprecatedLink(ProgramElementDoc member) { protected Content getDeprecatedLink(ProgramElementDoc member) {
return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, return writer.getDocLink(LinkInfoImpl.Kind.MEMBER,
(MemberDoc) member, ((FieldDoc)member).qualifiedName()); (MemberDoc) member, ((FieldDoc)member).qualifiedName());
} }
......
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -102,8 +102,8 @@ public class FieldWriterImpl extends AbstractMemberWriter ...@@ -102,8 +102,8 @@ public class FieldWriterImpl extends AbstractMemberWriter
Content pre = new HtmlTree(HtmlTag.PRE); Content pre = new HtmlTree(HtmlTag.PRE);
writer.addAnnotationInfo(field, pre); writer.addAnnotationInfo(field, pre);
addModifiers(field, pre); addModifiers(field, pre);
Content fieldlink = new RawHtml(writer.getLink(new LinkInfoImpl( Content fieldlink = writer.getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.CONTEXT_MEMBER, field.type()))); configuration, LinkInfoImpl.Kind.MEMBER, field.type()));
pre.addContent(fieldlink); pre.addContent(fieldlink);
pre.addContent(" "); pre.addContent(" ");
if (configuration.linksource) { if (configuration.linksource) {
...@@ -132,12 +132,12 @@ public class FieldWriterImpl extends AbstractMemberWriter ...@@ -132,12 +132,12 @@ public class FieldWriterImpl extends AbstractMemberWriter
(! (holder.isPublic() || Util.isLinkable(holder, configuration)))) { (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
writer.addInlineComment(field, fieldDocTree); writer.addInlineComment(field, fieldDocTree);
} else { } else {
Content link = new RawHtml( Content link =
writer.getDocLink(LinkInfoImpl.CONTEXT_FIELD_DOC_COPY, writer.getDocLink(LinkInfoImpl.Kind.FIELD_DOC_COPY,
holder, field, holder, field,
holder.isIncluded() ? holder.isIncluded() ?
holder.typeName() : holder.qualifiedTypeName(), holder.typeName() : holder.qualifiedTypeName(),
false)); false);
Content codeLink = HtmlTree.CODE(link); Content codeLink = HtmlTree.CODE(link);
Content strong = HtmlTree.STRONG(holder.isClass()? Content strong = HtmlTree.STRONG(holder.isClass()?
writer.descfrmClassLabel : writer.descfrmInterfaceLabel); writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
...@@ -203,8 +203,8 @@ public class FieldWriterImpl extends AbstractMemberWriter ...@@ -203,8 +203,8 @@ public class FieldWriterImpl extends AbstractMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public Content getCaption() {
return configuration.getText("doclet.Fields"); return configuration.getResource("doclet.Fields");
} }
/** /**
...@@ -239,8 +239,8 @@ public class FieldWriterImpl extends AbstractMemberWriter ...@@ -239,8 +239,8 @@ public class FieldWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) { public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
Content classLink = new RawHtml(writer.getPreQualifiedClassLink( Content classLink = writer.getPreQualifiedClassLink(
LinkInfoImpl.CONTEXT_MEMBER, cd, false)); LinkInfoImpl.Kind.MEMBER, cd, false);
Content label = new StringContent(cd.isClass() ? Content label = new StringContent(cd.isClass() ?
configuration.getText("doclet.Fields_Inherited_From_Class") : configuration.getText("doclet.Fields_Inherited_From_Class") :
configuration.getText("doclet.Fields_Inherited_From_Interface")); configuration.getText("doclet.Fields_Inherited_From_Interface"));
...@@ -254,10 +254,10 @@ public class FieldWriterImpl extends AbstractMemberWriter ...@@ -254,10 +254,10 @@ public class FieldWriterImpl extends AbstractMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member, protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) { Content tdSummary) {
Content strong = HtmlTree.STRONG(new RawHtml( Content strong = HtmlTree.STRONG(
writer.getDocLink(context, cd , (MemberDoc) member, member.name(), false))); writer.getDocLink(context, cd , (MemberDoc) member, member.name(), false));
Content code = HtmlTree.CODE(strong); Content code = HtmlTree.CODE(strong);
tdSummary.addContent(code); tdSummary.addContent(code);
} }
...@@ -267,9 +267,9 @@ public class FieldWriterImpl extends AbstractMemberWriter ...@@ -267,9 +267,9 @@ public class FieldWriterImpl extends AbstractMemberWriter
*/ */
protected void addInheritedSummaryLink(ClassDoc cd, protected void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member, Content linksTree) { ProgramElementDoc member, Content linksTree) {
linksTree.addContent(new RawHtml( linksTree.addContent(
writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc)member, writer.getDocLink(LinkInfoImpl.Kind.MEMBER, cd, (MemberDoc)member,
member.name(), false))); member.name(), false));
} }
/** /**
...@@ -284,7 +284,7 @@ public class FieldWriterImpl extends AbstractMemberWriter ...@@ -284,7 +284,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
protected Content getDeprecatedLink(ProgramElementDoc member) { protected Content getDeprecatedLink(ProgramElementDoc member) {
return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, return writer.getDocLink(LinkInfoImpl.Kind.MEMBER,
(MemberDoc) member, ((FieldDoc)member).qualifiedName()); (MemberDoc) member, ((FieldDoc)member).qualifiedName());
} }
......
...@@ -121,7 +121,7 @@ public class FrameOutputWriter extends HtmlDocletWriter { ...@@ -121,7 +121,7 @@ public class FrameOutputWriter extends HtmlDocletWriter {
getResource("doclet.Frame_Alert")); getResource("doclet.Frame_Alert"));
noframes.addContent(noframesHead); noframes.addContent(noframesHead);
Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message", Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message",
getHyperLinkString(configuration.topFile, getHyperLink(configuration.topFile,
configuration.getText("doclet.Non_Frame_Version")))); configuration.getText("doclet.Non_Frame_Version"))));
noframes.addContent(p); noframes.addContent(p);
contentTree.addContent(noframes); contentTree.addContent(noframes);
......
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -113,7 +113,7 @@ public class HelpWriter extends HtmlDocletWriter { ...@@ -113,7 +113,7 @@ public class HelpWriter extends HtmlDocletWriter {
getResource("doclet.Overview")); getResource("doclet.Overview"));
Content liOverview = HtmlTree.LI(HtmlStyle.blockList, overviewHeading); Content liOverview = HtmlTree.LI(HtmlStyle.blockList, overviewHeading);
Content line3 = getResource("doclet.Help_line_3", Content line3 = getResource("doclet.Help_line_3",
getHyperLinkString(DocPaths.OVERVIEW_SUMMARY, getHyperLink(DocPaths.OVERVIEW_SUMMARY,
configuration.getText("doclet.Overview"))); configuration.getText("doclet.Overview")));
Content overviewPara = HtmlTree.P(line3); Content overviewPara = HtmlTree.P(line3);
liOverview.addContent(overviewPara); liOverview.addContent(overviewPara);
...@@ -234,8 +234,9 @@ public class HelpWriter extends HtmlDocletWriter { ...@@ -234,8 +234,9 @@ public class HelpWriter extends HtmlDocletWriter {
getResource("doclet.Help_line_16")); getResource("doclet.Help_line_16"));
Content liTree = HtmlTree.LI(HtmlStyle.blockList, treeHead); Content liTree = HtmlTree.LI(HtmlStyle.blockList, treeHead);
Content line17 = getResource("doclet.Help_line_17_with_tree_link", Content line17 = getResource("doclet.Help_line_17_with_tree_link",
getHyperLinkString(DocPaths.OVERVIEW_TREE, getHyperLink(DocPaths.OVERVIEW_TREE,
configuration.getText("doclet.Class_Hierarchy"))); configuration.getText("doclet.Class_Hierarchy")),
HtmlTree.CODE(new StringContent("java.lang.Object")));
Content treePara = HtmlTree.P(line17); Content treePara = HtmlTree.P(line17);
liTree.addContent(treePara); liTree.addContent(treePara);
HtmlTree tul = new HtmlTree(HtmlTag.UL); HtmlTree tul = new HtmlTree(HtmlTag.UL);
...@@ -252,19 +253,19 @@ public class HelpWriter extends HtmlDocletWriter { ...@@ -252,19 +253,19 @@ public class HelpWriter extends HtmlDocletWriter {
getResource("doclet.Deprecated_API")); getResource("doclet.Deprecated_API"));
Content liDeprecated = HtmlTree.LI(HtmlStyle.blockList, dHead); Content liDeprecated = HtmlTree.LI(HtmlStyle.blockList, dHead);
Content line20 = getResource("doclet.Help_line_20_with_deprecated_api_link", Content line20 = getResource("doclet.Help_line_20_with_deprecated_api_link",
getHyperLinkString(DocPaths.DEPRECATED_LIST, getHyperLink(DocPaths.DEPRECATED_LIST,
configuration.getText("doclet.Deprecated_API"))); configuration.getText("doclet.Deprecated_API")));
Content dPara = HtmlTree.P(line20); Content dPara = HtmlTree.P(line20);
liDeprecated.addContent(dPara); liDeprecated.addContent(dPara);
ul.addContent(liDeprecated); ul.addContent(liDeprecated);
} }
if (configuration.createindex) { if (configuration.createindex) {
String indexlink; Content indexlink;
if (configuration.splitindex) { if (configuration.splitindex) {
indexlink = getHyperLinkString(DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1)), indexlink = getHyperLink(DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1)),
configuration.getText("doclet.Index")); configuration.getText("doclet.Index"));
} else { } else {
indexlink = getHyperLinkString(DocPaths.INDEX_ALL, indexlink = getHyperLink(DocPaths.INDEX_ALL,
configuration.getText("doclet.Index")); configuration.getText("doclet.Index"));
} }
Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
...@@ -293,7 +294,7 @@ public class HelpWriter extends HtmlDocletWriter { ...@@ -293,7 +294,7 @@ public class HelpWriter extends HtmlDocletWriter {
getResource("doclet.All_Classes")); getResource("doclet.All_Classes"));
Content liAllClasses = HtmlTree.LI(HtmlStyle.blockList, allclassesHead); Content liAllClasses = HtmlTree.LI(HtmlStyle.blockList, allclassesHead);
Content line27 = getResource("doclet.Help_line_27", Content line27 = getResource("doclet.Help_line_27",
getHyperLinkString(DocPaths.ALLCLASSES_NOFRAME, getHyperLink(DocPaths.ALLCLASSES_NOFRAME,
configuration.getText("doclet.All_Classes"))); configuration.getText("doclet.All_Classes")));
Content allclassesPara = HtmlTree.P(line27); Content allclassesPara = HtmlTree.P(line27);
liAllClasses.addContent(allclassesPara); liAllClasses.addContent(allclassesPara);
...@@ -309,7 +310,7 @@ public class HelpWriter extends HtmlDocletWriter { ...@@ -309,7 +310,7 @@ public class HelpWriter extends HtmlDocletWriter {
getResource("doclet.Constants_Summary")); getResource("doclet.Constants_Summary"));
Content liConst = HtmlTree.LI(HtmlStyle.blockList, constHead); Content liConst = HtmlTree.LI(HtmlStyle.blockList, constHead);
Content line29 = getResource("doclet.Help_line_29", Content line29 = getResource("doclet.Help_line_29",
getHyperLinkString(DocPaths.CONSTANT_VALUES, getHyperLink(DocPaths.CONSTANT_VALUES,
configuration.getText("doclet.Constants_Summary"))); configuration.getText("doclet.Constants_Summary")));
Content constPara = HtmlTree.P(line29); Content constPara = HtmlTree.P(line29);
liConst.addContent(constPara); liConst.addContent(constPara);
......
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -46,7 +46,7 @@ import com.sun.tools.doclets.internal.toolkit.taglets.*; ...@@ -46,7 +46,7 @@ import com.sun.tools.doclets.internal.toolkit.taglets.*;
* @author Bhavesh Patel (Modified) * @author Bhavesh Patel (Modified)
*/ */
public class HtmlSerialFieldWriter extends FieldWriterImpl public class HtmlSerialFieldWriter extends FieldWriterImpl
implements SerializedFormWriter.SerialFieldWriter { implements SerializedFormWriter.SerialFieldWriter {
ProgramElementDoc[] members = null; ProgramElementDoc[] members = null;
private boolean printedOverallAnchor = false; private boolean printedOverallAnchor = false;
...@@ -129,8 +129,8 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl ...@@ -129,8 +129,8 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
if (fieldType == null) { if (fieldType == null) {
pre.addContent(fieldTypeStr); pre.addContent(fieldTypeStr);
} else { } else {
Content fieldContent = new RawHtml(writer.getLink(new LinkInfoImpl( Content fieldContent = writer.getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.CONTEXT_SERIAL_MEMBER, fieldType))); configuration, LinkInfoImpl.Kind.SERIAL_MEMBER, fieldType));
pre.addContent(fieldContent); pre.addContent(fieldContent);
} }
pre.addContent(fieldDimensions + " "); pre.addContent(fieldDimensions + " ");
...@@ -186,17 +186,13 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl ...@@ -186,17 +186,13 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
* @param contentTree the tree to which the member tags info will be added * @param contentTree the tree to which the member tags info will be added
*/ */
public void addMemberTags(FieldDoc field, Content contentTree) { public void addMemberTags(FieldDoc field, Content contentTree) {
TagletOutputImpl output = new TagletOutputImpl(""); Content tagContent = new ContentBuilder();
TagletWriter.genTagOuput(configuration.tagletManager, field, TagletWriter.genTagOuput(configuration.tagletManager, field,
configuration.tagletManager.getCustomTags(field), configuration.tagletManager.getCustomTaglets(field),
writer.getTagletWriterInstance(false), output); writer.getTagletWriterInstance(false), tagContent);
String outputString = output.toString().trim();
Content dlTags = new HtmlTree(HtmlTag.DL); Content dlTags = new HtmlTree(HtmlTag.DL);
if (!outputString.isEmpty()) { dlTags.addContent(tagContent);
Content tagContent = new RawHtml(outputString); contentTree.addContent(dlTags); // TODO: what if empty?
dlTags.addContent(tagContent);
}
contentTree.addContent(dlTags);
} }
/** /**
......
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -146,19 +146,15 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements ...@@ -146,19 +146,15 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
* @param methodsContentTree the tree to which the member tags info will be added * @param methodsContentTree the tree to which the member tags info will be added
*/ */
public void addMemberTags(MethodDoc member, Content methodsContentTree) { public void addMemberTags(MethodDoc member, Content methodsContentTree) {
TagletOutputImpl output = new TagletOutputImpl(""); Content tagContent = new ContentBuilder();
TagletManager tagletManager = TagletManager tagletManager =
configuration.tagletManager; configuration.tagletManager;
TagletWriter.genTagOuput(tagletManager, member, TagletWriter.genTagOuput(tagletManager, member,
tagletManager.getSerializedFormTags(), tagletManager.getSerializedFormTaglets(),
writer.getTagletWriterInstance(false), output); writer.getTagletWriterInstance(false), tagContent);
String outputString = output.toString().trim();
Content dlTags = new HtmlTree(HtmlTag.DL); Content dlTags = new HtmlTree(HtmlTag.DL);
if (!outputString.isEmpty()) { dlTags.addContent(tagContent);
Content tagContent = new RawHtml(outputString); methodsContentTree.addContent(dlTags); // TODO: what if empty?
dlTags.addContent(tagContent);
}
methodsContentTree.addContent(dlTags);
MethodDoc method = member; MethodDoc method = member;
if (method.name().compareTo("writeExternal") == 0 if (method.name().compareTo("writeExternal") == 0
&& method.tags("serialData").length == 0) { && method.tags("serialData").length == 0) {
......
...@@ -28,6 +28,9 @@ package com.sun.tools.doclets.formats.html; ...@@ -28,6 +28,9 @@ package com.sun.tools.doclets.formats.html;
import java.util.List; import java.util.List;
import com.sun.javadoc.*; 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.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.doclets.internal.toolkit.util.links.*; import com.sun.tools.doclets.internal.toolkit.util.links.*;
...@@ -54,16 +57,16 @@ public class LinkFactoryImpl extends LinkFactory { ...@@ -54,16 +57,16 @@ public class LinkFactoryImpl extends LinkFactory {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected LinkOutput getOutputInstance() { protected Content newContent() {
return new LinkOutputImpl(); return new ContentBuilder();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected LinkOutput getClassLink(LinkInfo linkInfo) { protected Content getClassLink(LinkInfo linkInfo) {
LinkInfoImpl classLinkInfo = (LinkInfoImpl) linkInfo; LinkInfoImpl classLinkInfo = (LinkInfoImpl) linkInfo;
boolean noLabel = linkInfo.label == null || linkInfo.label.length() == 0; boolean noLabel = linkInfo.label == null || linkInfo.label.isEmpty();
ClassDoc classDoc = classLinkInfo.classDoc; ClassDoc classDoc = classLinkInfo.classDoc;
//Create a tool tip if we are linking to a class or interface. Don't //Create a tool tip if we are linking to a class or interface. Don't
//create one if we are linking to a member. //create one if we are linking to a member.
...@@ -73,100 +76,94 @@ public class LinkFactoryImpl extends LinkFactory { ...@@ -73,100 +76,94 @@ public class LinkFactoryImpl extends LinkFactory {
classLinkInfo.type != null && classLinkInfo.type != null &&
!classDoc.qualifiedTypeName().equals(classLinkInfo.type.qualifiedTypeName())) : !classDoc.qualifiedTypeName().equals(classLinkInfo.type.qualifiedTypeName())) :
""; "";
StringBuilder label = new StringBuilder( Content label = classLinkInfo.getClassLinkLabel(m_writer.configuration);
classLinkInfo.getClassLinkLabel(m_writer.configuration));
classLinkInfo.displayLength += label.length();
Configuration configuration = m_writer.configuration; Configuration configuration = m_writer.configuration;
LinkOutputImpl linkOutput = new LinkOutputImpl(); Content link = new ContentBuilder();
if (classDoc.isIncluded()) { if (classDoc.isIncluded()) {
if (configuration.isGeneratedDoc(classDoc)) { if (configuration.isGeneratedDoc(classDoc)) {
DocPath filename = getPath(classLinkInfo); DocPath filename = getPath(classLinkInfo);
if (linkInfo.linkToSelf || if (linkInfo.linkToSelf ||
!(DocPath.forName(classDoc)).equals(m_writer.filename)) { !(DocPath.forName(classDoc)).equals(m_writer.filename)) {
linkOutput.append(m_writer.getHyperLinkString( link.addContent(m_writer.getHyperLink(
filename.fragment(classLinkInfo.where), filename.fragment(classLinkInfo.where),
label.toString(), label,
classLinkInfo.isStrong, classLinkInfo.styleName, classLinkInfo.isStrong, classLinkInfo.styleName,
title, classLinkInfo.target)); title, classLinkInfo.target));
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
linkOutput.append(getTypeParameterLinks(linkInfo).toString()); link.addContent(getTypeParameterLinks(linkInfo));
} }
return linkOutput; return link;
} }
} }
} else { } else {
String crossLink = m_writer.getCrossClassLink( Content crossLink = m_writer.getCrossClassLink(
classDoc.qualifiedName(), classLinkInfo.where, classDoc.qualifiedName(), classLinkInfo.where,
label.toString(), classLinkInfo.isStrong, classLinkInfo.styleName, label, classLinkInfo.isStrong, classLinkInfo.styleName,
true); true);
if (crossLink != null) { if (crossLink != null) {
linkOutput.append(crossLink); link.addContent(crossLink);
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
linkOutput.append(getTypeParameterLinks(linkInfo).toString()); link.addContent(getTypeParameterLinks(linkInfo));
} }
return linkOutput; return link;
} }
} }
// Can't link so just write label. // Can't link so just write label.
linkOutput.append(label.toString()); link.addContent(label.toString());
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
linkOutput.append(getTypeParameterLinks(linkInfo).toString()); link.addContent(getTypeParameterLinks(linkInfo));
} }
return linkOutput; return link;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected LinkOutput getTypeParameterLink(LinkInfo linkInfo, protected Content getTypeParameterLink(LinkInfo linkInfo,
Type typeParam) { Type typeParam) {
LinkInfoImpl typeLinkInfo = new LinkInfoImpl(m_writer.configuration, LinkInfoImpl typeLinkInfo = new LinkInfoImpl(m_writer.configuration,
linkInfo.getContext(), typeParam); ((LinkInfoImpl) linkInfo).getContext(), typeParam);
typeLinkInfo.excludeTypeBounds = linkInfo.excludeTypeBounds; typeLinkInfo.excludeTypeBounds = linkInfo.excludeTypeBounds;
typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks; typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks;
typeLinkInfo.linkToSelf = linkInfo.linkToSelf; typeLinkInfo.linkToSelf = linkInfo.linkToSelf;
typeLinkInfo.isJava5DeclarationLocation = false; typeLinkInfo.isJava5DeclarationLocation = false;
LinkOutput output = getLinkOutput(typeLinkInfo); return getLink(typeLinkInfo);
((LinkInfoImpl) linkInfo).displayLength += typeLinkInfo.displayLength;
return output;
} }
protected LinkOutput getTypeAnnotationLink(LinkInfo linkInfo, protected Content getTypeAnnotationLink(LinkInfo linkInfo,
AnnotationDesc annotation) { AnnotationDesc annotation) {
throw new RuntimeException("Not implemented yet!"); throw new RuntimeException("Not implemented yet!");
} }
public LinkOutput getTypeAnnotationLinks(LinkInfo linkInfo) { public Content getTypeAnnotationLinks(LinkInfo linkInfo) {
LinkOutput output = getOutputInstance(); ContentBuilder links = new ContentBuilder();
AnnotationDesc[] annotations; AnnotationDesc[] annotations;
if (linkInfo.type instanceof AnnotatedType) { if (linkInfo.type instanceof AnnotatedType) {
annotations = linkInfo.type.asAnnotatedType().annotations(); annotations = linkInfo.type.asAnnotatedType().annotations();
} else if (linkInfo.type instanceof TypeVariable) { } else if (linkInfo.type instanceof TypeVariable) {
annotations = linkInfo.type.asTypeVariable().annotations(); annotations = linkInfo.type.asTypeVariable().annotations();
} else { } else {
return output; return links;
} }
if (annotations.length == 0) if (annotations.length == 0)
return output; return links;
List<String> annos = m_writer.getAnnotations(0, annotations, false, linkInfo.isJava5DeclarationLocation); List<Content> annos = m_writer.getAnnotations(0, annotations, false, linkInfo.isJava5DeclarationLocation);
boolean isFirst = true; boolean isFirst = true;
for (String anno : annos) { for (Content anno : annos) {
if (!isFirst) { if (!isFirst) {
linkInfo.displayLength += 1; links.addContent(" ");
output.append(" ");
} }
output.append(anno); links.addContent(anno);
isFirst = false; isFirst = false;
} }
if (!annos.isEmpty()) { if (!annos.isEmpty()) {
linkInfo.displayLength += 1; links.addContent(" ");
output.append(" ");
} }
return output; return links;
} }
/** /**
...@@ -204,7 +201,7 @@ public class LinkFactoryImpl extends LinkFactory { ...@@ -204,7 +201,7 @@ public class LinkFactoryImpl extends LinkFactory {
* @param linkInfo the information about the link. * @param linkInfo the information about the link.
*/ */
private DocPath getPath(LinkInfoImpl linkInfo) { private DocPath getPath(LinkInfoImpl linkInfo) {
if (linkInfo.context == LinkInfoImpl.PACKAGE_FRAME) { if (linkInfo.context == LinkInfoImpl.Kind.PACKAGE_FRAME) {
//Not really necessary to do this but we want to be consistent //Not really necessary to do this but we want to be consistent
//with 1.4.2 output. //with 1.4.2 output.
return DocPath.forName(linkInfo.classDoc); return DocPath.forName(linkInfo.classDoc);
......
...@@ -117,7 +117,6 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter ...@@ -117,7 +117,6 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
* @return a content object for the signature * @return a content object for the signature
*/ */
public Content getSignature(MethodDoc method) { public Content getSignature(MethodDoc method) {
writer.displayLength = 0;
Content pre = new HtmlTree(HtmlTag.PRE); Content pre = new HtmlTree(HtmlTag.PRE);
writer.addAnnotationInfo(method, pre); writer.addAnnotationInfo(method, pre);
addModifiers(method, pre); addModifiers(method, pre);
...@@ -129,8 +128,9 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter ...@@ -129,8 +128,9 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
} else { } else {
addName(method.name(), pre); addName(method.name(), pre);
} }
addParameters(method, pre); int indent = pre.charCount();
addExceptions(method, pre); addParameters(method, pre, indent);
addExceptions(method, pre, indent);
return pre; return pre;
} }
...@@ -152,12 +152,12 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter ...@@ -152,12 +152,12 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
Util.isLinkable(holderClassDoc, configuration)))) { Util.isLinkable(holderClassDoc, configuration)))) {
writer.addInlineComment(method, methodDocTree); writer.addInlineComment(method, methodDocTree);
} else { } else {
Content link = new RawHtml( Content link =
writer.getDocLink(LinkInfoImpl.CONTEXT_METHOD_DOC_COPY, writer.getDocLink(LinkInfoImpl.Kind.METHOD_DOC_COPY,
holder.asClassDoc(), method, holder.asClassDoc(), method,
holder.asClassDoc().isIncluded() ? holder.asClassDoc().isIncluded() ?
holder.typeName() : holder.qualifiedTypeName(), holder.typeName() : holder.qualifiedTypeName(),
false)); false);
Content codelLink = HtmlTree.CODE(link); Content codelLink = HtmlTree.CODE(link);
Content strong = HtmlTree.STRONG(holder.asClassDoc().isClass()? Content strong = HtmlTree.STRONG(holder.asClassDoc().isClass()?
writer.descfrmClassLabel : writer.descfrmInterfaceLabel); writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
...@@ -223,8 +223,8 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter ...@@ -223,8 +223,8 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public Content getCaption() {
return configuration.getText("doclet.Methods"); return configuration.getResource("doclet.Methods");
} }
/** /**
...@@ -260,8 +260,8 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter ...@@ -260,8 +260,8 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) { public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
Content classLink = new RawHtml(writer.getPreQualifiedClassLink( Content classLink = writer.getPreQualifiedClassLink(
LinkInfoImpl.CONTEXT_MEMBER, cd, false)); LinkInfoImpl.Kind.MEMBER, cd, false);
Content label = new StringContent(cd.isClass() ? Content label = new StringContent(cd.isClass() ?
configuration.getText("doclet.Methods_Inherited_From_Class") : configuration.getText("doclet.Methods_Inherited_From_Class") :
configuration.getText("doclet.Methods_Inherited_From_Interface")); configuration.getText("doclet.Methods_Inherited_From_Interface"));
...@@ -300,25 +300,25 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter ...@@ -300,25 +300,25 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
return; return;
} }
Content label = writer.overridesLabel; Content label = writer.overridesLabel;
int context = LinkInfoImpl.CONTEXT_METHOD_OVERRIDES; LinkInfoImpl.Kind context = LinkInfoImpl.Kind.METHOD_OVERRIDES;
if (method != null) { if (method != null) {
if (overriddenType.asClassDoc().isAbstract() && method.isAbstract()){ if (overriddenType.asClassDoc().isAbstract() && method.isAbstract()){
//Abstract method is implemented from abstract class, //Abstract method is implemented from abstract class,
//not overridden //not overridden
label = writer.specifiedByLabel; label = writer.specifiedByLabel;
context = LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY; context = LinkInfoImpl.Kind.METHOD_SPECIFIED_BY;
} }
Content dt = HtmlTree.DT(HtmlTree.STRONG(label)); Content dt = HtmlTree.DT(HtmlTree.STRONG(label));
dl.addContent(dt); dl.addContent(dt);
Content overriddenTypeLink = new RawHtml( Content overriddenTypeLink =
writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType))); writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType));
Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink); Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink);
String name = method.name(); String name = method.name();
Content methlink = new RawHtml(writer.getLink( Content methlink = writer.getLink(
new LinkInfoImpl(writer.configuration, LinkInfoImpl.CONTEXT_MEMBER, new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER,
overriddenType.asClassDoc(), overriddenType.asClassDoc())
writer.getAnchor(method), name, false))); .where(writer.getAnchor(method)).label(name));
Content codeMethLink = HtmlTree.CODE(methlink); Content codeMethLink = HtmlTree.CODE(methlink);
Content dd = HtmlTree.DD(codeMethLink); Content dd = HtmlTree.DD(codeMethLink);
dd.addContent(writer.getSpace()); dd.addContent(writer.getSpace());
...@@ -361,14 +361,14 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter ...@@ -361,14 +361,14 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
for (int i = 0; i < implementedMethods.length; i++) { for (int i = 0; i < implementedMethods.length; i++) {
MethodDoc implementedMeth = implementedMethods[i]; MethodDoc implementedMeth = implementedMethods[i];
Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth); Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth);
Content intfaclink = new RawHtml(writer.getLink(new LinkInfoImpl( Content intfaclink = writer.getLink(new LinkInfoImpl(
writer.configuration, LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac))); writer.configuration, LinkInfoImpl.Kind.METHOD_SPECIFIED_BY, intfac));
Content codeIntfacLink = HtmlTree.CODE(intfaclink); Content codeIntfacLink = HtmlTree.CODE(intfaclink);
Content dt = HtmlTree.DT(HtmlTree.STRONG(writer.specifiedByLabel)); Content dt = HtmlTree.DT(HtmlTree.STRONG(writer.specifiedByLabel));
dl.addContent(dt); dl.addContent(dt);
Content methlink = new RawHtml(writer.getDocLink( Content methlink = writer.getDocLink(
LinkInfoImpl.CONTEXT_MEMBER, implementedMeth, LinkInfoImpl.Kind.MEMBER, implementedMeth,
implementedMeth.name(), false)); implementedMeth.name(), false);
Content codeMethLink = HtmlTree.CODE(methlink); Content codeMethLink = HtmlTree.CODE(methlink);
Content dd = HtmlTree.DD(codeMethLink); Content dd = HtmlTree.DD(codeMethLink);
dd.addContent(writer.getSpace()); dd.addContent(writer.getSpace());
...@@ -388,8 +388,8 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter ...@@ -388,8 +388,8 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
protected void addReturnType(MethodDoc method, Content htmltree) { protected void addReturnType(MethodDoc method, Content htmltree) {
Type type = method.returnType(); Type type = method.returnType();
if (type != null) { if (type != null) {
Content linkContent = new RawHtml(writer.getLink( Content linkContent = writer.getLink(
new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_RETURN_TYPE, type))); new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
htmltree.addContent(linkContent); htmltree.addContent(linkContent);
htmltree.addContent(writer.getSpace()); htmltree.addContent(writer.getSpace());
} }
......
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import java.io.*; import java.io.*;
import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*; import com.sun.tools.doclets.formats.html.markup.*;
...@@ -101,8 +100,8 @@ public class NestedClassWriterImpl extends AbstractMemberWriter ...@@ -101,8 +100,8 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public Content getCaption() {
return configuration.getText("doclet.Nested_Classes"); return configuration.getResource("doclet.Nested_Classes");
} }
/** /**
...@@ -148,8 +147,8 @@ public class NestedClassWriterImpl extends AbstractMemberWriter ...@@ -148,8 +147,8 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) { public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
Content classLink = new RawHtml(writer.getPreQualifiedClassLink( Content classLink = writer.getPreQualifiedClassLink(
LinkInfoImpl.CONTEXT_MEMBER, cd, false)); LinkInfoImpl.Kind.MEMBER, cd, false);
Content label = new StringContent(cd.isInterface() ? Content label = new StringContent(cd.isInterface() ?
configuration.getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") : configuration.getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") :
configuration.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class")); configuration.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
...@@ -163,10 +162,10 @@ public class NestedClassWriterImpl extends AbstractMemberWriter ...@@ -163,10 +162,10 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member, protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) { Content tdSummary) {
Content strong = HtmlTree.STRONG(new RawHtml( Content strong = HtmlTree.STRONG(
writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member, false)))); writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member)));
Content code = HtmlTree.CODE(strong); Content code = HtmlTree.CODE(strong);
tdSummary.addContent(code); tdSummary.addContent(code);
} }
...@@ -176,9 +175,9 @@ public class NestedClassWriterImpl extends AbstractMemberWriter ...@@ -176,9 +175,9 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
*/ */
protected void addInheritedSummaryLink(ClassDoc cd, protected void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member, Content linksTree) { ProgramElementDoc member, Content linksTree) {
linksTree.addContent(new RawHtml( linksTree.addContent(
writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_MEMBER, writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER,
(ClassDoc)member, false)))); (ClassDoc)member)));
} }
/** /**
...@@ -194,7 +193,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter ...@@ -194,7 +193,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
protected Content getDeprecatedLink(ProgramElementDoc member) { protected Content getDeprecatedLink(ProgramElementDoc member) {
return writer.getQualifiedClassLink(LinkInfoImpl.CONTEXT_MEMBER, return writer.getQualifiedClassLink(LinkInfoImpl.Kind.MEMBER,
(ClassDoc)member); (ClassDoc)member);
} }
......
...@@ -94,7 +94,7 @@ public class PackageFrameWriter extends HtmlDocletWriter { ...@@ -94,7 +94,7 @@ public class PackageFrameWriter extends HtmlDocletWriter {
packgen = new PackageFrameWriter(configuration, packageDoc); packgen = new PackageFrameWriter(configuration, packageDoc);
String pkgName = Util.getPackageName(packageDoc); String pkgName = Util.getPackageName(packageDoc);
Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName)); Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
Content pkgNameContent = new RawHtml(pkgName); Content pkgNameContent = new StringContent(pkgName);
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
packgen.getTargetPackageLink(packageDoc, "classFrame", pkgNameContent)); packgen.getTargetPackageLink(packageDoc, "classFrame", pkgNameContent));
body.addContent(heading); body.addContent(heading);
...@@ -166,7 +166,7 @@ public class PackageFrameWriter extends HtmlDocletWriter { ...@@ -166,7 +166,7 @@ public class PackageFrameWriter extends HtmlDocletWriter {
Arrays.sort(arr); Arrays.sort(arr);
boolean printedHeader = false; boolean printedHeader = false;
HtmlTree ul = new HtmlTree(HtmlTag.UL); HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addAttr(HtmlAttr.TITLE, labelContent.toString()); ul.setTitle(labelContent);
for (int i = 0; i < arr.length; i++) { for (int i = 0; i < arr.length; i++) {
if (documentedClasses != null && if (documentedClasses != null &&
!documentedClasses.contains(arr[i])) { !documentedClasses.contains(arr[i])) {
...@@ -182,10 +182,10 @@ public class PackageFrameWriter extends HtmlDocletWriter { ...@@ -182,10 +182,10 @@ public class PackageFrameWriter extends HtmlDocletWriter {
contentTree.addContent(heading); contentTree.addContent(heading);
printedHeader = true; printedHeader = true;
} }
Content link = new RawHtml (getLink(new LinkInfoImpl(configuration, Content arr_i_name = new StringContent(arr[i].name());
LinkInfoImpl.PACKAGE_FRAME, arr[i], if (arr[i].isInterface()) arr_i_name = HtmlTree.I(arr_i_name);
(arr[i].isInterface() ? italicsText(arr[i].name()) : Content link = getLink(new LinkInfoImpl(configuration,
arr[i].name()),"classFrame"))); LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
Content li = HtmlTree.LI(link); Content li = HtmlTree.LI(link);
ul.addContent(li); ul.addContent(li);
} }
......
...@@ -84,7 +84,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter { ...@@ -84,7 +84,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
packagesLabel); packagesLabel);
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading); Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree ul = new HtmlTree(HtmlTag.UL); HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString()); ul.setTitle(packagesLabel);
for(int i = 0; i < packages.length; i++) { for(int i = 0; i < packages.length; i++) {
// Do not list the package if -nodeprecated option is set and the // Do not list the package if -nodeprecated option is set and the
// package is marked as deprecated. // package is marked as deprecated.
...@@ -112,7 +112,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter { ...@@ -112,7 +112,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
DocPaths.PACKAGE_FRAME), packageLabel, "", DocPaths.PACKAGE_FRAME), packageLabel, "",
"packageFrame"); "packageFrame");
} else { } else {
packageLabel = new RawHtml("&lt;unnamed package&gt;"); packageLabel = new StringContent("<unnamed package>");
packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME, packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
packageLabel, "", "packageFrame"); packageLabel, "", "packageFrame");
} }
......
...@@ -123,7 +123,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter { ...@@ -123,7 +123,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void addProfilesList(String profileSummary, String profilesTableSummary, protected void addProfilesList(Content profileSummary, String profilesTableSummary,
Content body) { Content body) {
Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, profilesTableSummary, Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, profilesTableSummary,
getTableCaption(profileSummary)); getTableCaption(profileSummary));
...@@ -141,7 +141,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter { ...@@ -141,7 +141,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
protected void addPackagesList(PackageDoc[] packages, String text, protected void addPackagesList(PackageDoc[] packages, String text,
String tableSummary, Content body) { String tableSummary, Content body) {
Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary, Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
getTableCaption(text)); getTableCaption(new RawHtml(text)));
table.addContent(getSummaryTableHeader(packageTableHeader, "col")); table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY); Content tbody = new HtmlTree(HtmlTag.TBODY);
addPackagesList(packages, tbody); addPackagesList(packages, tbody);
......
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
......
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -152,9 +152,9 @@ public class PackageUseWriter extends SubWriterHolderWriter { ...@@ -152,9 +152,9 @@ public class PackageUseWriter extends SubWriterHolderWriter {
*/ */
protected void addPackageList(Content contentTree) throws IOException { protected void addPackageList(Content contentTree) throws IOException {
Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary, Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
getTableCaption(configuration.getText( getTableCaption(configuration.getResource(
"doclet.ClassUse_Packages.that.use.0", "doclet.ClassUse_Packages.that.use.0",
getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false)))); getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)))));
table.addContent(getSummaryTableHeader(packageTableHeader, "col")); table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY); Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<String> it = usingPackageToUsedClasses.keySet().iterator(); Iterator<String> it = usingPackageToUsedClasses.keySet().iterator();
...@@ -197,10 +197,10 @@ public class PackageUseWriter extends SubWriterHolderWriter { ...@@ -197,10 +197,10 @@ public class PackageUseWriter extends SubWriterHolderWriter {
String tableSummary = configuration.getText("doclet.Use_Table_Summary", String tableSummary = configuration.getText("doclet.Use_Table_Summary",
configuration.getText("doclet.classes")); configuration.getText("doclet.classes"));
Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
getTableCaption(configuration.getText( getTableCaption(configuration.getResource(
"doclet.ClassUse_Classes.in.0.used.by.1", "doclet.ClassUse_Classes.in.0.used.by.1",
getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false), getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)),
getPackageLinkString(usingPackage,Util.getPackageName(usingPackage), false)))); getPackageLink(usingPackage, Util.getPackageName(usingPackage)))));
table.addContent(getSummaryTableHeader(classTableHeader, "col")); table.addContent(getSummaryTableHeader(classTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY); Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<ClassDoc> itc = Iterator<ClassDoc> itc =
...@@ -247,7 +247,7 @@ public class PackageUseWriter extends SubWriterHolderWriter { ...@@ -247,7 +247,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException { protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst, Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
getHyperLink(Util.getPackageName(pkg), getHyperLink(Util.getPackageName(pkg),
new RawHtml(Util.getPackageName(pkg)))); new StringContent(Util.getPackageName(pkg))));
contentTree.addContent(tdFirst); contentTree.addContent(tdFirst);
HtmlTree tdLast = new HtmlTree(HtmlTag.TD); HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
tdLast.addStyle(HtmlStyle.colLast); tdLast.addStyle(HtmlStyle.colLast);
...@@ -272,7 +272,10 @@ public class PackageUseWriter extends SubWriterHolderWriter { ...@@ -272,7 +272,10 @@ public class PackageUseWriter extends SubWriterHolderWriter {
Content bodyTree = getBody(true, getWindowTitle(title)); Content bodyTree = getBody(true, getWindowTitle(title));
addTop(bodyTree); addTop(bodyTree);
addNavLinks(true, bodyTree); addNavLinks(true, bodyTree);
Content headContent = getResource("doclet.ClassUse_Title", packageText, name); 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, Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
HtmlStyle.title, headContent); HtmlStyle.title, headContent);
Content div = HtmlTree.DIV(HtmlStyle.header, heading); Content div = HtmlTree.DIV(HtmlStyle.header, heading);
......
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -102,7 +102,7 @@ public class PackageWriterImpl extends HtmlDocletWriter ...@@ -102,7 +102,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
HtmlStyle.title, packageLabel); HtmlStyle.title, packageLabel);
tHeading.addContent(getSpace()); tHeading.addContent(getSpace());
Content packageHead = new RawHtml(heading); Content packageHead = new StringContent(heading);
tHeading.addContent(packageHead); tHeading.addContent(packageHead);
div.addContent(tHeading); div.addContent(tHeading);
addDeprecationInfo(div); addDeprecationInfo(div);
...@@ -168,7 +168,7 @@ public class PackageWriterImpl extends HtmlDocletWriter ...@@ -168,7 +168,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
String tableSummary, String[] tableHeader, Content summaryContentTree) { String tableSummary, String[] tableHeader, Content summaryContentTree) {
if(classes.length > 0) { if(classes.length > 0) {
Arrays.sort(classes); Arrays.sort(classes);
Content caption = getTableCaption(label); Content caption = getTableCaption(new RawHtml(label));
Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0, Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0,
tableSummary, caption); tableSummary, caption);
table.addContent(getSummaryTableHeader(tableHeader, "col")); table.addContent(getSummaryTableHeader(tableHeader, "col"));
...@@ -178,9 +178,8 @@ public class PackageWriterImpl extends HtmlDocletWriter ...@@ -178,9 +178,8 @@ public class PackageWriterImpl extends HtmlDocletWriter
!configuration.isGeneratedDoc(classes[i])) { !configuration.isGeneratedDoc(classes[i])) {
continue; continue;
} }
Content classContent = new RawHtml(getLink(new LinkInfoImpl( Content classContent = getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.CONTEXT_PACKAGE, classes[i], configuration, LinkInfoImpl.Kind.PACKAGE, classes[i]));
false)));
Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent); Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
HtmlTree tr = HtmlTree.TR(tdClass); HtmlTree tr = HtmlTree.TR(tdClass);
if (i%2 == 0) if (i%2 == 0)
......
...@@ -87,7 +87,7 @@ public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter { ...@@ -87,7 +87,7 @@ public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter {
profilesLabel); profilesLabel);
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading); Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree ul = new HtmlTree(HtmlTag.UL); HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addAttr(HtmlAttr.TITLE, profilesLabel.toString()); ul.setTitle(profilesLabel);
for (int i = 1; i < profiles.getProfileCount(); i++) { for (int i = 1; i < profiles.getProfileCount(); i++) {
ul.addContent(getProfile(i)); ul.addContent(getProfile(i));
} }
......
...@@ -158,7 +158,7 @@ public class ProfilePackageFrameWriter extends HtmlDocletWriter { ...@@ -158,7 +158,7 @@ public class ProfilePackageFrameWriter extends HtmlDocletWriter {
Arrays.sort(arr); Arrays.sort(arr);
boolean printedHeader = false; boolean printedHeader = false;
HtmlTree ul = new HtmlTree(HtmlTag.UL); HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addAttr(HtmlAttr.TITLE, labelContent.toString()); ul.setTitle(labelContent);
for (int i = 0; i < arr.length; i++) { for (int i = 0; i < arr.length; i++) {
if (!isTypeInProfile(arr[i], profileValue)) { if (!isTypeInProfile(arr[i], profileValue)) {
continue; continue;
...@@ -173,10 +173,10 @@ public class ProfilePackageFrameWriter extends HtmlDocletWriter { ...@@ -173,10 +173,10 @@ public class ProfilePackageFrameWriter extends HtmlDocletWriter {
contentTree.addContent(heading); contentTree.addContent(heading);
printedHeader = true; printedHeader = true;
} }
Content link = new RawHtml (getLink(new LinkInfoImpl(configuration, Content arr_i_name = new StringContent(arr[i].name());
LinkInfoImpl.PACKAGE_FRAME, arr[i], if (arr[i].isInterface()) arr_i_name = HtmlTree.I(arr_i_name);
(arr[i].isInterface() ? italicsText(arr[i].name()) : Content link = getLink(new LinkInfoImpl(configuration,
arr[i].name()),"classFrame"))); LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
Content li = HtmlTree.LI(link); Content li = HtmlTree.LI(link);
ul.addContent(li); ul.addContent(li);
} }
......
...@@ -91,7 +91,7 @@ public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter { ...@@ -91,7 +91,7 @@ public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter {
heading.addContent(packagesLabel); heading.addContent(packagesLabel);
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading); Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree ul = new HtmlTree(HtmlTag.UL); HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString()); ul.setTitle(packagesLabel);
PackageDoc[] packages = configuration.profilePackages.get(profileName); PackageDoc[] packages = configuration.profilePackages.get(profileName);
for (int i = 0; i < packages.length; i++) { for (int i = 0; i < packages.length; i++) {
if ((!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) { if ((!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
...@@ -118,7 +118,7 @@ public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter { ...@@ -118,7 +118,7 @@ public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter {
DocPaths.profilePackageFrame(profileName)), pkgLabel, "", DocPaths.profilePackageFrame(profileName)), pkgLabel, "",
"packageFrame"); "packageFrame");
} else { } else {
pkgLabel = new RawHtml("&lt;unnamed package&gt;"); pkgLabel = new StringContent("<unnamed package>");
packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME, packageLinkContent = getHyperLink(DocPaths.PACKAGE_FRAME,
pkgLabel, "", "packageFrame"); pkgLabel, "", "packageFrame");
} }
......
...@@ -98,9 +98,9 @@ public class PropertyWriterImpl extends AbstractMemberWriter ...@@ -98,9 +98,9 @@ public class PropertyWriterImpl extends AbstractMemberWriter
Content pre = new HtmlTree(HtmlTag.PRE); Content pre = new HtmlTree(HtmlTag.PRE);
writer.addAnnotationInfo(property, pre); writer.addAnnotationInfo(property, pre);
addModifiers(property, pre); addModifiers(property, pre);
Content propertylink = new RawHtml(writer.getLink(new LinkInfoImpl( Content propertylink = writer.getLink(new LinkInfoImpl(
configuration, LinkInfoImpl.CONTEXT_MEMBER, configuration, LinkInfoImpl.Kind.MEMBER,
property.returnType()))); property.returnType()));
pre.addContent(propertylink); pre.addContent(propertylink);
pre.addContent(" "); pre.addContent(" ");
if (configuration.linksource) { if (configuration.linksource) {
...@@ -128,12 +128,12 @@ public class PropertyWriterImpl extends AbstractMemberWriter ...@@ -128,12 +128,12 @@ public class PropertyWriterImpl extends AbstractMemberWriter
(! (holder.isPublic() || Util.isLinkable(holder, configuration)))) { (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
writer.addInlineComment(property, propertyDocTree); writer.addInlineComment(property, propertyDocTree);
} else { } else {
Content link = new RawHtml( Content link =
writer.getDocLink(LinkInfoImpl.CONTEXT_PROPERTY_DOC_COPY, writer.getDocLink(LinkInfoImpl.Kind.PROPERTY_DOC_COPY,
holder, property, holder, property,
holder.isIncluded() ? holder.isIncluded() ?
holder.typeName() : holder.qualifiedTypeName(), holder.typeName() : holder.qualifiedTypeName(),
false)); false);
Content codeLink = HtmlTree.CODE(link); Content codeLink = HtmlTree.CODE(link);
Content strong = HtmlTree.STRONG(holder.isClass()? Content strong = HtmlTree.STRONG(holder.isClass()?
writer.descfrmClassLabel : writer.descfrmInterfaceLabel); writer.descfrmClassLabel : writer.descfrmInterfaceLabel);
...@@ -199,8 +199,8 @@ public class PropertyWriterImpl extends AbstractMemberWriter ...@@ -199,8 +199,8 @@ public class PropertyWriterImpl extends AbstractMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public Content getCaption() {
return configuration.getText("doclet.Properties"); return configuration.getResource("doclet.Properties");
} }
/** /**
...@@ -235,8 +235,8 @@ public class PropertyWriterImpl extends AbstractMemberWriter ...@@ -235,8 +235,8 @@ public class PropertyWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) { public void addInheritedSummaryLabel(ClassDoc cd, Content inheritedTree) {
Content classLink = new RawHtml(writer.getPreQualifiedClassLink( Content classLink = writer.getPreQualifiedClassLink(
LinkInfoImpl.CONTEXT_MEMBER, cd, false)); LinkInfoImpl.Kind.MEMBER, cd, false);
Content label = new StringContent(cd.isClass() ? Content label = new StringContent(cd.isClass() ?
configuration.getText("doclet.Properties_Inherited_From_Class") : configuration.getText("doclet.Properties_Inherited_From_Class") :
configuration.getText("doclet.Properties_Inherited_From_Interface")); configuration.getText("doclet.Properties_Inherited_From_Interface"));
...@@ -250,15 +250,15 @@ public class PropertyWriterImpl extends AbstractMemberWriter ...@@ -250,15 +250,15 @@ public class PropertyWriterImpl extends AbstractMemberWriter
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member, protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) { Content tdSummary) {
Content strong = HtmlTree.STRONG(new RawHtml( Content strong = HtmlTree.STRONG(
writer.getDocLink(context, writer.getDocLink(context,
cd, cd,
(MemberDoc) member, (MemberDoc) member,
member.name().substring(0, member.name().lastIndexOf("Property")), member.name().substring(0, member.name().lastIndexOf("Property")),
false, false,
true))); true));
Content code = HtmlTree.CODE(strong); Content code = HtmlTree.CODE(strong);
tdSummary.addContent(code); tdSummary.addContent(code);
...@@ -269,12 +269,12 @@ public class PropertyWriterImpl extends AbstractMemberWriter ...@@ -269,12 +269,12 @@ public class PropertyWriterImpl extends AbstractMemberWriter
*/ */
protected void addInheritedSummaryLink(ClassDoc cd, protected void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member, Content linksTree) { ProgramElementDoc member, Content linksTree) {
linksTree.addContent(new RawHtml( linksTree.addContent(
writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, cd, (MemberDoc)member, writer.getDocLink(LinkInfoImpl.Kind.MEMBER, cd, (MemberDoc)member,
((member.name().lastIndexOf("Property") != -1) && configuration.javafx) ((member.name().lastIndexOf("Property") != -1) && configuration.javafx)
? member.name().substring(0, member.name().length() - "Property".length()) ? member.name().substring(0, member.name().length() - "Property".length())
: member.name(), : member.name(),
false, true))); false, true));
} }
/** /**
...@@ -289,7 +289,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter ...@@ -289,7 +289,7 @@ public class PropertyWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
protected Content getDeprecatedLink(ProgramElementDoc member) { protected Content getDeprecatedLink(ProgramElementDoc member) {
return writer.getDocLink(LinkInfoImpl.CONTEXT_MEMBER, return writer.getDocLink(LinkInfoImpl.Kind.MEMBER,
(MemberDoc) member, ((MethodDoc)member).qualifiedName()); (MemberDoc) member, ((MethodDoc)member).qualifiedName());
} }
......
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -127,29 +127,28 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter ...@@ -127,29 +127,28 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
* @return a content tree for the class header * @return a content tree for the class header
*/ */
public Content getClassHeader(ClassDoc classDoc) { public Content getClassHeader(ClassDoc classDoc) {
String classLink = (classDoc.isPublic() || classDoc.isProtected())? Content classLink = (classDoc.isPublic() || classDoc.isProtected()) ?
getLink(new LinkInfoImpl(configuration, classDoc, getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, classDoc)
configuration.getClassName(classDoc))): .label(configuration.getClassName(classDoc))) :
classDoc.qualifiedName(); new StringContent(classDoc.qualifiedName());
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor( Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
classDoc.qualifiedName())); classDoc.qualifiedName()));
String superClassLink = Content superClassLink =
classDoc.superclassType() != null ? classDoc.superclassType() != null ?
getLink(new LinkInfoImpl(configuration, getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_SERIALIZED_FORM, LinkInfoImpl.Kind.SERIALIZED_FORM,
classDoc.superclassType())) : classDoc.superclassType())) :
null; null;
//Print the heading. //Print the heading.
String className = superClassLink == null ? Content className = superClassLink == null ?
configuration.getText( configuration.getResource(
"doclet.Class_0_implements_serializable", classLink) : "doclet.Class_0_implements_serializable", classLink) :
configuration.getText( configuration.getResource(
"doclet.Class_0_extends_implements_serializable", classLink, "doclet.Class_0_extends_implements_serializable", classLink,
superClassLink); superClassLink);
Content classNameContent = new RawHtml(className);
li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
classNameContent)); className));
return li; return li;
} }
......
/* /*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -58,7 +58,7 @@ public class SourceToHTMLConverter { ...@@ -58,7 +58,7 @@ public class SourceToHTMLConverter {
/** /**
* New line to be added to the documentation. * New line to be added to the documentation.
*/ */
private static final Content NEW_LINE = new RawHtml(DocletConstants.NL); private static final String NEW_LINE = DocletConstants.NL;
private final ConfigurationImpl configuration; private final ConfigurationImpl configuration;
...@@ -269,10 +269,7 @@ public class SourceToHTMLConverter { ...@@ -269,10 +269,7 @@ public class SourceToHTMLConverter {
*/ */
private void addLine(Content pre, String line, int currentLineNo) { private void addLine(Content pre, String line, int currentLineNo) {
if (line != null) { if (line != null) {
StringBuilder lineBuffer = new StringBuilder(line); pre.addContent(Util.replaceTabs(configuration, line));
Util.replaceTabs(configuration, lineBuffer);
Util.escapeHtmlChars(lineBuffer);
pre.addContent(new RawHtml(lineBuffer.toString()));
Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo)); Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
pre.addContent(anchor); pre.addContent(anchor);
pre.addContent(NEW_LINE); pre.addContent(NEW_LINE);
......
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -135,10 +135,8 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter { ...@@ -135,10 +135,8 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
* @return the content tree for the method type link * @return the content tree for the method type link
*/ */
public Content getMethodTypeLinks(MethodTypes methodType) { public Content getMethodTypeLinks(MethodTypes methodType) {
StringBuilder jsShow = new StringBuilder("javascript:show("); String jsShow = "javascript:show(" + methodType.value() +");";
jsShow.append(methodType.value()).append(");"); HtmlTree link = HtmlTree.A(jsShow, new StringContent(methodType.text()));
HtmlTree link = HtmlTree.A(jsShow.toString(),
new StringContent(methodType.text()));
return link; return link;
} }
......
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.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.*;
import com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder; import com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder;
import com.sun.tools.doclets.internal.toolkit.taglets.*; import com.sun.tools.doclets.internal.toolkit.taglets.*;
...@@ -58,39 +63,48 @@ public class TagletWriterImpl extends TagletWriter { ...@@ -58,39 +63,48 @@ public class TagletWriterImpl extends TagletWriter {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput getOutputInstance() { public Content getOutputInstance() {
return new TagletOutputImpl(""); return new ContentBuilder();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput getDocRootOutput() { protected Content codeTagOutput(Tag tag) {
Content result = HtmlTree.CODE(new StringContent(tag.text()));
return result;
}
/**
* {@inheritDoc}
*/
public Content getDocRootOutput() {
String path;
if (configuration.docrootparent.length() > 0) if (configuration.docrootparent.length() > 0)
return new TagletOutputImpl(configuration.docrootparent); path = configuration.docrootparent;
else if (htmlWriter.pathToRoot.isEmpty()) else if (htmlWriter.pathToRoot.isEmpty())
return new TagletOutputImpl("."); path = ".";
else else
return new TagletOutputImpl(htmlWriter.pathToRoot.getPath()); path = htmlWriter.pathToRoot.getPath();
return new StringContent(path);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput deprecatedTagOutput(Doc doc) { public Content deprecatedTagOutput(Doc doc) {
StringBuilder output = new StringBuilder(); ContentBuilder result = new ContentBuilder();
Tag[] deprs = doc.tags("deprecated"); Tag[] deprs = doc.tags("deprecated");
if (doc instanceof ClassDoc) { if (doc instanceof ClassDoc) {
if (Util.isDeprecated((ProgramElementDoc) doc)) { if (Util.isDeprecated((ProgramElementDoc) doc)) {
output.append("<span class=\"strong\">" + result.addContent(HtmlTree.SPAN(HtmlStyle.strong,
configuration. new StringContent(configuration.getText("doclet.Deprecated"))));
getText("doclet.Deprecated") + "</span>&nbsp;"); result.addContent(RawHtml.nbsp);
if (deprs.length > 0) { if (deprs.length > 0) {
Tag[] commentTags = deprs[0].inlineTags(); Tag[] commentTags = deprs[0].inlineTags();
if (commentTags.length > 0) { if (commentTags.length > 0) {
result.addContent(commentTagsToOutput(null, doc,
output.append(commentTagsToOutput(null, doc, deprs[0].inlineTags(), false)
deprs[0].inlineTags(), false).toString()
); );
} }
} }
...@@ -98,24 +112,31 @@ public class TagletWriterImpl extends TagletWriter { ...@@ -98,24 +112,31 @@ public class TagletWriterImpl extends TagletWriter {
} else { } else {
MemberDoc member = (MemberDoc) doc; MemberDoc member = (MemberDoc) doc;
if (Util.isDeprecated((ProgramElementDoc) doc)) { if (Util.isDeprecated((ProgramElementDoc) doc)) {
output.append("<span class=\"strong\">" + result.addContent(HtmlTree.SPAN(HtmlStyle.strong,
configuration. new StringContent(configuration.getText("doclet.Deprecated"))));
getText("doclet.Deprecated") + "</span>&nbsp;"); result.addContent(RawHtml.nbsp);
if (deprs.length > 0) { if (deprs.length > 0) {
output.append("<i>"); Content body = commentTagsToOutput(null, doc,
output.append(commentTagsToOutput(null, doc, deprs[0].inlineTags(), false);
deprs[0].inlineTags(), false).toString()); result.addContent(HtmlTree.I(body));
output.append("</i>");
} }
} else { } else {
if (Util.isDeprecated(member.containingClass())) { if (Util.isDeprecated(member.containingClass())) {
output.append("<span class=\"strong\">" + result.addContent(HtmlTree.SPAN(HtmlStyle.strong,
configuration. new StringContent(configuration.getText("doclet.Deprecated"))));
getText("doclet.Deprecated") + "</span>&nbsp;"); result.addContent(RawHtml.nbsp);
} }
} }
} }
return new TagletOutputImpl(output.toString()); return result;
}
/**
* {@inheritDoc}
*/
protected Content literalTagOutput(Tag tag) {
Content result = new StringContent(tag.text());
return result;
} }
/** /**
...@@ -128,177 +149,200 @@ public class TagletWriterImpl extends TagletWriter { ...@@ -128,177 +149,200 @@ public class TagletWriterImpl extends TagletWriter {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput getParamHeader(String header) { public Content getParamHeader(String header) {
StringBuilder result = new StringBuilder(); HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong,
result.append("<dt>"); new StringContent(header)));
result.append("<span class=\"strong\">").append(header).append("</span></dt>"); return result;
return new TagletOutputImpl(result.toString()); }
/**
* {@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} * {@inheritDoc}
*/ */
public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) { public Content propertyTagOutput(Tag tag, String prefix) {
TagletOutput result = new TagletOutputImpl("<dd><code>" + paramName + "</code>" Content body = new ContentBuilder();
+ " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false) + "</dd>"); body.addContent(new RawHtml(prefix));
body.addContent(" ");
body.addContent(HtmlTree.CODE(new RawHtml(tag.text())));
body.addContent(".");
Content result = HtmlTree.P(body);
return result; return result;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput returnTagOutput(Tag returnTag) { public Content returnTagOutput(Tag returnTag) {
TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<dt>" + ContentBuilder result = new ContentBuilder();
"<span class=\"strong\">" + configuration.getText("doclet.Returns") + result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong,
"</span>" + "</dt>" + "<dd>" + new StringContent(configuration.getText("doclet.Returns")))));
htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(), result.addContent(HtmlTree.DD(htmlWriter.commentTagsToContent(
false) + "</dd>"); returnTag, null, returnTag.inlineTags(), false)));
return result; return result;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput seeTagOutput(Doc holder, SeeTag[] seeTags) { public Content seeTagOutput(Doc holder, SeeTag[] seeTags) {
String result = ""; ContentBuilder body = new ContentBuilder();
if (seeTags.length > 0) { if (seeTags.length > 0) {
result = addSeeHeader(result);
for (int i = 0; i < seeTags.length; ++i) { for (int i = 0; i < seeTags.length; ++i) {
if (i > 0) { appendSeparatorIfNotEmpty(body);
result += ", " + DocletConstants.NL; body.addContent(htmlWriter.seeTagToContent(seeTags[i]));
}
result += htmlWriter.seeTagToString(seeTags[i]);
} }
} }
if (holder.isField() && ((FieldDoc)holder).constantValue() != null && if (holder.isField() && ((FieldDoc)holder).constantValue() != null &&
htmlWriter instanceof ClassWriterImpl) { htmlWriter instanceof ClassWriterImpl) {
//Automatically add link to constant values page for constant fields. //Automatically add link to constant values page for constant fields.
result = addSeeHeader(result); appendSeparatorIfNotEmpty(body);
DocPath constantsPath = DocPath constantsPath =
htmlWriter.pathToRoot.resolve(DocPaths.CONSTANT_VALUES); htmlWriter.pathToRoot.resolve(DocPaths.CONSTANT_VALUES);
String whichConstant = String whichConstant =
((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName() + "." + ((FieldDoc) holder).name(); ((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName() + "." + ((FieldDoc) holder).name();
DocLink link = constantsPath.fragment(whichConstant); DocLink link = constantsPath.fragment(whichConstant);
result += htmlWriter.getHyperLinkString(link, body.addContent(htmlWriter.getHyperLink(link,
configuration.getText("doclet.Constants_Summary"), new StringContent(configuration.getText("doclet.Constants_Summary"))));
false);
} }
if (holder.isClass() && ((ClassDoc)holder).isSerializable()) { if (holder.isClass() && ((ClassDoc)holder).isSerializable()) {
//Automatically add link to serialized form page for serializable classes. //Automatically add link to serialized form page for serializable classes.
if ((SerializedFormBuilder.serialInclude(holder) && if ((SerializedFormBuilder.serialInclude(holder) &&
SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) { SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) {
result = addSeeHeader(result); appendSeparatorIfNotEmpty(body);
DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM); DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM);
DocLink link = serialPath.fragment(((ClassDoc)holder).qualifiedName()); DocLink link = serialPath.fragment(((ClassDoc)holder).qualifiedName());
result += htmlWriter.getHyperLinkString(link, body.addContent(htmlWriter.getHyperLink(link,
configuration.getText("doclet.Serialized_Form"), false); new StringContent(configuration.getText("doclet.Serialized_Form"))));
} }
} }
return result.equals("") ? null : new TagletOutputImpl(result + "</dd>"); if (body.isEmpty())
return body;
ContentBuilder result = new ContentBuilder();
result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong,
new StringContent(configuration.getText("doclet.See_Also")))));
result.addContent(HtmlTree.DD(body));
return result;
} }
private String addSeeHeader(String result) { private void appendSeparatorIfNotEmpty(ContentBuilder body) {
if (result != null && result.length() > 0) { if (!body.isEmpty()) {
return result + ", " + DocletConstants.NL; body.addContent(", ");
} else { body.addContent(DocletConstants.NL);
return "<dt><span class=\"strong\">" +
configuration.getText("doclet.See_Also") + "</span></dt><dd>";
} }
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) { public Content simpleTagOutput(Tag[] simpleTags, String header) {
String result = "<dt><span class=\"strong\">" + header + "</span></dt>" + DocletConstants.NL + ContentBuilder result = new ContentBuilder();
" <dd>"; result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, new RawHtml(header))));
ContentBuilder body = new ContentBuilder();
for (int i = 0; i < simpleTags.length; i++) { for (int i = 0; i < simpleTags.length; i++) {
if (i > 0) { if (i > 0) {
result += ", "; body.addContent(", ");
} }
result += htmlWriter.commentTagsToString(simpleTags[i], null, simpleTags[i].inlineTags(), false); body.addContent(htmlWriter.commentTagsToContent(
simpleTags[i], null, simpleTags[i].inlineTags(), false));
} }
result += "</dd>" + DocletConstants.NL; result.addContent(HtmlTree.DD(body));
return new TagletOutputImpl(result); return result;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput simpleTagOutput(Tag simpleTag, String header) { public Content simpleTagOutput(Tag simpleTag, String header) {
return new TagletOutputImpl("<dt><span class=\"strong\">" + header + "</span></dt>" + " <dd>" ContentBuilder result = new ContentBuilder();
+ htmlWriter.commentTagsToString(simpleTag, null, simpleTag.inlineTags(), false) result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, new RawHtml(header))));
+ "</dd>" + DocletConstants.NL); Content body = htmlWriter.commentTagsToContent(
simpleTag, null, simpleTag.inlineTags(), false);
result.addContent(HtmlTree.DD(body));
return result;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput getThrowsHeader() { public Content getThrowsHeader() {
return new TagletOutputImpl(DocletConstants.NL + "<dt>" + "<span class=\"strong\">" + HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong,
configuration.getText("doclet.Throws") + "</span></dt>"); new StringContent(configuration.getText("doclet.Throws"))));
return result;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput throwsTagOutput(ThrowsTag throwsTag) { public Content throwsTagOutput(ThrowsTag throwsTag) {
String result = DocletConstants.NL + "<dd>"; ContentBuilder body = new ContentBuilder();
result += throwsTag.exceptionType() == null ? Content excName = (throwsTag.exceptionType() == null) ?
htmlWriter.codeText(throwsTag.exceptionName()) : new RawHtml(throwsTag.exceptionName()) :
htmlWriter.codeText( htmlWriter.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER,
htmlWriter.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_MEMBER, throwsTag.exceptionType()));
throwsTag.exceptionType()))); body.addContent(HtmlTree.CODE(excName));
TagletOutput text = new TagletOutputImpl( Content desc = htmlWriter.commentTagsToContent(throwsTag, null,
htmlWriter.commentTagsToString(throwsTag, null, throwsTag.inlineTags(), false);
throwsTag.inlineTags(), false)); if (desc != null && !desc.isEmpty()) {
if (text != null && text.toString().length() > 0) { body.addContent(" - ");
result += " - " + text; body.addContent(desc);
} }
result += "</dd>"; HtmlTree result = HtmlTree.DD(body);
return new TagletOutputImpl(result); return result;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput throwsTagOutput(Type throwsType) { public Content throwsTagOutput(Type throwsType) {
return new TagletOutputImpl(DocletConstants.NL + "<dd>" + HtmlTree result = HtmlTree.DD(HtmlTree.CODE(htmlWriter.getLink(
htmlWriter.codeText(htmlWriter.getLink( new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, throwsType))));
new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_MEMBER, throwsType))) + "</dd>"); return result;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput valueTagOutput(FieldDoc field, String constantVal, public Content valueTagOutput(FieldDoc field, String constantVal,
boolean includeLink) { boolean includeLink) {
return new TagletOutputImpl(includeLink ? return includeLink ?
htmlWriter.getDocLink(LinkInfoImpl.CONTEXT_VALUE_TAG, field, htmlWriter.getDocLink(LinkInfoImpl.Kind.VALUE_TAG, field,
constantVal, false) : constantVal); constantVal, false) : new RawHtml(constantVal);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput commentTagsToOutput(Tag holderTag, Tag[] tags) { public Content commentTagsToOutput(Tag holderTag, Tag[] tags) {
return commentTagsToOutput(holderTag, null, tags, false); return commentTagsToOutput(holderTag, null, tags, false);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput commentTagsToOutput(Doc holderDoc, Tag[] tags) { public Content commentTagsToOutput(Doc holderDoc, Tag[] tags) {
return commentTagsToOutput(null, holderDoc, tags, false); return commentTagsToOutput(null, holderDoc, tags, false);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput commentTagsToOutput(Tag holderTag, public Content commentTagsToOutput(Tag holderTag,
Doc holderDoc, Tag[] tags, boolean isFirstSentence) { Doc holderDoc, Tag[] tags, boolean isFirstSentence) {
return new TagletOutputImpl(htmlWriter.commentTagsToString( return htmlWriter.commentTagsToContent(
holderTag, holderDoc, tags, isFirstSentence)); holderTag, holderDoc, tags, isFirstSentence);
} }
/** /**
...@@ -307,13 +351,4 @@ public class TagletWriterImpl extends TagletWriter { ...@@ -307,13 +351,4 @@ public class TagletWriterImpl extends TagletWriter {
public Configuration configuration() { public Configuration configuration() {
return configuration; return configuration;
} }
/**
* Return an instance of a TagletWriter that knows how to write HTML.
*
* @return an instance of a TagletWriter that knows how to write HTML.
*/
public TagletOutput getTagletOutputInstance() {
return new TagletOutputImpl("");
}
} }
...@@ -23,84 +23,75 @@ ...@@ -23,84 +23,75 @@
* questions. * questions.
*/ */
package com.sun.tools.doclets.internal.toolkit.taglets; package com.sun.tools.doclets.formats.html.markup;
import java.util.Map; import java.io.IOException;
import java.io.Writer;
import com.sun.tools.doclets.Taglet; import java.util.ArrayList;
import com.sun.javadoc.Tag; import java.util.Collections;
import java.util.List;
import com.sun.tools.doclets.internal.toolkit.Content;
/** /**
* An inline Taglet used to denote information for experts. * A sequence of Content nodes.
*
* <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 ExpertTaglet implements Taglet { public class ContentBuilder extends Content {
protected List<Content> contents = Collections.<Content>emptyList();
private static final String NAME = "expert";
private static final String START_TAG = "<sub id=\"expert\">"; @Override
private static final String END_TAG = "</sub>"; public void addContent(Content content) {
nullCheck(content);
/** if ((content instanceof ContentBuilder) && content.isEmpty())
* {@inheritDoc} return;
*/ ensureMutableContents();
public boolean inField() { if (content instanceof ContentBuilder) {
return true; contents.addAll(((ContentBuilder) content).contents);
} } else
contents.add(content);
public boolean inConstructor() {
return true;
} }
public boolean inMethod() { @Override
return true; public void addContent(String text) {
} if (text.isEmpty())
return;
public boolean inOverview() { ensureMutableContents();
return true; 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);
} }
public boolean inPackage() { @Override
return true; public boolean write(Writer writer, boolean atNewline) throws IOException {
for (Content content: contents) {
atNewline = content.write(writer, atNewline);
}
return atNewline;
} }
public boolean inType() { @Override
public boolean isEmpty() {
for (Content content: contents) {
if (!content.isEmpty())
return false;
}
return true; return true;
} }
public boolean isInlineTag() { @Override
return false; public int charCount() {
} int n = 0;
for (Content c : contents)
public String getName() { n += c.charCount();
return NAME; return n;
}
public static void register(Map<String, Taglet> map) {
map.remove(NAME);
map.put(NAME, new ExpertTaglet());
} }
public String toString(Tag tag) { private void ensureMutableContents() {
return (tag.text() == null || tag.text().length() == 0) ? null : if (contents.isEmpty())
START_TAG + LiteralTaglet.textToString(tag.text()) + END_TAG; contents = new ArrayList<Content>();
} }
public String toString(Tag[] tags) {
if (tags == null || tags.length == 0) return null;
StringBuffer sb = new StringBuffer(START_TAG);
for(Tag t:tags) {
sb.append(LiteralTaglet.textToString(t.text()));
}
sb.append(END_TAG);
return sb.toString();
}
} }
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -34,7 +34,6 @@ import com.sun.tools.doclets.internal.toolkit.*; ...@@ -34,7 +34,6 @@ import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.DocFile; 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.DocLink;
import com.sun.tools.doclets.internal.toolkit.util.DocPath; import com.sun.tools.doclets.internal.toolkit.util.DocPath;
import com.sun.tools.doclets.internal.toolkit.util.DocPaths;
/** /**
...@@ -72,43 +71,8 @@ public abstract class HtmlDocWriter extends HtmlWriter { ...@@ -72,43 +71,8 @@ public abstract class HtmlDocWriter extends HtmlWriter {
*/ */
public abstract Configuration configuration(); public abstract Configuration configuration();
/** public Content getHyperLink(DocPath link, String label) {
* Return Html Hyper Link string. return getHyperLink(link, new StringContent(label), false, "", "", "");
*
* @param link String name of the file.
* @param label Tag for the link.
* @param strong Boolean that sets label to strong.
* @return String Hyper Link.
*/
public String getHyperLinkString(DocPath link,
String label, boolean strong) {
return getHyperLinkString(link, label, strong, "", "", "");
}
public String getHyperLinkString(DocLink link,
String label, boolean strong) {
return getHyperLinkString(link, label, strong, "", "", "");
}
/**
* Get Html Hyper Link string.
*
* @param link String name of the file.
* @param label Tag for the link.
* @param strong Boolean that sets label to strong.
* @param stylename String style of text defined in style sheet.
* @return String Hyper Link.
*/
public String getHyperLinkString(DocPath link,
String label, boolean strong,
String stylename) {
return getHyperLinkString(link, label, strong, stylename, "", "");
}
public String getHyperLinkString(DocLink link,
String label, boolean strong,
String stylename) {
return getHyperLinkString(link, label, strong, stylename, "", "");
} }
/** /**
...@@ -125,69 +89,47 @@ public abstract class HtmlDocWriter extends HtmlWriter { ...@@ -125,69 +89,47 @@ public abstract class HtmlDocWriter extends HtmlWriter {
} }
/** /**
* Get Html Hyper Link string. * Get Html hyperlink.
* *
* @param link String name of the file. * @param link path of the file.
* @param label Tag for the link. * @param label Tag for the link.
* @return a content tree for the hyper link * @return a content tree for the hyper link
*/ */
public Content getHyperLink(DocPath link, public Content getHyperLink(DocPath link, Content label) {
Content label) {
return getHyperLink(link, label, "", ""); return getHyperLink(link, label, "", "");
} }
public Content getHyperLink(DocLink link, public Content getHyperLink(DocLink link, Content label) {
Content label) {
return getHyperLink(link, label, "", ""); return getHyperLink(link, label, "", "");
} }
/** public Content getHyperLink(DocPath link,
* Get Html Hyper Link string. Content label, boolean strong,
*
* @param link String name of the file.
* @param label Tag for the link.
* @param strong Boolean that sets label to strong.
* @param stylename String style of text defined in style sheet.
* @param title String that describes the links content for accessibility.
* @param target Target frame.
* @return String Hyper Link.
*/
public String getHyperLinkString(DocPath link,
String label, boolean strong,
String stylename, String title, String target) { String stylename, String title, String target) {
return getHyperLinkString(new DocLink(link), label, strong, return getHyperLink(new DocLink(link), label, strong,
stylename, title, target); stylename, title, target);
} }
public String getHyperLinkString(DocLink link, public Content getHyperLink(DocLink link,
String label, boolean strong, Content label, boolean strong,
String stylename, String title, String target) { String stylename, String title, String target) {
StringBuilder retlink = new StringBuilder(); Content body = label;
retlink.append("<a href=\"").append(link).append('"'); if (strong) {
if (title != null && title.length() != 0) { body = HtmlTree.SPAN(HtmlStyle.strong, body);
retlink.append(" title=\"").append(title).append('"');
}
if (target != null && target.length() != 0) {
retlink.append(" target=\"").append(target).append('"');
} }
retlink.append(">");
if (stylename != null && stylename.length() != 0) { if (stylename != null && stylename.length() != 0) {
retlink.append("<FONT CLASS=\""); HtmlTree t = new HtmlTree(HtmlTag.FONT, body);
retlink.append(stylename); t.addAttr(HtmlAttr.CLASS, stylename);
retlink.append("\">"); body = t;
}
if (strong) {
retlink.append("<span class=\"strong\">");
} }
retlink.append(label); HtmlTree l = HtmlTree.A(link.toString(), body);
if (strong) { if (title != null && title.length() != 0) {
retlink.append("</span>"); l.addAttr(HtmlAttr.TITLE, title);
} }
if (stylename != null && stylename.length() != 0) { if (target != null && target.length() != 0) {
retlink.append("</FONT>"); l.addAttr(HtmlAttr.TARGET, target);
} }
retlink.append("</a>"); return l;
return retlink.toString();
} }
/** /**
...@@ -216,17 +158,6 @@ public abstract class HtmlDocWriter extends HtmlWriter { ...@@ -216,17 +158,6 @@ public abstract class HtmlDocWriter extends HtmlWriter {
return anchor; return anchor;
} }
/**
* Get link string without positioning in the file.
*
* @param link String name of the file.
* @param label Tag for the link.
* @return Strign Hyper link.
*/
public String getHyperLinkString(DocPath link, String label) {
return getHyperLinkString(link, label, false);
}
/** /**
* Get the name of the package, this class is in. * Get the name of the package, this class is in.
* *
...@@ -277,20 +208,6 @@ public abstract class HtmlDocWriter extends HtmlWriter { ...@@ -277,20 +208,6 @@ public abstract class HtmlDocWriter extends HtmlWriter {
write(htmlDocument); write(htmlDocument);
} }
/**
* Print the appropriate spaces to format the class tree in the class page.
*
* @param len Number of spaces.
*/
public String spaces(int len) {
String space = "";
for (int i = 0; i < len; i++) {
space += " ";
}
return space;
}
protected String getGeneratedByString() { protected String getGeneratedByString() {
Calendar calendar = new GregorianCalendar(TimeZone.getDefault()); Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
Date today = calendar.getTime(); Date today = calendar.getTime();
......
/* /*
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -44,6 +44,7 @@ public enum HtmlTag { ...@@ -44,6 +44,7 @@ public enum HtmlTag {
CENTER, CENTER,
CODE(BlockType.INLINE, EndTag.END), CODE(BlockType.INLINE, EndTag.END),
DD, DD,
DIR,
DIV, DIV,
DL, DL,
DT, DT,
...@@ -63,6 +64,7 @@ public enum HtmlTag { ...@@ -63,6 +64,7 @@ public enum HtmlTag {
I(BlockType.INLINE, EndTag.END), I(BlockType.INLINE, EndTag.END),
IMG(BlockType.INLINE, EndTag.NOEND), IMG(BlockType.INLINE, EndTag.NOEND),
LI, LI,
LISTING,
LINK(BlockType.OTHER, EndTag.NOEND), LINK(BlockType.OTHER, EndTag.NOEND),
MENU, MENU,
META(BlockType.OTHER, EndTag.NOEND), META(BlockType.OTHER, EndTag.NOEND),
...@@ -75,6 +77,7 @@ public enum HtmlTag { ...@@ -75,6 +77,7 @@ public enum HtmlTag {
SMALL(BlockType.INLINE, EndTag.END), SMALL(BlockType.INLINE, EndTag.END),
SPAN(BlockType.INLINE, EndTag.END), SPAN(BlockType.INLINE, EndTag.END),
STRONG(BlockType.INLINE, EndTag.END), STRONG(BlockType.INLINE, EndTag.END),
SUB(BlockType.INLINE, EndTag.END),
TABLE, TABLE,
TBODY, TBODY,
TD, TD,
...@@ -84,14 +87,14 @@ public enum HtmlTag { ...@@ -84,14 +87,14 @@ public enum HtmlTag {
TT(BlockType.INLINE, EndTag.END), TT(BlockType.INLINE, EndTag.END),
UL; UL;
protected final BlockType blockType; public final BlockType blockType;
protected final EndTag endTag; public final EndTag endTag;
private final String value; public final String value;
/** /**
* Enum representing the type of HTML element. * Enum representing the type of HTML element.
*/ */
protected static enum BlockType { public static enum BlockType {
BLOCK, BLOCK,
INLINE, INLINE,
OTHER; OTHER;
...@@ -100,7 +103,7 @@ public enum HtmlTag { ...@@ -100,7 +103,7 @@ public enum HtmlTag {
/** /**
* Enum representing HTML end tag requirement. * Enum representing HTML end tag requirement.
*/ */
protected static enum EndTag { public static enum EndTag {
END, END,
NOEND; NOEND;
} }
......
/* /*
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -78,8 +78,12 @@ public class HtmlTree extends Content { ...@@ -78,8 +78,12 @@ public class HtmlTree extends Content {
*/ */
public void addAttr(HtmlAttr attrName, String attrValue) { public void addAttr(HtmlAttr attrName, String attrValue) {
if (attrs.isEmpty()) if (attrs.isEmpty())
attrs = new LinkedHashMap<HtmlAttr,String>(); attrs = new LinkedHashMap<HtmlAttr,String>(3);
attrs.put(nullCheck(attrName), nullCheck(attrValue)); attrs.put(nullCheck(attrName), escapeHtmlChars(attrValue));
}
public void setTitle(Content body) {
addAttr(HtmlAttr.TITLE, stripHtml(body));
} }
/** /**
...@@ -123,6 +127,42 @@ public class HtmlTree extends Content { ...@@ -123,6 +127,42 @@ public class HtmlTree extends Content {
addContent(new StringContent(stringContent)); 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("&lt;"); break;
case '>': sb.append("&gt;"); break;
case '&': sb.append("&amp;"); break;
default: sb.append(ch); break;
}
}
return sb.toString();
}
}
return s;
}
/** /**
* Generates an HTML anchor tag. * Generates an HTML anchor tag.
* *
...@@ -132,7 +172,7 @@ public class HtmlTree extends Content { ...@@ -132,7 +172,7 @@ public class HtmlTree extends Content {
*/ */
public static HtmlTree A(String ref, Content body) { public static HtmlTree A(String ref, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body)); HtmlTree htmltree = new HtmlTree(HtmlTag.A, nullCheck(body));
htmltree.addAttr(HtmlAttr.HREF, nullCheck(ref)); htmltree.addAttr(HtmlAttr.HREF, ref);
return htmltree; return htmltree;
} }
...@@ -317,7 +357,7 @@ public class HtmlTree extends Content { ...@@ -317,7 +357,7 @@ public class HtmlTree extends Content {
HtmlStyle styleClass, Content body) { HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body)); HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body));
if (printTitle) if (printTitle)
htmltree.addAttr(HtmlAttr.TITLE, Util.stripHtml(body.toString())); htmltree.setTitle(body);
if (styleClass != null) if (styleClass != null)
htmltree.addStyle(styleClass); htmltree.addStyle(styleClass);
return htmltree; return htmltree;
...@@ -802,7 +842,7 @@ public class HtmlTree extends Content { ...@@ -802,7 +842,7 @@ public class HtmlTree extends Content {
out.write(tagString); out.write(tagString);
Iterator<HtmlAttr> iterator = attrs.keySet().iterator(); Iterator<HtmlAttr> iterator = attrs.keySet().iterator();
HtmlAttr key; HtmlAttr key;
String value = ""; String value;
while (iterator.hasNext()) { while (iterator.hasNext()) {
key = iterator.next(); key = iterator.next();
value = attrs.get(key); value = attrs.get(key);
...@@ -830,4 +870,22 @@ public class HtmlTree extends Content { ...@@ -830,4 +870,22 @@ public class HtmlTree extends Content {
return false; 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();
}
} }
...@@ -27,6 +27,8 @@ package com.sun.tools.doclets.formats.html.markup; ...@@ -27,6 +27,8 @@ package com.sun.tools.doclets.formats.html.markup;
import java.io.*; import java.io.*;
import java.util.*; 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.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
...@@ -195,8 +197,7 @@ public class HtmlWriter { ...@@ -195,8 +197,7 @@ public class HtmlWriter {
configuration.getText("doclet.Modifier"), configuration.getText("doclet.Modifier"),
configuration.getText("doclet.Type")); configuration.getText("doclet.Type"));
overviewLabel = getResource("doclet.Overview"); overviewLabel = getResource("doclet.Overview");
defaultPackageLabel = new RawHtml( defaultPackageLabel = new StringContent(DocletConstants.DEFAULT_PACKAGE_NAME);
DocletConstants.DEFAULT_PACKAGE_NAME);
packageLabel = getResource("doclet.Package"); packageLabel = getResource("doclet.Package");
profileLabel = getResource("doclet.Profile"); profileLabel = getResource("doclet.Profile");
useLabel = getResource("doclet.navClassUse"); useLabel = getResource("doclet.navClassUse");
...@@ -252,30 +253,30 @@ public class HtmlWriter { ...@@ -252,30 +253,30 @@ public class HtmlWriter {
* @return a content tree for the text * @return a content tree for the text
*/ */
public Content getResource(String key) { public Content getResource(String key) {
return new StringContent(configuration.getText(key)); return configuration.getResource(key);
} }
/** /**
* Get the configuration string as a content. * Get the configuration string as a content.
* *
* @param key the key to look for in the configuration file * @param key the key to look for in the configuration file
* @param a1 string argument added to configuration text * @param o string or content argument added to configuration text
* @return a content tree for the text * @return a content tree for the text
*/ */
public Content getResource(String key, String a1) { public Content getResource(String key, Object o) {
return new RawHtml(configuration.getText(key, a1)); return configuration.getResource(key, o);
} }
/** /**
* Get the configuration string as a content. * Get the configuration string as a content.
* *
* @param key the key to look for in the configuration file * @param key the key to look for in the configuration file
* @param a1 string argument added to configuration text * @param o1 string or content argument added to configuration text
* @param a2 string argument added to configuration text * @param o2 string or content argument added to configuration text
* @return a content tree for the text * @return a content tree for the text
*/ */
public Content getResource(String key, String a1, String a2) { public Content getResource(String key, Object o0, Object o1) {
return new RawHtml(configuration.getText(key, a1, a2)); return configuration.getResource(key, o0, o1);
} }
/** /**
...@@ -303,10 +304,11 @@ public class HtmlWriter { ...@@ -303,10 +304,11 @@ public class HtmlWriter {
* *
* @return a content for the SCRIPT tag * @return a content for the SCRIPT tag
*/ */
protected Content getFramesetJavaScript(){ protected Content getFramesetJavaScript() {
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT); HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
script.addAttr(HtmlAttr.TYPE, "text/javascript"); script.addAttr(HtmlAttr.TYPE, "text/javascript");
String scriptCode = DocletConstants.NL + " targetPage = \"\" + window.location.search;" + DocletConstants.NL + String scriptCode = DocletConstants.NL +
" targetPage = \"\" + window.location.search;" + DocletConstants.NL +
" if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL + " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
" targetPage = targetPage.substring(1);" + DocletConstants.NL + " targetPage = targetPage.substring(1);" + DocletConstants.NL +
" if (targetPage.indexOf(\":\") != -1)" + DocletConstants.NL + " if (targetPage.indexOf(\":\") != -1)" + DocletConstants.NL +
...@@ -400,16 +402,6 @@ public class HtmlWriter { ...@@ -400,16 +402,6 @@ public class HtmlWriter {
return title; return title;
} }
/**
* Return, text passed, with Italics &lt;i&gt; and &lt;/i&gt; tags, surrounding it.
* So if the text passed is "Hi", then string returned will be "&lt;i&gt;Hi&lt;/i&gt;".
*
* @param text String to be printed in between &lt;I&gt; and &lt;/I&gt; tags.
*/
public String italicsText(String text) {
return "<i>" + text + "</i>";
}
public String codeText(String text) { public String codeText(String text) {
return "<code>" + text + "</code>"; return "<code>" + text + "</code>";
} }
......
/* /*
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -41,7 +41,7 @@ import com.sun.tools.doclets.internal.toolkit.util.*; ...@@ -41,7 +41,7 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
* *
* @author Bhavesh Patel * @author Bhavesh Patel
*/ */
public class RawHtml extends Content{ public class RawHtml extends Content {
private String rawHtmlContent; private String rawHtmlContent;
...@@ -90,10 +90,65 @@ public class RawHtml extends Content{ ...@@ -90,10 +90,65 @@ public class RawHtml extends Content{
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override
public String toString() { public String toString() {
return rawHtmlContent; 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} * {@inheritDoc}
*/ */
......
...@@ -132,7 +132,7 @@ doclet.Help_line_13=Each summary entry contains the first sentence from the deta ...@@ -132,7 +132,7 @@ doclet.Help_line_13=Each summary entry contains the first sentence from the deta
doclet.Help_line_14=Use 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_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_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 <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>. 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_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_19=When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
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_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.
...@@ -179,7 +179,7 @@ doclet.ClassUse_ConstructorArgsTypeParameters=Constructor parameters in {1} with ...@@ -179,7 +179,7 @@ doclet.ClassUse_ConstructorArgsTypeParameters=Constructor parameters in {1} with
doclet.ClassUse_ConstructorThrows=Constructors in {1} that throw {0} doclet.ClassUse_ConstructorThrows=Constructors in {1} that throw {0}
doclet.ClassUse_No.usage.of.0=No usage of {0} doclet.ClassUse_No.usage.of.0=No usage of {0}
doclet.Window_ClassUse_Header=Uses of {0} {1} doclet.Window_ClassUse_Header=Uses of {0} {1}
doclet.ClassUse_Title=Uses of {0}<br>{1} doclet.ClassUse_Title=Uses of {0}
doclet.navClassUse=Use doclet.navClassUse=Use
doclet.Error_in_packagelist=Error in using -group option: {0} {1} doclet.Error_in_packagelist=Error in using -group option: {0} {1}
doclet.Groupname_already_used=In -group option, groupname already used: {0} doclet.Groupname_already_used=In -group option, groupname already used: {0}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册