/* * @(#)FrameOutputWriter.java 1.11 98/04/28 * * Copyright 1997, 1998 by Sun Microsystems, Inc., * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. * All rights reserved. * * This software is the confidential and proprietary information * of Sun Microsystems, Inc. ("Confidential Information"). You * shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * you entered into with Sun. */ package com.sun.tools.doclets.standard; import com.sun.tools.doclets.*; import com.sun.javadoc.*; import java.io.*; import java.lang.*; import java.util.*; /** * Generate the Html output required for the Frames. * * @see com.sun.tools.doclets.HtmlDocWriter * @author Atul M Dambalkar */ public class FrameOutputWriter extends HtmlStandardWriter { boolean showPackageIndex; String firstclass; /** * Constructor. */ public FrameOutputWriter(String filename, RootDoc root) throws IOException { super(filename); showPackageIndex = root.specifiedPackages().length > 1; if (!showPackageIndex) { ClassDoc[] classarr = root.classes(); Arrays.sort(classarr); String pathstr = DirectoryManager.createPathString(classarr[0]); firstclass = ((pathstr.length() > 0)? pathstr + File.separatorChar: "") + classarr[0].name() + ".html"; } } /** * Generate the frame as well as the option file. * */ public static void generate(RootDoc root) throws DocletAbortException { FrameOutputWriter framegen; String filename = ""; try { filename = "index.html"; framegen = new FrameOutputWriter(filename, root); framegen.generateFrameFile(); framegen.close(); } catch (IOException exc) { Standard.configuration().standardmessage.error( "doclet.exception_encountered", exc.toString(), filename); throw new DocletAbortException(); } } /** * Print the frame file contents. */ protected void generateFrameFile() { if (Standard.configuration().title.length() > 0) { printPartialHeader(Standard.configuration().title); } else { printPartialHeader(getText("doclet.Untitled")); } printFrameDetails(); printFrameWarning(); printFrameFooter(); } /** * Generate the code for issueing the warning for a non-frame capable web * client. */ protected void printFrameWarning() { h2(); println("doclet.Frame_Alert"); h2End(); p(); printText("doclet.Frame_Warning_Message"); br(); printText("doclet.Link_To"); printHyperLink("overview-summary.html", getText("doclet.Non_Frame_Version")); } /** * Print the frame sizes and their contents. */ protected void printFrameDetails() { frameSet("cols=\"20%,80%\""); if (showPackageIndex) { frameSet("rows=\"30%,70%\""); frame("src=\"overview-frame.html\" name=\"packageListFrame\""); frame("src=\"" + "allclasses-frame.html" + "\" name=\"packageFrame\""); frameSetEnd(); frame("src=\"overview-summary.html\" name=\"classFrame\""); } else { frame("src=\"" + "allclasses-frame.html" + "\" name=\"packageFrame\""); frame("src=\"" + firstclass + "\" name=\"classFrame\""); } frameSetEnd(); } }