--- /dev/null
+// HtmlStyle.java\r
+// $Id: HtmlStyle.java,v 1.1 2010/06/15 12:29:35 smhuang Exp $\r
+// (c) COPYRIGHT MIT and INRIA, 1996.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.jigsaw.html ;\r
+\r
+import org.w3c.www.mime.MimeType;\r
+\r
+/**\r
+ * a sample Style class for HTML documents\r
+ */\r
+\r
+public class HtmlStyle {\r
+ MimeType type = MimeType.TEXT_CSS;\r
+ StringBuffer style = null;\r
+\r
+ /**\r
+ * set the type of style sheet used\r
+ * @param style the sheet's MimeType.\r
+ */\r
+\r
+ public void setType(MimeType type)\r
+ {\r
+ this.type = type;\r
+ }\r
+\r
+ /**\r
+ * append a string to the style buffer\r
+ * @param str1 A string to be append\r
+ */\r
+\r
+ public void append(String str1)\r
+ {\r
+ if(style == null)\r
+ style = new StringBuffer(str1);\r
+ else\r
+ style.append(str1);\r
+ }\r
+\r
+ /**\r
+ * genereate a String representation that can be\r
+ * append in a HTML document\r
+ */\r
+\r
+ public String toString()\r
+ {\r
+ if(style == null)\r
+ return "";\r
+ return "<STYLE TYPE=\"" + type.toString() + "\">\n"\r
+ + style.toString() + "\n</STYLE>\n" ;\r
+ }\r
+\r
+ public HtmlStyle(MimeType type, String style)\r
+ {\r
+ setType(type);\r
+ append(style);\r
+ }\r
+\r
+ public HtmlStyle(String style)\r
+ {\r
+ append(style);\r
+ }\r
+}\r