23 |
import gnu.classpath.tools.IOToolkit; |
import gnu.classpath.tools.IOToolkit; |
24 |
|
|
25 |
import gnu.classpath.tools.doclets.AbstractDoclet; |
import gnu.classpath.tools.doclets.AbstractDoclet; |
26 |
|
import gnu.classpath.tools.doclets.DocletConfigurationException; |
27 |
import gnu.classpath.tools.doclets.DocletOption; |
import gnu.classpath.tools.doclets.DocletOption; |
28 |
import gnu.classpath.tools.doclets.DocletOptionFile; |
import gnu.classpath.tools.doclets.DocletOptionFile; |
29 |
import gnu.classpath.tools.doclets.DocletOptionFlag; |
import gnu.classpath.tools.doclets.DocletOptionFlag; |
31 |
import gnu.classpath.tools.doclets.PackageGroup; |
import gnu.classpath.tools.doclets.PackageGroup; |
32 |
import gnu.classpath.tools.doclets.TagletPrinter; |
import gnu.classpath.tools.doclets.TagletPrinter; |
33 |
|
|
34 |
|
import gnu.classpath.tools.doclets.xmldoclet.HtmlRepairer; |
35 |
|
|
36 |
import gnu.classpath.tools.taglets.TagletContext; |
import gnu.classpath.tools.taglets.TagletContext; |
37 |
|
|
38 |
import gnu.classpath.tools.java2xhtml.Java2xhtml; |
import gnu.classpath.tools.java2xhtml.Java2xhtml; |
55 |
|
|
56 |
import java.net.MalformedURLException; |
import java.net.MalformedURLException; |
57 |
|
|
58 |
|
import java.nio.charset.Charset; |
59 |
|
|
60 |
import java.util.Arrays; |
import java.util.Arrays; |
61 |
import java.util.Collection; |
import java.util.Collection; |
62 |
import java.util.HashMap; |
import java.util.HashMap; |
352 |
{ |
{ |
353 |
HtmlPage output = new HtmlPage(new File(packageDir, |
HtmlPage output = new HtmlPage(new File(packageDir, |
354 |
"package-summary" + filenameExtension), |
"package-summary" + filenameExtension), |
355 |
pathToRoot); |
pathToRoot, |
356 |
output.beginPage(packageDoc.name()); |
getOutputDocEncoding()); |
357 |
|
output.beginPage(packageDoc.name(), getOutputCharset()); |
358 |
output.beginBody(); |
output.beginBody(); |
359 |
printNavBarTop(output, "package"); |
printNavBarTop(output, "package"); |
360 |
|
|
533 |
{ |
{ |
534 |
HtmlPage output = new HtmlPage(new File(packageDir, |
HtmlPage output = new HtmlPage(new File(packageDir, |
535 |
"tree" + filenameExtension), |
"tree" + filenameExtension), |
536 |
pathToRoot); |
pathToRoot, |
537 |
output.beginPage(packageDoc.name() + " Hierarchy"); |
getOutputDocEncoding()); |
538 |
|
output.beginPage(packageDoc.name() + " Hierarchy", getOutputCharset()); |
539 |
output.beginBody(); |
output.beginBody(); |
540 |
printNavBarTop(output, "package-tree"); |
printNavBarTop(output, "package-tree"); |
541 |
|
|
556 |
{ |
{ |
557 |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
558 |
"tree" + filenameExtension), |
"tree" + filenameExtension), |
559 |
"."); |
".", |
560 |
output.beginPage("Hierarchy"); |
getOutputDocEncoding()); |
561 |
|
output.beginPage("Hierarchy", getOutputCharset()); |
562 |
output.beginBody(); |
output.beginBody(); |
563 |
printNavBarTop(output, "full-tree"); |
printNavBarTop(output, "full-tree"); |
564 |
|
|
653 |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
654 |
"index" + filenameExtension), |
"index" + filenameExtension), |
655 |
".", |
".", |
656 |
|
getOutputDocEncoding(), |
657 |
HtmlPage.DOCTYPE_FRAMESET); |
HtmlPage.DOCTYPE_FRAMESET); |
658 |
|
|
659 |
String title; |
String title; |
663 |
else { |
else { |
664 |
title = optionWindowTitle.getValue(); |
title = optionWindowTitle.getValue(); |
665 |
} |
} |
666 |
output.beginPage(title); |
output.beginPage(title, getOutputCharset()); |
667 |
output.beginElement("frameset", "cols", "20%,80%"); |
output.beginElement("frameset", "cols", "20%,80%"); |
668 |
output.beginElement("frameset", "rows", "25%,75%"); |
output.beginElement("frameset", "rows", "25%,75%"); |
669 |
output.atomicElement("frame", |
output.atomicElement("frame", |
686 |
{ |
{ |
687 |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
688 |
"all-packages" + filenameExtension), |
"all-packages" + filenameExtension), |
689 |
"."); |
".", |
690 |
output.beginPage("Package Menu"); |
getOutputDocEncoding()); |
691 |
|
output.beginPage("Package Menu", getOutputCharset()); |
692 |
output.beginBody(); |
output.beginBody(); |
693 |
|
|
694 |
output.div(CssClass.PACKAGE_MENU_TITLE, "Packages"); |
output.div(CssClass.PACKAGE_MENU_TITLE, "Packages"); |
744 |
{ |
{ |
745 |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
746 |
"all-classes" + filenameExtension), |
"all-classes" + filenameExtension), |
747 |
"."); |
".", |
748 |
output.beginPage("Class Menu"); |
getOutputDocEncoding()); |
749 |
|
output.beginPage("Class Menu", getOutputCharset()); |
750 |
output.beginBody(); |
output.beginBody(); |
751 |
|
|
752 |
output.div(CssClass.CLASS_MENU_TITLE, "All Classes"); |
output.div(CssClass.CLASS_MENU_TITLE, "All Classes"); |
763 |
{ |
{ |
764 |
HtmlPage output = new HtmlPage(new File(packageDir, |
HtmlPage output = new HtmlPage(new File(packageDir, |
765 |
"classes" + filenameExtension), |
"classes" + filenameExtension), |
766 |
pathToRoot); |
pathToRoot, |
767 |
|
getOutputDocEncoding()); |
768 |
|
|
769 |
output.beginPage(packageDoc.name() + " Class Menu"); |
output.beginPage(packageDoc.name() + " Class Menu", getOutputCharset()); |
770 |
output.beginBody(); |
output.beginBody(); |
771 |
|
|
772 |
output.beginDiv(CssClass.CLASS_MENU_TITLE); |
output.beginDiv(CssClass.CLASS_MENU_TITLE); |
815 |
} |
} |
816 |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
817 |
pageName + filenameExtension), |
pageName + filenameExtension), |
818 |
"."); |
".", |
819 |
output.beginPage("Alphabetical Index"); |
getOutputDocEncoding()); |
820 |
|
output.beginPage("Alphabetical Index", getOutputCharset()); |
821 |
output.beginBody(); |
output.beginBody(); |
822 |
printNavBarTop(output, "index"); |
printNavBarTop(output, "index"); |
823 |
|
|
926 |
{ |
{ |
927 |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
928 |
"deprecated" + filenameExtension), |
"deprecated" + filenameExtension), |
929 |
"."); |
".", |
930 |
output.beginPage("Deprecated API"); |
getOutputDocEncoding()); |
931 |
|
output.beginPage("Deprecated API", getOutputCharset()); |
932 |
output.beginBody(); |
output.beginBody(); |
933 |
printNavBarTop(output, "deprecated"); |
printNavBarTop(output, "deprecated"); |
934 |
|
|
1058 |
{ |
{ |
1059 |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
HtmlPage output = new HtmlPage(new File(getTargetDirectory(), |
1060 |
"index-noframes" + filenameExtension), |
"index-noframes" + filenameExtension), |
1061 |
"."); |
".", |
1062 |
output.beginPage("Overview"); |
getOutputDocEncoding()); |
1063 |
|
output.beginPage("Overview", getOutputCharset()); |
1064 |
output.beginBody(); |
output.beginBody(); |
1065 |
|
|
1066 |
printNavBarTop(output, "overview"); |
printNavBarTop(output, "overview"); |
1149 |
{ |
{ |
1150 |
HtmlPage output = new HtmlPage(new File(packageDir, |
HtmlPage output = new HtmlPage(new File(packageDir, |
1151 |
classDoc.name() + "-uses" + filenameExtension), |
classDoc.name() + "-uses" + filenameExtension), |
1152 |
pathToRoot); |
pathToRoot, |
1153 |
output.beginPage(classDoc.name()); |
getOutputDocEncoding()); |
1154 |
|
output.beginPage(classDoc.name(), getOutputCharset()); |
1155 |
output.beginBody(); |
output.beginBody(); |
1156 |
printNavBarTop(output, "uses", classDoc); |
printNavBarTop(output, "uses", classDoc); |
1157 |
|
|
1243 |
{ |
{ |
1244 |
HtmlPage output = new HtmlPage(new File(packageDir, |
HtmlPage output = new HtmlPage(new File(packageDir, |
1245 |
classDoc.name() + filenameExtension), |
classDoc.name() + filenameExtension), |
1246 |
pathToRoot); |
pathToRoot, |
1247 |
output.beginPage(classDoc.name()); |
getOutputDocEncoding()); |
1248 |
|
output.beginPage(classDoc.name(), getOutputCharset()); |
1249 |
output.beginBody(); |
output.beginBody(); |
1250 |
printNavBarTop(output, "class", classDoc); |
printNavBarTop(output, "class", classDoc); |
1251 |
|
|
1338 |
"Method Details"); |
"Method Details"); |
1339 |
|
|
1340 |
printNavBarBottom(output, "class", classDoc); |
printNavBarBottom(output, "class", classDoc); |
1341 |
|
|
1342 |
|
String boilerplate = null; |
1343 |
|
Tag[] boilerplateTags = classDoc.tags("@boilerplate"); |
1344 |
|
if (boilerplateTags.length > 0) { |
1345 |
|
boilerplate = boilerplateTags[0].text(); |
1346 |
|
} |
1347 |
|
if (null != boilerplate) { |
1348 |
|
output.hr(); |
1349 |
|
output.beginDiv(CssClass.CLASS_BOILERPLATE); |
1350 |
|
output.print(boilerplate); |
1351 |
|
output.endDiv(CssClass.CLASS_BOILERPLATE); |
1352 |
|
} |
1353 |
output.endBody(); |
output.endBody(); |
1354 |
output.endPage(); |
output.endPage(); |
1355 |
output.close(); |
output.close(); |
1656 |
} |
} |
1657 |
} |
} |
1658 |
|
|
1659 |
private void printTag(HtmlPage output, Tag tag, boolean firstSentence) |
private void printTag(HtmlPage output, HtmlRepairer repairer, |
1660 |
|
Tag tag, boolean firstSentence) |
1661 |
{ |
{ |
1662 |
if ("Text".equals(tag.name())) { |
if ("Text".equals(tag.name())) { |
1663 |
output.print(tag.text()); |
output.print(repairer.getWellformedHTML(tag.text())); |
1664 |
} |
} |
1665 |
else if ("@link".equals(tag.name())) { |
else if ("@link".equals(tag.name())) { |
1666 |
SeeTag seeTag = (SeeTag)tag; |
SeeTag seeTag = (SeeTag)tag; |
1715 |
|
|
1716 |
private void printTags(HtmlPage output, Tag[] tags, boolean firstSentence) |
private void printTags(HtmlPage output, Tag[] tags, boolean firstSentence) |
1717 |
{ |
{ |
1718 |
|
HtmlRepairer repairer = new HtmlRepairer(getRootDoc(), |
1719 |
|
true, false, |
1720 |
|
null, null, |
1721 |
|
true); |
1722 |
for (int i=0; i<tags.length; ++i) { |
for (int i=0; i<tags.length; ++i) { |
1723 |
printTag(output, tags[i], firstSentence); |
printTag(output, repairer, tags[i], firstSentence); |
1724 |
} |
} |
1725 |
|
output.print(repairer.terminateText()); |
1726 |
} |
} |
1727 |
|
|
1728 |
private String getClassDocURL(HtmlPage output, ClassDoc classDoc) |
private String getClassDocURL(HtmlPage output, ClassDoc classDoc) |
2078 |
} |
} |
2079 |
}; |
}; |
2080 |
|
|
2081 |
|
private DocletOptionString optionDocEncoding = |
2082 |
|
new DocletOptionString("-docencoding"); |
2083 |
|
|
2084 |
|
private DocletOptionString optionEncoding = |
2085 |
|
new DocletOptionString("-encoding"); |
2086 |
|
|
2087 |
|
private DocletOptionString optionCharset = |
2088 |
|
new DocletOptionString("-charset"); |
2089 |
|
|
2090 |
private DocletOption[] options = |
private DocletOption[] options = |
2091 |
{ |
{ |
2092 |
optionNoNavBar, |
optionNoNavBar, |
2106 |
optionLinkSource, |
optionLinkSource, |
2107 |
optionLink, |
optionLink, |
2108 |
optionLinkOffline, |
optionLinkOffline, |
2109 |
|
optionDocEncoding, |
2110 |
|
optionEncoding, |
2111 |
|
optionCharset, |
2112 |
}; |
}; |
2113 |
|
|
2114 |
static { |
static { |
2119 |
{ |
{ |
2120 |
return StringToolkit.replace(str, "{@docRoot}", output.getPathToRoot()); |
return StringToolkit.replace(str, "{@docRoot}", output.getPathToRoot()); |
2121 |
} |
} |
2122 |
|
|
2123 |
|
private String getOutputDocEncoding() |
2124 |
|
{ |
2125 |
|
String encoding = optionDocEncoding.getValue(); |
2126 |
|
|
2127 |
|
if (null == encoding) { |
2128 |
|
encoding = optionEncoding.getValue(); |
2129 |
|
} |
2130 |
|
|
2131 |
|
return encoding; |
2132 |
|
} |
2133 |
|
|
2134 |
|
private String getOutputCharset() |
2135 |
|
{ |
2136 |
|
return optionCharset.getValue(); |
2137 |
|
} |
2138 |
} |
} |