org.apache.batik.css
Class CSSDocumentHandler

java.lang.Object
  |
  +--org.apache.batik.css.CSSDocumentHandler
All Implemented Interfaces:
DocumentHandler

public class CSSDocumentHandler
extends java.lang.Object
implements DocumentHandler

This class provides conveniant methods for parsing style sheets and implements the DocumentHandler interface.


Field Summary
protected  boolean append
          Whether the parsed rules must be added to the style sheet.
protected  CSSRule currentRule
          The current rule.
protected  ValueFactoryMap factories
          The value factory map.
protected  Parser parser
          The CSS parser.
protected static java.lang.Class parserClass
          The parser class.
protected  CSSOMStyleSheet styleSheet
          The style sheet.
protected  java.lang.String uri
          The URI of the current document.
 
Constructor Summary
protected CSSDocumentHandler(CSSOMStyleSheet ss, java.lang.String uri, boolean append)
          Creates a new handler.
protected CSSDocumentHandler(CSSOMStyleSheet ss, java.lang.String uri, CSSRule cr, boolean append)
          Creates a new handler.
 
Method Summary
 void comment(java.lang.String text)
          SAC: Implements DocumentHandler.comment(String).
static Parser createParser()
          Creates a new parser.
 void endDocument(InputSource source)
          SAC: Implements DocumentHandler.endDocument(InputSource).
 void endFontFace()
          SAC: Implements DocumentHandler.endFontFace().
 void endMedia(SACMediaList media)
          SAC: Implements DocumentHandler.endMedia(SACMediaList).
 void endPage(java.lang.String name, java.lang.String pseudo_page)
          SAC: Implements DocumentHandler.endPage(String,String).
 void endSelector(SelectorList selectors)
          SAC: Implements DocumentHandler.endSelector(SelectorList).
 void ignorableAtRule(java.lang.String atRule)
          SAC: Implements DocumentHandler.ignorableAtRule(String).
 void importStyle(java.lang.String uri, SACMediaList media, java.lang.String defaultNamespaceURI)
          SAC: Implements DocumentHandler.importStyle(String,SACMediaList,String).
 void namespaceDeclaration(java.lang.String prefix, java.lang.String uri)
          SAC: Implements DocumentHandler.namespaceDeclaration(String,String).
static CSSRule parseRule(CSSOMStyleSheet ss, java.lang.String rule)
          Parses one rules from its CSS text.
static void parseRules(CSSOMStyleSheet ss, java.lang.String rules)
          Parses a set of rules from its CSS text.
static void parseStyleSheet(CSSOMStyleSheet ss, java.lang.String uri)
          Parses a style sheet.
 void property(java.lang.String name, LexicalUnit value, boolean important)
          SAC: Implements DocumentHandler.property(String,LexicalUnit,boolean).
static void setParserClassName(java.lang.String name)
          Sets the parser class name.
 void startDocument(InputSource source)
          SAC: Implements DocumentHandler.startDocument(InputSource).
 void startFontFace()
          SAC: Implements DocumentHandler.startFontFace().
 void startMedia(SACMediaList media)
          SAC: Implements DocumentHandler.startMedia(SACMediaList).
 void startPage(java.lang.String name, java.lang.String pseudo_page)
          SAC: Implements DocumentHandler.startPage(String,String).
 void startSelector(SelectorList selectors)
          SAC: Implements DocumentHandler.startSelector(SelectorList).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parserClass

protected static java.lang.Class parserClass
The parser class.

parser

protected Parser parser
The CSS parser.

factories

protected ValueFactoryMap factories
The value factory map.

currentRule

protected CSSRule currentRule
The current rule.

styleSheet

protected CSSOMStyleSheet styleSheet
The style sheet.

append

protected boolean append
Whether the parsed rules must be added to the style sheet.

uri

protected java.lang.String uri
The URI of the current document.
Constructor Detail

CSSDocumentHandler

protected CSSDocumentHandler(CSSOMStyleSheet ss,
                             java.lang.String uri,
                             boolean append)
Creates a new handler.

CSSDocumentHandler

protected CSSDocumentHandler(CSSOMStyleSheet ss,
                             java.lang.String uri,
                             CSSRule cr,
                             boolean append)
Creates a new handler.
Method Detail

setParserClassName

public static void setParserClassName(java.lang.String name)
Sets the parser class name.

createParser

public static Parser createParser()
Creates a new parser.

parseStyleSheet

