Wed, 10 Oct 2012 16:48:21 -0700
8000665: fix "internal API" comments on javadoc files
Reviewed-by: darcy
duke@1 | 1 | /* |
jjg@1357 | 2 | * Copyright (c) 1997, 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@1357 | 30 | |
bpatel@766 | 31 | import com.sun.javadoc.*; |
jjg@1357 | 32 | import com.sun.tools.doclets.formats.html.markup.*; |
bpatel@766 | 33 | import com.sun.tools.doclets.internal.toolkit.*; |
bpatel@766 | 34 | import com.sun.tools.doclets.internal.toolkit.util.*; |
duke@1 | 35 | |
duke@1 | 36 | /** |
duke@1 | 37 | * Generate the package index page "overview-summary.html" for the right-hand |
duke@1 | 38 | * frame. A click on the package name on this page will update the same frame |
duke@1 | 39 | * with the "pacakge-summary.html" file for the clicked package. |
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 class PackageIndexWriter extends AbstractPackageIndexWriter { |
duke@1 | 50 | |
duke@1 | 51 | /** |
duke@1 | 52 | * Root of the program structure. Used for "overview" documentation. |
duke@1 | 53 | */ |
duke@1 | 54 | private RootDoc root; |
duke@1 | 55 | |
duke@1 | 56 | /** |
duke@1 | 57 | * Map representing the group of packages as specified on the command line. |
duke@1 | 58 | * |
duke@1 | 59 | * @see Group |
duke@1 | 60 | */ |
jjg@74 | 61 | private Map<String,List<PackageDoc>> groupPackageMap; |
duke@1 | 62 | |
duke@1 | 63 | /** |
duke@1 | 64 | * List to store the order groups as specified on the command line. |
duke@1 | 65 | */ |
mcimadamore@184 | 66 | private List<String> groupList; |
duke@1 | 67 | |
duke@1 | 68 | /** |
duke@1 | 69 | * Construct the PackageIndexWriter. Also constructs the grouping |
duke@1 | 70 | * information as provided on the command line by "-group" option. Stores |
duke@1 | 71 | * the order of groups specified by the user. |
duke@1 | 72 | * |
duke@1 | 73 | * @see Group |
duke@1 | 74 | */ |
duke@1 | 75 | public PackageIndexWriter(ConfigurationImpl configuration, |
duke@1 | 76 | String filename) |
duke@1 | 77 | throws IOException { |
duke@1 | 78 | super(configuration, filename); |
duke@1 | 79 | this.root = configuration.root; |
duke@1 | 80 | groupPackageMap = configuration.group.groupPackages(packages); |
duke@1 | 81 | groupList = configuration.group.getGroupList(); |
duke@1 | 82 | } |
duke@1 | 83 | |
duke@1 | 84 | /** |
duke@1 | 85 | * Generate the package index page for the right-hand frame. |
duke@1 | 86 | * |
duke@1 | 87 | * @param configuration the current configuration of the doclet. |
duke@1 | 88 | */ |
duke@1 | 89 | public static void generate(ConfigurationImpl configuration) { |
duke@1 | 90 | PackageIndexWriter packgen; |
duke@1 | 91 | String filename = "overview-summary.html"; |
duke@1 | 92 | try { |
duke@1 | 93 | packgen = new PackageIndexWriter(configuration, filename); |
bpatel@766 | 94 | packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true); |
duke@1 | 95 | packgen.close(); |
duke@1 | 96 | } catch (IOException exc) { |
duke@1 | 97 | configuration.standardmessage.error( |
duke@1 | 98 | "doclet.exception_encountered", |
duke@1 | 99 | exc.toString(), filename); |
duke@1 | 100 | throw new DocletAbortException(); |
duke@1 | 101 | } |
duke@1 | 102 | } |
duke@1 | 103 | |
duke@1 | 104 | /** |
bpatel@766 | 105 | * Depending upon the grouping information and their titles, add |
bpatel@766 | 106 | * separate table indices for each package group. |
duke@1 | 107 | * |
bpatel@766 | 108 | * @param body the documentation tree to which the index will be added |
duke@1 | 109 | */ |
bpatel@766 | 110 | protected void addIndex(Content body) { |
duke@1 | 111 | for (int i = 0; i < groupList.size(); i++) { |
jjg@198 | 112 | String groupname = groupList.get(i); |
jjg@74 | 113 | List<PackageDoc> list = groupPackageMap.get(groupname); |
duke@1 | 114 | if (list != null && list.size() > 0) { |
bpatel@766 | 115 | addIndexContents(list.toArray(new PackageDoc[list.size()]), |
bpatel@766 | 116 | groupname, configuration.getText("doclet.Member_Table_Summary", |
bpatel@766 | 117 | groupname, configuration.getText("doclet.packages")), body); |
duke@1 | 118 | } |
duke@1 | 119 | } |
duke@1 | 120 | } |
duke@1 | 121 | |
duke@1 | 122 | /** |
bpatel@766 | 123 | * {@inheritDoc} |
duke@1 | 124 | */ |
bpatel@766 | 125 | protected void addPackagesList(PackageDoc[] packages, String text, |
bpatel@766 | 126 | String tableSummary, Content body) { |
bpatel@766 | 127 | Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary, |
bpatel@766 | 128 | getTableCaption(text)); |
bpatel@766 | 129 | table.addContent(getSummaryTableHeader(packageTableHeader, "col")); |
bpatel@766 | 130 | Content tbody = new HtmlTree(HtmlTag.TBODY); |
bpatel@766 | 131 | addPackagesList(packages, tbody); |
bpatel@766 | 132 | table.addContent(tbody); |
bpatel@766 | 133 | Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table); |
bpatel@766 | 134 | body.addContent(div); |
bpatel@766 | 135 | } |
bpatel@766 | 136 | |
bpatel@766 | 137 | /** |
bpatel@766 | 138 | * Adds list of packages in the index table. Generate link to each package. |
bpatel@766 | 139 | * |
bpatel@766 | 140 | * @param packages Packages to which link is to be generated |
bpatel@766 | 141 | * @param tbody the documentation tree to which the list will be added |
bpatel@766 | 142 | */ |
bpatel@766 | 143 | protected void addPackagesList(PackageDoc[] packages, Content tbody) { |
bpatel@766 | 144 | for (int i = 0; i < packages.length; i++) { |
bpatel@766 | 145 | if (packages[i] != null && packages[i].name().length() > 0) { |
bpatel@995 | 146 | if (configuration.nodeprecated && Util.isDeprecated(packages[i])) |
bpatel@995 | 147 | continue; |
bpatel@766 | 148 | Content packageLinkContent = getPackageLink(packages[i], |
bpatel@766 | 149 | getPackageName(packages[i])); |
bpatel@766 | 150 | Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent); |
bpatel@766 | 151 | HtmlTree tdSummary = new HtmlTree(HtmlTag.TD); |
bpatel@766 | 152 | tdSummary.addStyle(HtmlStyle.colLast); |
bpatel@766 | 153 | addSummaryComment(packages[i], tdSummary); |
bpatel@766 | 154 | HtmlTree tr = HtmlTree.TR(tdPackage); |
bpatel@766 | 155 | tr.addContent(tdSummary); |
bpatel@766 | 156 | if (i%2 == 0) |
bpatel@766 | 157 | tr.addStyle(HtmlStyle.altColor); |
bpatel@766 | 158 | else |
bpatel@766 | 159 | tr.addStyle(HtmlStyle.rowColor); |
bpatel@766 | 160 | tbody.addContent(tr); |
bpatel@766 | 161 | } |
duke@1 | 162 | } |
duke@1 | 163 | } |
duke@1 | 164 | |
duke@1 | 165 | /** |
bpatel@766 | 166 | * Adds the overview summary comment for this documentation. Add one line |
bpatel@766 | 167 | * summary at the top of the page and generate a link to the description, |
bpatel@766 | 168 | * which is added at the end of this page. |
bpatel@766 | 169 | * |
bpatel@766 | 170 | * @param body the documentation tree to which the overview header will be added |
duke@1 | 171 | */ |
bpatel@766 | 172 | protected void addOverviewHeader(Content body) { |
duke@1 | 173 | if (root.inlineTags().length > 0) { |
bpatel@943 | 174 | HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV); |
bpatel@943 | 175 | subTitleDiv.addStyle(HtmlStyle.subTitle); |
bpatel@943 | 176 | addSummaryComment(root, subTitleDiv); |
bpatel@943 | 177 | Content div = HtmlTree.DIV(HtmlStyle.header, subTitleDiv); |
bpatel@766 | 178 | Content see = seeLabel; |
bpatel@766 | 179 | see.addContent(" "); |
bpatel@766 | 180 | Content descPara = HtmlTree.P(see); |
bpatel@766 | 181 | Content descLink = getHyperLink("", "overview_description", |
bpatel@766 | 182 | descriptionLabel, "", ""); |
bpatel@766 | 183 | descPara.addContent(descLink); |
bpatel@766 | 184 | div.addContent(descPara); |
bpatel@766 | 185 | body.addContent(div); |
duke@1 | 186 | } |
duke@1 | 187 | } |
duke@1 | 188 | |
duke@1 | 189 | /** |
bpatel@766 | 190 | * Adds the overview comment as provided in the file specified by the |
bpatel@766 | 191 | * "-overview" option on the command line. |
bpatel@766 | 192 | * |
bpatel@766 | 193 | * @param htmltree the documentation tree to which the overview comment will |
bpatel@766 | 194 | * be added |
duke@1 | 195 | */ |
bpatel@766 | 196 | protected void addOverviewComment(Content htmltree) { |
bpatel@766 | 197 | if (root.inlineTags().length > 0) { |
bpatel@766 | 198 | htmltree.addContent(getMarkerAnchor("overview_description")); |
bpatel@943 | 199 | HtmlTree div = new HtmlTree(HtmlTag.DIV); |
bpatel@943 | 200 | div.addStyle(HtmlStyle.subTitle); |
bpatel@943 | 201 | addInlineComment(root, div); |
bpatel@943 | 202 | htmltree.addContent(div); |
bpatel@766 | 203 | } |
duke@1 | 204 | } |
duke@1 | 205 | |
duke@1 | 206 | /** |
bpatel@766 | 207 | * Adds the tag information as provided in the file specified by the |
bpatel@766 | 208 | * "-overview" option on the command line. |
bpatel@766 | 209 | * |
bpatel@766 | 210 | * @param body the documentation tree to which the overview will be added |
duke@1 | 211 | */ |
bpatel@766 | 212 | protected void addOverview(Content body) throws IOException { |
bpatel@766 | 213 | HtmlTree div = new HtmlTree(HtmlTag.DIV); |
bpatel@766 | 214 | div.addStyle(HtmlStyle.footer); |
bpatel@766 | 215 | addOverviewComment(div); |
bpatel@766 | 216 | addTagsInfo(root, div); |
bpatel@766 | 217 | body.addContent(div); |
duke@1 | 218 | } |
duke@1 | 219 | |
duke@1 | 220 | /** |
bpatel@766 | 221 | * Adds the top text (from the -top option), the upper |
bpatel@766 | 222 | * navigation bar, and then the title (from the"-title" |
bpatel@766 | 223 | * option), at the top of page. |
bpatel@766 | 224 | * |
bpatel@766 | 225 | * @body the documentation tree to which the navigation bar header will be added |
bpatel@766 | 226 | */ |
bpatel@766 | 227 | protected void addNavigationBarHeader(Content body) { |
bpatel@766 | 228 | addTop(body); |
bpatel@766 | 229 | addNavLinks(true, body); |
bpatel@766 | 230 | addConfigurationTitle(body); |
bpatel@766 | 231 | } |
bpatel@766 | 232 | |
bpatel@766 | 233 | /** |
bpatel@766 | 234 | * Adds the lower navigation bar and the bottom text |
duke@1 | 235 | * (from the -bottom option) at the bottom of page. |
bpatel@766 | 236 | * |
jjg@1358 | 237 | * @param body the documentation tree to which the navigation bar footer will be added |
duke@1 | 238 | */ |
bpatel@766 | 239 | protected void addNavigationBarFooter(Content body) { |
bpatel@766 | 240 | addNavLinks(false, body); |
bpatel@766 | 241 | addBottom(body); |
duke@1 | 242 | } |
duke@1 | 243 | } |