Tue, 13 Jan 2009 13:27:14 +0000
6765045: Remove rawtypes warnings from langtools
Summary: Removed all occurrences of rawtypes warnings from langtools
Reviewed-by: jjg, bpatel
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 */
26 package com.sun.tools.doclets.formats.html;
28 import com.sun.tools.doclets.internal.toolkit.util.*;
29 import com.sun.javadoc.*;
30 import java.io.*;
31 import java.util.*;
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 {
44 /**
45 * The name of the output file with frames
46 */
47 public static final String OUTPUT_FILE_NAME_FRAMES = "allclasses-frame.html";
49 /**
50 * The name of the output file without frames
51 */
52 public static final String OUTPUT_FILE_NAME_NOFRAMES = "allclasses-noframe.html";
54 /**
55 * Index of all the classes.
56 */
57 protected IndexBuilder indexbuilder;
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 }
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 }
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");
109 printHtmlHeader(label, null, false);
111 printAllClassesTableHeader();
112 printAllClasses(wantFrames);
113 printAllClassesTableFooter();
115 printBodyHtmlEnd();
116 }
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 }
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 */
140 protected void generateContents(List<Doc> classlist, boolean wantFrames) {
141 for (int i = 0; i < classlist.size(); i++) {
142 ClassDoc cd = (ClassDoc)classlist.get(i);
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 }
158 /**
159 * Print the heading "All Classes" and also print Html table tag.
160 */
161 protected void printAllClassesTableHeader() {
162 fontSizeStyle("+1", "FrameHeadingFont");
163 strongText("doclet.All_Classes");
164 fontEnd();
165 br();
166 table();
167 tr();
168 tdNowrap();
169 fontStyle("FrameItemFont");
170 }
172 /**
173 * Print Html closing table tag.
174 */
175 protected void printAllClassesTableFooter() {
176 fontEnd();
177 tdEnd();
178 trEnd();
179 tableEnd();
180 }
181 }