80 /** |
80 /** |
81 * The global configuration information for this run. |
81 * The global configuration information for this run. |
82 */ |
82 */ |
83 public final ConfigurationImpl configuration; |
83 public final ConfigurationImpl configuration; |
84 |
84 |
|
85 protected final Utils utils; |
|
86 |
85 /** |
87 /** |
86 * To check whether annotation heading is printed or not. |
88 * To check whether annotation heading is printed or not. |
87 */ |
89 */ |
88 protected boolean printedAnnotationHeading = false; |
90 protected boolean printedAnnotationHeading = false; |
89 |
91 |
109 */ |
111 */ |
110 public HtmlDocletWriter(ConfigurationImpl configuration, DocPath path) |
112 public HtmlDocletWriter(ConfigurationImpl configuration, DocPath path) |
111 throws IOException { |
113 throws IOException { |
112 super(configuration, path); |
114 super(configuration, path); |
113 this.configuration = configuration; |
115 this.configuration = configuration; |
|
116 this.utils = configuration.utils; |
114 this.path = path; |
117 this.path = path; |
115 this.pathToRoot = path.parent().invert(); |
118 this.pathToRoot = path.parent().invert(); |
116 this.filename = path.basename(); |
119 this.filename = path.basename(); |
117 } |
120 } |
118 |
121 |
345 Content tbody = new HtmlTree(HtmlTag.TBODY); |
348 Content tbody = new HtmlTree(HtmlTag.TBODY); |
346 for (int i = 0; i < classes.length; i++) { |
349 for (int i = 0; i < classes.length; i++) { |
347 if (!isTypeInProfile(classes[i], profileValue)) { |
350 if (!isTypeInProfile(classes[i], profileValue)) { |
348 continue; |
351 continue; |
349 } |
352 } |
350 if (!Util.isCoreClass(classes[i]) || |
353 if (!utils.isCoreClass(classes[i]) || |
351 !configuration.isGeneratedDoc(classes[i])) { |
354 !configuration.isGeneratedDoc(classes[i])) { |
352 continue; |
355 continue; |
353 } |
356 } |
354 Content classContent = getLink(new LinkInfoImpl( |
357 Content classContent = getLink(new LinkInfoImpl( |
355 configuration, LinkInfoImpl.Kind.PACKAGE, classes[i])); |
358 configuration, LinkInfoImpl.Kind.PACKAGE, classes[i])); |
359 tr.addStyle(HtmlStyle.altColor); |
362 tr.addStyle(HtmlStyle.altColor); |
360 else |
363 else |
361 tr.addStyle(HtmlStyle.rowColor); |
364 tr.addStyle(HtmlStyle.rowColor); |
362 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD); |
365 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD); |
363 tdClassDescription.addStyle(HtmlStyle.colLast); |
366 tdClassDescription.addStyle(HtmlStyle.colLast); |
364 if (Util.isDeprecated(classes[i])) { |
367 if (utils.isDeprecated(classes[i])) { |
365 tdClassDescription.addContent(deprecatedLabel); |
368 tdClassDescription.addContent(deprecatedLabel); |
366 if (classes[i].tags("deprecated").length > 0) { |
369 if (classes[i].tags("deprecated").length > 0) { |
367 addSummaryDeprecatedComment(classes[i], |
370 addSummaryDeprecatedComment(classes[i], |
368 classes[i].tags("deprecated")[0], tdClassDescription); |
371 classes[i].tags("deprecated")[0], tdClassDescription); |
369 } |
372 } |
1019 } |
1022 } |
1020 if (included || pkg == null) { |
1023 if (included || pkg == null) { |
1021 return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), |
1024 return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), |
1022 label); |
1025 label); |
1023 } else { |
1026 } else { |
1024 DocLink crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); |
1027 DocLink crossPkgLink = getCrossPackageLink(utils.getPackageName(pkg)); |
1025 if (crossPkgLink != null) { |
1028 if (crossPkgLink != null) { |
1026 return getHyperLink(crossPkgLink, label); |
1029 return getHyperLink(crossPkgLink, label); |
1027 } else { |
1030 } else { |
1028 return label; |
1031 return label; |
1029 } |
1032 } |
1286 } |
1289 } |
1287 |
1290 |
1288 public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc, |
1291 public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc, |
1289 Content label, boolean strong, boolean isProperty) { |
1292 Content label, boolean strong, boolean isProperty) { |
1290 if (! (doc.isIncluded() || |
1293 if (! (doc.isIncluded() || |
1291 Util.isLinkable(classDoc, configuration))) { |
1294 utils.isLinkable(classDoc, configuration))) { |
1292 return label; |
1295 return label; |
1293 } else if (doc instanceof ExecutableMemberDoc) { |
1296 } else if (doc instanceof ExecutableMemberDoc) { |
1294 ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; |
1297 ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; |
1295 return getLink(new LinkInfoImpl(configuration, context, classDoc) |
1298 return getLink(new LinkInfoImpl(configuration, context, classDoc) |
1296 .label(label).where(getName(getAnchor(emd, isProperty))).strong(strong)); |
1299 .label(label).where(getName(getAnchor(emd, isProperty))).strong(strong)); |
1314 * @return the link for the given member |
1317 * @return the link for the given member |
1315 */ |
1318 */ |
1316 public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc, |
1319 public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc, |
1317 Content label) { |
1320 Content label) { |
1318 if (! (doc.isIncluded() || |
1321 if (! (doc.isIncluded() || |
1319 Util.isLinkable(classDoc, configuration))) { |
1322 utils.isLinkable(classDoc, configuration))) { |
1320 return label; |
1323 return label; |
1321 } else if (doc instanceof ExecutableMemberDoc) { |
1324 } else if (doc instanceof ExecutableMemberDoc) { |
1322 ExecutableMemberDoc emd = (ExecutableMemberDoc) doc; |
1325 ExecutableMemberDoc emd = (ExecutableMemberDoc) doc; |
1323 return getLink(new LinkInfoImpl(configuration, context, classDoc) |
1326 return getLink(new LinkInfoImpl(configuration, context, classDoc) |
1324 .label(label).where(getName(getAnchor(emd)))); |
1327 .label(label).where(getName(getAnchor(emd)))); |
1358 String tagName = see.name(); |
1361 String tagName = see.name(); |
1359 if (! (tagName.startsWith("@link") || tagName.equals("@see"))) { |
1362 if (! (tagName.startsWith("@link") || tagName.equals("@see"))) { |
1360 return new ContentBuilder(); |
1363 return new ContentBuilder(); |
1361 } |
1364 } |
1362 |
1365 |
1363 String seetext = replaceDocRootDir(Util.normalizeNewlines(see.text())); |
1366 String seetext = replaceDocRootDir(utils.normalizeNewlines(see.text())); |
1364 |
1367 |
1365 //Check if @see is an href or "string" |
1368 //Check if @see is an href or "string" |
1366 if (seetext.startsWith("<") || seetext.startsWith("\"")) { |
1369 if (seetext.startsWith("<") || seetext.startsWith("\"")) { |
1367 return new RawHtml(seetext); |
1370 return new RawHtml(seetext); |
1368 } |
1371 } |
1420 // Must be a member reference since refClass is not null and refMemName is not null. |
1423 // Must be a member reference since refClass is not null and refMemName is not null. |
1421 // refMem is not null, so this @see tag must be referencing a valid member. |
1424 // refMem is not null, so this @see tag must be referencing a valid member. |
1422 ClassDoc containing = refMem.containingClass(); |
1425 ClassDoc containing = refMem.containingClass(); |
1423 if (see.text().trim().startsWith("#") && |
1426 if (see.text().trim().startsWith("#") && |
1424 ! (containing.isPublic() || |
1427 ! (containing.isPublic() || |
1425 Util.isLinkable(containing, configuration))) { |
1428 utils.isLinkable(containing, configuration))) { |
1426 // Since the link is relative and the holder is not even being |
1429 // Since the link is relative and the holder is not even being |
1427 // documented, this must be an inherited link. Redirect it. |
1430 // documented, this must be an inherited link. Redirect it. |
1428 // The current class either overrides the referenced member or |
1431 // The current class either overrides the referenced member or |
1429 // inherits it automatically. |
1432 // inherits it automatically. |
1430 if (this instanceof ClassWriterImpl) { |
1433 if (this instanceof ClassWriterImpl) { |
1626 // line as a text argument to an option (like -header).] |
1629 // line as a text argument to an option (like -header).] |
1627 text = replaceDocRootDir(text); |
1630 text = replaceDocRootDir(text); |
1628 if (isFirstSentence) { |
1631 if (isFirstSentence) { |
1629 text = removeNonInlineHtmlTags(text); |
1632 text = removeNonInlineHtmlTags(text); |
1630 } |
1633 } |
1631 text = Util.replaceTabs(configuration, text); |
1634 text = utils.replaceTabs(configuration, text); |
1632 text = Util.normalizeNewlines(text); |
1635 text = utils.normalizeNewlines(text); |
1633 result.addContent(new RawHtml(text)); |
1636 result.addContent(new RawHtml(text)); |
1634 } |
1637 } |
1635 } |
1638 } |
1636 return result; |
1639 return result; |
1637 } |
1640 } |
1953 // If an annotation is not documented, do not add it to the list. If |
1956 // If an annotation is not documented, do not add it to the list. If |
1954 // the annotation is of a repeatable type, and if it is not documented |
1957 // the annotation is of a repeatable type, and if it is not documented |
1955 // and also if its container annotation is not documented, do not add it |
1958 // and also if its container annotation is not documented, do not add it |
1956 // to the list. If an annotation of a repeatable type is not documented |
1959 // to the list. If an annotation of a repeatable type is not documented |
1957 // but its container is documented, it will be added to the list. |
1960 // but its container is documented, it will be added to the list. |
1958 if (!Util.isDocumentedAnnotation(annotationDoc) && |
1961 if (!utils.isDocumentedAnnotation(annotationDoc) && |
1959 (!isAnnotationDocumented && !isContainerDocumented)) { |
1962 (!isAnnotationDocumented && !isContainerDocumented)) { |
1960 continue; |
1963 continue; |
1961 } |
1964 } |
1962 /* TODO: check logic here to correctly handle declaration |
1965 /* TODO: check logic here to correctly handle declaration |
1963 * and type annotations. |
1966 * and type annotations. |
1964 if (Util.isDeclarationAnnotation(annotationDoc, isJava5DeclarationLocation)) { |
1967 if (util.isDeclarationAnnotation(annotationDoc, isJava5DeclarationLocation)) { |
1965 continue; |
1968 continue; |
1966 }*/ |
1969 }*/ |
1967 annotation = new ContentBuilder(); |
1970 annotation = new ContentBuilder(); |
1968 isAnnotationDocumented = false; |
1971 isAnnotationDocumented = false; |
1969 LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, |
1972 LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, |
2094 if (annotationArray.length > 1) { |
2097 if (annotationArray.length > 1) { |
2095 if (annotationArray[0].value() instanceof AnnotationDesc) { |
2098 if (annotationArray[0].value() instanceof AnnotationDesc) { |
2096 AnnotationTypeDoc annotationDoc = |
2099 AnnotationTypeDoc annotationDoc = |
2097 ((AnnotationDesc) annotationArray[0].value()).annotationType(); |
2100 ((AnnotationDesc) annotationArray[0].value()).annotationType(); |
2098 isContainerDocumented = true; |
2101 isContainerDocumented = true; |
2099 if (Util.isDocumentedAnnotation(annotationDoc)) { |
2102 if (utils.isDocumentedAnnotation(annotationDoc)) { |
2100 isAnnotationDocumented = true; |
2103 isAnnotationDocumented = true; |
2101 } |
2104 } |
2102 return true; |
2105 return true; |
2103 } |
2106 } |
2104 } |
2107 } |