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

mercurial