author | bpatel |
Thu, 08 Jan 2009 16:26:59 -0800 | |
changeset 1787 | 1aa079321cd2 |
parent 10 | 06bc494ca11e |
child 2216 | b124d5c924eb |
permissions | -rw-r--r-- |
10 | 1 |
/* |
2 |
* Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved. |
|
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 |
||
32 |
/** |
|
33 |
* Class to generate Tree page for a package. The name of the file generated is |
|
34 |
* "package-tree.html" and it is generated in the respective package directory. |
|
35 |
* |
|
36 |
* @author Atul M Dambalkar |
|
37 |
*/ |
|
38 |
public class PackageTreeWriter extends AbstractTreeWriter { |
|
39 |
||
40 |
/** |
|
41 |
* Package for which tree is to be generated. |
|
42 |
*/ |
|
43 |
protected PackageDoc packagedoc; |
|
44 |
||
45 |
/** |
|
46 |
* The previous package name in the alpha-order list. |
|
47 |
*/ |
|
48 |
protected PackageDoc prev; |
|
49 |
||
50 |
/** |
|
51 |
* The next package name in the alpha-order list. |
|
52 |
*/ |
|
53 |
protected PackageDoc next; |
|
54 |
||
55 |
/** |
|
56 |
* Constructor. |
|
57 |
* @throws IOException |
|
58 |
* @throws DocletAbortException |
|
59 |
*/ |
|
60 |
public PackageTreeWriter(ConfigurationImpl configuration, |
|
61 |
String path, String filename, |
|
62 |
PackageDoc packagedoc, |
|
63 |
PackageDoc prev, PackageDoc next) |
|
64 |
throws IOException { |
|
65 |
super(configuration, path, filename, |
|
66 |
new ClassTree( |
|
67 |
configuration.classDocCatalog.allClasses(packagedoc), |
|
68 |
configuration), |
|
69 |
packagedoc); |
|
70 |
this.packagedoc = packagedoc; |
|
71 |
this.prev = prev; |
|
72 |
this.next = next; |
|
73 |
} |
|
74 |
||
75 |
/** |
|
76 |
* Construct a PackageTreeWriter object and then use it to generate the |
|
77 |
* package tree page. |
|
78 |
* |
|
79 |
* @param pkg Package for which tree file is to be generated. |
|
80 |
* @param prev Previous package in the alpha-ordered list. |
|
81 |
* @param next Next package in the alpha-ordered list. |
|
82 |
* @param noDeprecated If true, do not generate any information for |
|
83 |
* deprecated classe or interfaces. |
|
84 |
* @throws DocletAbortException |
|
85 |
*/ |
|
86 |
public static void generate(ConfigurationImpl configuration, |
|
87 |
PackageDoc pkg, PackageDoc prev, |
|
88 |
PackageDoc next, boolean noDeprecated) { |
|
89 |
PackageTreeWriter packgen; |
|
90 |
String path = DirectoryManager.getDirectoryPath(pkg); |
|
91 |
String filename = "package-tree.html"; |
|
92 |
try { |
|
93 |
packgen = new PackageTreeWriter(configuration, path, filename, pkg, |
|
94 |
prev, next); |
|
95 |
packgen.generatePackageTreeFile(); |
|
96 |
packgen.close(); |
|
97 |
} catch (IOException exc) { |
|
98 |
configuration.standardmessage.error( |
|
99 |
"doclet.exception_encountered", |
|
100 |
exc.toString(), filename); |
|
101 |
throw new DocletAbortException(); |
|
102 |
} |
|
103 |
} |
|
104 |
||
105 |
/** |
|
106 |
* Generate a separate tree file for each package. |
|
107 |
*/ |
|
108 |
protected void generatePackageTreeFile() throws IOException { |
|
109 |
printHtmlHeader(packagedoc.name() + " " |
|
110 |
+ configuration.getText("doclet.Window_Class_Hierarchy"), null, true); |
|
111 |
||
112 |
printPackageTreeHeader(); |
|
113 |
||
114 |
if (configuration.packages.length > 1) { |
|
115 |
printLinkToMainTree(); |
|
116 |
} |
|
117 |
||
118 |
generateTree(classtree.baseclasses(), "doclet.Class_Hierarchy"); |
|
119 |
generateTree(classtree.baseinterfaces(), "doclet.Interface_Hierarchy"); |
|
120 |
generateTree(classtree.baseAnnotationTypes(), "doclet.Annotation_Type_Hierarchy"); |
|
121 |
generateTree(classtree.baseEnums(), "doclet.Enum_Hierarchy"); |
|
122 |
||
123 |
printPackageTreeFooter(); |
|
124 |
printBottom(); |
|
125 |
printBodyHtmlEnd(); |
|
126 |
} |
|
127 |
||
128 |
/** |
|
129 |
* Print the navigation bar header for the package tree file. |
|
130 |
*/ |
|
131 |
protected void printPackageTreeHeader() { |
|
132 |
printTop(); |
|
133 |
navLinks(true); |
|
134 |
hr(); |
|
135 |
center(); |
|
136 |
h2(configuration.getText("doclet.Hierarchy_For_Package", |
|
137 |
Util.getPackageName(packagedoc))); |
|
138 |
centerEnd(); |
|
139 |
} |
|
140 |
||
141 |
/** |
|
142 |
* Generate a link to the tree for all the packages. |
|
143 |
*/ |
|
144 |
protected void printLinkToMainTree() { |
|
145 |
dl(); |
|
146 |
dt(); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
147 |
strongText("doclet.Package_Hierarchies"); |
10 | 148 |
dd(); |
149 |
navLinkMainTree(configuration.getText("doclet.All_Packages")); |
|
150 |
dlEnd(); |
|
151 |
hr(); |
|
152 |
} |
|
153 |
||
154 |
/** |
|
155 |
* Print the navigation bar footer for the package tree file. |
|
156 |
*/ |
|
157 |
protected void printPackageTreeFooter() { |
|
158 |
hr(); |
|
159 |
navLinks(false); |
|
160 |
} |
|
161 |
||
162 |
/** |
|
163 |
* Link for the previous package tree file. |
|
164 |
*/ |
|
165 |
protected void navLinkPrevious() { |
|
166 |
if (prev == null) { |
|
167 |
navLinkPrevious(null); |
|
168 |
} else { |
|
169 |
String path = DirectoryManager.getRelativePath(packagedoc.name(), |
|
170 |
prev.name()); |
|
171 |
navLinkPrevious(path + "package-tree.html"); |
|
172 |
} |
|
173 |
} |
|
174 |
||
175 |
/** |
|
176 |
* Link for the next package tree file. |
|
177 |
*/ |
|
178 |
protected void navLinkNext() { |
|
179 |
if (next == null) { |
|
180 |
navLinkNext(null); |
|
181 |
} else { |
|
182 |
String path = DirectoryManager.getRelativePath(packagedoc.name(), |
|
183 |
next.name()); |
|
184 |
navLinkNext(path + "package-tree.html"); |
|
185 |
} |
|
186 |
} |
|
187 |
||
188 |
/** |
|
189 |
* Link to the package summary page for the package of this tree. |
|
190 |
*/ |
|
191 |
protected void navLinkPackage() { |
|
192 |
navCellStart(); |
|
193 |
printHyperLink("package-summary.html", "", configuration.getText("doclet.Package"), |
|
194 |
true, "NavBarFont1"); |
|
195 |
navCellEnd(); |
|
196 |
} |
|
197 |
} |