1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Tue May 14 10:14:56 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Tue May 14 10:14:57 2013 -0700 1.3 @@ -27,9 +27,7 @@ 1.4 1.5 import com.sun.javadoc.*; 1.6 import com.sun.tools.doclets.formats.html.markup.ContentBuilder; 1.7 -import com.sun.tools.doclets.formats.html.markup.HtmlAttr; 1.8 import com.sun.tools.doclets.formats.html.markup.HtmlStyle; 1.9 -import com.sun.tools.doclets.formats.html.markup.HtmlTag; 1.10 import com.sun.tools.doclets.formats.html.markup.HtmlTree; 1.11 import com.sun.tools.doclets.formats.html.markup.RawHtml; 1.12 import com.sun.tools.doclets.formats.html.markup.StringContent; 1.13 @@ -65,34 +63,36 @@ 1.14 /** 1.15 * {@inheritDoc} 1.16 */ 1.17 - public TagletOutput getOutputInstance() { 1.18 - return new TagletOutputImpl(); 1.19 + public Content getOutputInstance() { 1.20 + return new ContentBuilder(); 1.21 } 1.22 1.23 /** 1.24 * {@inheritDoc} 1.25 */ 1.26 - protected TagletOutput codeTagOutput(Tag tag) { 1.27 + protected Content codeTagOutput(Tag tag) { 1.28 Content result = HtmlTree.CODE(new StringContent(tag.text())); 1.29 - return new TagletOutputImpl(result); 1.30 + return result; 1.31 } 1.32 1.33 /** 1.34 * {@inheritDoc} 1.35 */ 1.36 - public TagletOutput getDocRootOutput() { 1.37 + public Content getDocRootOutput() { 1.38 + String path; 1.39 if (configuration.docrootparent.length() > 0) 1.40 - return new TagletOutputImpl(configuration.docrootparent); 1.41 + path = configuration.docrootparent; 1.42 else if (htmlWriter.pathToRoot.isEmpty()) 1.43 - return new TagletOutputImpl("."); 1.44 + path = "."; 1.45 else 1.46 - return new TagletOutputImpl(htmlWriter.pathToRoot.getPath()); 1.47 + path = htmlWriter.pathToRoot.getPath(); 1.48 + return new StringContent(path); 1.49 } 1.50 1.51 /** 1.52 * {@inheritDoc} 1.53 */ 1.54 - public TagletOutput deprecatedTagOutput(Doc doc) { 1.55 + public Content deprecatedTagOutput(Doc doc) { 1.56 ContentBuilder result = new ContentBuilder(); 1.57 Tag[] deprs = doc.tags("deprecated"); 1.58 if (doc instanceof ClassDoc) { 1.59 @@ -104,7 +104,7 @@ 1.60 Tag[] commentTags = deprs[0].inlineTags(); 1.61 if (commentTags.length > 0) { 1.62 result.addContent(commentTagsToOutput(null, doc, 1.63 - deprs[0].inlineTags(), false).getContent() 1.64 + deprs[0].inlineTags(), false) 1.65 ); 1.66 } 1.67 } 1.68 @@ -116,9 +116,9 @@ 1.69 new StringContent(configuration.getText("doclet.Deprecated")))); 1.70 result.addContent(RawHtml.nbsp); 1.71 if (deprs.length > 0) { 1.72 - TagletOutputImpl body = commentTagsToOutput(null, doc, 1.73 + Content body = commentTagsToOutput(null, doc, 1.74 deprs[0].inlineTags(), false); 1.75 - result.addContent(HtmlTree.I(body.getContent())); 1.76 + result.addContent(HtmlTree.I(body)); 1.77 } 1.78 } else { 1.79 if (Util.isDeprecated(member.containingClass())) { 1.80 @@ -128,15 +128,15 @@ 1.81 } 1.82 } 1.83 } 1.84 - return new TagletOutputImpl(result); 1.85 + return result; 1.86 } 1.87 1.88 /** 1.89 * {@inheritDoc} 1.90 */ 1.91 - protected TagletOutput literalTagOutput(Tag tag) { 1.92 + protected Content literalTagOutput(Tag tag) { 1.93 Content result = new StringContent(tag.text()); 1.94 - return new TagletOutputImpl(result); 1.95 + return result; 1.96 } 1.97 1.98 /** 1.99 @@ -149,53 +149,53 @@ 1.100 /** 1.101 * {@inheritDoc} 1.102 */ 1.103 - public TagletOutput getParamHeader(String header) { 1.104 + public Content getParamHeader(String header) { 1.105 HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, 1.106 new StringContent(header))); 1.107 - return new TagletOutputImpl(result); 1.108 + return result; 1.109 } 1.110 1.111 /** 1.112 * {@inheritDoc} 1.113 */ 1.114 - public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) { 1.115 + public Content paramTagOutput(ParamTag paramTag, String paramName) { 1.116 ContentBuilder body = new ContentBuilder(); 1.117 body.addContent(HtmlTree.CODE(new RawHtml(paramName))); 1.118 body.addContent(" - "); 1.119 body.addContent(htmlWriter.commentTagsToContent(paramTag, null, paramTag.inlineTags(), false)); 1.120 HtmlTree result = HtmlTree.DD(body); 1.121 - return new TagletOutputImpl(result); 1.122 + return result; 1.123 } 1.124 1.125 /** 1.126 * {@inheritDoc} 1.127 */ 1.128 - public TagletOutput propertyTagOutput(Tag tag, String prefix) { 1.129 + public Content propertyTagOutput(Tag tag, String prefix) { 1.130 Content body = new ContentBuilder(); 1.131 body.addContent(new RawHtml(prefix)); 1.132 body.addContent(" "); 1.133 body.addContent(HtmlTree.CODE(new RawHtml(tag.text()))); 1.134 body.addContent("."); 1.135 Content result = HtmlTree.P(body); 1.136 - return new TagletOutputImpl(result); 1.137 + return result; 1.138 } 1.139 1.140 /** 1.141 * {@inheritDoc} 1.142 */ 1.143 - public TagletOutput returnTagOutput(Tag returnTag) { 1.144 + public Content returnTagOutput(Tag returnTag) { 1.145 ContentBuilder result = new ContentBuilder(); 1.146 result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, 1.147 new StringContent(configuration.getText("doclet.Returns"))))); 1.148 result.addContent(HtmlTree.DD(htmlWriter.commentTagsToContent( 1.149 returnTag, null, returnTag.inlineTags(), false))); 1.150 - return new TagletOutputImpl(result); 1.151 + return result; 1.152 } 1.153 1.154 /** 1.155 * {@inheritDoc} 1.156 */ 1.157 - public TagletOutput seeTagOutput(Doc holder, SeeTag[] seeTags) { 1.158 + public Content seeTagOutput(Doc holder, SeeTag[] seeTags) { 1.159 ContentBuilder body = new ContentBuilder(); 1.160 if (seeTags.length > 0) { 1.161 for (int i = 0; i < seeTags.length; ++i) { 1.162 @@ -227,13 +227,13 @@ 1.163 } 1.164 } 1.165 if (body.isEmpty()) 1.166 - return new TagletOutputImpl(body); 1.167 + return body; 1.168 1.169 ContentBuilder result = new ContentBuilder(); 1.170 result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, 1.171 new StringContent(configuration.getText("doclet.See_Also"))))); 1.172 result.addContent(HtmlTree.DD(body)); 1.173 - return new TagletOutputImpl(result); 1.174 + return result; 1.175 1.176 } 1.177 1.178 @@ -247,7 +247,7 @@ 1.179 /** 1.180 * {@inheritDoc} 1.181 */ 1.182 - public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) { 1.183 + public Content simpleTagOutput(Tag[] simpleTags, String header) { 1.184 ContentBuilder result = new ContentBuilder(); 1.185 result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, new RawHtml(header)))); 1.186 ContentBuilder body = new ContentBuilder(); 1.187 @@ -259,34 +259,34 @@ 1.188 simpleTags[i], null, simpleTags[i].inlineTags(), false)); 1.189 } 1.190 result.addContent(HtmlTree.DD(body)); 1.191 - return new TagletOutputImpl(result); 1.192 + return result; 1.193 } 1.194 1.195 /** 1.196 * {@inheritDoc} 1.197 */ 1.198 - public TagletOutput simpleTagOutput(Tag simpleTag, String header) { 1.199 + public Content simpleTagOutput(Tag simpleTag, String header) { 1.200 ContentBuilder result = new ContentBuilder(); 1.201 result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, new RawHtml(header)))); 1.202 Content body = htmlWriter.commentTagsToContent( 1.203 simpleTag, null, simpleTag.inlineTags(), false); 1.204 result.addContent(HtmlTree.DD(body)); 1.205 - return new TagletOutputImpl(result); 1.206 + return result; 1.207 } 1.208 1.209 /** 1.210 * {@inheritDoc} 1.211 */ 1.212 - public TagletOutput getThrowsHeader() { 1.213 + public Content getThrowsHeader() { 1.214 HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, 1.215 new StringContent(configuration.getText("doclet.Throws")))); 1.216 - return new TagletOutputImpl(result); 1.217 + return result; 1.218 } 1.219 1.220 /** 1.221 * {@inheritDoc} 1.222 */ 1.223 - public TagletOutput throwsTagOutput(ThrowsTag throwsTag) { 1.224 + public Content throwsTagOutput(ThrowsTag throwsTag) { 1.225 ContentBuilder body = new ContentBuilder(); 1.226 Content excName = (throwsTag.exceptionType() == null) ? 1.227 new RawHtml(throwsTag.exceptionName()) : 1.228 @@ -299,50 +299,50 @@ 1.229 body.addContent(" - "); 1.230 body.addContent(desc); 1.231 } 1.232 - HtmlTree res2 = HtmlTree.DD(body); 1.233 - return new TagletOutputImpl(res2); 1.234 + HtmlTree result = HtmlTree.DD(body); 1.235 + return result; 1.236 } 1.237 1.238 /** 1.239 * {@inheritDoc} 1.240 */ 1.241 - public TagletOutput throwsTagOutput(Type throwsType) { 1.242 + public Content throwsTagOutput(Type throwsType) { 1.243 HtmlTree result = HtmlTree.DD(HtmlTree.CODE(htmlWriter.getLink( 1.244 new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, throwsType)))); 1.245 - return new TagletOutputImpl(result); 1.246 + return result; 1.247 } 1.248 1.249 /** 1.250 * {@inheritDoc} 1.251 */ 1.252 - public TagletOutput valueTagOutput(FieldDoc field, String constantVal, 1.253 + public Content valueTagOutput(FieldDoc field, String constantVal, 1.254 boolean includeLink) { 1.255 - return new TagletOutputImpl(includeLink ? 1.256 + return includeLink ? 1.257 htmlWriter.getDocLink(LinkInfoImpl.Kind.VALUE_TAG, field, 1.258 - constantVal, false) : new RawHtml(constantVal)); 1.259 + constantVal, false) : new RawHtml(constantVal); 1.260 } 1.261 1.262 /** 1.263 * {@inheritDoc} 1.264 */ 1.265 - public TagletOutputImpl commentTagsToOutput(Tag holderTag, Tag[] tags) { 1.266 + public Content commentTagsToOutput(Tag holderTag, Tag[] tags) { 1.267 return commentTagsToOutput(holderTag, null, tags, false); 1.268 } 1.269 1.270 /** 1.271 * {@inheritDoc} 1.272 */ 1.273 - public TagletOutputImpl commentTagsToOutput(Doc holderDoc, Tag[] tags) { 1.274 + public Content commentTagsToOutput(Doc holderDoc, Tag[] tags) { 1.275 return commentTagsToOutput(null, holderDoc, tags, false); 1.276 } 1.277 1.278 /** 1.279 * {@inheritDoc} 1.280 */ 1.281 - public TagletOutputImpl commentTagsToOutput(Tag holderTag, 1.282 + public Content commentTagsToOutput(Tag holderTag, 1.283 Doc holderDoc, Tag[] tags, boolean isFirstSentence) { 1.284 - return new TagletOutputImpl(htmlWriter.commentTagsToContent( 1.285 - holderTag, holderDoc, tags, isFirstSentence)); 1.286 + return htmlWriter.commentTagsToContent( 1.287 + holderTag, holderDoc, tags, isFirstSentence); 1.288 } 1.289 1.290 /**