001: /*
002: * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.tools.doclets.formats.html;
027:
028: import com.sun.tools.doclets.internal.toolkit.util.*;
029: import java.io.*;
030:
031: /**
032: * Generate the Help File for the generated API documentation. The help file
033: * contents are helpful for browsing the generated documentation.
034: *
035: * @author Atul M Dambalkar
036: */
037: public class HelpWriter extends HtmlDocletWriter {
038:
039: /**
040: * Constructor to construct HelpWriter object.
041: * @param filename File to be generated.
042: */
043: public HelpWriter(ConfigurationImpl configuration, String filename)
044: throws IOException {
045: super (configuration, filename);
046: }
047:
048: /**
049: * Construct the HelpWriter object and then use it to generate the help
050: * file. The name of the generated file is "help-doc.html". The help file
051: * will get generated if and only if "-helpfile" and "-nohelp" is not used
052: * on the command line.
053: * @throws DocletAbortException
054: */
055: public static void generate(ConfigurationImpl configuration) {
056: HelpWriter helpgen;
057: String filename = "";
058: try {
059: filename = "help-doc.html";
060: helpgen = new HelpWriter(configuration, filename);
061: helpgen.generateHelpFile();
062: helpgen.close();
063: } catch (IOException exc) {
064: configuration.standardmessage.error(
065: "doclet.exception_encountered", exc.toString(),
066: filename);
067: throw new DocletAbortException();
068: }
069: }
070:
071: /**
072: * Generate the help file contents.
073: */
074: protected void generateHelpFile() {
075: printHtmlHeader(configuration
076: .getText("doclet.Window_Help_title"), null, true);
077: printTop();
078: navLinks(true);
079: hr();
080:
081: printHelpFileContents();
082:
083: navLinks(false);
084: printBottom();
085: printBodyHtmlEnd();
086: }
087:
088: /**
089: * Print the help file contents from the resource file. While generating the
090: * help file contents it also keeps track of user options. If "-notree"
091: * is used, then the "overview-tree.html" will not get generated and hence
092: * help information also will not get generated.
093: */
094: protected void printHelpFileContents() {
095: center();
096: h1();
097: printText("doclet.Help_line_1");
098: h1End();
099: centerEnd();
100: printText("doclet.Help_line_2");
101: if (configuration.createoverview) {
102: h3();
103: printText("doclet.Overview");
104: h3End();
105: blockquote();
106: p();
107: printText("doclet.Help_line_3", getHyperLink(
108: "overview-summary.html", configuration
109: .getText("doclet.Overview")));
110: blockquoteEnd();
111: }
112: h3();
113: printText("doclet.Package");
114: h3End();
115: blockquote();
116: p();
117: printText("doclet.Help_line_4");
118: ul();
119: li();
120: printText("doclet.Interfaces_Italic");
121: li();
122: printText("doclet.Classes");
123: li();
124: printText("doclet.Enums");
125: li();
126: printText("doclet.Exceptions");
127: li();
128: printText("doclet.Errors");
129: li();
130: printText("doclet.AnnotationTypes");
131: ulEnd();
132: blockquoteEnd();
133: h3();
134: printText("doclet.Help_line_5");
135: h3End();
136: blockquote();
137: p();
138: printText("doclet.Help_line_6");
139: ul();
140: li();
141: printText("doclet.Help_line_7");
142: li();
143: printText("doclet.Help_line_8");
144: li();
145: printText("doclet.Help_line_9");
146: li();
147: printText("doclet.Help_line_10");
148: li();
149: printText("doclet.Help_line_11");
150: li();
151: printText("doclet.Help_line_12");
152: p();
153: li();
154: printText("doclet.Nested_Class_Summary");
155: li();
156: printText("doclet.Field_Summary");
157: li();
158: printText("doclet.Constructor_Summary");
159: li();
160: printText("doclet.Method_Summary");
161: p();
162: li();
163: printText("doclet.Field_Detail");
164: li();
165: printText("doclet.Constructor_Detail");
166: li();
167: printText("doclet.Method_Detail");
168: ulEnd();
169: printText("doclet.Help_line_13");
170: blockquoteEnd();
171:
172: //Annotation Types
173: blockquoteEnd();
174: h3();
175: printText("doclet.AnnotationType");
176: h3End();
177: blockquote();
178: p();
179: printText("doclet.Help_annotation_type_line_1");
180: ul();
181: li();
182: printText("doclet.Help_annotation_type_line_2");
183: li();
184: printText("doclet.Help_annotation_type_line_3");
185: li();
186: printText("doclet.Annotation_Type_Required_Member_Summary");
187: li();
188: printText("doclet.Annotation_Type_Optional_Member_Summary");
189: li();
190: printText("doclet.Annotation_Type_Member_Detail");
191: ulEnd();
192: blockquoteEnd();
193:
194: //Enums
195: blockquoteEnd();
196: h3();
197: printText("doclet.Enum");
198: h3End();
199: blockquote();
200: p();
201: printText("doclet.Help_enum_line_1");
202: ul();
203: li();
204: printText("doclet.Help_enum_line_2");
205: li();
206: printText("doclet.Help_enum_line_3");
207: li();
208: printText("doclet.Enum_Constant_Summary");
209: li();
210: printText("doclet.Enum_Constant_Detail");
211: ulEnd();
212: blockquoteEnd();
213:
214: if (configuration.classuse) {
215: h3();
216: printText("doclet.Help_line_14");
217: h3End();
218: blockquote();
219: printText("doclet.Help_line_15");
220: blockquoteEnd();
221: }
222: if (configuration.createtree) {
223: h3();
224: printText("doclet.Help_line_16");
225: h3End();
226: blockquote();
227: printText("doclet.Help_line_17_with_tree_link",
228: getHyperLink("overview-tree.html", configuration
229: .getText("doclet.Class_Hierarchy")));
230: ul();
231: li();
232: printText("doclet.Help_line_18");
233: li();
234: printText("doclet.Help_line_19");
235: ulEnd();
236: blockquoteEnd();
237: }
238: if (!(configuration.nodeprecatedlist || configuration.nodeprecated)) {
239: h3();
240: printText("doclet.Deprecated_API");
241: h3End();
242: blockquote();
243: printText("doclet.Help_line_20_with_deprecated_api_link",
244: getHyperLink("deprecated-list.html", configuration
245: .getText("doclet.Deprecated_API")));
246: blockquoteEnd();
247: }
248: if (configuration.createindex) {
249: String indexlink;
250: if (configuration.splitindex) {
251: indexlink = getHyperLink("index-files/index-1.html",
252: configuration.getText("doclet.Index"));
253: } else {
254: indexlink = getHyperLink("index-all.html",
255: configuration.getText("doclet.Index"));
256: }
257: h3();
258: printText("doclet.Help_line_21");
259: h3End();
260: blockquote();
261: printText("doclet.Help_line_22", indexlink);
262: blockquoteEnd();
263: }
264: h3();
265: printText("doclet.Help_line_23");
266: h3End();
267: printText("doclet.Help_line_24");
268: h3();
269: printText("doclet.Help_line_25");
270: h3End();
271: printText("doclet.Help_line_26");
272: p();
273:
274: h3();
275: printText("doclet.Serialized_Form");
276: h3End();
277: printText("doclet.Help_line_27");
278: p();
279:
280: h3();
281: printText("doclet.Constants_Summary");
282: h3End();
283: printText("doclet.Help_line_28");
284: p();
285:
286: font("-1");
287: em();
288: printText("doclet.Help_line_29");
289: emEnd();
290: fontEnd();
291: br();
292: hr();
293: }
294:
295: /**
296: * Highlight the word "Help" in the navigation bar as this is the help file.
297: */
298: protected void navLinkHelp() {
299: navCellRevStart();
300: fontStyle("NavBarFont1Rev");
301: boldText("doclet.Help");
302: fontEnd();
303: navCellEnd();
304: }
305: }
|