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

Mon, 19 Nov 2012 16:10:34 -0800

author
bpatel
date
Mon, 19 Nov 2012 16:10:34 -0800
changeset 1417
522a1ee72340
parent 1372
78962d89f283
child 1568
5f0731e4e5e6
permissions
-rw-r--r--

8002304: Group methods by types in methods summary section
Reviewed-by: jjg

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

mercurial