com.steadystate.css.dom

Class CSSStyleSheetImpl

Implemented Interfaces:
CSSStyleSheet, Serializable, StyleSheet

public class CSSStyleSheetImpl
extends java.lang.Object
implements CSSStyleSheet, Serializable

TODO: Setting the media list
Version:
$Release$
Author:
David Schweinsberg

Constructor Summary

CSSStyleSheetImpl()

Method Summary

void
deleteRule(int index)
Used to delete a rule from the style sheet.
CSSRuleList
getCssRules()
The list of all CSS rules contained within the style sheet.
boolean
getDisabled()
false if the style sheet is applied to the document.
String
getHref()
If the style sheet is a linked style sheet, the value of its attribute is its location.
MediaList
getMedia()
The intended destination media for style information.
Node
getOwnerNode()
The node that associates this style sheet with the document.
CSSRule
getOwnerRule()
If this style sheet comes from an @import rule, the ownerRule attribute will contain the CSSImportRule.
StyleSheet
getParentStyleSheet()
For style sheet languages that support the concept of style sheet inclusion, this attribute represents the including style sheet, if one exists.
String
getTitle()
The advisory title.
String
getType()
This specifies the style sheet language for this style sheet.
int
insertRule(String rule, int index)
Used to insert a new rule into the style sheet.
boolean
isReadOnly()
void
setDisabled(boolean disabled)
We will need to respond more fully if a stylesheet is disabled, probably by generating an event for the main application.
void
setHref(String href)
void
setMedia(String mediaText)
void
setOwnerNode(Node ownerNode)
void
setOwnerRule(CSSRule ownerRule)
void
setParentStyleSheet(StyleSheet parentStyleSheet)
void
setReadOnly(boolean b)
void
setRuleList(CSSRuleListImpl rules)
void
setTitle(String title)
String
toString()

Constructor Details

CSSStyleSheetImpl

public CSSStyleSheetImpl()

Method Details

deleteRule

public void deleteRule(int index)
            throws DOMException
Used to delete a rule from the style sheet.
Specified by:
deleteRule in interface CSSStyleSheet
Parameters:
index - The index within the style sheet's rule list of the rule to remove.

getCssRules

public CSSRuleList getCssRules()
The list of all CSS rules contained within the style sheet. This includes both rule sets and at-rules.
Specified by:
getCssRules in interface CSSStyleSheet

getDisabled

public boolean getDisabled()
false if the style sheet is applied to the document. true if it is not. Modifying this attribute may cause a new resolution of style for the document. A stylesheet only applies if both an appropriate medium definition is present and the disabled attribute is false. So, if the media doesn't apply to the current user agent, the disabled attribute is ignored.
Specified by:
getDisabled in interface StyleSheet

getHref

public String getHref()
If the style sheet is a linked style sheet, the value of its attribute is its location. For inline style sheets, the value of this attribute is null. See the href attribute definition for the LINK element in HTML 4.0, and the href pseudo-attribute for the XML style sheet processing instruction.
Specified by:
getHref in interface StyleSheet

getMedia

public MediaList getMedia()
The intended destination media for style information. The media is often specified in the ownerNode. If no media has been specified, the MediaList will be empty. See the media attribute definition for the LINK element in HTML 4.0, and the media pseudo-attribute for the XML style sheet processing instruction . Modifying the media list may cause a change to the attribute disabled.
Specified by:
getMedia in interface StyleSheet

getOwnerNode

public Node getOwnerNode()
The node that associates this style sheet with the document. For HTML, this may be the corresponding LINK or STYLE element. For XML, it may be the linking processing instruction. For style sheets that are included by other style sheets, the value of this attribute is null.
Specified by:
getOwnerNode in interface StyleSheet

getOwnerRule

public CSSRule getOwnerRule()
If this style sheet comes from an @import rule, the ownerRule attribute will contain the CSSImportRule. In that case, the ownerNode attribute in the StyleSheet interface will be null. If the style sheet comes from an element or a processing instruction, the ownerRule attribute will be null and the ownerNode attribute will contain the Node.
Specified by:
getOwnerRule in interface CSSStyleSheet

getParentStyleSheet

public StyleSheet getParentStyleSheet()
For style sheet languages that support the concept of style sheet inclusion, this attribute represents the including style sheet, if one exists. If the style sheet is a top-level style sheet, or the style sheet language does not support inclusion, the value of this attribute is null.
Specified by:
getParentStyleSheet in interface StyleSheet

getTitle

public String getTitle()
The advisory title. The title is often specified in the ownerNode. See the title attribute definition for the LINK element in HTML 4.0, and the title pseudo-attribute for the XML style sheet processing instruction.
Specified by:
getTitle in interface StyleSheet

getType

public String getType()
This specifies the style sheet language for this style sheet. The style sheet language is specified as a content type (e.g. "text/css"). The content type is often specified in the ownerNode. Also see the type attribute definition for the LINK element in HTML 4.0, and the type pseudo-attribute for the XML style sheet processing instruction.
Specified by:
getType in interface StyleSheet

insertRule

public int insertRule(String rule,
                      int index)
            throws DOMException
Used to insert a new rule into the style sheet. The new rule now becomes part of the cascade.
Specified by:
insertRule in interface 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.

isReadOnly

public boolean isReadOnly()

setDisabled

public void setDisabled(boolean disabled)
We will need to respond more fully if a stylesheet is disabled, probably by generating an event for the main application.
Specified by:
setDisabled in interface StyleSheet

setHref

public void setHref(String href)

setMedia

public void setMedia(String mediaText)

setOwnerNode

public void setOwnerNode(Node ownerNode)

setOwnerRule

public void setOwnerRule(CSSRule ownerRule)

setParentStyleSheet

public void setParentStyleSheet(StyleSheet parentStyleSheet)

setReadOnly

public void setReadOnly(boolean b)

setRuleList

public void setRuleList(CSSRuleListImpl rules)

setTitle

public void setTitle(String title)

toString

public String toString()