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

Tue, 25 May 2010 15:54:51 -0700

author
ohair
date
Tue, 25 May 2010 15:54:51 -0700
changeset 554
9d9f26857129
parent 243
edd944553131
child 766
90af8d87741f
permissions
-rw-r--r--

6943119: Rebrand source copyright notices
Reviewed-by: darcy

duke@1 1 /*
ohair@554 2 * Copyright (c) 1998, 2005, Oracle and/or its affiliates. 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
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle 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 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * 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.javadoc.*;
duke@1 29 import java.io.*;
duke@1 30 import java.util.*;
duke@1 31
duke@1 32 /**
duke@1 33 * Abstract class to generate the overview files in
duke@1 34 * Frame and Non-Frame format. This will be sub-classed by to
duke@1 35 * generate overview-frame.html as well as overview-summary.html.
duke@1 36 *
duke@1 37 * @author Atul M Dambalkar
bpatel@243 38 * @author Bhavesh Patel (Modified)
duke@1 39 */
duke@1 40 public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
duke@1 41
duke@1 42 /**
duke@1 43 * Array of Packages to be documented.
duke@1 44 */
duke@1 45 protected PackageDoc[] packages;
duke@1 46
duke@1 47 /**
duke@1 48 * Constructor. Also initialises the packages variable.
duke@1 49 *
duke@1 50 * @param filename Name of the package index file to be generated.
duke@1 51 */
duke@1 52 public AbstractPackageIndexWriter(ConfigurationImpl configuration,
duke@1 53 String filename) throws IOException {
duke@1 54 super(configuration, filename);
duke@1 55 this.relativepathNoSlash = ".";
duke@1 56 packages = configuration.packages;
duke@1 57 }
duke@1 58
duke@1 59 protected abstract void printNavigationBarHeader();
duke@1 60
duke@1 61 protected abstract void printNavigationBarFooter();
duke@1 62
duke@1 63 protected abstract void printOverviewHeader();
duke@1 64
bpatel@243 65 protected abstract void printIndexHeader(String text, String tableSummary);
duke@1 66
duke@1 67 protected abstract void printIndexRow(PackageDoc pkg);
duke@1 68
duke@1 69 protected abstract void printIndexFooter();
duke@1 70
duke@1 71 /**
duke@1 72 * Generate the contants in the package index file. Call appropriate
duke@1 73 * methods from the sub-class in order to generate Frame or Non
duke@1 74 * Frame format.
duke@1 75 * @param title the title of the window.
duke@1 76 * @param includeScript boolean set true if windowtitle script is to be included
duke@1 77 */
duke@1 78 protected void generatePackageIndexFile(String title, boolean includeScript) throws IOException {
duke@1 79 String windowOverview = configuration.getText(title);
duke@1 80 printHtmlHeader(windowOverview,
duke@1 81 configuration.metakeywords.getOverviewMetaKeywords(title,
duke@1 82 configuration.doctitle),
duke@1 83 includeScript);
duke@1 84 printNavigationBarHeader();
duke@1 85 printOverviewHeader();
duke@1 86
duke@1 87 generateIndex();
duke@1 88
duke@1 89 printOverview();
duke@1 90
duke@1 91 printNavigationBarFooter();
duke@1 92 printBodyHtmlEnd();
duke@1 93 }
duke@1 94
duke@1 95 /**
duke@1 96 * Default to no overview, overwrite to add overview.
duke@1 97 */
duke@1 98 protected void printOverview() throws IOException {
duke@1 99 }
duke@1 100
duke@1 101 /**
duke@1 102 * Generate the frame or non-frame package index.
duke@1 103 */
duke@1 104 protected void generateIndex() {
bpatel@243 105 printIndexContents(packages, "doclet.Package_Summary",
bpatel@243 106 configuration.getText("doclet.Member_Table_Summary",
bpatel@243 107 configuration.getText("doclet.Package_Summary"),
bpatel@243 108 configuration.getText("doclet.packages")));
duke@1 109 }
duke@1 110
duke@1 111 /**
duke@1 112 * Generate code for package index contents. Call appropriate methods from
duke@1 113 * the sub-classes.
duke@1 114 *
duke@1 115 * @param packages Array of packages to be documented.
duke@1 116 * @param text String which will be used as the heading.
duke@1 117 */
bpatel@243 118 protected void printIndexContents(PackageDoc[] packages, String text, String tableSummary) {
duke@1 119 if (packages.length > 0) {
duke@1 120 Arrays.sort(packages);
bpatel@243 121 printIndexHeader(text, tableSummary);
duke@1 122 printAllClassesPackagesLink();
duke@1 123 for(int i = 0; i < packages.length; i++) {
duke@1 124 if (packages[i] != null) {
duke@1 125 printIndexRow(packages[i]);
duke@1 126 }
duke@1 127 }
duke@1 128 printIndexFooter();
duke@1 129 }
duke@1 130 }
duke@1 131
duke@1 132 /**
duke@1 133 * Print the doctitle, if it is specified on the command line.
duke@1 134 */
duke@1 135 protected void printConfigurationTitle() {
duke@1 136 if (configuration.doctitle.length() > 0) {
duke@1 137 center();
duke@1 138 h1(configuration.doctitle);
duke@1 139 centerEnd();
duke@1 140 }
duke@1 141 }
duke@1 142
duke@1 143 /**
bpatel@182 144 * Highlight "Overview" in the strong format, in the navigation bar as this
duke@1 145 * is the overview page.
duke@1 146 */
duke@1 147 protected void navLinkContents() {
duke@1 148 navCellRevStart();
duke@1 149 fontStyle("NavBarFont1Rev");
bpatel@182 150 strongText("doclet.Overview");
duke@1 151 fontEnd();
duke@1 152 navCellEnd();
duke@1 153 }
duke@1 154
duke@1 155 /**
duke@1 156 * Do nothing. This will be overridden in PackageIndexFrameWriter.
duke@1 157 */
duke@1 158 protected void printAllClassesPackagesLink() {
duke@1 159 }
duke@1 160 }

mercurial