com.steadystate.css.dom
public class CSSMediaRuleImpl extends java.lang.Object implements CSSMediaRule, java.io.Serializable
CHARSET_RULE, FONT_FACE_RULE, IMPORT_RULE, MEDIA_RULE, PAGE_RULE, STYLE_RULE, UNKNOWN_RULE
Constructor and Description |
---|
CSSMediaRuleImpl(CSSStyleSheetImpl parentStyleSheet,
CSSRule parentRule,
MediaList media) |
Modifier and Type | Method and Description |
---|---|
void |
deleteRule(int index)
Used to delete a rule from the media block.
|
CSSRuleList |
getCssRules()
A list of all CSS rules contained within the media block.
|
java.lang.String |
getCssText()
The parsable textual representation of the rule.
|
MediaList |
getMedia()
A list of media types for this rule.
|
CSSRule |
getParentRule()
If this rule is contained inside another rule (e.g.
|
CSSStyleSheet |
getParentStyleSheet()
The style sheet that contains this rule.
|
short |
getType()
The type of the rule, as defined above.
|
int |
insertRule(java.lang.String rule,
int index)
Used to insert a new rule into the media block.
|
void |
setCssText(java.lang.String cssText) |
void |
setRuleList(CSSRuleListImpl rules) |
java.lang.String |
toString() |
public CSSMediaRuleImpl(CSSStyleSheetImpl parentStyleSheet, CSSRule parentRule, MediaList media)
public short getType()
CSSRule
CSSRule
interface to the specific
derived interface implied by the type
.public java.lang.String getCssText()
CSSRule
getCssText
in interface CSSRule
public void setCssText(java.lang.String cssText) throws org.w3c.dom.DOMException
setCssText
in interface CSSRule
org.w3c.dom.DOMException
public CSSStyleSheet getParentStyleSheet()
CSSRule
getParentStyleSheet
in interface CSSRule
public CSSRule getParentRule()
CSSRule
null
.getParentRule
in interface CSSRule
public MediaList getMedia()
CSSMediaRule
getMedia
in interface CSSMediaRule
public CSSRuleList getCssRules()
CSSMediaRule
getCssRules
in interface CSSMediaRule
public int insertRule(java.lang.String rule, int index) throws org.w3c.dom.DOMException
CSSMediaRule
insertRule
in interface CSSMediaRule
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.org.w3c.dom.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.
public void deleteRule(int index) throws org.w3c.dom.DOMException
CSSMediaRule
deleteRule
in interface CSSMediaRule
index
- The index within the media block's rule collection of the
rule to remove.org.w3c.dom.DOMException
- INDEX_SIZE_ERR: Raised if the specified index does not correspond to
a rule in the media rule list.
public void setRuleList(CSSRuleListImpl rules)
public java.lang.String toString()
toString
in class java.lang.Object