88 |
91 |
89 /** |
92 /** |
90 * {@inheritDoc} |
93 * {@inheritDoc} |
91 */ |
94 */ |
92 public TagletOutput deprecatedTagOutput(Doc doc) { |
95 public TagletOutput deprecatedTagOutput(Doc doc) { |
93 StringBuilder output = new StringBuilder(); |
96 ContentBuilder result = new ContentBuilder(); |
94 Tag[] deprs = doc.tags("deprecated"); |
97 Tag[] deprs = doc.tags("deprecated"); |
95 if (doc instanceof ClassDoc) { |
98 if (doc instanceof ClassDoc) { |
96 if (Util.isDeprecated((ProgramElementDoc) doc)) { |
99 if (Util.isDeprecated((ProgramElementDoc) doc)) { |
97 output.append("<span class=\"strong\">" + |
100 result.addContent(HtmlTree.SPAN(HtmlStyle.strong, |
98 configuration. |
101 new StringContent(configuration.getText("doclet.Deprecated")))); |
99 getText("doclet.Deprecated") + "</span> "); |
102 result.addContent(RawHtml.nbsp); |
100 if (deprs.length > 0) { |
103 if (deprs.length > 0) { |
101 Tag[] commentTags = deprs[0].inlineTags(); |
104 Tag[] commentTags = deprs[0].inlineTags(); |
102 if (commentTags.length > 0) { |
105 if (commentTags.length > 0) { |
103 |
106 result.addContent(commentTagsToOutput(null, doc, |
104 output.append(commentTagsToOutput(null, doc, |
|
105 deprs[0].inlineTags(), false).toString() |
107 deprs[0].inlineTags(), false).toString() |
106 ); |
108 ); |
107 } |
109 } |
108 } |
110 } |
109 } |
111 } |
110 } else { |
112 } else { |
111 MemberDoc member = (MemberDoc) doc; |
113 MemberDoc member = (MemberDoc) doc; |
112 if (Util.isDeprecated((ProgramElementDoc) doc)) { |
114 if (Util.isDeprecated((ProgramElementDoc) doc)) { |
113 output.append("<span class=\"strong\">" + |
115 result.addContent(HtmlTree.SPAN(HtmlStyle.strong, |
114 configuration. |
116 new StringContent(configuration.getText("doclet.Deprecated")))); |
115 getText("doclet.Deprecated") + "</span> "); |
117 result.addContent(RawHtml.nbsp); |
116 if (deprs.length > 0) { |
118 if (deprs.length > 0) { |
117 output.append("<i>"); |
119 TagletOutput body = commentTagsToOutput(null, doc, |
118 output.append(commentTagsToOutput(null, doc, |
120 deprs[0].inlineTags(), false); |
119 deprs[0].inlineTags(), false).toString()); |
121 result.addContent(HtmlTree.I(new RawHtml(body.toString()))); |
120 output.append("</i>"); |
|
121 } |
122 } |
122 } else { |
123 } else { |
123 if (Util.isDeprecated(member.containingClass())) { |
124 if (Util.isDeprecated(member.containingClass())) { |
124 output.append("<span class=\"strong\">" + |
125 result.addContent(HtmlTree.SPAN(HtmlStyle.strong, |
125 configuration. |
126 new StringContent(configuration.getText("doclet.Deprecated")))); |
126 getText("doclet.Deprecated") + "</span> "); |
127 result.addContent(RawHtml.nbsp); |
127 } |
128 } |
128 } |
129 } |
129 } |
130 } |
130 return new TagletOutputImpl(output.toString()); |
131 return new TagletOutputImpl(result); |
131 } |
132 } |
132 |
133 |
133 /** |
134 /** |
134 * {@inheritDoc} |
135 * {@inheritDoc} |
135 */ |
136 */ |
136 protected TagletOutput expertTagOutput(Tag tag) { |
137 protected TagletOutput expertTagOutput(Tag tag) { |
137 HtmlTree result = new HtmlTree(HtmlTag.SUB, new StringContent(tag.text())); |
138 HtmlTree result = new HtmlTree(HtmlTag.SUB, new StringContent(tag.text())); |
138 result.addAttr(HtmlAttr.ID, "expert"); |
139 result.addAttr(HtmlAttr.ID, "expert"); |
139 return new TagletOutputImpl(result.toString()); |
140 return new TagletOutputImpl(result); |
140 } |
141 } |
141 |
142 |
142 /** |
143 /** |
143 * {@inheritDoc} |
144 * {@inheritDoc} |
144 */ |
145 */ |
145 protected TagletOutput literalTagOutput(Tag tag) { |
146 protected TagletOutput literalTagOutput(Tag tag) { |
146 Content result = new StringContent(tag.text()); |
147 Content result = new StringContent(tag.text()); |
147 return new TagletOutputImpl(result.toString()); |
148 return new TagletOutputImpl(result); |
148 } |
149 } |
149 |
150 |
150 /** |
151 /** |
151 * {@inheritDoc} |
152 * {@inheritDoc} |
152 */ |
153 */ |
156 |
157 |
157 /** |
158 /** |
158 * {@inheritDoc} |
159 * {@inheritDoc} |
159 */ |
160 */ |
160 public TagletOutput getParamHeader(String header) { |
161 public TagletOutput getParamHeader(String header) { |
161 StringBuilder result = new StringBuilder(); |
162 HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, |
162 result.append("<dt>"); |
163 new StringContent(header))); |
163 result.append("<span class=\"strong\">").append(header).append("</span></dt>"); |
164 return new TagletOutputImpl(result); |
164 return new TagletOutputImpl(result.toString()); |
|
165 } |
165 } |
166 |
166 |
167 /** |
167 /** |
168 * {@inheritDoc} |
168 * {@inheritDoc} |
169 */ |
169 */ |
170 public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) { |
170 public TagletOutput paramTagOutput(ParamTag paramTag, String paramName) { |
171 TagletOutput result = new TagletOutputImpl("<dd><code>" + paramName + "</code>" |
171 ContentBuilder body = new ContentBuilder(); |
172 + " - " + htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false) + "</dd>"); |
172 body.addContent(HtmlTree.CODE(new RawHtml(paramName))); |
173 return result; |
173 body.addContent(" - "); |
|
174 body.addContent(new RawHtml(htmlWriter.commentTagsToString(paramTag, null, paramTag.inlineTags(), false))); |
|
175 HtmlTree result = HtmlTree.DD(body); |
|
176 return new TagletOutputImpl(result); |
174 } |
177 } |
175 |
178 |
176 /** |
179 /** |
177 * {@inheritDoc} |
180 * {@inheritDoc} |
178 */ |
181 */ |
179 public TagletOutput returnTagOutput(Tag returnTag) { |
182 public TagletOutput returnTagOutput(Tag returnTag) { |
180 TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<dt>" + |
183 ContentBuilder result = new ContentBuilder(); |
181 "<span class=\"strong\">" + configuration.getText("doclet.Returns") + |
184 result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, |
182 "</span>" + "</dt>" + "<dd>" + |
185 new StringContent(configuration.getText("doclet.Returns"))))); |
183 htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(), |
186 result.addContent(HtmlTree.DD(new RawHtml(htmlWriter.commentTagsToString( |
184 false) + "</dd>"); |
187 returnTag, null, returnTag.inlineTags(), false)))); |
185 return result; |
188 return new TagletOutputImpl(result); |
186 } |
189 } |
187 |
190 |
188 /** |
191 /** |
189 * {@inheritDoc} |
192 * {@inheritDoc} |
190 */ |
193 */ |
191 public TagletOutput seeTagOutput(Doc holder, SeeTag[] seeTags) { |
194 public TagletOutput seeTagOutput(Doc holder, SeeTag[] seeTags) { |
192 String result = ""; |
195 ContentBuilder body = new ContentBuilder(); |
193 if (seeTags.length > 0) { |
196 if (seeTags.length > 0) { |
194 result = addSeeHeader(result); |
|
195 for (int i = 0; i < seeTags.length; ++i) { |
197 for (int i = 0; i < seeTags.length; ++i) { |
196 if (i > 0) { |
198 appendSeparatorIfNotEmpty(body); |
197 result += ", " + DocletConstants.NL; |
199 body.addContent(new RawHtml(htmlWriter.seeTagToString(seeTags[i]))); |
198 } |
|
199 result += htmlWriter.seeTagToString(seeTags[i]); |
|
200 } |
200 } |
201 } |
201 } |
202 if (holder.isField() && ((FieldDoc)holder).constantValue() != null && |
202 if (holder.isField() && ((FieldDoc)holder).constantValue() != null && |
203 htmlWriter instanceof ClassWriterImpl) { |
203 htmlWriter instanceof ClassWriterImpl) { |
204 //Automatically add link to constant values page for constant fields. |
204 //Automatically add link to constant values page for constant fields. |
205 result = addSeeHeader(result); |
205 appendSeparatorIfNotEmpty(body); |
206 DocPath constantsPath = |
206 DocPath constantsPath = |
207 htmlWriter.pathToRoot.resolve(DocPaths.CONSTANT_VALUES); |
207 htmlWriter.pathToRoot.resolve(DocPaths.CONSTANT_VALUES); |
208 String whichConstant = |
208 String whichConstant = |
209 ((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName() + "." + ((FieldDoc) holder).name(); |
209 ((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName() + "." + ((FieldDoc) holder).name(); |
210 DocLink link = constantsPath.fragment(whichConstant); |
210 DocLink link = constantsPath.fragment(whichConstant); |
211 result += htmlWriter.getHyperLinkString(link, |
211 body.addContent(htmlWriter.getHyperLink(link, |
212 configuration.getText("doclet.Constants_Summary")); |
212 new StringContent(configuration.getText("doclet.Constants_Summary")))); |
213 } |
213 } |
214 if (holder.isClass() && ((ClassDoc)holder).isSerializable()) { |
214 if (holder.isClass() && ((ClassDoc)holder).isSerializable()) { |
215 //Automatically add link to serialized form page for serializable classes. |
215 //Automatically add link to serialized form page for serializable classes. |
216 if ((SerializedFormBuilder.serialInclude(holder) && |
216 if ((SerializedFormBuilder.serialInclude(holder) && |
217 SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) { |
217 SerializedFormBuilder.serialInclude(((ClassDoc)holder).containingPackage()))) { |
218 result = addSeeHeader(result); |
218 appendSeparatorIfNotEmpty(body); |
219 DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM); |
219 DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM); |
220 DocLink link = serialPath.fragment(((ClassDoc)holder).qualifiedName()); |
220 DocLink link = serialPath.fragment(((ClassDoc)holder).qualifiedName()); |
221 result += htmlWriter.getHyperLinkString(link, |
221 body.addContent(htmlWriter.getHyperLink(link, |
222 configuration.getText("doclet.Serialized_Form")); |
222 new StringContent(configuration.getText("doclet.Serialized_Form")))); |
223 } |
223 } |
224 } |
224 } |
225 return result.equals("") ? null : new TagletOutputImpl(result + "</dd>"); |
225 if (body.isEmpty()) |
226 } |
226 return new TagletOutputImpl(body); |
227 |
227 |
228 private String addSeeHeader(String result) { |
228 ContentBuilder result = new ContentBuilder(); |
229 if (result != null && result.length() > 0) { |
229 result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, |
230 return result + ", " + DocletConstants.NL; |
230 new StringContent(configuration.getText("doclet.See_Also"))))); |
231 } else { |
231 result.addContent(HtmlTree.DD(body)); |
232 return "<dt><span class=\"strong\">" + |
232 return new TagletOutputImpl(result); |
233 configuration.getText("doclet.See_Also") + "</span></dt><dd>"; |
233 |
234 } |
234 } |
235 } |
235 |
|
236 private void appendSeparatorIfNotEmpty(ContentBuilder body) { |
|
237 if (!body.isEmpty()) { |
|
238 body.addContent(", "); |
|
239 body.addContent(DocletConstants.NL); |
|
240 } |
|
241 } |
236 |
242 |
237 /** |
243 /** |
238 * {@inheritDoc} |
244 * {@inheritDoc} |
239 */ |
245 */ |
240 public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) { |
246 public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) { |
241 String result = "<dt><span class=\"strong\">" + header + "</span></dt>" + DocletConstants.NL + |
247 ContentBuilder result = new ContentBuilder(); |
242 " <dd>"; |
248 result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, new RawHtml(header)))); |
|
249 ContentBuilder body = new ContentBuilder(); |
243 for (int i = 0; i < simpleTags.length; i++) { |
250 for (int i = 0; i < simpleTags.length; i++) { |
244 if (i > 0) { |
251 if (i > 0) { |
245 result += ", "; |
252 body.addContent(", "); |
246 } |
253 } |
247 result += htmlWriter.commentTagsToString(simpleTags[i], null, simpleTags[i].inlineTags(), false); |
254 body.addContent(new RawHtml(htmlWriter.commentTagsToString( |
248 } |
255 simpleTags[i], null, simpleTags[i].inlineTags(), false))); |
249 result += "</dd>" + DocletConstants.NL; |
256 } |
|
257 result.addContent(HtmlTree.DD(body)); |
250 return new TagletOutputImpl(result); |
258 return new TagletOutputImpl(result); |
251 } |
259 } |
252 |
260 |
253 /** |
261 /** |
254 * {@inheritDoc} |
262 * {@inheritDoc} |
255 */ |
263 */ |
256 public TagletOutput simpleTagOutput(Tag simpleTag, String header) { |
264 public TagletOutput simpleTagOutput(Tag simpleTag, String header) { |
257 return new TagletOutputImpl("<dt><span class=\"strong\">" + header + "</span></dt>" + " <dd>" |
265 ContentBuilder result = new ContentBuilder(); |
258 + htmlWriter.commentTagsToString(simpleTag, null, simpleTag.inlineTags(), false) |
266 result.addContent(HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, new RawHtml(header)))); |
259 + "</dd>" + DocletConstants.NL); |
267 Content body = new RawHtml(htmlWriter.commentTagsToString( |
|
268 simpleTag, null, simpleTag.inlineTags(), false)); |
|
269 result.addContent(HtmlTree.DD(body)); |
|
270 return new TagletOutputImpl(result); |
260 } |
271 } |
261 |
272 |
262 /** |
273 /** |
263 * {@inheritDoc} |
274 * {@inheritDoc} |
264 */ |
275 */ |
265 public TagletOutput getThrowsHeader() { |
276 public TagletOutput getThrowsHeader() { |
266 return new TagletOutputImpl(DocletConstants.NL + "<dt>" + "<span class=\"strong\">" + |
277 HtmlTree result = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, |
267 configuration.getText("doclet.Throws") + "</span></dt>"); |
278 new StringContent(configuration.getText("doclet.Throws")))); |
|
279 return new TagletOutputImpl(result); |
268 } |
280 } |
269 |
281 |
270 /** |
282 /** |
271 * {@inheritDoc} |
283 * {@inheritDoc} |
272 */ |
284 */ |
273 public TagletOutput throwsTagOutput(ThrowsTag throwsTag) { |
285 public TagletOutput throwsTagOutput(ThrowsTag throwsTag) { |
274 String result = DocletConstants.NL + "<dd>"; |
286 ContentBuilder body = new ContentBuilder(); |
275 result += throwsTag.exceptionType() == null ? |
287 Content excName = (throwsTag.exceptionType() == null) ? |
276 htmlWriter.codeText(throwsTag.exceptionName()) : |
288 new RawHtml(throwsTag.exceptionName()) : |
277 htmlWriter.codeText( |
|
278 htmlWriter.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, |
289 htmlWriter.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, |
279 throwsTag.exceptionType())).toString()); |
290 throwsTag.exceptionType())); |
280 TagletOutput text = new TagletOutputImpl( |
291 body.addContent(HtmlTree.CODE(excName)); |
281 htmlWriter.commentTagsToString(throwsTag, null, |
292 String desc = htmlWriter.commentTagsToString(throwsTag, null, |
282 throwsTag.inlineTags(), false)); |
293 throwsTag.inlineTags(), false); |
283 if (text != null && text.toString().length() > 0) { |
294 if (desc != null && !desc.isEmpty()) { |
284 result += " - " + text; |
295 body.addContent(" - "); |
285 } |
296 body.addContent(new RawHtml(desc)); |
286 result += "</dd>"; |
297 } |
287 return new TagletOutputImpl(result); |
298 HtmlTree res2 = HtmlTree.DD(body); |
|
299 return new TagletOutputImpl(res2); |
288 } |
300 } |
289 |
301 |
290 /** |
302 /** |
291 * {@inheritDoc} |
303 * {@inheritDoc} |
292 */ |
304 */ |
293 public TagletOutput throwsTagOutput(Type throwsType) { |
305 public TagletOutput throwsTagOutput(Type throwsType) { |
294 return new TagletOutputImpl(DocletConstants.NL + "<dd>" + |
306 HtmlTree result = HtmlTree.DD(HtmlTree.CODE(htmlWriter.getLink( |
295 htmlWriter.codeText(htmlWriter.getLink( |
307 new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, throwsType)))); |
296 new LinkInfoImpl(configuration, LinkInfoImpl.Kind.MEMBER, throwsType)).toString()) + "</dd>"); |
308 return new TagletOutputImpl(result); |
297 } |
309 } |
298 |
310 |
299 /** |
311 /** |
300 * {@inheritDoc} |
312 * {@inheritDoc} |
301 */ |
313 */ |
302 public TagletOutput valueTagOutput(FieldDoc field, String constantVal, |
314 public TagletOutput valueTagOutput(FieldDoc field, String constantVal, |
303 boolean includeLink) { |
315 boolean includeLink) { |
304 return new TagletOutputImpl(includeLink ? |
316 return new TagletOutputImpl(includeLink ? |
305 htmlWriter.getDocLink(LinkInfoImpl.Kind.VALUE_TAG, field, |
317 htmlWriter.getDocLink(LinkInfoImpl.Kind.VALUE_TAG, field, |
306 constantVal, false).toString() : constantVal); |
318 constantVal, false) : new RawHtml(constantVal)); |
307 } |
319 } |
308 |
320 |
309 /** |
321 /** |
310 * {@inheritDoc} |
322 * {@inheritDoc} |
311 */ |
323 */ |