langtools/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java Tue Nov 30 09:38:48 2010 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SplitIndexWriter.java Wed Dec 01 11:02:38 2010 -0800
@@ -25,9 +25,10 @@
package com.sun.tools.doclets.formats.html;
+import java.io.*;
import com.sun.tools.doclets.internal.toolkit.util.*;
-
-import java.io.*;
+import com.sun.tools.doclets.formats.html.markup.*;
+import com.sun.tools.doclets.internal.toolkit.*;
/**
* Generate Separate Index Files for all the member names with Indexing in
@@ -36,6 +37,7 @@
*
* @see java.lang.Character
* @author Atul M Dambalkar
+ * @author Bhavesh Patel (Modified)
*/
public class SplitIndexWriter extends AbstractIndexWriter {
@@ -109,56 +111,68 @@
* index.
*/
protected void generateIndexFile(Character unicode) throws IOException {
- printHtmlHeader(configuration.getText("doclet.Window_Split_Index",
- unicode.toString()), null, true);
- printTop();
- navLinks(true);
- printLinksForIndexes();
-
- hr();
-
- generateContents(unicode, indexbuilder.getMemberList(unicode));
-
- navLinks(false);
- printLinksForIndexes();
-
- printBottom();
- printBodyHtmlEnd();
+ String title = configuration.getText("doclet.Window_Split_Index",
+ unicode.toString());
+ Content body = getBody(true, getWindowTitle(title));
+ addTop(body);
+ addNavLinks(true, body);
+ HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
+ divTree.addStyle(HtmlStyle.contentContainer);
+ addLinksForIndexes(divTree);
+ addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
+ addLinksForIndexes(divTree);
+ body.addContent(divTree);
+ addNavLinks(false, body);
+ addBottom(body);
+ printHtmlDocument(null, true, body);
}
/**
- * Print Links for all the Index Files per unicode character.
+ * Add links for all the Index Files per unicode character.
+ *
+ * @param contentTree the content tree to which the links for indexes will be added
*/
- protected void printLinksForIndexes() {
- for (int i = 0; i < indexbuilder.elements().length; i++) {
+ protected void addLinksForIndexes(Content contentTree) {
+ Object[] unicodeChars = indexbuilder.elements();
+ for (int i = 0; i < unicodeChars.length; i++) {
int j = i + 1;
- printHyperLink("index-" + j + ".html",
- indexbuilder.elements()[i].toString());
- print(' ');
+ contentTree.addContent(getHyperLink("index-" + j + ".html",
+ new StringContent(unicodeChars[i].toString())));
+ contentTree.addContent(getSpace());
}
}
/**
- * Print the previous unicode character index link.
+ * Get link to the previous unicode character.
+ *
+ * @return a content tree for the link
*/
- protected void navLinkPrevious() {
+ public Content getNavLinkPrevious() {
+ Content prevletterLabel = getResource("doclet.Prev_Letter");
if (prev == -1) {
- printText("doclet.Prev_Letter");
- } else {
- printHyperLink("index-" + prev + ".html", "",
- configuration.getText("doclet.Prev_Letter"), true);
+ return HtmlTree.LI(prevletterLabel);
+ }
+ else {
+ Content prevLink = getHyperLink("index-" + prev + ".html", "",
+ prevletterLabel);
+ return HtmlTree.LI(prevLink);
}
}
/**
- * Print the next unicode character index link.
+ * Get link to the next unicode character.
+ *
+ * @return a content tree for the link
*/
- protected void navLinkNext() {
+ public Content getNavLinkNext() {
+ Content nextletterLabel = getResource("doclet.Next_Letter");
if (next == -1) {
- printText("doclet.Next_Letter");
- } else {
- printHyperLink("index-" + next + ".html","",
- configuration.getText("doclet.Next_Letter"), true);
+ return HtmlTree.LI(nextletterLabel);
+ }
+ else {
+ Content nextLink = getHyperLink("index-" + next + ".html","",
+ nextletterLabel);
+ return HtmlTree.LI(nextLink);
}
}
}