23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.tools.doclets.formats.html; |
26 package com.sun.tools.doclets.formats.html; |
27 |
27 |
|
28 import java.io.*; |
28 import com.sun.tools.doclets.internal.toolkit.util.*; |
29 import com.sun.tools.doclets.internal.toolkit.util.*; |
29 |
30 import com.sun.tools.doclets.formats.html.markup.*; |
30 import java.io.*; |
31 import com.sun.tools.doclets.internal.toolkit.*; |
31 |
32 |
32 /** |
33 /** |
33 * Generate Separate Index Files for all the member names with Indexing in |
34 * Generate Separate Index Files for all the member names with Indexing in |
34 * Unicode Order. This will create "index-files" directory in the current or |
35 * Unicode Order. This will create "index-files" directory in the current or |
35 * destination directory and will generate separate file for each unicode index. |
36 * destination directory and will generate separate file for each unicode index. |
36 * |
37 * |
37 * @see java.lang.Character |
38 * @see java.lang.Character |
38 * @author Atul M Dambalkar |
39 * @author Atul M Dambalkar |
|
40 * @author Bhavesh Patel (Modified) |
39 */ |
41 */ |
40 public class SplitIndexWriter extends AbstractIndexWriter { |
42 public class SplitIndexWriter extends AbstractIndexWriter { |
41 |
43 |
42 /** |
44 /** |
43 * Previous unicode character index in the built index. |
45 * Previous unicode character index in the built index. |
107 * |
109 * |
108 * @param unicode Unicode character referring to the character for the |
110 * @param unicode Unicode character referring to the character for the |
109 * index. |
111 * index. |
110 */ |
112 */ |
111 protected void generateIndexFile(Character unicode) throws IOException { |
113 protected void generateIndexFile(Character unicode) throws IOException { |
112 printHtmlHeader(configuration.getText("doclet.Window_Split_Index", |
114 String title = configuration.getText("doclet.Window_Split_Index", |
113 unicode.toString()), null, true); |
115 unicode.toString()); |
114 printTop(); |
116 Content body = getBody(true, getWindowTitle(title)); |
115 navLinks(true); |
117 addTop(body); |
116 printLinksForIndexes(); |
118 addNavLinks(true, body); |
117 |
119 HtmlTree divTree = new HtmlTree(HtmlTag.DIV); |
118 hr(); |
120 divTree.addStyle(HtmlStyle.contentContainer); |
119 |
121 addLinksForIndexes(divTree); |
120 generateContents(unicode, indexbuilder.getMemberList(unicode)); |
122 addContents(unicode, indexbuilder.getMemberList(unicode), divTree); |
121 |
123 addLinksForIndexes(divTree); |
122 navLinks(false); |
124 body.addContent(divTree); |
123 printLinksForIndexes(); |
125 addNavLinks(false, body); |
124 |
126 addBottom(body); |
125 printBottom(); |
127 printHtmlDocument(null, true, body); |
126 printBodyHtmlEnd(); |
|
127 } |
128 } |
128 |
129 |
129 /** |
130 /** |
130 * Print Links for all the Index Files per unicode character. |
131 * Add links for all the Index Files per unicode character. |
|
132 * |
|
133 * @param contentTree the content tree to which the links for indexes will be added |
131 */ |
134 */ |
132 protected void printLinksForIndexes() { |
135 protected void addLinksForIndexes(Content contentTree) { |
133 for (int i = 0; i < indexbuilder.elements().length; i++) { |
136 Object[] unicodeChars = indexbuilder.elements(); |
|
137 for (int i = 0; i < unicodeChars.length; i++) { |
134 int j = i + 1; |
138 int j = i + 1; |
135 printHyperLink("index-" + j + ".html", |
139 contentTree.addContent(getHyperLink("index-" + j + ".html", |
136 indexbuilder.elements()[i].toString()); |
140 new StringContent(unicodeChars[i].toString()))); |
137 print(' '); |
141 contentTree.addContent(getSpace()); |
138 } |
142 } |
139 } |
143 } |
140 |
144 |
141 /** |
145 /** |
142 * Print the previous unicode character index link. |
146 * Get link to the previous unicode character. |
|
147 * |
|
148 * @return a content tree for the link |
143 */ |
149 */ |
144 protected void navLinkPrevious() { |
150 public Content getNavLinkPrevious() { |
|
151 Content prevletterLabel = getResource("doclet.Prev_Letter"); |
145 if (prev == -1) { |
152 if (prev == -1) { |
146 printText("doclet.Prev_Letter"); |
153 return HtmlTree.LI(prevletterLabel); |
147 } else { |
154 } |
148 printHyperLink("index-" + prev + ".html", "", |
155 else { |
149 configuration.getText("doclet.Prev_Letter"), true); |
156 Content prevLink = getHyperLink("index-" + prev + ".html", "", |
|
157 prevletterLabel); |
|
158 return HtmlTree.LI(prevLink); |
150 } |
159 } |
151 } |
160 } |
152 |
161 |
153 /** |
162 /** |
154 * Print the next unicode character index link. |
163 * Get link to the next unicode character. |
|
164 * |
|
165 * @return a content tree for the link |
155 */ |
166 */ |
156 protected void navLinkNext() { |
167 public Content getNavLinkNext() { |
|
168 Content nextletterLabel = getResource("doclet.Next_Letter"); |
157 if (next == -1) { |
169 if (next == -1) { |
158 printText("doclet.Next_Letter"); |
170 return HtmlTree.LI(nextletterLabel); |
159 } else { |
171 } |
160 printHyperLink("index-" + next + ".html","", |
172 else { |
161 configuration.getText("doclet.Next_Letter"), true); |
173 Content nextLink = getHyperLink("index-" + next + ".html","", |
|
174 nextletterLabel); |
|
175 return HtmlTree.LI(nextLink); |
162 } |
176 } |
163 } |
177 } |
164 } |
178 } |