summaryrefslogtreecommitdiff
path: root/sources/ch/epfl/lamp/util/HTMLPrinter.java
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2003-09-02 16:02:57 +0000
committermichelou <michelou@epfl.ch>2003-09-02 16:02:57 +0000
commit7d98030490ea89182afe3df9c3c7164ecc9f8a8c (patch)
tree849cd39eda90759d528daf1873a4b9eb7210e49f /sources/ch/epfl/lamp/util/HTMLPrinter.java
parent3cb7eb8fcdbf3cd5d24859fe6cb42be49e71ed54 (diff)
downloadscala-7d98030490ea89182afe3df9c3c7164ecc9f8a8c.tar.gz
scala-7d98030490ea89182afe3df9c3c7164ecc9f8a8c.tar.bz2
scala-7d98030490ea89182afe3df9c3c7164ecc9f8a8c.zip
- added 'stylesheet' parameter to class constru...
- added 'stylesheet' parameter to class constructor
Diffstat (limited to 'sources/ch/epfl/lamp/util/HTMLPrinter.java')
-rw-r--r--sources/ch/epfl/lamp/util/HTMLPrinter.java54
1 files changed, 41 insertions, 13 deletions
diff --git a/sources/ch/epfl/lamp/util/HTMLPrinter.java b/sources/ch/epfl/lamp/util/HTMLPrinter.java
index 33e78326bd..df2866fcc1 100644
--- a/sources/ch/epfl/lamp/util/HTMLPrinter.java
+++ b/sources/ch/epfl/lamp/util/HTMLPrinter.java
@@ -36,18 +36,29 @@ public class HTMLPrinter {
//########################################################################
// Private Fields
- /** The underlying code printer */
+ /**
+ * The underlying code printer.
+ */
private final CodePrinter printer;
- /** The document title */
+ /**
+ * The document title.
+ */
private final String title;
//########################################################################
// Protected Fields
- /** The document representation */
+ /**
+ * The document representation.
+ */
protected final HTMLRepresentation representation;
+ /**
+ * The document stylesheet.
+ */
+ protected final String stylesheet;
+
//########################################################################
// Public Constructors
@@ -57,11 +68,26 @@ public class HTMLPrinter {
* @param writer
* @param title
* @param representation
+ * @param stylesheet
*/
- public HTMLPrinter(Writer writer, String title, HTMLRepresentation representation) {
+ public HTMLPrinter(Writer writer, String title, HTMLRepresentation representation,
+ String stylesheet)
+ {
this.printer = new CodePrinter(writer, " ");
this.title = title;
this.representation = representation;
+ this.stylesheet = stylesheet;
+ }
+
+ /**
+ * Creates a new instance.
+ *
+ * @param writer
+ * @param title
+ * @param representation
+ */
+ public HTMLPrinter(Writer writer, String title, HTMLRepresentation representation) {
+ this(writer, title, representation, DEFAULT_STYLESHEET);
}
/**
@@ -71,10 +97,12 @@ public class HTMLPrinter {
* @param title
* @param encoding
*/
- public HTMLPrinter(Writer writer, String title, String encoding) {
- this.printer = new CodePrinter(writer, " ");
- this.title = title;
- this.representation = new HTMLRepresentation("HTML 4.01 Transitional", encoding);
+ public HTMLPrinter(Writer writer, String title, String docencoding) {
+ this(
+ writer,
+ title,
+ new HTMLRepresentation(HTMLRepresentation.DEFAULT_DOCTYPE, docencoding)
+ );
}
/**
@@ -84,7 +112,7 @@ public class HTMLPrinter {
* @param title
*/
public HTMLPrinter(Writer writer, String title) {
- this(writer, title, "iso-8859-1");
+ this(writer, title, HTMLRepresentation.DEFAULT_DOCENCODING);
}
//########################################################################
@@ -630,9 +658,9 @@ public class HTMLPrinter {
* Prints the HTML preamble of the current page.
*/
protected void printPreamble() {
- println("<!DOCTYPE html PUBLIC \"-//W3C//DTD " +
- representation.getType() + "//" + representation.getLanguage() + "\">");
- printlnOTag("html").line();
+ println("<!DOCTYPE html PUBLIC \"-//W3C//DTD " +
+ representation.getType() + "//" + representation.getLanguage() + "\">");
+ printlnOTag("html").line();
}
/**
@@ -715,7 +743,7 @@ public class HTMLPrinter {
* @param generator
*/
public void printHeader(XMLAttribute[] metaAttrs, String generator) {
- printHeader(metaAttrs, generator, DEFAULT_STYLESHEET);
+ printHeader(metaAttrs, generator, stylesheet);
}
/**