duke@1: /* bpatel@1568: * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this duke@1: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. duke@1: */ duke@1: duke@1: package com.sun.tools.doclets.formats.html; duke@1: bpatel@766: import java.io.*; jjg@1357: bpatel@766: import com.sun.javadoc.*; jjg@1357: import com.sun.tools.doclets.formats.html.markup.*; bpatel@766: import com.sun.tools.doclets.internal.toolkit.*; duke@1: import com.sun.tools.doclets.internal.toolkit.util.*; duke@1: duke@1: /** duke@1: * Generate the package index for the left-hand frame in the generated output. duke@1: * A click on the package name in this frame will update the page in the bottom duke@1: * left hand frame with the listing of contents of the clicked package. duke@1: * jjg@1359: *
This is NOT part of any supported API.
jjg@1359: * If you write code that depends on this, you do so at your own risk.
jjg@1359: * This code and its internal interfaces are subject to change or
jjg@1359: * deletion without notice.
jjg@1359: *
duke@1: * @author Atul M Dambalkar
duke@1: */
duke@1: public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
duke@1:
duke@1: /**
duke@1: * Construct the PackageIndexFrameWriter object.
duke@1: *
duke@1: * @param filename Name of the package index file to be generated.
duke@1: */
duke@1: public PackageIndexFrameWriter(ConfigurationImpl configuration,
jjg@1372: DocPath filename) throws IOException {
duke@1: super(configuration, filename);
duke@1: }
duke@1:
duke@1: /**
duke@1: * Generate the package index file named "overview-frame.html".
duke@1: * @throws DocletAbortException
duke@1: */
duke@1: public static void generate(ConfigurationImpl configuration) {
duke@1: PackageIndexFrameWriter packgen;
jjg@1372: DocPath filename = DocPaths.OVERVIEW_FRAME;
duke@1: try {
duke@1: packgen = new PackageIndexFrameWriter(configuration, filename);
bpatel@766: packgen.buildPackageIndexFile("doclet.Window_Overview", false);
duke@1: packgen.close();
duke@1: } catch (IOException exc) {
duke@1: configuration.standardmessage.error(
duke@1: "doclet.exception_encountered",
duke@1: exc.toString(), filename);
duke@1: throw new DocletAbortException();
duke@1: }
duke@1: }
duke@1:
duke@1: /**
bpatel@766: * {@inheritDoc}
duke@1: */
bpatel@766: protected void addPackagesList(PackageDoc[] packages, String text,
bpatel@766: String tableSummary, Content body) {
bpatel@766: Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
bpatel@766: packagesLabel);
bpatel@766: Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
bpatel@766: HtmlTree ul = new HtmlTree(HtmlTag.UL);
bpatel@766: ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString());
bpatel@766: for(int i = 0; i < packages.length; i++) {
bpatel@995: // Do not list the package if -nodeprecated option is set and the
bpatel@995: // package is marked as deprecated.
bpatel@995: if (packages[i] != null &&
bpatel@995: (!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
bpatel@766: ul.addContent(getPackage(packages[i]));
bpatel@766: }
duke@1: }
bpatel@766: div.addContent(ul);
bpatel@766: body.addContent(div);
duke@1: }
duke@1:
duke@1: /**
bpatel@766: * Gets each package name as a separate link.
bpatel@766: *
bpatel@766: * @param pd PackageDoc
bpatel@766: * @return content for the package link
duke@1: */
bpatel@766: protected Content getPackage(PackageDoc pd) {
bpatel@766: Content packageLinkContent;
bpatel@766: Content packageLabel;
bpatel@766: if (pd.name().length() > 0) {
bpatel@766: packageLabel = getPackageLabel(pd.name());
bpatel@766: packageLinkContent = getHyperLink(pathString(pd,
jjg@1373: DocPaths.PACKAGE_FRAME), packageLabel, "",
bpatel@766: "packageFrame");
bpatel@766: } else {
jjg@1737: packageLabel = new StringContent("