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

Mon, 13 Dec 2010 13:44:47 -0800

author
bpatel
date
Mon, 13 Dec 2010 13:44:47 -0800
changeset 793
ffbf2b2a8611
parent 766
90af8d87741f
child 798
4868a36f6fd8
permissions
-rw-r--r--

7006270: Several javadoc regression tests are failing on windows
Reviewed-by: jjg

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 java.io.*;
duke@1 29 import java.util.*;
bpatel@766 30 import com.sun.javadoc.*;
bpatel@766 31 import com.sun.tools.doclets.formats.html.markup.*;
bpatel@766 32 import com.sun.tools.doclets.internal.toolkit.*;
duke@1 33
duke@1 34 /**
duke@1 35 * Abstract class to generate the overview files in
duke@1 36 * Frame and Non-Frame format. This will be sub-classed by to
duke@1 37 * generate overview-frame.html as well as overview-summary.html.
duke@1 38 *
duke@1 39 * @author Atul M Dambalkar
bpatel@243 40 * @author Bhavesh Patel (Modified)
duke@1 41 */
duke@1 42 public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
duke@1 43
duke@1 44 /**
duke@1 45 * Array of Packages to be documented.
duke@1 46 */
duke@1 47 protected PackageDoc[] packages;
duke@1 48
duke@1 49 /**
duke@1 50 * Constructor. Also initialises the packages variable.
duke@1 51 *
duke@1 52 * @param filename Name of the package index file to be generated.
duke@1 53 */
duke@1 54 public AbstractPackageIndexWriter(ConfigurationImpl configuration,
duke@1 55 String filename) throws IOException {
duke@1 56 super(configuration, filename);
duke@1 57 this.relativepathNoSlash = ".";
duke@1 58 packages = configuration.packages;
duke@1 59 }
duke@1 60
bpatel@766 61 /**
bpatel@766 62 * Adds the navigation bar header to the documentation tree.
bpatel@766 63 *
bpatel@766 64 * @param body the document tree to which the navigation bar header will be added
bpatel@766 65 */
bpatel@766 66 protected abstract void addNavigationBarHeader(Content body);
duke@1 67
duke@1 68 /**
bpatel@766 69 * Adds the navigation bar footer to the documentation tree.
bpatel@766 70 *
bpatel@766 71 * @param body the document tree to which the navigation bar footer will be added
bpatel@766 72 */
bpatel@766 73 protected abstract void addNavigationBarFooter(Content body);
bpatel@766 74
bpatel@766 75 /**
bpatel@766 76 * Adds the overview header to the documentation tree.
bpatel@766 77 *
bpatel@766 78 * @param body the document tree to which the overview header will be added
bpatel@766 79 */
bpatel@766 80 protected abstract void addOverviewHeader(Content body);
bpatel@766 81
bpatel@766 82 /**
bpatel@766 83 * Adds the packages list to the documentation tree.
bpatel@766 84 *
bpatel@766 85 * @param packages an array of packagedoc objects
bpatel@766 86 * @param text caption for the table
bpatel@766 87 * @param tableSummary summary for the table
bpatel@766 88 * @param body the document tree to which the packages list will be added
bpatel@766 89 */
bpatel@766 90 protected abstract void addPackagesList(PackageDoc[] packages, String text,
bpatel@766 91 String tableSummary, Content body);
bpatel@766 92
bpatel@766 93 /**
bpatel@766 94 * Generate and prints the contents in the package index file. Call appropriate
duke@1 95 * methods from the sub-class in order to generate Frame or Non
duke@1 96 * Frame format.
bpatel@766 97 *
duke@1 98 * @param title the title of the window.
duke@1 99 * @param includeScript boolean set true if windowtitle script is to be included
duke@1 100 */
bpatel@766 101 protected void buildPackageIndexFile(String title, boolean includeScript) throws IOException {
duke@1 102 String windowOverview = configuration.getText(title);
bpatel@766 103 Content body = getBody(includeScript, getWindowTitle(windowOverview));
bpatel@766 104 addNavigationBarHeader(body);
bpatel@766 105 addOverviewHeader(body);
bpatel@766 106 addIndex(body);
bpatel@766 107 addOverview(body);
bpatel@766 108 addNavigationBarFooter(body);
bpatel@766 109 printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
bpatel@766 110 configuration.doctitle), includeScript, body);
duke@1 111 }
duke@1 112
duke@1 113 /**
bpatel@766 114 * Default to no overview, override to add overview.
bpatel@766 115 *
bpatel@766 116 * @param body the document tree to which the overview will be added
duke@1 117 */
bpatel@766 118 protected void addOverview(Content body) throws IOException {
duke@1 119 }
duke@1 120
duke@1 121 /**
bpatel@766 122 * Adds the frame or non-frame package index to the documentation tree.
bpatel@766 123 *
bpatel@766 124 * @param body the document tree to which the index will be added
duke@1 125 */
bpatel@766 126 protected void addIndex(Content body) {
bpatel@766 127 addIndexContents(packages, "doclet.Package_Summary",
bpatel@243 128 configuration.getText("doclet.Member_Table_Summary",
bpatel@243 129 configuration.getText("doclet.Package_Summary"),
bpatel@766 130 configuration.getText("doclet.packages")), body);
duke@1 131 }
duke@1 132
duke@1 133 /**
bpatel@766 134 * Adds package index contents. Call appropriate methods from
bpatel@766 135 * the sub-classes. Adds it to the body HtmlTree
duke@1 136 *
bpatel@766 137 * @param packages array of packages to be documented
bpatel@766 138 * @param text string which will be used as the heading
bpatel@766 139 * @param tableSummary summary for the table
bpatel@766 140 * @param body the document tree to which the index contents will be added
duke@1 141 */
bpatel@766 142 protected void addIndexContents(PackageDoc[] packages, String text,
bpatel@766 143 String tableSummary, Content body) {
duke@1 144 if (packages.length > 0) {
duke@1 145 Arrays.sort(packages);
bpatel@766 146 addAllClassesLink(body);
bpatel@766 147 addPackagesList(packages, text, tableSummary, body);
duke@1 148 }
duke@1 149 }
duke@1 150
duke@1 151 /**
bpatel@766 152 * Adds the doctitle to the documentation tree, if it is specified on the command line.
bpatel@766 153 *
bpatel@766 154 * @param body the document tree to which the title will be added
duke@1 155 */
bpatel@766 156 protected void addConfigurationTitle(Content body) {
duke@1 157 if (configuration.doctitle.length() > 0) {
bpatel@766 158 Content title = new RawHtml(configuration.doctitle);
bpatel@766 159 Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
bpatel@766 160 HtmlStyle.title, title);
bpatel@766 161 Content div = HtmlTree.DIV(HtmlStyle.header, heading);
bpatel@766 162 body.addContent(div);
duke@1 163 }
duke@1 164 }
duke@1 165
duke@1 166 /**
bpatel@766 167 * Returns highlighted "Overview", in the navigation bar as this is the
bpatel@766 168 * overview page.
bpatel@766 169 *
bpatel@766 170 * @return a Content object to be added to the documentation tree
duke@1 171 */
bpatel@766 172 protected Content getNavLinkContents() {
bpatel@766 173 Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, overviewLabel);
bpatel@766 174 return li;
duke@1 175 }
duke@1 176
duke@1 177 /**
duke@1 178 * Do nothing. This will be overridden in PackageIndexFrameWriter.
bpatel@766 179 *
bpatel@766 180 * @param body the document tree to which the all classes link will be added
duke@1 181 */
bpatel@766 182 protected void addAllClassesLink(Content body) {
duke@1 183 }
duke@1 184 }

mercurial