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

Sun, 11 Apr 2010 23:24:24 -0700

author
yhuang
date
Sun, 11 Apr 2010 23:24:24 -0700
changeset 539
06e06ec0d6f2
parent 243
edd944553131
child 554
9d9f26857129
permissions
-rw-r--r--

6875904: Java 7 message synchronization 1
Reviewed-by: ogino, faryad

duke@1 1 /*
duke@1 2 * Copyright 1998-2005 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
duke@1 30 import com.sun.javadoc.*;
duke@1 31 import java.io.*;
duke@1 32
duke@1 33 /**
duke@1 34 * Generate the package index for the left-hand frame in the generated output.
duke@1 35 * A click on the package name in this frame will update the page in the bottom
duke@1 36 * left hand frame with the listing of contents of the clicked package.
duke@1 37 *
duke@1 38 * @author Atul M Dambalkar
duke@1 39 */
duke@1 40 public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
duke@1 41
duke@1 42 /**
duke@1 43 * Construct the PackageIndexFrameWriter object.
duke@1 44 *
duke@1 45 * @param filename Name of the package index file to be generated.
duke@1 46 */
duke@1 47 public PackageIndexFrameWriter(ConfigurationImpl configuration,
duke@1 48 String filename) throws IOException {
duke@1 49 super(configuration, filename);
duke@1 50 }
duke@1 51
duke@1 52 /**
duke@1 53 * Generate the package index file named "overview-frame.html".
duke@1 54 * @throws DocletAbortException
duke@1 55 */
duke@1 56 public static void generate(ConfigurationImpl configuration) {
duke@1 57 PackageIndexFrameWriter packgen;
duke@1 58 String filename = "overview-frame.html";
duke@1 59 try {
duke@1 60 packgen = new PackageIndexFrameWriter(configuration, filename);
duke@1 61 packgen.generatePackageIndexFile("doclet.Window_Overview", false);
duke@1 62 packgen.close();
duke@1 63 } catch (IOException exc) {
duke@1 64 configuration.standardmessage.error(
duke@1 65 "doclet.exception_encountered",
duke@1 66 exc.toString(), filename);
duke@1 67 throw new DocletAbortException();
duke@1 68 }
duke@1 69 }
duke@1 70
duke@1 71 /**
duke@1 72 * Print each package name on separate rows.
duke@1 73 *
duke@1 74 * @param pd PackageDoc
duke@1 75 */
duke@1 76 protected void printIndexRow(PackageDoc pd) {
duke@1 77 fontStyle("FrameItemFont");
duke@1 78 if (pd.name().length() > 0) {
duke@1 79 print(getHyperLink(pathString(pd, "package-frame.html"), "",
duke@1 80 pd.name(), false, "", "", "packageFrame"));
duke@1 81 } else {
duke@1 82 print(getHyperLink("package-frame.html", "", "<unnamed package>",
duke@1 83 false, "", "", "packageFrame"));
duke@1 84 }
duke@1 85 fontEnd();
duke@1 86 br();
duke@1 87 }
duke@1 88
duke@1 89 /**
bpatel@182 90 * Print the "-packagesheader" string in strong format, at top of the page,
duke@1 91 * if it is not the empty string. Otherwise print the "-header" string.
duke@1 92 * Despite the name, there is actually no navigation bar for this page.
duke@1 93 */
duke@1 94 protected void printNavigationBarHeader() {
duke@1 95 printTableHeader(true);
duke@1 96 fontSizeStyle("+1", "FrameTitleFont");
duke@1 97 if (configuration.packagesheader.length() > 0) {
bpatel@182 98 strong(replaceDocRootDir(configuration.packagesheader));
duke@1 99 } else {
bpatel@182 100 strong(replaceDocRootDir(configuration.header));
duke@1 101 }
duke@1 102 fontEnd();
duke@1 103 printTableFooter(true);
duke@1 104 }
duke@1 105
duke@1 106 /**
duke@1 107 * Do nothing as there is no overview information in this page.
duke@1 108 */
duke@1 109 protected void printOverviewHeader() {
duke@1 110 }
duke@1 111
duke@1 112 /**
duke@1 113 * Print Html "table" tag for the package index format.
duke@1 114 *
duke@1 115 * @param text Text string will not be used in this method.
duke@1 116 */
bpatel@243 117 protected void printIndexHeader(String text, String tableSummary) {
duke@1 118 printTableHeader(false);
duke@1 119 }
duke@1 120
duke@1 121 /**
duke@1 122 * Print Html closing "table" tag at the end of the package index.
duke@1 123 */
duke@1 124 protected void printIndexFooter() {
duke@1 125 printTableFooter(false);
duke@1 126 }
duke@1 127
duke@1 128 /**
duke@1 129 * Print "All Classes" link at the top of the left-hand frame page.
duke@1 130 */
duke@1 131 protected void printAllClassesPackagesLink() {
duke@1 132 fontStyle("FrameItemFont");
duke@1 133 print(getHyperLink("allclasses-frame.html", "",
duke@1 134 configuration.getText("doclet.All_Classes"), false, "", "",
duke@1 135 "packageFrame"));
duke@1 136 fontEnd();
duke@1 137 p();
duke@1 138 fontSizeStyle("+1", "FrameHeadingFont");
duke@1 139 printText("doclet.Packages");
duke@1 140 fontEnd();
duke@1 141 br();
duke@1 142 }
duke@1 143
duke@1 144 /**
duke@1 145 * Just print some space, since there is no navigation bar for this page.
duke@1 146 */
duke@1 147 protected void printNavigationBarFooter() {
duke@1 148 p();
duke@1 149 space();
duke@1 150 }
duke@1 151
duke@1 152 /**
duke@1 153 * Print Html closing tags for the table for package index.
duke@1 154 *
duke@1 155 * @param isHeading true if this is a table for a heading.
duke@1 156 */
duke@1 157 private void printTableFooter(boolean isHeading) {
duke@1 158 if (isHeading) {
duke@1 159 thEnd();
duke@1 160 } else {
duke@1 161 tdEnd();
duke@1 162 }
duke@1 163 trEnd();
duke@1 164 tableEnd();
duke@1 165 }
duke@1 166
duke@1 167 /**
duke@1 168 * Print Html tags for the table for package index.
duke@1 169 *
duke@1 170 * @param isHeading true if this is a table for a heading.
duke@1 171 */
duke@1 172 private void printTableHeader(boolean isHeading) {
duke@1 173 table();
duke@1 174 tr();
duke@1 175 if (isHeading) {
duke@1 176 thAlignNowrap("left");
duke@1 177 } else {
duke@1 178 tdNowrap();
duke@1 179 }
duke@1 180
duke@1 181 }
duke@1 182 }

mercurial