bpatel@766: /* bpatel@766: * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. bpatel@766: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. bpatel@766: * bpatel@766: * This code is free software; you can redistribute it and/or modify it bpatel@766: * under the terms of the GNU General Public License version 2 only, as bpatel@766: * published by the Free Software Foundation. Oracle designates this bpatel@766: * particular file as subject to the "Classpath" exception as provided bpatel@766: * by Oracle in the LICENSE file that accompanied this code. bpatel@766: * bpatel@766: * This code is distributed in the hope that it will be useful, but WITHOUT bpatel@766: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or bpatel@766: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License bpatel@766: * version 2 for more details (a copy is included in the LICENSE file that bpatel@766: * accompanied this code). bpatel@766: * bpatel@766: * You should have received a copy of the GNU General Public License version bpatel@766: * 2 along with this work; if not, write to the Free Software Foundation, bpatel@766: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. bpatel@766: * bpatel@766: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA bpatel@766: * or visit www.oracle.com if you need additional information or have any bpatel@766: * questions. bpatel@766: */ bpatel@766: bpatel@766: package com.sun.tools.doclets.formats.html.markup; bpatel@766: bpatel@766: import com.sun.tools.doclets.internal.toolkit.Content; bpatel@766: import com.sun.tools.doclets.internal.toolkit.util.*; bpatel@766: bpatel@766: /** bpatel@766: * Class for generating document type for HTML pages of javadoc output. bpatel@766: * bpatel@766: * @author Bhavesh Patel bpatel@766: */ bpatel@766: public class DocType extends Content{ bpatel@766: bpatel@766: private String docType; bpatel@766: bpatel@766: private static DocType transitional; bpatel@766: bpatel@766: private static DocType frameset; bpatel@766: bpatel@766: /** bpatel@766: * Constructor to construct a DocType object. bpatel@766: * bpatel@766: * @param type the doctype to be added bpatel@766: */ bpatel@766: private DocType(String type, String dtd) { bpatel@766: docType = "" + DocletConstants.NL; bpatel@766: } bpatel@766: bpatel@766: /** bpatel@766: * Construct and return a HTML 4.01 transitional DocType content bpatel@766: * bpatel@766: * @return a content tree for transitional DocType bpatel@766: */ bpatel@766: public static DocType Transitional() { bpatel@766: if (transitional == null) bpatel@766: transitional = new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd"); bpatel@766: return transitional; bpatel@766: } bpatel@766: bpatel@766: /** bpatel@766: * Construct and return a HTML 4.01 frameset DocType content bpatel@766: * bpatel@766: * @return a content tree for frameset DocType bpatel@766: */ bpatel@766: public static DocType Frameset() { bpatel@766: if (frameset == null) bpatel@766: frameset = new DocType("Frameset", "http://www.w3.org/TR/html4/frameset.dtd"); bpatel@766: return frameset; bpatel@766: } bpatel@766: bpatel@766: /** bpatel@766: * This method is not supported by the class. bpatel@766: * bpatel@766: * @param content content that needs to be added bpatel@766: * @throws DocletAbortException this method will always throw a bpatel@766: * DocletAbortException because it bpatel@766: * is not supported. bpatel@766: */ bpatel@766: public void addContent(Content content) { bpatel@766: throw new DocletAbortException(); bpatel@766: } bpatel@766: bpatel@766: /** bpatel@766: * This method is not supported by the class. bpatel@766: * bpatel@766: * @param stringContent string content that needs to be added bpatel@766: * @throws DocletAbortException this method will always throw a bpatel@766: * DocletAbortException because it bpatel@766: * is not supported. bpatel@766: */ bpatel@766: public void addContent(String stringContent) { bpatel@766: throw new DocletAbortException(); bpatel@766: } bpatel@766: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: public boolean isEmpty() { bpatel@766: return (docType.length() == 0); bpatel@766: } bpatel@766: bpatel@766: /** bpatel@766: * {@inheritDoc} bpatel@766: */ bpatel@766: public void write(StringBuilder contentBuilder) { bpatel@766: contentBuilder.append(docType); bpatel@766: } bpatel@766: }