com.lightdev.app.shtm
Class CSSWriter

java.lang.Object
  extended by com.lightdev.app.shtm.CSSWriter

public class CSSWriter
extends java.lang.Object

A writer for creating a cascading style sheet (CSS) file from a StyleSheet.


Constructor Summary
CSSWriter(java.io.Writer writer, javax.swing.text.html.StyleSheet styles)
          construct a new CSSWriter
 
Method Summary
 void write()
          write the style sheet to the given writer
 void writeRule(java.lang.String ruleName)
          write out a rule with a given name
 void writeRule(java.lang.String ruleName, javax.swing.text.AttributeSet rule)
          write out a rule with a given name and style
 boolean writeStyle(javax.swing.text.AttributeSet style)
          write a given style
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSSWriter

public CSSWriter(java.io.Writer writer,
                 javax.swing.text.html.StyleSheet styles)
construct a new CSSWriter

Parameters:
writer - the writer to write to
styles - the StyleSheet to write
Method Detail

write

public void write()
           throws java.io.IOException
write the style sheet to the given writer

Throws:
java.io.IOException

writeRule

public void writeRule(java.lang.String ruleName)
               throws java.io.IOException
write out a rule with a given name

Takes the style with the given name from the style sheet passed in the constructor and writes it to the writer passed in the constructor.

.

Parameters:
ruleName - the name of the rule to write out
Throws:
java.io.IOException - if i/o fails

writeRule

public void writeRule(java.lang.String ruleName,
                      javax.swing.text.AttributeSet rule)
               throws java.io.IOException
write out a rule with a given name and style

Takes the style passed in paramter 'rule' and writes it under the given name to the writer passed in the constructor.

.

Parameters:
ruleName - the name of the rule to write out
Throws:
java.io.IOException - if i/o fails

writeStyle

public boolean writeStyle(javax.swing.text.AttributeSet style)
                   throws java.io.IOException
write a given style

A style is an AttributeSet which can have other AttributeSets in the value field of one of its Attributes. Therefore this is recursively called whenever an Attribute contains another AttributeSet.

Parameters:
style - the Style to write
Returns:
true, if the style was closed in this run of recursion, false if not
Throws:
java.io.IOException