com.inet.html.parser
Class CssParser

java.lang.Object
  extended by com.inet.html.parser.CssParser

public class CssParser
extends java.lang.Object

The JWebEngine CSS2 parser. Defined by http://www.w3.org/TR/1998/REC-CSS2/syndata.html


Constructor Summary
CssParser(PushReader reader, Styles styles, boolean ignoreUnknown)
          This constructor can be used to parse styles directly to a given styles-table.
CssParser(PushReader reader, Styles styles, java.lang.Object sourceID, java.net.URL baseURL, boolean ignoreUnknown, boolean avoidDuplicates)
          Constructor is used for the includes STYLE tag.
CssParser(java.lang.String style, Styles styles, java.net.URL baseURL, boolean ignoreUnknown, boolean avoidDuplicates)
          This constructor is uses for the HTML attribute "style".
CssParser(java.net.URL url, java.lang.Object sourceID, Styles styles, java.lang.String charset, boolean ignoreUnknown)
          This constructor is using for external stylscheets.
CssParser(java.net.URL url, Styles styles, boolean ignoreUnknown, java.lang.Object sourceID)
          This constructor is using for default.css.
 
Method Summary
 void parse()
          Parses the new styles
 void parseStyle(javax.swing.text.MutableAttributeSet attrs)
          Parse the value of the HTML attribute "style".
 java.lang.Object parseWithID()
          Parses the new styles
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CssParser

public CssParser(java.net.URL url,
                 Styles styles,
                 boolean ignoreUnknown,
                 java.lang.Object sourceID)
          throws java.io.IOException
This constructor is using for default.css.

Parameters:
url - the URL of the stylesheet file
styles - the container for the
ignoreUnknown - set to true, to completely ignore unknown attributes
sourceID - an object to identify the source of this style sheet
Throws:
java.io.IOException - if an I/O exception occurs.

CssParser

public CssParser(PushReader reader,
                 Styles styles,
                 boolean ignoreUnknown)
This constructor can be used to parse styles directly to a given styles-table. Since it does not uses a sourceID, it is recommended to use this constructor only for default styles.

Parameters:
reader - the reader to get the data from
styles - the container for the parsed styles
ignoreUnknown - set to true, if unknown styles should be ignored

CssParser

public CssParser(java.net.URL url,
                 java.lang.Object sourceID,
                 Styles styles,
                 java.lang.String charset,
                 boolean ignoreUnknown)
          throws java.io.IOException
This constructor is using for external stylscheets.

Parameters:
url - the URL of the stylesheet file
sourceID - the identifier of an external CSS source
styles - the container for the parsed styles
charset - the encoding of the file
ignoreUnknown - set to true, to completely ignore unknown attributes
Throws:
java.io.IOException - if an I/O exception occurs.

CssParser

public CssParser(java.lang.String style,
                 Styles styles,
                 java.net.URL baseURL,
                 boolean ignoreUnknown,
                 boolean avoidDuplicates)
This constructor is uses for the HTML attribute "style".

Parameters:
style - the value of the style attribute
styles - the primary stylesheet of the current document
baseURL - the baseURL for solving of relative URLs
ignoreUnknown - set to true, if unknown styles should be ignored
avoidDuplicates - set to true, if this stylesheet is inserted an duplicates should be avoided

CssParser

public CssParser(PushReader reader,
                 Styles styles,
                 java.lang.Object sourceID,
                 java.net.URL baseURL,
                 boolean ignoreUnknown,
                 boolean avoidDuplicates)
Constructor is used for the includes STYLE tag.

Parameters:
reader - the reader of the html document. the pointer is on the starting position of the STYLE data
styles - the primary stylesheet of the current document
sourceID - TODO
baseURL - the baseURL for solving of relative URLs
ignoreUnknown - set to true, if unknown styles should be ignored
avoidDuplicates - set to true, if this stylesheet is inserted an duplicates should be avoided
Method Detail

parse

public void parse()
           throws java.io.IOException
Parses the new styles

Throws:
java.io.IOException - thrown on stream read errors

parseWithID

public java.lang.Object parseWithID()
                             throws java.io.IOException
Parses the new styles

Returns:
the generated CSS class name prefix for this style sheet
Throws:
java.io.IOException - thrown on stream read errors

parseStyle

public void parseStyle(javax.swing.text.MutableAttributeSet attrs)
                throws java.io.IOException
Parse the value of the HTML attribute "style".

Parameters:
attrs - the attribute set to parse to
Throws:
java.io.IOException - thrown on stream read errors