src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java

changeset 766
90af8d87741f
parent 554
9d9f26857129
child 798
4868a36f6fd8
equal deleted inserted replaced
758:bcbc86cc5b31 766:90af8d87741f
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 com.sun.tools.doclets.internal.toolkit.util.*;
29 import com.sun.javadoc.*;
30 import java.io.*; 28 import java.io.*;
31 import java.util.*; 29 import java.util.*;
30 import com.sun.javadoc.*;
31 import com.sun.tools.doclets.internal.toolkit.*;
32 import com.sun.tools.doclets.internal.toolkit.util.*;
33 import com.sun.tools.doclets.formats.html.markup.*;
32 34
33 /** 35 /**
34 * Generate the package index page "overview-summary.html" for the right-hand 36 * Generate the package index page "overview-summary.html" for the right-hand
35 * frame. A click on the package name on this page will update the same frame 37 * frame. A click on the package name on this page will update the same frame
36 * with the "pacakge-summary.html" file for the clicked package. 38 * with the "pacakge-summary.html" file for the clicked package.
81 public static void generate(ConfigurationImpl configuration) { 83 public static void generate(ConfigurationImpl configuration) {
82 PackageIndexWriter packgen; 84 PackageIndexWriter packgen;
83 String filename = "overview-summary.html"; 85 String filename = "overview-summary.html";
84 try { 86 try {
85 packgen = new PackageIndexWriter(configuration, filename); 87 packgen = new PackageIndexWriter(configuration, filename);
86 packgen.generatePackageIndexFile("doclet.Window_Overview_Summary", true); 88 packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
87 packgen.close(); 89 packgen.close();
88 } catch (IOException exc) { 90 } catch (IOException exc) {
89 configuration.standardmessage.error( 91 configuration.standardmessage.error(
90 "doclet.exception_encountered", 92 "doclet.exception_encountered",
91 exc.toString(), filename); 93 exc.toString(), filename);
92 throw new DocletAbortException(); 94 throw new DocletAbortException();
93 } 95 }
94 } 96 }
95 97
96 /** 98 /**
97 * Print each package in separate rows in the index table. Generate link 99 * Depending upon the grouping information and their titles, add
98 * to each package.
99 *
100 * @param pkg Package to which link is to be generated.
101 */
102 protected void printIndexRow(PackageDoc pkg) {
103 if(pkg != null && pkg.name().length() > 0) {
104 trBgcolorStyle("white", "TableRowColor");
105 summaryRow(20);
106 strong();
107 printPackageLink(pkg, Util.getPackageName(pkg), false);
108 strongEnd();
109 summaryRowEnd();
110 summaryRow(0);
111 printSummaryComment(pkg);
112 summaryRowEnd();
113 trEnd();
114 }
115 }
116
117 /**
118 * Depending upon the grouping information and their titles, generate
119 * separate table indices for each package group. 100 * separate table indices for each package group.
120 */ 101 *
121 protected void generateIndex() { 102 * @param body the documentation tree to which the index will be added
103 */
104 protected void addIndex(Content body) {
122 for (int i = 0; i < groupList.size(); i++) { 105 for (int i = 0; i < groupList.size(); i++) {
123 String groupname = groupList.get(i); 106 String groupname = groupList.get(i);
124 List<PackageDoc> list = groupPackageMap.get(groupname); 107 List<PackageDoc> list = groupPackageMap.get(groupname);
125 if (list != null && list.size() > 0) { 108 if (list != null && list.size() > 0) {
126 printIndexContents(list.toArray(new PackageDoc[list.size()]), 109 addIndexContents(list.toArray(new PackageDoc[list.size()]),
127 groupname, 110 groupname, configuration.getText("doclet.Member_Table_Summary",
128 configuration.getText("doclet.Member_Table_Summary", 111 groupname, configuration.getText("doclet.packages")), body);
129 groupname,
130 configuration.getText("doclet.packages")));
131 } 112 }
132 } 113 }
133 } 114 }
134 115
135 /** 116 /**
136 * Print the overview summary comment for this documentation. Print one line 117 * {@inheritDoc}
118 */
119 protected void addPackagesList(PackageDoc[] packages, String text,
120 String tableSummary, Content body) {
121 Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
122 getTableCaption(text));
123 table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
124 Content tbody = new HtmlTree(HtmlTag.TBODY);
125 addPackagesList(packages, tbody);
126 table.addContent(tbody);
127 Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
128 body.addContent(div);
129 }
130
131 /**
132 * Adds list of packages in the index table. Generate link to each package.
133 *
134 * @param packages Packages to which link is to be generated
135 * @param tbody the documentation tree to which the list will be added
136 */
137 protected void addPackagesList(PackageDoc[] packages, Content tbody) {
138 for (int i = 0; i < packages.length; i++) {
139 if (packages[i] != null && packages[i].name().length() > 0) {
140 Content packageLinkContent = getPackageLink(packages[i],
141 getPackageName(packages[i]));
142 Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
143 HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
144 tdSummary.addStyle(HtmlStyle.colLast);
145 addSummaryComment(packages[i], tdSummary);
146 HtmlTree tr = HtmlTree.TR(tdPackage);
147 tr.addContent(tdSummary);
148 if (i%2 == 0)
149 tr.addStyle(HtmlStyle.altColor);
150 else
151 tr.addStyle(HtmlStyle.rowColor);
152 tbody.addContent(tr);
153 }
154 }
155 }
156
157 /**
158 * Adds the overview summary comment for this documentation. Add one line
137 * summary at the top of the page and generate a link to the description, 159 * summary at the top of the page and generate a link to the description,
138 * which is generated at the end of this page. 160 * which is added at the end of this page.
139 */ 161 *
140 protected void printOverviewHeader() { 162 * @param body the documentation tree to which the overview header will be added
163 */
164 protected void addOverviewHeader(Content body) {
141 if (root.inlineTags().length > 0) { 165 if (root.inlineTags().length > 0) {
142 printSummaryComment(root); 166 HtmlTree p = new HtmlTree(HtmlTag.P);
143 p(); 167 p.addStyle(HtmlStyle.subTitle);
144 strong(configuration.getText("doclet.See")); 168 addSummaryComment(root, p);
145 br(); 169 Content div = HtmlTree.DIV(HtmlStyle.header, p);
146 printNbsps(); 170 Content see = seeLabel;
147 printHyperLink("", "overview_description", 171 see.addContent(" ");
148 configuration.getText("doclet.Description"), true); 172 Content descPara = HtmlTree.P(see);
149 p(); 173 Content descLink = getHyperLink("", "overview_description",
150 } 174 descriptionLabel, "", "");
151 } 175 descPara.addContent(descLink);
152 176 div.addContent(descPara);
153 /** 177 body.addContent(div);
154 * Print Html tags for the table for this package index. 178 }
155 */ 179 }
156 protected void printIndexHeader(String text, String tableSummary) { 180
157 tableIndexSummary(tableSummary); 181 /**
158 tableCaptionStart(); 182 * Adds the overview comment as provided in the file specified by the
159 print(text);
160 tableCaptionEnd();
161 summaryTableHeader(packageTableHeader, "col");
162 }
163
164 /**
165 * Print Html closing tags for the table for this package index.
166 */
167 protected void printIndexFooter() {
168 tableEnd();
169 p();
170 space();
171 }
172
173 /**
174 * Print the overview comment as provided in the file specified by the
175 * "-overview" option on the command line. 183 * "-overview" option on the command line.
176 */ 184 *
177 protected void printOverviewComment() { 185 * @param htmltree the documentation tree to which the overview comment will
186 * be added
187 */
188 protected void addOverviewComment(Content htmltree) {
178 if (root.inlineTags().length > 0) { 189 if (root.inlineTags().length > 0) {
179 anchor("overview_description"); 190 htmltree.addContent(getMarkerAnchor("overview_description"));
180 p(); 191 HtmlTree p = new HtmlTree(HtmlTag.P);
181 printInlineComment(root); 192 p.addStyle(HtmlStyle.subTitle);
182 p(); 193 addInlineComment(root, p);
183 } 194 htmltree.addContent(p);
184 } 195 }
185 196 }
186 /** 197
187 * Call {@link #printOverviewComment()} and then genrate the tag information 198 /**
188 * as provided in the file specified by the "-overview" option on the 199 * Adds the tag information as provided in the file specified by the
189 * command line. 200 * "-overview" option on the command line.
190 */ 201 *
191 protected void printOverview() throws IOException { 202 * @param body the documentation tree to which the overview will be added
192 printOverviewComment(); 203 */
193 printTags(root); 204 protected void addOverview(Content body) throws IOException {
194 } 205 HtmlTree div = new HtmlTree(HtmlTag.DIV);
195 206 div.addStyle(HtmlStyle.footer);
196 /** 207 addOverviewComment(div);
197 * Print the top text (from the -top option), the upper 208 addTagsInfo(root, div);
209 body.addContent(div);
210 }
211
212 /**
213 * Adds the top text (from the -top option), the upper
198 * navigation bar, and then the title (from the"-title" 214 * navigation bar, and then the title (from the"-title"
199 * option), at the top of page. 215 * option), at the top of page.
200 */ 216 *
201 protected void printNavigationBarHeader() { 217 * @body the documentation tree to which the navigation bar header will be added
202 printTop(); 218 */
203 navLinks(true); 219 protected void addNavigationBarHeader(Content body) {
204 hr(); 220 addTop(body);
205 printConfigurationTitle(); 221 addNavLinks(true, body);
206 } 222 addConfigurationTitle(body);
207 223 }
208 /** 224
209 * Print the lower navigation bar and the bottom text 225 /**
226 * Adds the lower navigation bar and the bottom text
210 * (from the -bottom option) at the bottom of page. 227 * (from the -bottom option) at the bottom of page.
211 */ 228 *
212 protected void printNavigationBarFooter() { 229 * @param the documentation tree to which the navigation bar footer will be added
213 hr(); 230 */
214 navLinks(false); 231 protected void addNavigationBarFooter(Content body) {
215 printBottom(); 232 addNavLinks(false, body);
233 addBottom(body);
216 } 234 }
217 } 235 }

mercurial