author | ohair |
Tue, 25 May 2010 15:54:51 -0700 | |
changeset 5520 | 86e4b9a9da40 |
parent 2320 | 5b8c377175f4 |
child 7614 | cfadc977ca75 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
5520 | 2 |
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
26 |
package com.sun.tools.doclets.formats.html; |
|
27 |
||
28 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
|
29 |
import com.sun.javadoc.*; |
|
30 |
import java.io.*; |
|
31 |
import java.util.*; |
|
32 |
||
33 |
/** |
|
34 |
* 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 |
|
36 |
* with the "pacakge-summary.html" file for the clicked package. |
|
37 |
* |
|
38 |
* @author Atul M Dambalkar |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2212
diff
changeset
|
39 |
* @author Bhavesh Patel (Modified) |
10 | 40 |
*/ |
41 |
public class PackageIndexWriter extends AbstractPackageIndexWriter { |
|
42 |
||
43 |
/** |
|
44 |
* Root of the program structure. Used for "overview" documentation. |
|
45 |
*/ |
|
46 |
private RootDoc root; |
|
47 |
||
48 |
/** |
|
49 |
* Map representing the group of packages as specified on the command line. |
|
50 |
* |
|
51 |
* @see Group |
|
52 |
*/ |
|
868 | 53 |
private Map<String,List<PackageDoc>> groupPackageMap; |
10 | 54 |
|
55 |
/** |
|
56 |
* List to store the order groups as specified on the command line. |
|
57 |
*/ |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1787
diff
changeset
|
58 |
private List<String> groupList; |
10 | 59 |
|
60 |
/** |
|
61 |
* Construct the PackageIndexWriter. Also constructs the grouping |
|
62 |
* information as provided on the command line by "-group" option. Stores |
|
63 |
* the order of groups specified by the user. |
|
64 |
* |
|
65 |
* @see Group |
|
66 |
*/ |
|
67 |
public PackageIndexWriter(ConfigurationImpl configuration, |
|
68 |
String filename) |
|
69 |
throws IOException { |
|
70 |
super(configuration, filename); |
|
71 |
this.root = configuration.root; |
|
72 |
groupPackageMap = configuration.group.groupPackages(packages); |
|
73 |
groupList = configuration.group.getGroupList(); |
|
74 |
} |
|
75 |
||
76 |
/** |
|
77 |
* Generate the package index page for the right-hand frame. |
|
78 |
* |
|
79 |
* @param configuration the current configuration of the doclet. |
|
80 |
*/ |
|
81 |
public static void generate(ConfigurationImpl configuration) { |
|
82 |
PackageIndexWriter packgen; |
|
83 |
String filename = "overview-summary.html"; |
|
84 |
try { |
|
85 |
packgen = new PackageIndexWriter(configuration, filename); |
|
86 |
packgen.generatePackageIndexFile("doclet.Window_Overview_Summary", true); |
|
87 |
packgen.close(); |
|
88 |
} catch (IOException exc) { |
|
89 |
configuration.standardmessage.error( |
|
90 |
"doclet.exception_encountered", |
|
91 |
exc.toString(), filename); |
|
92 |
throw new DocletAbortException(); |
|
93 |
} |
|
94 |
} |
|
95 |
||
96 |
/** |
|
97 |
* Print each package in separate rows in the index table. Generate link |
|
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); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
106 |
strong(); |
10 | 107 |
printPackageLink(pkg, Util.getPackageName(pkg), false); |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
108 |
strongEnd(); |
10 | 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. |
|
120 |
*/ |
|
121 |
protected void generateIndex() { |
|
122 |
for (int i = 0; i < groupList.size(); i++) { |
|
1870
57a1138dffc8
6795903: fix latent build warnings in langtools repository
jjg
parents:
1789
diff
changeset
|
123 |
String groupname = groupList.get(i); |
868 | 124 |
List<PackageDoc> list = groupPackageMap.get(groupname); |
10 | 125 |
if (list != null && list.size() > 0) { |
868 | 126 |
printIndexContents(list.toArray(new PackageDoc[list.size()]), |
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2212
diff
changeset
|
127 |
groupname, |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2212
diff
changeset
|
128 |
configuration.getText("doclet.Member_Table_Summary", |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2212
diff
changeset
|
129 |
groupname, |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2212
diff
changeset
|
130 |
configuration.getText("doclet.packages"))); |
10 | 131 |
} |
132 |
} |
|
133 |
} |
|
134 |
||
135 |
/** |
|
136 |
* Print the overview summary comment for this documentation. Print one line |
|
137 |
* summary at the top of the page and generate a link to the description, |
|
138 |
* which is generated at the end of this page. |
|
139 |
*/ |
|
140 |
protected void printOverviewHeader() { |
|
141 |
if (root.inlineTags().length > 0) { |
|
142 |
printSummaryComment(root); |
|
143 |
p(); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
144 |
strong(configuration.getText("doclet.See")); |
10 | 145 |
br(); |
146 |
printNbsps(); |
|
147 |
printHyperLink("", "overview_description", |
|
148 |
configuration.getText("doclet.Description"), true); |
|
149 |
p(); |
|
150 |
} |
|
151 |
} |
|
152 |
||
153 |
/** |
|
154 |
* Print Html tags for the table for this package index. |
|
155 |
*/ |
|
2320
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2212
diff
changeset
|
156 |
protected void printIndexHeader(String text, String tableSummary) { |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2212
diff
changeset
|
157 |
tableIndexSummary(tableSummary); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2212
diff
changeset
|
158 |
tableCaptionStart(); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2212
diff
changeset
|
159 |
print(text); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2212
diff
changeset
|
160 |
tableCaptionEnd(); |
5b8c377175f4
6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents:
2212
diff
changeset
|
161 |
summaryTableHeader(packageTableHeader, "col"); |
10 | 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. |
|
176 |
*/ |
|
177 |
protected void printOverviewComment() { |
|
178 |
if (root.inlineTags().length > 0) { |
|
179 |
anchor("overview_description"); |
|
180 |
p(); |
|
181 |
printInlineComment(root); |
|
182 |
p(); |
|
183 |
} |
|
184 |
} |
|
185 |
||
186 |
/** |
|
187 |
* Call {@link #printOverviewComment()} and then genrate the tag information |
|
188 |
* as provided in the file specified by the "-overview" option on the |
|
189 |
* command line. |
|
190 |
*/ |
|
191 |
protected void printOverview() throws IOException { |
|
192 |
printOverviewComment(); |
|
193 |
printTags(root); |
|
194 |
} |
|
195 |
||
196 |
/** |
|
197 |
* Print the top text (from the -top option), the upper |
|
198 |
* navigation bar, and then the title (from the"-title" |
|
199 |
* option), at the top of page. |
|
200 |
*/ |
|
201 |
protected void printNavigationBarHeader() { |
|
202 |
printTop(); |
|
203 |
navLinks(true); |
|
204 |
hr(); |
|
205 |
printConfigurationTitle(); |
|
206 |
} |
|
207 |
||
208 |
/** |
|
209 |
* Print the lower navigation bar and the bottom text |
|
210 |
* (from the -bottom option) at the bottom of page. |
|
211 |
*/ |
|
212 |
protected void printNavigationBarFooter() { |
|
213 |
hr(); |
|
214 |
navLinks(false); |
|
215 |
printBottom(); |
|
216 |
} |
|
217 |
} |