src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java

Wed, 18 Feb 2009 13:47:27 -0800

author
bpatel
date
Wed, 18 Feb 2009 13:47:27 -0800
changeset 222
d424ed561993
parent 1
9a66ca7c79fa
child 554
9d9f26857129
permissions
-rw-r--r--

6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
Reviewed-by: jjg

duke@1 1 /*
duke@1 2 * Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation. Sun designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
duke@1 9 * by Sun in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
duke@1 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 22 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 23 * have any questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.tools.doclets.formats.html;
duke@1 27
duke@1 28 import com.sun.tools.doclets.internal.toolkit.util.*;
duke@1 29 import java.io.*;
duke@1 30
duke@1 31 /**
duke@1 32 * Generate the documentation in the Html "frame" format in the browser. The
duke@1 33 * generated documentation will have two or three frames depending upon the
duke@1 34 * number of packages on the command line. In general there will be three frames
duke@1 35 * in the output, a left-hand top frame will have a list of all packages with
duke@1 36 * links to target left-hand bottom frame. The left-hand bottom frame will have
duke@1 37 * the particular package contents or the all-classes list, where as the single
duke@1 38 * right-hand frame will have overview or package summary or class file. Also
duke@1 39 * take care of browsers which do not support Html frames.
duke@1 40 *
duke@1 41 * @author Atul M Dambalkar
duke@1 42 */
duke@1 43 public class FrameOutputWriter extends HtmlDocletWriter {
duke@1 44
duke@1 45 /**
duke@1 46 * Number of packages specified on the command line.
duke@1 47 */
duke@1 48 int noOfPackages;
duke@1 49
duke@1 50 /**
duke@1 51 * Constructor to construct FrameOutputWriter object.
duke@1 52 *
duke@1 53 * @param filename File to be generated.
duke@1 54 */
duke@1 55 public FrameOutputWriter(ConfigurationImpl configuration,
duke@1 56 String filename) throws IOException {
duke@1 57 super(configuration, filename);
duke@1 58 noOfPackages = configuration.packages.length;
duke@1 59 }
duke@1 60
duke@1 61 /**
duke@1 62 * Construct FrameOutputWriter object and then use it to generate the Html
duke@1 63 * file which will have the description of all the frames in the
duke@1 64 * documentation. The name of the generated file is "index.html" which is
duke@1 65 * the default first file for Html documents.
duke@1 66 * @throws DocletAbortException
duke@1 67 */
duke@1 68 public static void generate(ConfigurationImpl configuration) {
duke@1 69 FrameOutputWriter framegen;
duke@1 70 String filename = "";
duke@1 71 try {
duke@1 72 filename = "index.html";
duke@1 73 framegen = new FrameOutputWriter(configuration, filename);
duke@1 74 framegen.generateFrameFile();
duke@1 75 framegen.close();
duke@1 76 } catch (IOException exc) {
duke@1 77 configuration.standardmessage.error(
duke@1 78 "doclet.exception_encountered",
duke@1 79 exc.toString(), filename);
duke@1 80 throw new DocletAbortException();
duke@1 81 }
duke@1 82 }
duke@1 83
duke@1 84 /**
duke@1 85 * Generate the contants in the "index.html" file. Print the frame details
duke@1 86 * as well as warning if browser is not supporting the Html frames.
duke@1 87 */
duke@1 88 protected void generateFrameFile() {
duke@1 89 if (configuration.windowtitle.length() > 0) {
duke@1 90 printFramesetHeader(configuration.windowtitle, configuration.notimestamp);
duke@1 91 } else {
duke@1 92 printFramesetHeader(configuration.getText("doclet.Generated_Docs_Untitled"),
duke@1 93 configuration.notimestamp);
duke@1 94 }
duke@1 95 printFrameDetails();
duke@1 96 printFrameFooter();
duke@1 97 }
duke@1 98
duke@1 99 /**
duke@1 100 * Generate the code for issueing the warning for a non-frame capable web
duke@1 101 * client. Also provide links to the non-frame version documentation.
duke@1 102 */
duke@1 103 protected void printFrameWarning() {
duke@1 104 noFrames();
duke@1 105 h2();
duke@1 106 printText("doclet.Frame_Alert");
duke@1 107 h2End();
duke@1 108 p();
duke@1 109 printText("doclet.Frame_Warning_Message");
duke@1 110 br();
duke@1 111 printText("doclet.Link_To");
duke@1 112 printHyperLink(configuration.topFile,
duke@1 113 configuration.getText("doclet.Non_Frame_Version"));
duke@1 114 println("");
duke@1 115 noFramesEnd();
duke@1 116 }
duke@1 117
duke@1 118 /**
duke@1 119 * Print the frame sizes and their contents.
duke@1 120 */
duke@1 121 protected void printFrameDetails() {
duke@1 122 // title attribute intentionally made empty so
duke@1 123 // 508 tests will not flag it as missing
duke@1 124 frameSet("cols=\"20%,80%\" title=\"\" onLoad=\"top.loadFrames()\"");
duke@1 125 if (noOfPackages <= 1) {
duke@1 126 printAllClassesFrameTag();
duke@1 127 } else if (noOfPackages > 1) {
duke@1 128 frameSet("rows=\"30%,70%\" title=\"\" onLoad=\"top.loadFrames()\"");
duke@1 129 printAllPackagesFrameTag();
duke@1 130 printAllClassesFrameTag();
duke@1 131 frameSetEnd();
duke@1 132 }
duke@1 133 printClassFrameTag();
duke@1 134 printFrameWarning();
duke@1 135 frameSetEnd();
duke@1 136 }
duke@1 137
duke@1 138 /**
duke@1 139 * Print the FRAME tag for the frame that lists all packages
duke@1 140 */
duke@1 141 private void printAllPackagesFrameTag() {
duke@1 142 frame("src=\"overview-frame.html\" name=\"packageListFrame\""
duke@1 143 + " title=\"" + configuration.getText("doclet.All_Packages") + "\"");
duke@1 144 }
duke@1 145
duke@1 146 /**
duke@1 147 * Print the FRAME tag for the frame that lists all classes
duke@1 148 */
duke@1 149 private void printAllClassesFrameTag() {
duke@1 150 frame("src=\"" + "allclasses-frame.html" + "\""
duke@1 151 + " name=\"packageFrame\""
duke@1 152 + " title=\"" + configuration.getText("doclet.All_classes_and_interfaces")
duke@1 153 + "\"");
duke@1 154 }
duke@1 155
duke@1 156 /**
duke@1 157 * Print the FRAME tag for the frame that describes the class in detail
duke@1 158 */
duke@1 159 private void printClassFrameTag() {
duke@1 160 frame("src=\"" + configuration.topFile + "\""
duke@1 161 + " name=\"classFrame\""
duke@1 162 + " title=\""
duke@1 163 + configuration.getText("doclet.Package_class_and_interface_descriptions")
duke@1 164 + "\" scrolling=\"yes\"");
duke@1 165 }
duke@1 166
duke@1 167 }

mercurial