org.apache.batik.css
Class CSSOMStyleSheet

java.lang.Object
  |
  +--org.apache.batik.css.AbstractStyleSheet
        |
        +--org.apache.batik.css.CSSOMStyleSheet
All Implemented Interfaces:
CSSPropertyChangeListener, CSSRuleListOwner, CSSStyleDeclarationChangeListener, CSSStyleRuleChangeListener, CSSStyleSheet, StyleSheet

public class CSSOMStyleSheet
extends AbstractStyleSheet
implements CSSStyleSheet, CSSRuleListOwner, CSSStyleRuleChangeListener

This class provides an implementation of the CSSStyleSheet interface.


Field Summary
protected  CSSOMRuleList cssRules
          The rule list.
protected  ValueFactoryMap factories
          The value factory map.
protected  CSSRule ownerRule
          The owner rule.
protected  Parser parser
          The CSS parser.
protected  CSSStyleSheetChangeSupport styleSheetChangeSupport
          The Style sheet change support.
 
Fields inherited from class org.apache.batik.css.AbstractStyleSheet
disabled, href, media, ownerNode, parentStyleSheet, title
 
Constructor Summary
CSSOMStyleSheet(Node owner, StyleSheet parent, java.lang.String href, java.lang.String title, MediaList media, CSSRule ownerRule, ValueFactoryMap factories, Parser parser)
          Creates a new style sheet.
 
Method Summary
 void addCSSStyleSheetChangeListener(CSSStyleSheetChangeListener listener)
          Adds a CSSStyleSheetChangeListener to the listener list.
 void appendRule(CSSRule r)
          Appends a rule to the style sheet.
 void appendRules(java.lang.String rules)
          Appends a set of rule to the stylesheet.
 void cssPropertyChange(CSSPropertyChangeEvent evt)
          Called when a CSS property is changed.
protected  void cssRuleAdded(CSSRule r)
          Called when a CSSRule has been added to the style sheet.
 void cssStyleDeclarationChangeCancel(CSSStyleDeclarationChangeEvent evt)
          Called a CSS declaration change has been cancelled.
 void cssStyleDeclarationChangeEnd(CSSStyleDeclarationChangeEvent evt)
          Called after a CSS declaration was changed.
 void cssStyleDeclarationChangeStart(CSSStyleDeclarationChangeEvent evt)
          Called before a CSS declaration will be changed.
 void cssStyleRuleChangeCancel(CSSStyleRuleChangeEvent evt)
          Called a CSS rule change has been cancelled.
 void cssStyleRuleChangeEnd(CSSStyleRuleChangeEvent evt)
          Called after a CSS rule was changed.
 void cssStyleRuleChangeStart(CSSStyleRuleChangeEvent evt)
          Called before a CSS rule will be changed.
 void deleteRule(int index)
          DOM: Implements CSSStyleSheet.deleteRule(int).
 CSSRuleList getCssRules()
          DOM: Implements CSSStyleSheet.getCssRules().
 CSSRule getOwnerRule()
          DOM: Implements CSSStyleSheet.getOwnerRule().
 Parser getParser()
          Returns the parser used to read style sheets.
 java.lang.String getType()
          DOM: Implements StyleSheet.getType().
 ValueFactoryMap getValueFactoryMap()
          Returns the map of value factories.
 int insertRule(java.lang.String rule, int index)
          DOM: Implements CSSStyleSheet.insertRule(String,int).
 void removeCSSStyleSheetChangeListener(CSSStyleSheetChangeListener listener)
          Removes a CSSStyleSheetChangeListener from the listener list.
 void selectorListChange(SelectorListChangeEvent evt)
          Called when a selector list was changed.
 
Methods inherited from class org.apache.batik.css.AbstractStyleSheet
getDisabled, getHref, getMedia, getOwnerNode, getParentStyleSheet, getTitle, setDisabled, setOwnerNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.stylesheets.StyleSheet
getDisabled, getHref, getMedia, getOwnerNode, getParentStyleSheet, getTitle, setDisabled
 

Field Detail

cssRules

protected CSSOMRuleList cssRules
The rule list.

parser

protected Parser parser
The CSS parser.

factories

protected ValueFactoryMap factories
The value factory map.

ownerRule

protected CSSRule ownerRule
The owner rule.

styleSheetChangeSupport

protected CSSStyleSheetChangeSupport styleSheetChangeSupport
The Style sheet change support.
Constructor Detail

CSSOMStyleSheet

public CSSOMStyleSheet(Node owner,
                       StyleSheet parent,
                       java.lang.String href,
                       java.lang.String title,
                       MediaList media,
                       CSSRule ownerRule,
                       ValueFactoryMap factories,
                       Parser parser)
Creates a new style sheet.
Parameters:
owner - The owner node or null.
parent - The parent StyleSheet or null.
href - The StyleSheet URI or null.
title - The title or null.
media - The media list.
ownerRule - The owner rule or null.
factories - The values factories.
parser - The CSS parser.
Method Detail

getParser

public Parser getParser()
Returns the parser used to read style sheets.
Specified by:
getParser in interface CSSRuleListOwner

getValueFactoryMap

