duke@1: /* ohair@554: * Copyright (c) 1998, 2005, Oracle and/or its affiliates. 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 ohair@554: * published by the Free Software Foundation. Oracle designates this duke@1: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle 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: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * 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: duke@1: import com.sun.javadoc.*; duke@1: import java.io.*; duke@1: duke@1: /** duke@1: * Generate the package index for the left-hand frame in the generated output. duke@1: * A click on the package name in this frame will update the page in the bottom duke@1: * left hand frame with the listing of contents of the clicked package. duke@1: * duke@1: * @author Atul M Dambalkar duke@1: */ duke@1: public class PackageIndexFrameWriter extends AbstractPackageIndexWriter { duke@1: duke@1: /** duke@1: * Construct the PackageIndexFrameWriter object. duke@1: * duke@1: * @param filename Name of the package index file to be generated. duke@1: */ duke@1: public PackageIndexFrameWriter(ConfigurationImpl configuration, duke@1: String filename) throws IOException { duke@1: super(configuration, filename); duke@1: } duke@1: duke@1: /** duke@1: * Generate the package index file named "overview-frame.html". duke@1: * @throws DocletAbortException duke@1: */ duke@1: public static void generate(ConfigurationImpl configuration) { duke@1: PackageIndexFrameWriter packgen; duke@1: String filename = "overview-frame.html"; duke@1: try { duke@1: packgen = new PackageIndexFrameWriter(configuration, filename); duke@1: packgen.generatePackageIndexFile("doclet.Window_Overview", false); duke@1: packgen.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: * Print each package name on separate rows. duke@1: * duke@1: * @param pd PackageDoc duke@1: */ duke@1: protected void printIndexRow(PackageDoc pd) { duke@1: fontStyle("FrameItemFont"); duke@1: if (pd.name().length() > 0) { duke@1: print(getHyperLink(pathString(pd, "package-frame.html"), "", duke@1: pd.name(), false, "", "", "packageFrame")); duke@1: } else { duke@1: print(getHyperLink("package-frame.html", "", "<unnamed package>", duke@1: false, "", "", "packageFrame")); duke@1: } duke@1: fontEnd(); duke@1: br(); duke@1: } duke@1: duke@1: /** bpatel@182: * Print the "-packagesheader" string in strong format, at top of the page, duke@1: * if it is not the empty string. Otherwise print the "-header" string. duke@1: * Despite the name, there is actually no navigation bar for this page. duke@1: */ duke@1: protected void printNavigationBarHeader() { duke@1: printTableHeader(true); duke@1: fontSizeStyle("+1", "FrameTitleFont"); duke@1: if (configuration.packagesheader.length() > 0) { bpatel@182: strong(replaceDocRootDir(configuration.packagesheader)); duke@1: } else { bpatel@182: strong(replaceDocRootDir(configuration.header)); duke@1: } duke@1: fontEnd(); duke@1: printTableFooter(true); duke@1: } duke@1: duke@1: /** duke@1: * Do nothing as there is no overview information in this page. duke@1: */ duke@1: protected void printOverviewHeader() { duke@1: } duke@1: duke@1: /** duke@1: * Print Html "table" tag for the package index format. duke@1: * duke@1: * @param text Text string will not be used in this method. duke@1: */ bpatel@243: protected void printIndexHeader(String text, String tableSummary) { duke@1: printTableHeader(false); duke@1: } duke@1: duke@1: /** duke@1: * Print Html closing "table" tag at the end of the package index. duke@1: */ duke@1: protected void printIndexFooter() { duke@1: printTableFooter(false); duke@1: } duke@1: duke@1: /** duke@1: * Print "All Classes" link at the top of the left-hand frame page. duke@1: */ duke@1: protected void printAllClassesPackagesLink() { duke@1: fontStyle("FrameItemFont"); duke@1: print(getHyperLink("allclasses-frame.html", "", duke@1: configuration.getText("doclet.All_Classes"), false, "", "", duke@1: "packageFrame")); duke@1: fontEnd(); duke@1: p(); duke@1: fontSizeStyle("+1", "FrameHeadingFont"); duke@1: printText("doclet.Packages"); duke@1: fontEnd(); duke@1: br(); duke@1: } duke@1: duke@1: /** duke@1: * Just print some space, since there is no navigation bar for this page. duke@1: */ duke@1: protected void printNavigationBarFooter() { duke@1: p(); duke@1: space(); duke@1: } duke@1: duke@1: /** duke@1: * Print Html closing tags for the table for package index. duke@1: * duke@1: * @param isHeading true if this is a table for a heading. duke@1: */ duke@1: private void printTableFooter(boolean isHeading) { duke@1: if (isHeading) { duke@1: thEnd(); duke@1: } else { duke@1: tdEnd(); duke@1: } duke@1: trEnd(); duke@1: tableEnd(); duke@1: } duke@1: duke@1: /** duke@1: * Print Html tags for the table for package index. duke@1: * duke@1: * @param isHeading true if this is a table for a heading. duke@1: */ duke@1: private void printTableHeader(boolean isHeading) { duke@1: table(); duke@1: tr(); duke@1: if (isHeading) { duke@1: thAlignNowrap("left"); duke@1: } else { duke@1: tdNowrap(); duke@1: } duke@1: duke@1: } duke@1: }