org.apache.batik.css
Class CSSOMMediaRule

java.lang.Object
  |
  +--org.apache.batik.css.AbstractCSSRule
        |
        +--org.apache.batik.css.CSSOMMediaRule
All Implemented Interfaces:
CSSMediaRule, CSSRule, CSSRuleListOwner

public class CSSOMMediaRule
extends AbstractCSSRule
implements CSSMediaRule, CSSRuleListOwner

This class implements the CSSMediaRule interface.


Inner Class Summary
protected  class CSSOMMediaRule.MediaRuleHandler
          To handle the parsing of a media rule.
 
Field Summary
protected  CSSOMRuleList cssRules
          The rule list.
protected  ValueFactoryMap factories
          The value factory map.
protected  MediaList media
          The media.
protected  Parser parser
          The CSS parser.
protected  DocumentHandler ruleHandler
          The CSS document handler.
 
Fields inherited from class org.apache.batik.css.AbstractCSSRule
CONDITION_FACTORY, parentRule, parentStyleSheet, SELECTOR_FACTORY
 
Fields inherited from interface org.w3c.dom.css.CSSRule
CHARSET_RULE, FONT_FACE_RULE, IMPORT_RULE, MEDIA_RULE, PAGE_RULE, STYLE_RULE, UNKNOWN_RULE
 
Constructor Summary
CSSOMMediaRule(CSSStyleSheet parent, CSSRule pr, MediaList media, Parser p, ValueFactoryMap m)
          Creates a new media rule.
 
Method Summary
 void appendRule(CSSRule r)
          Appends a rule.
 void deleteRule(int index)
          DOM: Implements CSSMediaRule.deleteRule(int).
 CSSRuleList getCssRules()
          DOM: Implements CSSMediaRule.getCssRules().
 java.lang.String getCssText()
          DOM: Implements CSSRule.getCssText().
 MediaList getMedia()
          DOM: Implements CSSMediaRule.getMedia().
 Parser getParser()
          Returns the parser used to read style sheets.
 short getType()
          DOM: Implements CSSRule.getType().
 ValueFactoryMap getValueFactoryMap()
          Returns the map of value factories.
 int insertRule(java.lang.String rule, int index)
          DOM: Implements CSSMediaRule.insertRule(String,int).
 void setCssText(java.lang.String cssText)
          DOM: Implements CSSRule.setCssText(String).
 
Methods inherited from class org.apache.batik.css.AbstractCSSRule
getParentRule, getParentStyleSheet
 
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.css.CSSRule
getParentRule, getParentStyleSheet
 

Field Detail

cssRules

protected CSSOMRuleList cssRules
The rule list.

parser

protected Parser parser
The CSS parser.

factories

protected ValueFactoryMap factories
The value factory map.

media

protected MediaList media
The media.

ruleHandler

protected DocumentHandler ruleHandler
The CSS document handler.
Constructor Detail

CSSOMMediaRule

public CSSOMMediaRule(CSSStyleSheet parent,
                      CSSRule pr,
                      MediaList media,
                      Parser p,
                      ValueFactoryMap m)
Creates a new media rule.
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 short getType()
DOM: Implements CSSRule.getType().
Specified by:
getType in interface CSSRule

getCssText

public java.lang.String getCssText()
DOM: Implements CSSRule.getCssText().
Specified by:
getCssText in interface CSSRule
Following copied from interface: org.w3c.dom.css.CSSRule
Throws:
DOMException - SYNTAX_ERR: Raised if the specified CSS string value has a syntax error and is unparsable.
INVALID_MODIFICATION_ERR: Raised if the specified CSS string value represents a different type of rule than the current one.
HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at this point in the style sheet.
NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is readonly.

setCssText

public void setCssText(java.lang.String cssText)
                throws DOMException
DOM: Implements CSSRule.setCssText(String).
Specified by:
setCssText in interface CSSRule
Following copied from interface: org.w3c.dom.css.CSSRule
Throws:
DOMException - SYNTAX_ERR: Raised if the specified CSS string value has a syntax error and is unparsable.
INVALID_MODIFICATION_ERR: Raised if the specified CSS string value represents a different type of rule than the current one.
HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at this point in the style sheet.
NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is readonly.

getMedia

public MediaList getMedia()
DOM: Implements CSSMediaRule.getMedia().
Specified by:
getMedia in interface CSSMediaRule

getCssRules

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

insertRule

public int insertRule(java.lang.String rule,
                      int index)
               throws DOMException
DOM: Implements CSSMediaRule.insertRule(String,int).
Specified by:
insertRule in interface CSSMediaRule
Following copied from interface: org.w3c.dom.css.CSSMediaRule
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 media block's rule collection of the rule before which to insert the specified rule. If the specified index is equal to the length of the media blocks's rule collection, the rule will be added to the end of the media block.
Returns:
The index within the media block'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 media rule 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 CSSMediaRule.deleteRule(int).
Specified by:
deleteRule in interface CSSMediaRule
Following copied from interface: org.w3c.dom.css.CSSMediaRule
Parameters:
index - The index within the media block's rule collection of the rule to remove.
Throws:
DOMException - INDEX_SIZE_ERR: Raised if the specified index does not correspond to a rule in the media rule list.
NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is readonly.

appendRule

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


Copyright © 2001 Apache Software Foundation. All Rights Reserved.