javax.swing.text.html
Class StyleSheet.CssParser

java.lang.Object
  extended byjavax.swing.text.html.StyleSheet.CssParser
All Implemented Interfaces:
CSSParser.CSSParserCallback
Enclosing class:
StyleSheet

class StyleSheet.CssParser
extends Object
implements CSSParser.CSSParserCallback

Default parser for CSS specifications that get loaded into the StyleSheet.

This class is NOT thread safe, do not ask it to parse while it is in the middle of parsing.


Field Summary
(package private)  URL base
          Where the CSS stylesheet lives.
(package private)  MutableAttributeSet declaration
           
(package private)  boolean isLink
          True if the attributes are coming from a linked/imported style.
(package private)  CSSParser parser
           
(package private)  boolean parsingDeclaration
          True if parsing a declaration, that is the Reader will not contain a selector.
(package private)  String propertyName
          Name of the current property.
(package private)  Vector selectors
           
(package private)  Vector selectorTokens
           
 
Constructor Summary
(package private) StyleSheet.CssParser()
           
 
Method Summary
private  void addSelector()
           
 void endRule()
          Invoked when the end of a rule is encountered.
 void handleImport(String importString)
          Invoked when a valid @import is encountered, will call importStyleSheet if a MalformedURLException is not thrown in creating the URL.
 void handleProperty(String property)
          Invoked when a property name is encountered.
 void handleSelector(String selector)
          A selector has been encountered.
 void handleValue(String value)
          Invoked when a property value is encountered.
 void parse(URL base, Reader r, boolean parseDeclaration, boolean isLink)
          Parse the given CSS stream
 AttributeSet parseDeclaration(Reader r)
          Parses the passed in CSS declaration into an AttributeSet.
 AttributeSet parseDeclaration(String string)
          Parses the passed in CSS declaration into an AttributeSet.
 void startRule()
          Invoked when the start of a rule is encountered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

selectors

Vector selectors

selectorTokens

Vector selectorTokens

propertyName

String propertyName
Name of the current property.


declaration

MutableAttributeSet declaration

parsingDeclaration

boolean parsingDeclaration
True if parsing a declaration, that is the Reader will not contain a selector.


isLink

boolean isLink
True if the attributes are coming from a linked/imported style.


base

URL base
Where the CSS stylesheet lives.


parser

CSSParser parser
Constructor Detail

StyleSheet.CssParser

StyleSheet.CssParser()
Method Detail

parseDeclaration

public AttributeSet parseDeclaration(String string)
Parses the passed in CSS declaration into an AttributeSet.


parseDeclaration

public AttributeSet parseDeclaration(Reader r)
                              throws IOException
Parses the passed in CSS declaration into an AttributeSet.

Throws:
IOException

parse

public void parse(URL base,
                  Reader r,
                  boolean parseDeclaration,
                  boolean isLink)
           throws IOException
Parse the given CSS stream

Throws:
IOException

handleImport

public void handleImport(String importString)
Invoked when a valid @import is encountered, will call importStyleSheet if a MalformedURLException is not thrown in creating the URL.

Specified by:
handleImport in interface CSSParser.CSSParserCallback

handleSelector

public void handleSelector(String selector)
A selector has been encountered.

Specified by:
handleSelector in interface CSSParser.CSSParserCallback

startRule

public void startRule()
Invoked when the start of a rule is encountered.

Specified by:
startRule in interface CSSParser.CSSParserCallback

handleProperty

public void handleProperty(String property)
Invoked when a property name is encountered.

Specified by:
handleProperty in interface CSSParser.CSSParserCallback

handleValue

public void handleValue(String value)
Invoked when a property value is encountered.

Specified by:
handleValue in interface CSSParser.CSSParserCallback

endRule

public void endRule()
Invoked when the end of a rule is encountered.

Specified by:
endRule in interface CSSParser.CSSParserCallback

addSelector

private void addSelector()