src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.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 java.io.*;
29 import java.util.*;
30 import com.sun.javadoc.*;
28 import com.sun.tools.doclets.internal.toolkit.*; 31 import com.sun.tools.doclets.internal.toolkit.*;
29 import com.sun.tools.doclets.internal.toolkit.util.*; 32 import com.sun.tools.doclets.internal.toolkit.util.*;
30 33 import com.sun.tools.doclets.formats.html.markup.*;
31 import com.sun.javadoc.*;
32 import java.io.*;
33 import java.util.*;
34 34
35 /** 35 /**
36 * Class to generate file for each package contents in the right-hand 36 * Class to generate file for each package contents in the right-hand
37 * frame. This will list all the Class Kinds in the package. A click on any 37 * frame. This will list all the Class Kinds in the package. A click on any
38 * class-kind will update the frame with the clicked class-kind page. 38 * class-kind will update the frame with the clicked class-kind page.
96 } 96 }
97 97
98 /** 98 /**
99 * {@inheritDoc} 99 * {@inheritDoc}
100 */ 100 */
101 public void writeSummaryHeader() {} 101 public Content getPackageHeader(String heading) {
102 102 String pkgName = packageDoc.name();
103 /** 103 Content bodyTree = getBody(true, getWindowTitle(pkgName));
104 * {@inheritDoc} 104 addTop(bodyTree);
105 */ 105 addNavLinks(true, bodyTree);
106 public void writeSummaryFooter() {} 106 HtmlTree div = new HtmlTree(HtmlTag.DIV);
107 107 div.addStyle(HtmlStyle.header);
108 /** 108 Content annotationContent = new HtmlTree(HtmlTag.P);
109 * {@inheritDoc} 109 addAnnotationInfo(packageDoc, annotationContent);
110 */ 110 div.addContent(annotationContent);
111 public void writeClassesSummary(ClassDoc[] classes, String label, String tableSummary, String[] tableHeader) { 111 Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
112 HtmlStyle.title, packageLabel);
113 tHeading.addContent(getSpace());
114 Content packageHead = new RawHtml(heading);
115 tHeading.addContent(packageHead);
116 div.addContent(tHeading);
117 if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
118 HtmlTree p = new HtmlTree(HtmlTag.P);
119 p.addStyle(HtmlStyle.subTitle);
120 addSummaryComment(packageDoc, p);
121 div.addContent(p);
122 Content space = getSpace();
123 Content descLink = getHyperLink("", "package_description",
124 descriptionLabel, "", "");
125 Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
126 div.addContent(descPara);
127 }
128 bodyTree.addContent(div);
129 return bodyTree;
130 }
131
132 /**
133 * {@inheritDoc}
134 */
135 public Content getContentHeader() {
136 HtmlTree div = new HtmlTree(HtmlTag.DIV);
137 div.addStyle(HtmlStyle.contentContainer);
138 return div;
139 }
140
141 /**
142 * {@inheritDoc}
143 */
144 public Content getSummaryHeader() {
145 HtmlTree ul = new HtmlTree(HtmlTag.UL);
146 ul.addStyle(HtmlStyle.blockList);
147 return ul;
148 }
149
150 /**
151 * {@inheritDoc}
152 */
153 public void addClassesSummary(ClassDoc[] classes, String label,
154 String tableSummary, String[] tableHeader, Content summaryContentTree) {
112 if(classes.length > 0) { 155 if(classes.length > 0) {
113 Arrays.sort(classes); 156 Arrays.sort(classes);
114 tableIndexSummary(tableSummary); 157 Content caption = getTableCaption(label);
115 boolean printedHeading = false; 158 Content table = HtmlTree.TABLE(HtmlStyle.packageSummary, 0, 3, 0,
159 tableSummary, caption);
160 table.addContent(getSummaryTableHeader(tableHeader, "col"));
161 Content tbody = new HtmlTree(HtmlTag.TBODY);
116 for (int i = 0; i < classes.length; i++) { 162 for (int i = 0; i < classes.length; i++) {
117 if (!printedHeading) {
118 printTableCaption(label);
119 printFirstRow(tableHeader);
120 printedHeading = true;
121 }
122 if (!Util.isCoreClass(classes[i]) || 163 if (!Util.isCoreClass(classes[i]) ||
123 !configuration.isGeneratedDoc(classes[i])) { 164 !configuration.isGeneratedDoc(classes[i])) {
124 continue; 165 continue;
125 } 166 }
126 trBgcolorStyle("white", "TableRowColor"); 167 Content classContent = new RawHtml(getLink(new LinkInfoImpl(
127 summaryRow(15); 168 LinkInfoImpl.CONTEXT_PACKAGE, classes[i], false)));
128 strong(); 169 Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
129 printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_PACKAGE, 170 HtmlTree tr = HtmlTree.TR(tdClass);
130 classes[i], false)); 171 if (i%2 == 0)
131 strongEnd(); 172 tr.addStyle(HtmlStyle.altColor);
132 summaryRowEnd(); 173 else
133 summaryRow(0); 174 tr.addStyle(HtmlStyle.rowColor);
175 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
176 tdClassDescription.addStyle(HtmlStyle.colLast);
134 if (Util.isDeprecated(classes[i])) { 177 if (Util.isDeprecated(classes[i])) {
135 strongText("doclet.Deprecated"); 178 tdClassDescription.addContent(deprecatedLabel);
136 if (classes[i].tags("deprecated").length > 0) { 179 if (classes[i].tags("deprecated").length > 0) {
137 space(); 180 addSummaryDeprecatedComment(classes[i],
138 printSummaryDeprecatedComment(classes[i], 181 classes[i].tags("deprecated")[0], tdClassDescription);
139 classes[i].tags("deprecated")[0]);
140 } 182 }
141 } else {
142 printSummaryComment(classes[i]);
143 } 183 }
144 summaryRowEnd(); 184 else
145 trEnd(); 185 addSummaryComment(classes[i], tdClassDescription);
186 tr.addContent(tdClassDescription);
187 tbody.addContent(tr);
146 } 188 }
147 tableEnd(); 189 table.addContent(tbody);
148 println("&nbsp;"); 190 Content li = HtmlTree.LI(HtmlStyle.blockList, table);
149 p(); 191 summaryContentTree.addContent(li);
150 } 192 }
151 } 193 }
152 194
153 /** 195 /**
154 * Print the table caption for the class-listing. 196 * {@inheritDoc}
155 * 197 */
156 * @param label label for the Class kind listing. 198 public void addPackageDescription(Content packageContentTree) {
157 */
158 protected void printTableCaption(String label) {
159 tableCaptionStart();
160 print(label);
161 tableCaptionEnd();
162 }
163
164 /**
165 * Print the table heading for the class-listing.
166 *
167 * @param tableHeader table header string for the Class listing.
168 */
169 protected void printFirstRow(String[] tableHeader) {
170 summaryTableHeader(tableHeader, "col");
171 }
172
173 /**
174 * {@inheritDoc}
175 */
176 public void writePackageDescription() {
177 if (packageDoc.inlineTags().length > 0) { 199 if (packageDoc.inlineTags().length > 0) {
178 anchor("package_description"); 200 packageContentTree.addContent(getMarkerAnchor("package_description"));
179 h2(configuration.getText("doclet.Package_Description", packageDoc.name())); 201 Content h2Content = new StringContent(
180 p(); 202 configuration.getText("doclet.Package_Description",
181 printInlineComment(packageDoc); 203 packageDoc.name()));
182 p(); 204 packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
183 } 205 true, h2Content));
184 } 206 addInlineComment(packageDoc, packageContentTree);
185 207 }
186 /** 208 }
187 * {@inheritDoc} 209
188 */ 210 /**
189 public void writePackageTags() { 211 * {@inheritDoc}
190 printTags(packageDoc); 212 */
191 } 213 public void addPackageTags(Content packageContentTree) {
192 214 addTagsInfo(packageDoc, packageContentTree);
193 /** 215 }
194 * {@inheritDoc} 216
195 */ 217 /**
196 public void writePackageHeader(String heading) { 218 * {@inheritDoc}
197 String pkgName = packageDoc.name(); 219 */
198 printHtmlHeader(pkgName, 220 public void addPackageFooter(Content contentTree) {
199 configuration.metakeywords.getMetaKeywords(packageDoc), true); 221 addNavLinks(false, contentTree);
200 printTop(); 222 addBottom(contentTree);
201 navLinks(true); 223 }
202 hr(); 224
203 writeAnnotationInfo(packageDoc); 225 /**
204 h2(configuration.getText("doclet.Package") + " " + heading); 226 * {@inheritDoc}
205 if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) { 227 */
206 printSummaryComment(packageDoc); 228 public void printDocument(Content contentTree) {
207 p(); 229 printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageDoc),
208 strong(configuration.getText("doclet.See")); 230 true, contentTree);
209 br(); 231 }
210 printNbsps(); 232
211 printHyperLink("", "package_description", 233 /**
212 configuration.getText("doclet.Description"), true); 234 * Get "Use" link for this pacakge in the navigation bar.
213 p(); 235 *
214 } 236 * @return a content tree for the class use link
215 } 237 */
216 238 protected Content getNavLinkClassUse() {
217 /** 239 Content useLink = getHyperLink("package-use.html", "",
218 * {@inheritDoc} 240 useLabel, "", "");
219 */ 241 Content li = HtmlTree.LI(useLink);
220 public void writePackageFooter() { 242 return li;
221 hr(); 243 }
222 navLinks(false); 244
223 printBottom(); 245 /**
224 printBodyHtmlEnd(); 246 * Get "PREV PACKAGE" link in the navigation bar.
225 } 247 *
226 248 * @return a content tree for the previous link
227 /** 249 */
228 * Print "Use" link for this pacakge in the navigation bar. 250 public Content getNavLinkPrevious() {
229 */ 251 Content li;
230 protected void navLinkClassUse() {
231 navCellStart();
232 printHyperLink("package-use.html", "", configuration.getText("doclet.navClassUse"),
233 true, "NavBarFont1");
234 navCellEnd();
235 }
236
237 /**
238 * Print "PREV PACKAGE" link in the navigation bar.
239 */
240 protected void navLinkPrevious() {
241 if (prev == null) { 252 if (prev == null) {
242 printText("doclet.Prev_Package"); 253 li = HtmlTree.LI(prevpackageLabel);
243 } else { 254 } else {
244 String path = DirectoryManager.getRelativePath(packageDoc.name(), 255 String path = DirectoryManager.getRelativePath(packageDoc.name(),
245 prev.name()); 256 prev.name());
246 printHyperLink(path + "package-summary.html", "", 257 li = HtmlTree.LI(getHyperLink(path + "package-summary.html", "",
247 configuration.getText("doclet.Prev_Package"), true); 258 prevpackageLabel, "", ""));
248 } 259 }
249 } 260 return li;
250 261 }
251 /** 262
252 * Print "NEXT PACKAGE" link in the navigation bar. 263 /**
253 */ 264 * Get "NEXT PACKAGE" link in the navigation bar.
254 protected void navLinkNext() { 265 *
266 * @return a content tree for the next link
267 */
268 public Content getNavLinkNext() {
269 Content li;
255 if (next == null) { 270 if (next == null) {
256 printText("doclet.Next_Package"); 271 li = HtmlTree.LI(nextpackageLabel);
257 } else { 272 } else {
258 String path = DirectoryManager.getRelativePath(packageDoc.name(), 273 String path = DirectoryManager.getRelativePath(packageDoc.name(),
259 next.name()); 274 next.name());
260 printHyperLink(path + "package-summary.html", "", 275 li = HtmlTree.LI(getHyperLink(path + "package-summary.html", "",
261 configuration.getText("doclet.Next_Package"), true); 276 nextpackageLabel, "", ""));
262 } 277 }
263 } 278 return li;
264 279 }
265 /** 280
266 * Print "Tree" link in the navigation bar. This will be link to the package 281 /**
282 * Get "Tree" link in the navigation bar. This will be link to the package
267 * tree file. 283 * tree file.
268 */ 284 *
269 protected void navLinkTree() { 285 * @return a content tree for the tree link
270 navCellStart(); 286 */
271 printHyperLink("package-tree.html", "", configuration.getText("doclet.Tree"), 287 protected Content getNavLinkTree() {
272 true, "NavBarFont1"); 288 Content useLink = getHyperLink("package-tree.html", "",
273 navCellEnd(); 289 treeLabel, "", "");
290 Content li = HtmlTree.LI(useLink);
291 return li;
274 } 292 }
275 293
276 /** 294 /**
277 * Highlight "Package" in the navigation bar, as this is the package page. 295 * Highlight "Package" in the navigation bar, as this is the package page.
278 */ 296 *
279 protected void navLinkPackage() { 297 * @return a content tree for the package link
280 navCellRevStart(); 298 */
281 fontStyle("NavBarFont1Rev"); 299 protected Content getNavLinkPackage() {
282 strongText("doclet.Package"); 300 Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, packageLabel);
283 fontEnd(); 301 return li;
284 navCellEnd();
285 } 302 }
286 } 303 }

mercurial