duke@1: /* duke@1: * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as duke@1: * published by the Free Software Foundation. Sun designates this duke@1: * particular file as subject to the "Classpath" exception as provided duke@1: * by Sun in the LICENSE file that accompanied this code. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * duke@1: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@1: * CA 95054 USA or visit www.sun.com if you need additional information or duke@1: * have any questions. duke@1: */ duke@1: duke@1: package com.sun.tools.doclets.formats.html; duke@1: duke@1: import com.sun.tools.doclets.internal.toolkit.util.*; duke@1: import java.io.*; duke@1: duke@1: /** duke@1: * Generate the Help File for the generated API documentation. The help file duke@1: * contents are helpful for browsing the generated documentation. duke@1: * duke@1: * @author Atul M Dambalkar duke@1: */ duke@1: public class HelpWriter extends HtmlDocletWriter { duke@1: duke@1: /** duke@1: * Constructor to construct HelpWriter object. duke@1: * @param filename File to be generated. duke@1: */ duke@1: public HelpWriter(ConfigurationImpl configuration, duke@1: String filename) throws IOException { duke@1: super(configuration, filename); duke@1: } duke@1: duke@1: /** duke@1: * Construct the HelpWriter object and then use it to generate the help duke@1: * file. The name of the generated file is "help-doc.html". The help file duke@1: * will get generated if and only if "-helpfile" and "-nohelp" is not used duke@1: * on the command line. duke@1: * @throws DocletAbortException duke@1: */ duke@1: public static void generate(ConfigurationImpl configuration) { duke@1: HelpWriter helpgen; duke@1: String filename = ""; duke@1: try { duke@1: filename = "help-doc.html"; duke@1: helpgen = new HelpWriter(configuration, filename); duke@1: helpgen.generateHelpFile(); duke@1: helpgen.close(); duke@1: } catch (IOException exc) { duke@1: configuration.standardmessage.error( duke@1: "doclet.exception_encountered", duke@1: exc.toString(), filename); duke@1: throw new DocletAbortException(); duke@1: } duke@1: } duke@1: duke@1: /** duke@1: * Generate the help file contents. duke@1: */ duke@1: protected void generateHelpFile() { duke@1: printHtmlHeader(configuration.getText("doclet.Window_Help_title"), duke@1: null, true); duke@1: printTop(); duke@1: navLinks(true); hr(); duke@1: duke@1: printHelpFileContents(); duke@1: duke@1: navLinks(false); duke@1: printBottom(); duke@1: printBodyHtmlEnd(); duke@1: } duke@1: duke@1: /** duke@1: * Print the help file contents from the resource file. While generating the duke@1: * help file contents it also keeps track of user options. If "-notree" duke@1: * is used, then the "overview-tree.html" will not get generated and hence duke@1: * help information also will not get generated. duke@1: */ duke@1: protected void printHelpFileContents() { duke@1: center(); h1(); printText("doclet.Help_line_1"); h1End(); centerEnd(); duke@1: printText("doclet.Help_line_2"); duke@1: if (configuration.createoverview) { duke@1: h3(); printText("doclet.Overview"); h3End(); duke@1: blockquote(); p(); duke@1: printText("doclet.Help_line_3", duke@1: getHyperLink("overview-summary.html", duke@1: configuration.getText("doclet.Overview"))); duke@1: blockquoteEnd(); duke@1: } duke@1: h3(); printText("doclet.Package"); h3End(); duke@1: blockquote(); p(); printText("doclet.Help_line_4"); duke@1: ul(); duke@1: li(); printText("doclet.Interfaces_Italic"); duke@1: li(); printText("doclet.Classes"); duke@1: li(); printText("doclet.Enums"); duke@1: li(); printText("doclet.Exceptions"); duke@1: li(); printText("doclet.Errors"); duke@1: li(); printText("doclet.AnnotationTypes"); duke@1: ulEnd(); duke@1: blockquoteEnd(); duke@1: h3(); printText("doclet.Help_line_5"); h3End(); duke@1: blockquote(); p(); printText("doclet.Help_line_6"); duke@1: ul(); duke@1: li(); printText("doclet.Help_line_7"); duke@1: li(); printText("doclet.Help_line_8"); duke@1: li(); printText("doclet.Help_line_9"); duke@1: li(); printText("doclet.Help_line_10"); duke@1: li(); printText("doclet.Help_line_11"); duke@1: li(); printText("doclet.Help_line_12"); duke@1: p(); duke@1: li(); printText("doclet.Nested_Class_Summary"); duke@1: li(); printText("doclet.Field_Summary"); duke@1: li(); printText("doclet.Constructor_Summary"); duke@1: li(); printText("doclet.Method_Summary"); duke@1: p(); duke@1: li(); printText("doclet.Field_Detail"); duke@1: li(); printText("doclet.Constructor_Detail"); duke@1: li(); printText("doclet.Method_Detail"); duke@1: ulEnd(); duke@1: printText("doclet.Help_line_13"); duke@1: blockquoteEnd(); duke@1: duke@1: //Annotation Types duke@1: blockquoteEnd(); duke@1: h3(); printText("doclet.AnnotationType"); h3End(); duke@1: blockquote(); p(); printText("doclet.Help_annotation_type_line_1"); duke@1: ul(); duke@1: li(); printText("doclet.Help_annotation_type_line_2"); duke@1: li(); printText("doclet.Help_annotation_type_line_3"); duke@1: li(); printText("doclet.Annotation_Type_Required_Member_Summary"); duke@1: li(); printText("doclet.Annotation_Type_Optional_Member_Summary"); duke@1: li(); printText("doclet.Annotation_Type_Member_Detail"); duke@1: ulEnd(); duke@1: blockquoteEnd(); duke@1: duke@1: //Enums duke@1: blockquoteEnd(); duke@1: h3(); printText("doclet.Enum"); h3End(); duke@1: blockquote(); p(); printText("doclet.Help_enum_line_1"); duke@1: ul(); duke@1: li(); printText("doclet.Help_enum_line_2"); duke@1: li(); printText("doclet.Help_enum_line_3"); duke@1: li(); printText("doclet.Enum_Constant_Summary"); duke@1: li(); printText("doclet.Enum_Constant_Detail"); duke@1: ulEnd(); duke@1: blockquoteEnd(); duke@1: duke@1: if (configuration.classuse) { duke@1: h3(); printText("doclet.Help_line_14"); h3End(); duke@1: blockquote(); duke@1: printText("doclet.Help_line_15"); duke@1: blockquoteEnd(); duke@1: } duke@1: if (configuration.createtree) { duke@1: h3(); printText("doclet.Help_line_16"); h3End(); duke@1: blockquote(); duke@1: printText("doclet.Help_line_17_with_tree_link", duke@1: getHyperLink("overview-tree.html", duke@1: configuration.getText("doclet.Class_Hierarchy"))); duke@1: ul(); duke@1: li(); printText("doclet.Help_line_18"); duke@1: li(); printText("doclet.Help_line_19"); duke@1: ulEnd(); duke@1: blockquoteEnd(); duke@1: } duke@1: if (!(configuration.nodeprecatedlist || duke@1: configuration.nodeprecated)) { duke@1: h3(); printText("doclet.Deprecated_API"); h3End(); duke@1: blockquote(); duke@1: printText("doclet.Help_line_20_with_deprecated_api_link", duke@1: getHyperLink("deprecated-list.html", duke@1: configuration.getText("doclet.Deprecated_API"))); duke@1: blockquoteEnd(); duke@1: } duke@1: if (configuration.createindex) { duke@1: String indexlink; duke@1: if (configuration.splitindex) { duke@1: indexlink = getHyperLink("index-files/index-1.html", duke@1: configuration.getText("doclet.Index")); duke@1: } else { duke@1: indexlink = getHyperLink("index-all.html", duke@1: configuration.getText("doclet.Index")); duke@1: } duke@1: h3(); printText("doclet.Help_line_21"); h3End(); duke@1: blockquote(); duke@1: printText("doclet.Help_line_22", indexlink); duke@1: blockquoteEnd(); duke@1: } duke@1: h3(); printText("doclet.Help_line_23"); h3End(); duke@1: printText("doclet.Help_line_24"); duke@1: h3(); printText("doclet.Help_line_25"); h3End(); duke@1: printText("doclet.Help_line_26"); p(); duke@1: duke@1: h3(); printText("doclet.Serialized_Form"); h3End(); duke@1: printText("doclet.Help_line_27"); p(); duke@1: duke@1: h3(); printText("doclet.Constants_Summary"); h3End(); duke@1: printText("doclet.Help_line_28"); p(); duke@1: duke@1: font("-1"); em(); duke@1: printText("doclet.Help_line_29"); duke@1: emEnd(); fontEnd(); br(); duke@1: hr(); duke@1: } duke@1: duke@1: /** duke@1: * Highlight the word "Help" in the navigation bar as this is the help file. duke@1: */ duke@1: protected void navLinkHelp() { duke@1: navCellRevStart(); duke@1: fontStyle("NavBarFont1Rev"); bpatel@182: strongText("doclet.Help"); duke@1: fontEnd(); duke@1: navCellEnd(); duke@1: } duke@1: }