bpatel@1568: /* bpatel@1568: * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. bpatel@1568: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. bpatel@1568: * bpatel@1568: * This code is free software; you can redistribute it and/or modify it bpatel@1568: * under the terms of the GNU General Public License version 2 only, as bpatel@1568: * published by the Free Software Foundation. Oracle designates this bpatel@1568: * particular file as subject to the "Classpath" exception as provided bpatel@1568: * by Oracle in the LICENSE file that accompanied this code. bpatel@1568: * bpatel@1568: * This code is distributed in the hope that it will be useful, but WITHOUT bpatel@1568: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or bpatel@1568: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License bpatel@1568: * version 2 for more details (a copy is included in the LICENSE file that bpatel@1568: * accompanied this code). bpatel@1568: * bpatel@1568: * You should have received a copy of the GNU General Public License version bpatel@1568: * 2 along with this work; if not, write to the Free Software Foundation, bpatel@1568: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. bpatel@1568: * bpatel@1568: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA bpatel@1568: * or visit www.oracle.com if you need additional information or have any bpatel@1568: * questions. bpatel@1568: */ bpatel@1568: bpatel@1568: package com.sun.tools.doclets.formats.html; bpatel@1568: bpatel@1568: import java.io.*; bpatel@1568: bpatel@1568: import com.sun.tools.javac.sym.Profiles; bpatel@1568: import com.sun.tools.doclets.formats.html.markup.*; bpatel@1568: import com.sun.tools.doclets.internal.toolkit.*; bpatel@1568: import com.sun.tools.doclets.internal.toolkit.util.*; bpatel@1568: import com.sun.tools.javac.jvm.Profile; bpatel@1568: bpatel@1568: /** bpatel@1568: * Generate the profile index for the left-hand frame in the generated output. bpatel@1568: * A click on the profile name in this frame will update the page in the top bpatel@1568: * left hand frame with the listing of packages of the clicked profile. bpatel@1568: * bpatel@1568: *

This is NOT part of any supported API. bpatel@1568: * If you write code that depends on this, you do so at your own risk. bpatel@1568: * This code and its internal interfaces are subject to change or bpatel@1568: * deletion without notice. bpatel@1568: * bpatel@1568: * @author Bhavesh Patel bpatel@1568: */ bpatel@1568: public class ProfileIndexFrameWriter extends AbstractProfileIndexWriter { bpatel@1568: bpatel@1568: /** bpatel@1568: * Construct the ProfileIndexFrameWriter object. bpatel@1568: * bpatel@1568: * @param configuration the configuration object bpatel@1568: * @param filename Name of the profile index file to be generated. bpatel@1568: */ bpatel@1568: public ProfileIndexFrameWriter(ConfigurationImpl configuration, bpatel@1568: DocPath filename) throws IOException { bpatel@1568: super(configuration, filename); bpatel@1568: } bpatel@1568: bpatel@1568: /** bpatel@1568: * Generate the profile index file named "profile-overview-frame.html". bpatel@1568: * @throws DocletAbortException bpatel@1568: * @param configuration the configuration object bpatel@1568: */ bpatel@1568: public static void generate(ConfigurationImpl configuration) { bpatel@1568: ProfileIndexFrameWriter profilegen; bpatel@1568: DocPath filename = DocPaths.PROFILE_OVERVIEW_FRAME; bpatel@1568: try { bpatel@1568: profilegen = new ProfileIndexFrameWriter(configuration, filename); bpatel@1568: profilegen.buildProfileIndexFile("doclet.Window_Overview", false); bpatel@1568: profilegen.close(); bpatel@1568: } catch (IOException exc) { bpatel@1568: configuration.standardmessage.error( bpatel@1568: "doclet.exception_encountered", bpatel@1568: exc.toString(), filename); bpatel@1568: throw new DocletAbortException(); bpatel@1568: } bpatel@1568: } bpatel@1568: bpatel@1568: /** bpatel@1568: * {@inheritDoc} bpatel@1568: */ bpatel@1568: protected void addProfilesList(Profiles profiles, String text, bpatel@1568: String tableSummary, Content body) { bpatel@1568: Content heading = HtmlTree.HEADING(HtmlConstants.PROFILE_HEADING, true, bpatel@1568: profilesLabel); bpatel@1568: Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading); bpatel@1568: HtmlTree ul = new HtmlTree(HtmlTag.UL); jjg@1747: ul.setTitle(profilesLabel); bpatel@1568: for (int i = 1; i < profiles.getProfileCount(); i++) { bpatel@1568: ul.addContent(getProfile(i)); bpatel@1568: } bpatel@1568: div.addContent(ul); bpatel@1568: body.addContent(div); bpatel@1568: } bpatel@1568: bpatel@1568: /** bpatel@1568: * Gets each profile name as a separate link. bpatel@1568: * bpatel@1568: * @param profile the profile being documented bpatel@1568: * @return content for the profile link bpatel@1568: */ bpatel@1568: protected Content getProfile(int profile) { bpatel@1568: Content profileLinkContent; bpatel@1568: Content profileLabel; bpatel@1568: String profileName = (Profile.lookup(profile)).name; bpatel@1568: profileLabel = new StringContent(profileName); bpatel@1568: profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "", bpatel@1635: "packageListFrame"); bpatel@1568: Content li = HtmlTree.LI(profileLinkContent); bpatel@1568: return li; bpatel@1568: } bpatel@1568: bpatel@1568: /** bpatel@1568: * {@inheritDoc} bpatel@1568: */ bpatel@1568: protected void addNavigationBarHeader(Content body) { bpatel@1568: Content headerContent; bpatel@1568: if (configuration.packagesheader.length() > 0) { bpatel@1568: headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader)); bpatel@1568: } else { bpatel@1568: headerContent = new RawHtml(replaceDocRootDir(configuration.header)); bpatel@1568: } bpatel@1568: Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, bpatel@1568: HtmlStyle.bar, headerContent); bpatel@1568: body.addContent(heading); bpatel@1568: } bpatel@1568: bpatel@1568: /** bpatel@1568: * Do nothing as there is no overview information in this page. bpatel@1568: */ bpatel@1568: protected void addOverviewHeader(Content body) { bpatel@1568: } bpatel@1568: bpatel@1568: /** bpatel@1568: * Adds "All Classes" link for the top of the left-hand frame page to the bpatel@1568: * documentation tree. bpatel@1568: * bpatel@1568: * @param div the Content object to which the all classes link should be added bpatel@1568: */ bpatel@1568: protected void addAllClassesLink(Content div) { bpatel@1568: Content linkContent = getHyperLink(DocPaths.ALLCLASSES_FRAME, bpatel@1568: allclassesLabel, "", "packageFrame"); bpatel@1568: Content span = HtmlTree.SPAN(linkContent); bpatel@1568: div.addContent(span); bpatel@1568: } bpatel@1568: bpatel@1568: /** bpatel@1568: * Adds "All Packages" link for the top of the left-hand frame page to the bpatel@1568: * documentation tree. bpatel@1568: * bpatel@1568: * @param div the Content object to which the all packages link should be added bpatel@1568: */ bpatel@1568: protected void addAllPackagesLink(Content div) { bpatel@1568: Content linkContent = getHyperLink(DocPaths.OVERVIEW_FRAME, bpatel@1635: allpackagesLabel, "", "packageListFrame"); bpatel@1568: Content span = HtmlTree.SPAN(linkContent); bpatel@1568: div.addContent(span); bpatel@1568: } bpatel@1568: bpatel@1568: /** bpatel@1568: * {@inheritDoc} bpatel@1568: */ bpatel@1568: protected void addNavigationBarFooter(Content body) { bpatel@1568: Content p = HtmlTree.P(getSpace()); bpatel@1568: body.addContent(p); bpatel@1568: } bpatel@1568: bpatel@1568: protected void addProfilePackagesList(Profiles profiles, String text, bpatel@1568: String tableSummary, Content body, String profileName) { bpatel@1568: } bpatel@1568: }