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

Tue, 18 Jun 2013 20:56:04 -0700

author
mfang
date
Tue, 18 Jun 2013 20:56:04 -0700
changeset 1841
792c40d5185a
parent 1747
df4f44800923
child 1985
0e6577980181
permissions
-rw-r--r--

8015657: jdk8 l10n resource file translation update 3
Reviewed-by: yhuang

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);
bpatel@1568 77 throw new DocletAbortException();
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@1568 91 for (int i = 1; i < profiles.getProfileCount(); i++) {
bpatel@1568 92 ul.addContent(getProfile(i));
bpatel@1568 93 }
bpatel@1568 94 div.addContent(ul);
bpatel@1568 95 body.addContent(div);
bpatel@1568 96 }
bpatel@1568 97
bpatel@1568 98 /**
bpatel@1568 99 * Gets each profile name as a separate link.
bpatel@1568 100 *
bpatel@1568 101 * @param profile the profile being documented
bpatel@1568 102 * @return content for the profile link
bpatel@1568 103 */
bpatel@1568 104 protected Content getProfile(int profile) {
bpatel@1568 105 Content profileLinkContent;
bpatel@1568 106 Content profileLabel;
bpatel@1568 107 String profileName = (Profile.lookup(profile)).name;
bpatel@1568 108 profileLabel = new StringContent(profileName);
bpatel@1568 109 profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "",
bpatel@1635 110 "packageListFrame");
bpatel@1568 111 Content li = HtmlTree.LI(profileLinkContent);
bpatel@1568 112 return li;
bpatel@1568 113 }
bpatel@1568 114
bpatel@1568 115 /**
bpatel@1568 116 * {@inheritDoc}
bpatel@1568 117 */
bpatel@1568 118 protected void addNavigationBarHeader(Content body) {
bpatel@1568 119 Content headerContent;
bpatel@1568 120 if (configuration.packagesheader.length() > 0) {
bpatel@1568 121 headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader));
bpatel@1568 122 } else {
bpatel@1568 123 headerContent = new RawHtml(replaceDocRootDir(configuration.header));
bpatel@1568 124 }
bpatel@1568 125 Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
bpatel@1568 126 HtmlStyle.bar, headerContent);
bpatel@1568 127 body.addContent(heading);
bpatel@1568 128 }
bpatel@1568 129
bpatel@1568 130 /**
bpatel@1568 131 * Do nothing as there is no overview information in this page.
bpatel@1568 132 */
bpatel@1568 133 protected void addOverviewHeader(Content body) {
bpatel@1568 134 }
bpatel@1568 135
bpatel@1568 136 /**
bpatel@1568 137 * Adds "All Classes" link for the top of the left-hand frame page to the
bpatel@1568 138 * documentation tree.
bpatel@1568 139 *
bpatel@1568 140 * @param div the Content object to which the all classes link should be added
bpatel@1568 141 */
bpatel@1568 142 protected void addAllClassesLink(Content div) {
bpatel@1568 143 Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME,
bpatel@1568 144 allclassesLabel, "", "packageFrame");
bpatel@1568 145 Content span = HtmlTree.SPAN(linkContent);
bpatel@1568 146 div.addContent(span);
bpatel@1568 147 }
bpatel@1568 148
bpatel@1568 149 /**
bpatel@1568 150 * Adds "All Packages" link for the top of the left-hand frame page to the
bpatel@1568 151 * documentation tree.
bpatel@1568 152 *
bpatel@1568 153 * @param div the Content object to which the all packages link should be added
bpatel@1568 154 */
bpatel@1568 155 protected void addAllPackagesLink(Content div) {
bpatel@1568 156 Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME,
bpatel@1635 157 allpackagesLabel, "", "packageListFrame");
bpatel@1568 158 Content span = HtmlTree.SPAN(linkContent);
bpatel@1568 159 div.addContent(span);
bpatel@1568 160 }
bpatel@1568 161
bpatel@1568 162 /**
bpatel@1568 163 * {@inheritDoc}
bpatel@1568 164 */
bpatel@1568 165 protected void addNavigationBarFooter(Content body) {
bpatel@1568 166 Content p = HtmlTree.P(getSpace());
bpatel@1568 167 body.addContent(p);
bpatel@1568 168 }
bpatel@1568 169
bpatel@1568 170 protected void addProfilePackagesList(Profiles profiles, String text,
bpatel@1568 171 String tableSummary, Content body, String profileName) {
bpatel@1568 172 }
bpatel@1568 173 }

mercurial