diff options
Diffstat (limited to 'sources/ch/epfl/lamp/util/XHTMLPrinter.java')
-rw-r--r-- | sources/ch/epfl/lamp/util/XHTMLPrinter.java | 89 |
1 files changed, 73 insertions, 16 deletions
diff --git a/sources/ch/epfl/lamp/util/XHTMLPrinter.java b/sources/ch/epfl/lamp/util/XHTMLPrinter.java index 86fde04ad2..1b7707acff 100644 --- a/sources/ch/epfl/lamp/util/XHTMLPrinter.java +++ b/sources/ch/epfl/lamp/util/XHTMLPrinter.java @@ -10,73 +10,130 @@ package ch.epfl.lamp.util; import java.io.Writer; -/** This class provides methods to print XHTML document. +/** + * This class provides methods to print XHTML document. + * + * @author Stephane Micheloud + * @version 1.1 */ public class XHTMLPrinter extends HTMLPrinter { //######################################################################## // Public Constructors - /** Creates a new instance */ + /** + * Creates a new instance. + * + * @param writer + * @param title + * @param repr + */ public XHTMLPrinter(Writer writer, String title, HTMLRepresentation repr) { super(writer, title, repr); } - /** Creates a new instance */ + /** + * Creates a new instance with "XHTML 1.0 Transitional" as default document type. + * + * @param writer + * @param title + * @param encoding + */ public XHTMLPrinter(Writer writer, String title, String encoding) { - super(writer, title, encoding); + this(writer, title, new HTMLRepresentation("XHTML 1.0 Transitional", encoding)); } - /** Creates a new instance */ + /** + * Creates a new instance with "utf-8" as default character encoding. + * + * @param writer + * @param title + */ public XHTMLPrinter(Writer writer, String title) { - super(writer, title, "utf-8"); + this(writer, title, "utf-8"); } //######################################################################## - // Public Methods + // Public Methods - Printing simple values followed by a new line - /** Prints text 'text' in bold followed by a new line. */ + /** + * Prints text <code>text</code> in bold followed by a new line. + * + * @param text + */ public HTMLPrinter printlnBold(String text) { return printlnTag("span", new XMLAttribute[]{ new XMLAttribute("style", "font-weight:bold;") }, text); } - /** Prints text 'text' in bold. */ + /** + * Prints an horizontal line separator followed by a new line. + */ + public HTMLPrinter printlnHLine() { + printOTag("div", new XMLAttribute[] { + new XMLAttribute("style", "border:1px solid #aaaaaa; " + + "margin:10px 0px 5px 0px;height:1px;") }); + return printlnCTag("div"); + } + + //######################################################################## + // Public Methods - Printing simple values + + /** + * Prints text <code>text</code> in bold. + * + * @param text + */ public HTMLPrinter printBold(String text) { return printTag("span", new XMLAttribute[]{ new XMLAttribute("style", "font-weight:bold;") }, text); } - /** Prints an horizontal line separator - * @ param n gives the number of printed blank spaces + /** + * Prints an horizontal line separator */ public HTMLPrinter printHLine() { printOTag("div", new XMLAttribute[] { new XMLAttribute("style", "border:1px solid #aaaaaa; " + "margin:10px 0px 5px 0px;height:1px;") }); - return printlnCTag("div"); + return printCTag("div"); } - /** Prints an horizontal line separator with attributes 'attrs'. */ + /** + * Prints an horizontal line separator with attributes <code>attrs</code>. + * + * @param attrs + */ public HTMLPrinter printHLine(XMLAttribute[] attrs) { return printHLine(); } - /** Prints the <meta/> tag with attributes 'attrs' followed by a new line. */ + /** + * Prints the <meta/> tag with attributes <code>attrs</code> + * followed by a new line. + * + * @param attrs + */ public HTMLPrinter printlnMeta(XMLAttribute[] attrs) { return printlnSTag("meta", attrs); } - /** Prints the <link> tag with attributes 'attrs' followed by a new line. */ + /** + * Prints the <link> tag with attributes <code>attrs</code> + * followed by a new line. + * + * @param attrs + */ public HTMLPrinter printlnLink(XMLAttribute[] attrs) { return printlnSTag("link", attrs); } //######################################################################## - /** Prints XHTML preamble. + /** + * Prints XHTML preamble. */ protected void printPreamble() { println("<!--"); |