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

Thu, 02 Oct 2008 19:58:40 -0700

author
xdono
date
Thu, 02 Oct 2008 19:58:40 -0700
changeset 117
24a47c3062fe
parent 74
5a9172b251dd
child 182
47a62d8d98b4
permissions
-rw-r--r--

6754988: Update copyright year
Summary: Update for files that have been modified starting July 2008
Reviewed-by: ohair, tbell

duke@1 1 /*
xdono@117 2 * Copyright 1997-2008 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 com.sun.javadoc.*;
duke@1 30 import java.io.*;
duke@1 31 import java.util.*;
duke@1 32
duke@1 33 /**
duke@1 34 * Generate the package index page "overview-summary.html" for the right-hand
duke@1 35 * frame. A click on the package name on this page will update the same frame
duke@1 36 * with the "pacakge-summary.html" file for the clicked package.
duke@1 37 *
duke@1 38 * @author Atul M Dambalkar
duke@1 39 */
duke@1 40 public class PackageIndexWriter extends AbstractPackageIndexWriter {
duke@1 41
duke@1 42 /**
duke@1 43 * Root of the program structure. Used for "overview" documentation.
duke@1 44 */
duke@1 45 private RootDoc root;
duke@1 46
duke@1 47 /**
duke@1 48 * Map representing the group of packages as specified on the command line.
duke@1 49 *
duke@1 50 * @see Group
duke@1 51 */
jjg@74 52 private Map<String,List<PackageDoc>> groupPackageMap;
duke@1 53
duke@1 54 /**
duke@1 55 * List to store the order groups as specified on the command line.
duke@1 56 */
duke@1 57 private List groupList;
duke@1 58
duke@1 59 /**
duke@1 60 * Construct the PackageIndexWriter. Also constructs the grouping
duke@1 61 * information as provided on the command line by "-group" option. Stores
duke@1 62 * the order of groups specified by the user.
duke@1 63 *
duke@1 64 * @see Group
duke@1 65 */
duke@1 66 public PackageIndexWriter(ConfigurationImpl configuration,
duke@1 67 String filename)
duke@1 68 throws IOException {
duke@1 69 super(configuration, filename);
duke@1 70 this.root = configuration.root;
duke@1 71 groupPackageMap = configuration.group.groupPackages(packages);
duke@1 72 groupList = configuration.group.getGroupList();
duke@1 73 }
duke@1 74
duke@1 75 /**
duke@1 76 * Generate the package index page for the right-hand frame.
duke@1 77 *
duke@1 78 * @param configuration the current configuration of the doclet.
duke@1 79 */
duke@1 80 public static void generate(ConfigurationImpl configuration) {
duke@1 81 PackageIndexWriter packgen;
duke@1 82 String filename = "overview-summary.html";
duke@1 83 try {
duke@1 84 packgen = new PackageIndexWriter(configuration, filename);
duke@1 85 packgen.generatePackageIndexFile("doclet.Window_Overview_Summary", true);
duke@1 86 packgen.close();
duke@1 87 } catch (IOException exc) {
duke@1 88 configuration.standardmessage.error(
duke@1 89 "doclet.exception_encountered",
duke@1 90 exc.toString(), filename);
duke@1 91 throw new DocletAbortException();
duke@1 92 }
duke@1 93 }
duke@1 94
duke@1 95 /**
duke@1 96 * Print each package in separate rows in the index table. Generate link
duke@1 97 * to each package.
duke@1 98 *
duke@1 99 * @param pkg Package to which link is to be generated.
duke@1 100 */
duke@1 101 protected void printIndexRow(PackageDoc pkg) {
duke@1 102 if(pkg != null && pkg.name().length() > 0) {
duke@1 103 trBgcolorStyle("white", "TableRowColor");
duke@1 104 summaryRow(20);
duke@1 105 bold();
duke@1 106 printPackageLink(pkg, Util.getPackageName(pkg), false);
duke@1 107 boldEnd();
duke@1 108 summaryRowEnd();
duke@1 109 summaryRow(0);
duke@1 110 printSummaryComment(pkg);
duke@1 111 summaryRowEnd();
duke@1 112 trEnd();
duke@1 113 }
duke@1 114 }
duke@1 115
duke@1 116 /**
duke@1 117 * Depending upon the grouping information and their titles, generate
duke@1 118 * separate table indices for each package group.
duke@1 119 */
duke@1 120 protected void generateIndex() {
duke@1 121 for (int i = 0; i < groupList.size(); i++) {
duke@1 122 String groupname = (String)groupList.get(i);
jjg@74 123 List<PackageDoc> list = groupPackageMap.get(groupname);
duke@1 124 if (list != null && list.size() > 0) {
jjg@74 125 printIndexContents(list.toArray(new PackageDoc[list.size()]),
duke@1 126 groupname);
duke@1 127 }
duke@1 128 }
duke@1 129 }
duke@1 130
duke@1 131 /**
duke@1 132 * Print the overview summary comment for this documentation. Print one line
duke@1 133 * summary at the top of the page and generate a link to the description,
duke@1 134 * which is generated at the end of this page.
duke@1 135 */
duke@1 136 protected void printOverviewHeader() {
duke@1 137 if (root.inlineTags().length > 0) {
duke@1 138 printSummaryComment(root);
duke@1 139 p();
duke@1 140 bold(configuration.getText("doclet.See"));
duke@1 141 br();
duke@1 142 printNbsps();
duke@1 143 printHyperLink("", "overview_description",
duke@1 144 configuration.getText("doclet.Description"), true);
duke@1 145 p();
duke@1 146 }
duke@1 147 }
duke@1 148
duke@1 149 /**
duke@1 150 * Print Html tags for the table for this package index.
duke@1 151 */
duke@1 152 protected void printIndexHeader(String text) {
duke@1 153 tableIndexSummary();
duke@1 154 tableHeaderStart("#CCCCFF");
duke@1 155 bold(text);
duke@1 156 tableHeaderEnd();
duke@1 157 }
duke@1 158
duke@1 159 /**
duke@1 160 * Print Html closing tags for the table for this package index.
duke@1 161 */
duke@1 162 protected void printIndexFooter() {
duke@1 163 tableEnd();
duke@1 164 p();
duke@1 165 space();
duke@1 166 }
duke@1 167
duke@1 168 /**
duke@1 169 * Print the overview comment as provided in the file specified by the
duke@1 170 * "-overview" option on the command line.
duke@1 171 */
duke@1 172 protected void printOverviewComment() {
duke@1 173 if (root.inlineTags().length > 0) {
duke@1 174 anchor("overview_description");
duke@1 175 p();
duke@1 176 printInlineComment(root);
duke@1 177 p();
duke@1 178 }
duke@1 179 }
duke@1 180
duke@1 181 /**
duke@1 182 * Call {@link #printOverviewComment()} and then genrate the tag information
duke@1 183 * as provided in the file specified by the "-overview" option on the
duke@1 184 * command line.
duke@1 185 */
duke@1 186 protected void printOverview() throws IOException {
duke@1 187 printOverviewComment();
duke@1 188 printTags(root);
duke@1 189 }
duke@1 190
duke@1 191 /**
duke@1 192 * Print the top text (from the -top option), the upper
duke@1 193 * navigation bar, and then the title (from the"-title"
duke@1 194 * option), at the top of page.
duke@1 195 */
duke@1 196 protected void printNavigationBarHeader() {
duke@1 197 printTop();
duke@1 198 navLinks(true);
duke@1 199 hr();
duke@1 200 printConfigurationTitle();
duke@1 201 }
duke@1 202
duke@1 203 /**
duke@1 204 * Print the lower navigation bar and the bottom text
duke@1 205 * (from the -bottom option) at the bottom of page.
duke@1 206 */
duke@1 207 protected void printNavigationBarFooter() {
duke@1 208 hr();
duke@1 209 navLinks(false);
duke@1 210 printBottom();
duke@1 211 }
duke@1 212 }

mercurial