/*
* @(#)HtmlDocWriter.java 1.26 98/02/24
*
* 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;
import com.sun.javadoc.*;
import java.io.*;
import java.util.*;
import java.lang.*;
import java.text.MessageFormat;
/**
* Class for the Html Format Code Generation specific to JavaDoc.
* This Class contains methods related to the Html Code Generation which
* are used by the Sub-Classes: PackageIndexWriter, PackageWriter,
* ClassWriter which are Standard Doclets.
* Super-Class is HtmlWriter.
*
* @since JDK1.2
* @author Atul M Dambalkar
* @author Robert Field
*/
public abstract class HtmlDocWriter extends HtmlWriter {
/**
* All the user given options on the command line.
*/
public static Configuration configuration;
/**
* Constructor. Initializes the destination file name through the super
* class HtmlWriter.
*
* @param filename String file name.
*/
public HtmlDocWriter(String filename) throws IOException {
super(configuration.destdirname + filename, configuration.docencoding);
configuration.message.notice("doclet.Generating_0",
configuration.destdirname + filename);
}
public HtmlDocWriter(String path, String filename) throws IOException {
super(configuration.destdirname + path, filename,
configuration.docencoding);
configuration.message.notice("doclet.Generating_0",
configuration.destdirname +
((path.length() > 0)?
path + fileseparator: "") + filename);
}
/**
* Print Html Hyper Link.
*
* @param link String name of the file.
* @param where Position of the link in the file.
* @param label Tag for the link.
*/
public void printHyperLink(String link, String where,
String label, boolean bold) {
print("");
if (bold) {
bold();
}
print(label);
if (bold) {
boldEnd();
}
print("");
}
/**
* Print link without positioning in the file.
*/
public void printHyperLink(String link, String label) {
printHyperLink(link, "", label, false);
}
public void printPkgName(ClassDoc cd) {
String pkgName = cd.containingPackage().name();
if (pkgName.length() > 0) {
print(pkgName);
print('.');
}
}
public void printHyperLink(String link, String where, String label) {
printHyperLink(link, where, label, false);
}
/**
* Print some part of the Html file header.
*/
public void printPartialHeader(String title) {
println("");
println("");
html();
head();
print("");
title();
println(title);
titleEnd();
headEnd();
}
/**
* Print the appropriate spaces to format the class tree in the class page.
*/
public String spaces(int len) {
String space = "";
for (int i = 0; i < len; i++) {
space += " ";
}
return space;
}
/**
* Print the html file footer.
*/
public void printFooter() {
bodyEnd();
htmlEnd();
}
public void printFrameFooter() {
htmlEnd();
}
public void printNbsps() {
print(" ");
}
/**
* Print the today info., depending upon user option
*/
public String today() {
if (configuration.nodate) {
return "TODAY";
}
Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
return calendar.getTime().toString();
}
}