001 /**
002 * www.jcoverage.com
003 * Copyright (C)2003 jcoverage ltd.
004 *
005 * This file is part of jcoverage.
006 *
007 * jcoverage is free software; you can redistribute it and/or modify
008 * it under the terms of the GNU General Public License as published
009 * by the Free Software Foundation; either version 2 of the License,
010 * or (at your option) any later version.
011 *
012 * jcoverage is distributed in the hope that it will be useful, but
013 * WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * General Public License for more details.
016 *
017 * You should have received a copy of the GNU General Public License
018 * along with jcoverage; if not, write to the Free Software
019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
020 * USA
021 *
022 */
023 package com.jcoverage.reporting.html;
024
025 import java.io.PrintWriter;
026
027 import org.apache.log4j.Logger;
028
029 /**
030 *
031 */
032 public class Html extends HtmlBlockElement {
033
034 static Logger logger=Logger.getLogger(Html.class);
035
036 Head head=new Head();
037 Body body=new Body();
038
039 public Html() {
040 super("html");
041 }
042
043 public Head getHead() {
044 return head;
045 }
046
047 public Body getBody() {
048 return body;
049 }
050
051 public void setTitle(String title) {
052 getHead().setTitle(title);
053 }
054
055 public void add(Writable writable) {
056 getBody().add(writable);
057 }
058
059 public void add(String pcdata) {
060 getBody().add(pcdata);
061 }
062
063 /**
064 * Writes this HTML document to the given writer. Since this would
065 * always finish the output, the writer is closed afterwards.
066 */
067 public void writeTo(PrintWriter writer) {
068 openBlock(writer);
069 getHead().writeTo(writer);
070 getBody().writeTo(writer);
071 closeBlock(writer);
072 writer.close();
073 }
074
075 }