author | mcimadamore |
Tue, 13 Jan 2009 13:27:14 +0000 | |
changeset 1789 | 7ac8c0815000 |
parent 1787 | 1aa079321cd2 |
child 5520 | 86e4b9a9da40 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
2 |
* Copyright 1998-2003 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 |
import java.util.*; |
|
32 |
||
33 |
/** |
|
34 |
* Generate the file with list of all the classes in this run. This page will be |
|
35 |
* used in the left-hand bottom frame, when "All Classes" link is clicked in |
|
36 |
* the left-hand top frame. The name of the generated file is |
|
37 |
* "allclasses-frame.html". |
|
38 |
* |
|
39 |
* @author Atul M Dambalkar |
|
40 |
* @author Doug Kramer |
|
41 |
*/ |
|
42 |
public class AllClassesFrameWriter extends HtmlDocletWriter { |
|
43 |
||
44 |
/** |
|
45 |
* The name of the output file with frames |
|
46 |
*/ |
|
47 |
public static final String OUTPUT_FILE_NAME_FRAMES = "allclasses-frame.html"; |
|
48 |
||
49 |
/** |
|
50 |
* The name of the output file without frames |
|
51 |
*/ |
|
52 |
public static final String OUTPUT_FILE_NAME_NOFRAMES = "allclasses-noframe.html"; |
|
53 |
||
54 |
/** |
|
55 |
* Index of all the classes. |
|
56 |
*/ |
|
57 |
protected IndexBuilder indexbuilder; |
|
58 |
||
59 |
/** |
|
60 |
* Construct AllClassesFrameWriter object. Also initilises the indexbuilder |
|
61 |
* variable in this class. |
|
62 |
* @throws IOException |
|
63 |
* @throws DocletAbortException |
|
64 |
*/ |
|
65 |
public AllClassesFrameWriter(ConfigurationImpl configuration, |
|
66 |
String filename, IndexBuilder indexbuilder) |
|
67 |
throws IOException { |
|
68 |
super(configuration, filename); |
|
69 |
this.indexbuilder = indexbuilder; |
|
70 |
} |
|
71 |
||
72 |
/** |
|
73 |
* Create AllClassesFrameWriter object. Then use it to generate the |
|
74 |
* "allclasses-frame.html" file. Generate the file in the current or the |
|
75 |
* destination directory. |
|
76 |
* |
|
77 |
* @param indexbuilder IndexBuilder object for all classes index. |
|
78 |
* @throws DocletAbortException |
|
79 |
*/ |
|
80 |
public static void generate(ConfigurationImpl configuration, |
|
81 |
IndexBuilder indexbuilder) { |
|
82 |
AllClassesFrameWriter allclassgen; |
|
83 |
String filename = OUTPUT_FILE_NAME_FRAMES; |
|
84 |
try { |
|
85 |
allclassgen = new AllClassesFrameWriter(configuration, |
|
86 |
filename, indexbuilder); |
|
87 |
allclassgen.generateAllClassesFile(true); |
|
88 |
allclassgen.close(); |
|
89 |
filename = OUTPUT_FILE_NAME_NOFRAMES; |
|
90 |
allclassgen = new AllClassesFrameWriter(configuration, |
|
91 |
filename, indexbuilder); |
|
92 |
allclassgen.generateAllClassesFile(false); |
|
93 |
allclassgen.close(); |
|
94 |
} catch (IOException exc) { |
|
95 |
configuration.standardmessage. |
|
96 |
error("doclet.exception_encountered", |
|
97 |
exc.toString(), filename); |
|
98 |
throw new DocletAbortException(); |
|
99 |
} |
|
100 |
} |
|
101 |
||
102 |
/** |
|
103 |
* Print all the classes in table format in the file. |
|
104 |
* @param wantFrames True if we want frames. |
|
105 |
*/ |
|
106 |
protected void generateAllClassesFile(boolean wantFrames) throws IOException { |
|
107 |
String label = configuration.getText("doclet.All_Classes"); |
|
108 |
||
109 |
printHtmlHeader(label, null, false); |
|
110 |
||
111 |
printAllClassesTableHeader(); |
|
112 |
printAllClasses(wantFrames); |
|
113 |
printAllClassesTableFooter(); |
|
114 |
||
115 |
printBodyHtmlEnd(); |
|
116 |
} |
|
117 |
||
118 |
/** |
|
119 |
* Use the sorted index of all the classes and print all the classes. |
|
120 |
* |
|
121 |
* @param wantFrames True if we want frames. |
|
122 |
*/ |
|
123 |
protected void printAllClasses(boolean wantFrames) { |
|
124 |
for (int i = 0; i < indexbuilder.elements().length; i++) { |
|
125 |
Character unicode = (Character)((indexbuilder.elements())[i]); |
|
126 |
generateContents(indexbuilder.getMemberList(unicode), wantFrames); |
|
127 |
} |
|
128 |
} |
|
129 |
||
130 |
/** |
|
131 |
* Given a list of classes, generate links for each class or interface. |
|
132 |
* If the class kind is interface, print it in the italics font. Also all |
|
133 |
* links should target the right-hand frame. If clicked on any class name |
|
134 |
* in this page, appropriate class page should get opened in the right-hand |
|
135 |
* frame. |
|
136 |
* |
|
137 |
* @param classlist Sorted list of classes. |
|
138 |
* @param wantFrames True if we want frames. |
|
139 |
*/ |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1787
diff
changeset
|
140 |
protected void generateContents(List<Doc> classlist, boolean wantFrames) { |
10 | 141 |
for (int i = 0; i < classlist.size(); i++) { |
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1787
diff
changeset
|
142 |
ClassDoc cd = (ClassDoc)classlist.get(i); |
10 | 143 |
if (!Util.isCoreClass(cd)) { |
144 |
continue; |
|
145 |
} |
|
146 |
String label = italicsClassName(cd, false); |
|
147 |
if(wantFrames){ |
|
148 |
printLink(new LinkInfoImpl(LinkInfoImpl.ALL_CLASSES_FRAME, cd, |
|
149 |
label, "classFrame") |
|
150 |
); |
|
151 |
} else { |
|
152 |
printLink(new LinkInfoImpl(cd, label)); |
|
153 |
} |
|
154 |
br(); |
|
155 |
} |
|
156 |
} |
|
157 |
||
158 |
/** |
|
159 |
* Print the heading "All Classes" and also print Html table tag. |
|
160 |
*/ |
|
161 |
protected void printAllClassesTableHeader() { |
|
162 |
fontSizeStyle("+1", "FrameHeadingFont"); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
163 |
strongText("doclet.All_Classes"); |
10 | 164 |
fontEnd(); |
165 |
br(); |
|
166 |
table(); |
|
167 |
tr(); |
|
168 |
tdNowrap(); |
|
169 |
fontStyle("FrameItemFont"); |
|
170 |
} |
|
171 |
||
172 |
/** |
|
173 |
* Print Html closing table tag. |
|
174 |
*/ |
|
175 |
protected void printAllClassesTableFooter() { |
|
176 |
fontEnd(); |
|
177 |
tdEnd(); |
|
178 |
trEnd(); |
|
179 |
tableEnd(); |
|
180 |
} |
|
181 |
} |