public ValueFactoryMap getValueFactoryMap()
Returns the map of value factories.
Specified by:
getValueFactoryMap in interface CSSRuleListOwner

getType

public java.lang.String getType()
DOM: Implements StyleSheet.getType().
Specified by:
getType in interface StyleSheet

getOwnerRule

public CSSRule getOwnerRule()
DOM: Implements CSSStyleSheet.getOwnerRule().
Specified by:
getOwnerRule in interface CSSStyleSheet

getCssRules

public CSSRuleList getCssRules()
DOM: Implements CSSStyleSheet.getCssRules().
Specified by:
getCssRules in interface CSSStyleSheet

appendRules

public void appendRules(java.lang.String rules)
Appends a set of rule to the stylesheet.

insertRule

public int insertRule(java.lang.String rule,
                      int index)
               throws DOMException
DOM: Implements CSSStyleSheet.insertRule(String,int).
Specified by:
insertRule in interface CSSStyleSheet
Following copied from interface: org.w3c.dom.css.CSSStyleSheet
Parameters:
rule - The parsable text representing the rule. For rule sets this contains both the selector and the style declaration. For at-rules, this specifies both the at-identifier and the rule content.
index - The index within the style sheet's rule list of the rule before which to insert the specified rule. If the specified index is equal to the length of the style sheet's rule collection, the rule will be added to the end of the style sheet.
Returns:
The index within the style sheet's rule collection of the newly inserted rule.
Throws:
DOMException - HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the specified index e.g. if an @import rule is inserted after a standard rule set or other at-rule.
INDEX_SIZE_ERR: Raised if the specified index is not a valid insertion point.
NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is readonly.
SYNTAX_ERR: Raised if the specified rule has a syntax error and is unparsable.

deleteRule

public void deleteRule(int index)
                throws DOMException
DOM: Implements CSSStyleSheet.deleteRule(int).
Specified by:
deleteRule in interface CSSStyleSheet
Following copied from interface: org.w3c.dom.css.CSSStyleSheet
Parameters:
index - The index within the style sheet's rule list of the rule to remove.
Throws:
DOMException - INDEX_SIZE_ERR: Raised if the specified index does not correspond to a rule in the style sheet's rule list.
NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is readonly.

appendRule

public void appendRule(CSSRule r)
Appends a rule to the style sheet.
Specified by:
appendRule in interface CSSRuleListOwner

cssRuleAdded

protected void cssRuleAdded(CSSRule r)
Called when a CSSRule has been added to the style sheet.

addCSSStyleSheetChangeListener

public void addCSSStyleSheetChangeListener(CSSStyleSheetChangeListener listener)
Adds a CSSStyleSheetChangeListener to the listener list.
Parameters:
listener - The CSSStyleSheetChangeListener to be added

removeCSSStyleSheetChangeListener

public void removeCSSStyleSheetChangeListener(CSSStyleSheetChangeListener listener)
Removes a CSSStyleSheetChangeListener from the listener list.
Parameters:
listener - The CSSStyleSheetChangeListener to be removed

cssStyleRuleChangeStart

public void cssStyleRuleChangeStart(CSSStyleRuleChangeEvent evt)
Called before a CSS rule will be changed.
Specified by:
cssStyleRuleChangeStart in interface CSSStyleRuleChangeListener

cssStyleRuleChangeCancel

public void cssStyleRuleChangeCancel(CSSStyleRuleChangeEvent evt)
Called a CSS rule change has been cancelled.
Specified by:
cssStyleRuleChangeCancel in interface CSSStyleRuleChangeListener

cssStyleRuleChangeEnd

public void cssStyleRuleChangeEnd(CSSStyleRuleChangeEvent evt)
Called after a CSS rule was changed.
Specified by:
cssStyleRuleChangeEnd in interface CSSStyleRuleChangeListener

selectorListChange

public void selectorListChange(SelectorListChangeEvent evt)
Called when a selector list was changed.
Specified by:
selectorListChange in interface CSSStyleRuleChangeListener

cssStyleDeclarationChangeStart

public void cssStyleDeclarationChangeStart(CSSStyleDeclarationChangeEvent evt)
Called before a CSS declaration will be changed.
Specified by:
cssStyleDeclarationChangeStart in interface CSSStyleDeclarationChangeListener

cssStyleDeclarationChangeCancel

public void cssStyleDeclarationChangeCancel(CSSStyleDeclarationChangeEvent evt)
Called a CSS declaration change has been cancelled.
Specified by:
cssStyleDeclarationChangeCancel in interface CSSStyleDeclarationChangeListener

cssStyleDeclarationChangeEnd

public void cssStyleDeclarationChangeEnd(CSSStyleDeclarationChangeEvent evt)
Called after a CSS declaration was changed.
Specified by:
cssStyleDeclarationChangeEnd in interface CSSStyleDeclarationChangeListener

cssPropertyChange

public void cssPropertyChange(CSSPropertyChangeEvent evt)
Called when a CSS property is changed.
Specified by:
cssPropertyChange in interface CSSPropertyChangeListener


Copyright © 2001 Apache Software Foundation. All Rights Reserved.