author | bpatel |
Thu, 08 Jan 2009 16:26:59 -0800 | |
changeset 1787 | 1aa079321cd2 |
parent 1264 | 076a3cde30d5 |
child 1789 | 7ac8c0815000 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
1264 | 2 |
* Copyright 1997-2008 Sun Microsystems, Inc. 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 |
|
7 |
* published by the Free Software Foundation. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun in the LICENSE file that accompanied this code. |
|
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 |
* |
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
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 |
|
39 |
*/ |
|
40 |
public class PackageIndexWriter extends AbstractPackageIndexWriter { |
|
41 |
||
42 |
/** |
|
43 |
* Root of the program structure. Used for "overview" documentation. |
|
44 |
*/ |
|
45 |
private RootDoc root; |
|
46 |
||
47 |
/** |
|
48 |
* Map representing the group of packages as specified on the command line. |
|
49 |
* |
|
50 |
* @see Group |
|
51 |
*/ |
|
868 | 52 |
private Map<String,List<PackageDoc>> groupPackageMap; |
10 | 53 |
|
54 |
/** |
|
55 |
* List to store the order groups as specified on the command line. |
|
56 |
*/ |
|
57 |
private List groupList; |
|
58 |
||
59 |
/** |
|
60 |
* Construct the PackageIndexWriter. Also constructs the grouping |
|
61 |
* information as provided on the command line by "-group" option. Stores |
|
62 |
* the order of groups specified by the user. |
|
63 |
* |
|
64 |
* @see Group |
|
65 |
*/ |
|
66 |
public PackageIndexWriter(ConfigurationImpl configuration, |
|
67 |
String filename) |
|
68 |
throws IOException { |
|
69 |
super(configuration, filename); |
|
70 |
this.root = configuration.root; |
|
71 |
groupPackageMap = configuration.group.groupPackages(packages); |
|
72 |
groupList = configuration.group.getGroupList(); |
|
73 |
} |
|
74 |
||
75 |
/** |
|
76 |
* Generate the package index page for the right-hand frame. |
|
77 |
* |
|
78 |
* @param configuration the current configuration of the doclet. |
|
79 |
*/ |
|
80 |
public static void generate(ConfigurationImpl configuration) { |
|
81 |
PackageIndexWriter packgen; |
|
82 |
String filename = "overview-summary.html"; |
|
83 |
try { |
|
84 |
packgen = new PackageIndexWriter(configuration, filename); |
|
85 |
packgen.generatePackageIndexFile("doclet.Window_Overview_Summary", true); |
|
86 |
packgen.close(); |
|
87 |
} catch (IOException exc) { |
|
88 |
configuration.standardmessage.error( |
|
89 |
"doclet.exception_encountered", |
|
90 |
exc.toString(), filename); |
|
91 |
throw new DocletAbortException(); |
|
92 |
} |
|
93 |
} |
|
94 |
||
95 |
/** |
|
96 |
* Print each package in separate rows in the index table. Generate link |
|
97 |
* to each package. |
|
98 |
* |
|
99 |
* @param pkg Package to which link is to be generated. |
|
100 |
*/ |
|
101 |
protected void printIndexRow(PackageDoc pkg) { |
|
102 |
if(pkg != null && pkg.name().length() > 0) { |
|
103 |
trBgcolorStyle("white", "TableRowColor"); |
|
104 |
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
|
105 |
strong(); |
10 | 106 |
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
|
107 |
strongEnd(); |
10 | 108 |
summaryRowEnd(); |
109 |
summaryRow(0); |
|
110 |
printSummaryComment(pkg); |
|
111 |
summaryRowEnd(); |
|
112 |
trEnd(); |
|
113 |
} |
|
114 |
} |
|
115 |
||
116 |
/** |
|
117 |
* Depending upon the grouping information and their titles, generate |
|
118 |
* separate table indices for each package group. |
|
119 |
*/ |
|
120 |
protected void generateIndex() { |
|
121 |
for (int i = 0; i < groupList.size(); i++) { |
|
122 |
String groupname = (String)groupList.get(i); |
|
868 | 123 |
List<PackageDoc> list = groupPackageMap.get(groupname); |
10 | 124 |
if (list != null && list.size() > 0) { |
868 | 125 |
printIndexContents(list.toArray(new PackageDoc[list.size()]), |
10 | 126 |
groupname); |
127 |
} |
|
128 |
} |
|
129 |
} |
|
130 |
||
131 |
/** |
|
132 |
* Print the overview summary comment for this documentation. Print one line |
|
133 |
* summary at the top of the page and generate a link to the description, |
|
134 |
* which is generated at the end of this page. |
|
135 |
*/ |
|
136 |
protected void printOverviewHeader() { |
|
137 |
if (root.inlineTags().length > 0) { |
|
138 |
printSummaryComment(root); |
|
139 |
p(); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
140 |
strong(configuration.getText("doclet.See")); |
10 | 141 |
br(); |
142 |
printNbsps(); |
|
143 |
printHyperLink("", "overview_description", |
|
144 |
configuration.getText("doclet.Description"), true); |
|
145 |
p(); |
|
146 |
} |
|
147 |
} |
|
148 |
||
149 |
/** |
|
150 |
* Print Html tags for the table for this package index. |
|
151 |
*/ |
|
152 |
protected void printIndexHeader(String text) { |
|
153 |
tableIndexSummary(); |
|
154 |
tableHeaderStart("#CCCCFF"); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
1264
diff
changeset
|
155 |
strong(text); |
10 | 156 |
tableHeaderEnd(); |
157 |
} |
|
158 |
||
159 |
/** |
|
160 |
* Print Html closing tags for the table for this package index. |
|
161 |
*/ |
|
162 |
protected void printIndexFooter() { |
|
163 |
tableEnd(); |
|
164 |
p(); |
|
165 |
space(); |
|
166 |
} |
|
167 |
||
168 |
/** |
|
169 |
* Print the overview comment as provided in the file specified by the |
|
170 |
* "-overview" option on the command line. |
|
171 |
*/ |
|
172 |
protected void printOverviewComment() { |
|
173 |
if (root.inlineTags().length > 0) { |
|
174 |
anchor("overview_description"); |
|
175 |
p(); |
|
176 |
printInlineComment(root); |
|
177 |
p(); |
|
178 |
} |
|
179 |
} |
|
180 |
||
181 |
/** |
|
182 |
* Call {@link #printOverviewComment()} and then genrate the tag information |
|
183 |
* as provided in the file specified by the "-overview" option on the |
|
184 |
* command line. |
|
185 |
*/ |
|
186 |
protected void printOverview() throws IOException { |
|
187 |
printOverviewComment(); |
|
188 |
printTags(root); |
|
189 |
} |
|
190 |
||
191 |
/** |
|
192 |
* Print the top text (from the -top option), the upper |
|
193 |
* navigation bar, and then the title (from the"-title" |
|
194 |
* option), at the top of page. |
|
195 |
*/ |
|
196 |
protected void printNavigationBarHeader() { |
|
197 |
printTop(); |
|
198 |
navLinks(true); |
|
199 |
hr(); |
|
200 |
printConfigurationTitle(); |
|
201 |
} |
|
202 |
||
203 |
/** |
|
204 |
* Print the lower navigation bar and the bottom text |
|
205 |
* (from the -bottom option) at the bottom of page. |
|
206 |
*/ |
|
207 |
protected void printNavigationBarFooter() { |
|
208 |
hr(); |
|
209 |
navLinks(false); |
|
210 |
printBottom(); |
|
211 |
} |
|
212 |
} |