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

Wed, 11 Sep 2013 14:50:11 -0700

author
bpatel
date
Wed, 11 Sep 2013 14:50:11 -0700
changeset 2023
cf37c3775397
parent 1985
0e6577980181
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8015496: Information that package is deprecated is missing in profiles view
Reviewed-by: jjg

bpatel@1568 1 /*
bpatel@1568 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
bpatel@1568 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bpatel@1568 4 *
bpatel@1568 5 * This code is free software; you can redistribute it and/or modify it
bpatel@1568 6 * under the terms of the GNU General Public License version 2 only, as
bpatel@1568 7 * published by the Free Software Foundation. Oracle designates this
bpatel@1568 8 * particular file as subject to the "Classpath" exception as provided
bpatel@1568 9 * by Oracle in the LICENSE file that accompanied this code.
bpatel@1568 10 *
bpatel@1568 11 * This code is distributed in the hope that it will be useful, but WITHOUT
bpatel@1568 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bpatel@1568 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bpatel@1568 14 * version 2 for more details (a copy is included in the LICENSE file that
bpatel@1568 15 * accompanied this code).
bpatel@1568 16 *
bpatel@1568 17 * You should have received a copy of the GNU General Public License version
bpatel@1568 18 * 2 along with this work; if not, write to the Free Software Foundation,
bpatel@1568 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bpatel@1568 20 *
bpatel@1568 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bpatel@1568 22 * or visit www.oracle.com if you need additional information or have any
bpatel@1568 23 * questions.
bpatel@1568 24 */
bpatel@1568 25
bpatel@1568 26 package com.sun.tools.doclets.formats.html;
bpatel@1568 27
bpatel@1568 28 import java.io.*;
bpatel@1568 29
bpatel@1568 30 import com.sun.tools.javac.sym.Profiles;
bpatel@1568 31 import com.sun.tools.doclets.formats.html.markup.*;
bpatel@1568 32 import com.sun.tools.doclets.internal.toolkit.*;
bpatel@1568 33 import com.sun.tools.doclets.internal.toolkit.util.*;
bpatel@1568 34 import com.sun.tools.javac.jvm.Profile;
bpatel@1568 35
bpatel@1568 36 /**
bpatel@1568 37 * Generate the profile index for the left-hand frame in the generated output.
bpatel@1568 38 * A click on the profile name in this frame will update the page in the top
bpatel@1568 39 * left hand frame with the listing of packages of the clicked profile.
bpatel@1568 40 *
bpatel@1568 41 * <p><b>This is NOT part of any supported API.
bpatel@1568 42 * If you write code that depends on this, you do so at your own risk.
bpatel@1568 43 * This code and its internal interfaces are subject to change or
bpatel@1568 44 * deletion without notice.</b>
bpatel@1568 45 *
bpatel@1568 46 * @author Bhavesh Patel
bpatel@1568 47 */
bpatel@1568 48 public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter {
bpatel@1568 49
bpatel@1568 50 /**
bpatel@1568 51 * Construct the ProfileIndexFrameWriter object.
bpatel@1568 52 *
bpatel@1568 53 * @param configuration the configuration object
bpatel@1568 54 * @param filename Name of the profile index file to be generated.
bpatel@1568 55 */
bpatel@1568 56 public ProfileIndexFrameWriter(ConfigurationImpl configuration,
bpatel@1568 57 DocPath filename) throws IOException {
bpatel@1568 58 super(configuration, filename);
bpatel@1568 59 }
bpatel@1568 60
bpatel@1568 61 /**
bpatel@1568 62 * Generate the profile index file named "profile-overview-frame.html".
bpatel@1568 63 * @throws DocletAbortException
bpatel@1568 64 * @param configuration the configuration object
bpatel@1568 65 */
bpatel@1568 66 public static void generate(ConfigurationImpl configuration) {
bpatel@1568 67 ProfileIndexFrameWriter profilegen;
bpatel@1568 68 DocPath filename = DocPaths.PROFILE_OVERVIEW_FRAME;
bpatel@1568 69 try {
bpatel@1568 70 profilegen = new ProfileIndexFrameWriter(configuration, filename);
bpatel@1568 71 profilegen.buildProfileIndexFile("doclet.Window_Overview", false);
bpatel@1568 72 profilegen.close();
bpatel@1568 73 } catch (IOException exc) {
bpatel@1568 74 configuration.standardmessage.error(
bpatel@1568 75 "doclet.exception_encountered",
bpatel@1568 76 exc.toString(), filename);
jjg@1985 77 throw new DocletAbortException(exc);
bpatel@1568 78 }
bpatel@1568 79 }
bpatel@1568 80
bpatel@1568 81 /**
bpatel@1568 82 * {@inheritDoc}
bpatel@1568 83 */
bpatel@1568 84 protected void addProfilesList(Profiles profiles, String text,
bpatel@1568 85 String tableSummary, Content body) {
bpatel@1568 86 Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true,
bpatel@1568 87 profilesLabel);
bpatel@1568 88 Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
bpatel@1568 89 HtmlTree ul = new HtmlTree(HtmlTag.UL);
jjg@1747 90 ul.setTitle(profilesLabel);
bpatel@2023 91 String profileName;
bpatel@1568 92 for (int i = 1; i < profiles.getProfileCount(); i++) {
bpatel@2023 93 profileName = (Profile.lookup(i)).name;
bpatel@2023 94 // If the profile has valid packages to be documented, add it to the
bpatel@2023 95 // left-frame generated for profile index.
bpatel@2023 96 if (configuration.shouldDocumentProfile(profileName))
bpatel@2023 97 ul.addContent(getProfile(profileName));
bpatel@1568 98 }
bpatel@1568 99 div.addContent(ul);
bpatel@1568 100 body.addContent(div);
bpatel@1568 101 }
bpatel@1568 102
bpatel@1568 103 /**
bpatel@1568 104 * Gets each profile name as a separate link.
bpatel@1568 105 *
bpatel@2023 106 * @param profileName the profile being documented
bpatel@1568 107 * @return content for the profile link
bpatel@1568 108 */
bpatel@2023 109 protected Content getProfile(String profileName) {
bpatel@1568 110 Content profileLinkContent;
bpatel@1568 111 Content profileLabel;
bpatel@1568 112 profileLabel = new StringContent(profileName);
bpatel@1568 113 profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "",
bpatel@1635 114 "packageListFrame");
bpatel@1568 115 Content li = HtmlTree.LI(profileLinkContent);
bpatel@1568 116 return li;
bpatel@1568 117 }
bpatel@1568 118
bpatel@1568 119 /**
bpatel@1568 120 * {@inheritDoc}
bpatel@1568 121 */
bpatel@1568 122 protected void addNavigationBarHeader(Content body) {
bpatel@1568 123 Content headerContent;
bpatel@1568 124 if (configuration.packagesheader.length() > 0) {
bpatel@1568 125 headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
bpatel@1568 126 } else {
bpatel@1568 127 headerContent = new RawHtml(replaceDocRootDir(configuration.header));
bpatel@1568 128 }
bpatel@1568 129 Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
bpatel@1568 130 HtmlStyle.bar, headerContent);
bpatel@1568 131 body.addContent(heading);
bpatel@1568 132 }
bpatel@1568 133
bpatel@1568 134 /**
bpatel@1568 135 * Do nothing as there is no overview information in this page.
bpatel@1568 136 */
bpatel@1568 137 protected void addOverviewHeader(Content body) {
bpatel@1568 138 }
bpatel@1568 139
bpatel@1568 140 /**
bpatel@1568 141 * Adds "All Classes" link for the top of the left-hand frame page to the
bpatel@1568 142 * documentation tree.
bpatel@1568 143 *
bpatel@1568 144 * @param div the Content object to which the all classes link should be added
bpatel@1568 145 */
bpatel@1568 146 protected void addAllClassesLink(Content div) {
bpatel@1568 147 Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
bpatel@1568 148 allclassesLabel, "", "packageFrame");
bpatel@1568 149 Content span = HtmlTree.SPAN(linkContent);
bpatel@1568 150 div.addContent(span);
bpatel@1568 151 }
bpatel@1568 152
bpatel@1568 153 /**
bpatel@1568 154 * Adds "All Packages" link for the top of the left-hand frame page to the
bpatel@1568 155 * documentation tree.
bpatel@1568 156 *
bpatel@1568 157 * @param div the Content object to which the all packages link should be added
bpatel@1568 158 */
bpatel@1568 159 protected void addAllPackagesLink(Content div) {
bpatel@1568 160 Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
bpatel@1635 161 allpackagesLabel, "", "packageListFrame");
bpatel@1568 162 Content span = HtmlTree.SPAN(linkContent);
bpatel@1568 163 div.addContent(span);
bpatel@1568 164 }
bpatel@1568 165
bpatel@1568 166 /**
bpatel@1568 167 * {@inheritDoc}
bpatel@1568 168 */
bpatel@1568 169 protected void addNavigationBarFooter(Content body) {
bpatel@1568 170 Content p = HtmlTree.P(getSpace());
bpatel@1568 171 body.addContent(p);
bpatel@1568 172 }
bpatel@1568 173
bpatel@1568 174 protected void addProfilePackagesList(Profiles profiles, String text,
bpatel@1568 175 String tableSummary, Content body, String profileName) {
bpatel@1568 176 }
bpatel@1568 177 }

mercurial