44 * @see java.lang.Character |
45 * @see java.lang.Character |
45 * @author Atul M Dambalkar |
46 * @author Atul M Dambalkar |
46 * @author Bhavesh Patel (Modified) |
47 * @author Bhavesh Patel (Modified) |
47 */ |
48 */ |
48 public class SingleIndexWriter extends AbstractIndexWriter { |
49 public class SingleIndexWriter extends AbstractIndexWriter { |
|
50 |
|
51 private List<Object> elements; |
49 |
52 |
50 /** |
53 /** |
51 * Construct the SingleIndexWriter with filename "index-all.html" and the |
54 * Construct the SingleIndexWriter with filename "index-all.html" and the |
52 * {@link IndexBuilder} |
55 * {@link IndexBuilder} |
53 * |
56 * |
98 if (configuration.allowTag(HtmlTag.HEADER)) { |
101 if (configuration.allowTag(HtmlTag.HEADER)) { |
99 body.addContent(htmlTree); |
102 body.addContent(htmlTree); |
100 } |
103 } |
101 HtmlTree divTree = new HtmlTree(HtmlTag.DIV); |
104 HtmlTree divTree = new HtmlTree(HtmlTag.DIV); |
102 divTree.addStyle(HtmlStyle.contentContainer); |
105 divTree.addStyle(HtmlStyle.contentContainer); |
|
106 Set<Object> keys = new TreeSet<>(Arrays.asList(indexbuilder.elements())); |
|
107 keys.addAll(configuration.tagSearchIndexKeys); |
|
108 elements = new ArrayList<>(keys); |
103 addLinksForIndexes(divTree); |
109 addLinksForIndexes(divTree); |
104 for (int i = 0; i < indexbuilder.elements().length; i++) { |
110 for (Object ch : elements) { |
105 Character unicode = (Character)((indexbuilder.elements())[i]); |
111 Character unicode = (Character) ch; |
106 addContents(unicode, indexbuilder.getMemberList(unicode), divTree); |
112 if (configuration.tagSearchIndexMap.get(unicode) == null) { |
|
113 addContents(unicode, indexbuilder.getMemberList(unicode), divTree); |
|
114 } else if (indexbuilder.getMemberList(unicode) == null) { |
|
115 addSearchContents(unicode, configuration.tagSearchIndexMap.get(unicode), divTree); |
|
116 } else { |
|
117 addContents(unicode, indexbuilder.getMemberList(unicode), |
|
118 configuration.tagSearchIndexMap.get(unicode), divTree); |
|
119 } |
107 } |
120 } |
108 addLinksForIndexes(divTree); |
121 addLinksForIndexes(divTree); |
109 body.addContent((configuration.allowTag(HtmlTag.MAIN)) |
122 body.addContent((configuration.allowTag(HtmlTag.MAIN)) |
110 ? HtmlTree.MAIN(divTree) |
123 ? HtmlTree.MAIN(divTree) |
111 : divTree); |
124 : divTree); |
115 addNavLinks(false, htmlTree); |
128 addNavLinks(false, htmlTree); |
116 addBottom(htmlTree); |
129 addBottom(htmlTree); |
117 if (configuration.allowTag(HtmlTag.FOOTER)) { |
130 if (configuration.allowTag(HtmlTag.FOOTER)) { |
118 body.addContent(htmlTree); |
131 body.addContent(htmlTree); |
119 } |
132 } |
|
133 createSearchIndexFiles(); |
120 printHtmlDocument(null, true, body); |
134 printHtmlDocument(null, true, body); |
121 } |
135 } |
122 |
136 |
123 /** |
137 /** |
124 * Add links for all the Index Files per unicode character. |
138 * Add links for all the Index Files per unicode character. |
125 * |
139 * |
126 * @param contentTree the content tree to which the links for indexes will be added |
140 * @param contentTree the content tree to which the links for indexes will be added |
127 */ |
141 */ |
128 protected void addLinksForIndexes(Content contentTree) { |
142 protected void addLinksForIndexes(Content contentTree) { |
129 for (int i = 0; i < indexbuilder.elements().length; i++) { |
143 for (Object ch : elements) { |
130 String unicode = (indexbuilder.elements())[i].toString(); |
144 String unicode = ch.toString(); |
131 contentTree.addContent( |
145 contentTree.addContent( |
132 getHyperLink(getNameForIndex(unicode), |
146 getHyperLink(getNameForIndex(unicode), |
133 new StringContent(unicode))); |
147 new StringContent(unicode))); |
134 contentTree.addContent(getSpace()); |
148 contentTree.addContent(getSpace()); |
135 } |
149 } |
136 } |
150 } |
137 } |
151 } |