public static void parseStyleSheet(CSSOMStyleSheet ss,
                                   java.lang.String uri)
                            throws DOMException
Parses a style sheet.

parseRules

public static void parseRules(CSSOMStyleSheet ss,
                              java.lang.String rules)
                       throws DOMException
Parses a set of rules from its CSS text.

parseRule

public static CSSRule parseRule(CSSOMStyleSheet ss,
                                java.lang.String rule)
                         throws DOMException
Parses one rules from its CSS text.

startDocument

public void startDocument(InputSource source)
                   throws CSSException
SAC: Implements DocumentHandler.startDocument(InputSource).
Specified by:
startDocument in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
uri - The URI of the style sheet. @@TODO can be NULL ! (inline style sheet)
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

endDocument

public void endDocument(InputSource source)
                 throws CSSException
SAC: Implements DocumentHandler.endDocument(InputSource).
Specified by:
endDocument in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
uri - The URI of the style sheet.
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

comment

public void comment(java.lang.String text)
             throws CSSException
SAC: Implements DocumentHandler.comment(String).
Specified by:
comment in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
text - The comment.
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

ignorableAtRule

public void ignorableAtRule(java.lang.String atRule)
                     throws CSSException
SAC: Implements DocumentHandler.ignorableAtRule(String).
Specified by:
ignorableAtRule in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
at-rule - The complete ignored at-rule.
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

namespaceDeclaration

public void namespaceDeclaration(java.lang.String prefix,
                                 java.lang.String uri)
                          throws CSSException
SAC: Implements DocumentHandler.namespaceDeclaration(String,String).
Specified by:
namespaceDeclaration in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
prefix - null if this is the default namespace
uri - The URI for this namespace.
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

importStyle

public void importStyle(java.lang.String uri,
                        SACMediaList media,
                        java.lang.String defaultNamespaceURI)
                 throws CSSException
SAC: Implements DocumentHandler.importStyle(String,SACMediaList,String).
Specified by:
importStyle in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
uri - The URI of the imported style sheet.
media - The intended destination media for style information.
defaultNamepaceURI - The default namespace URI for the imported style sheet.
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

startMedia

public void startMedia(SACMediaList media)
                throws CSSException
SAC: Implements DocumentHandler.startMedia(SACMediaList).
Specified by:
startMedia in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
media - The intended destination media for style information.
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

endMedia

public void endMedia(SACMediaList media)
              throws CSSException
SAC: Implements DocumentHandler.endMedia(SACMediaList).
Specified by:
endMedia in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
media - The intended destination media for style information.
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

startPage

public void startPage(java.lang.String name,
                      java.lang.String pseudo_page)
               throws CSSException
SAC: Implements DocumentHandler.startPage(String,String).
Specified by:
startPage in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
name - the name of the page (if any, null otherwise)
pseudo_page - the pseudo page (if any, null otherwise)
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

endPage

public void endPage(java.lang.String name,
                    java.lang.String pseudo_page)
             throws CSSException
SAC: Implements DocumentHandler.endPage(String,String).
Specified by:
endPage in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
media - The intended destination medium for style information.
pseudo_page - the pseudo page (if any, null otherwise)
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

startFontFace

public void startFontFace()
                   throws CSSException
SAC: Implements DocumentHandler.startFontFace().
Specified by:
startFontFace in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

endFontFace

public void endFontFace()
                 throws CSSException
SAC: Implements DocumentHandler.endFontFace().
Specified by:
endFontFace in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

startSelector

public void startSelector(SelectorList selectors)
                   throws CSSException
SAC: Implements DocumentHandler.startSelector(SelectorList).
Specified by:
startSelector in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
selectors - All intended selectors for all declarations.
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

endSelector

public void endSelector(SelectorList selectors)
                 throws CSSException
SAC: Implements DocumentHandler.endSelector(SelectorList).
Specified by:
endSelector in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
selectors - All intended selectors for all declarations.
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.

property

public void property(java.lang.String name,
                     LexicalUnit value,
                     boolean important)
              throws CSSException
SAC: Implements DocumentHandler.property(String,LexicalUnit,boolean).
Specified by:
property in interface DocumentHandler
Following copied from interface: org.w3c.css.sac.DocumentHandler
Parameters:
name - the name of the property.
value - the value of the property. All whitespace are stripped.
important - is this property important ?
Throws:
CSSException - Any CSS exception, possibly wrapping another exception.


Copyright © 2001 Apache Software Foundation. All Rights Reserved.