Package com.steadystate.css.dom
Class CSSStyleSheetImpl
- java.lang.Object
-
- com.steadystate.css.dom.CSSStyleSheetImpl
-
- All Implemented Interfaces:
java.io.Serializable,CSSStyleSheet,StyleSheet
public class CSSStyleSheetImpl extends java.lang.Object implements CSSStyleSheet, java.io.Serializable
TODO: Setting the media list- Version:
- $Release$
- Author:
- David Schweinsberg
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringKEY_DISABLED_CHANGED
-
Constructor Summary
Constructors Constructor Description CSSStyleSheetImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteRule(int index)Used to delete a rule from the style sheet.CSSRuleListgetCssRules()The list of all CSS rules contained within the style sheet.booleangetDisabled()falseif the style sheet is applied to the document.java.lang.StringgetHref()If the style sheet is a linked style sheet, the value of its attribute is its location.MediaListgetMedia()The intended destination media for style information.org.w3c.dom.NodegetOwnerNode()The node that associates this style sheet with the document.CSSRulegetOwnerRule()If this style sheet comes from an@importrule, theownerRuleattribute will contain theCSSImportRule.StyleSheetgetParentStyleSheet()For style sheet languages that support the concept of style sheet inclusion, this attribute represents the including style sheet, if one exists.java.lang.StringgetTitle()The advisory title.java.lang.StringgetType()This specifies the style sheet language for this style sheet.intinsertRule(java.lang.String rule, int index)Used to insert a new rule into the style sheet.booleanisReadOnly()voidsetDisabled(boolean disabled)We will need to respond more fully if a stylesheet is disabled, probably by generating an event for the main application.voidsetDisabledOnly(boolean disabled)voidsetHref(java.lang.String href)voidsetMedia(java.lang.String mediaText)voidsetOwnerNode(org.w3c.dom.Node ownerNode)voidsetOwnerRule(CSSRule ownerRule)voidsetParentStyleSheet(StyleSheet parentStyleSheet)voidsetReadOnly(boolean b)voidsetRuleList(CSSRuleListImpl rules)voidsetTitle(java.lang.String title)java.lang.StringtoString()
-
-
-
Field Detail
-
KEY_DISABLED_CHANGED
public static final java.lang.String KEY_DISABLED_CHANGED
- See Also:
- Constant Field Values
-
-
Method Detail
-
getType
public java.lang.String getType()
Description copied from interface:StyleSheetThis 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 theownerNode. Also see the type attribute definition for theLINKelement in HTML 4.0, and the type pseudo-attribute for the XML style sheet processing instruction.- Specified by:
getTypein interfaceStyleSheet
-
getDisabled
public boolean getDisabled()
Description copied from interface:StyleSheetfalseif the style sheet is applied to the document.trueif 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, thedisabledattribute is ignored.- Specified by:
getDisabledin interfaceStyleSheet
-
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:
setDisabledin interfaceStyleSheet
-
setDisabledOnly
public void setDisabledOnly(boolean disabled)
-
getOwnerNode
public org.w3c.dom.Node getOwnerNode()
Description copied from interface:StyleSheetThe node that associates this style sheet with the document. For HTML, this may be the correspondingLINKorSTYLEelement. For XML, it may be the linking processing instruction. For style sheets that are included by other style sheets, the value of this attribute isnull.- Specified by:
getOwnerNodein interfaceStyleSheet
-
getParentStyleSheet
public StyleSheet getParentStyleSheet()
Description copied from interface:StyleSheetFor 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 isnull.- Specified by:
getParentStyleSheetin interfaceStyleSheet
-
getHref
public java.lang.String getHref()
Description copied from interface:StyleSheetIf 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 isnull. See the href attribute definition for theLINKelement in HTML 4.0, and the href pseudo-attribute for the XML style sheet processing instruction.- Specified by:
getHrefin interfaceStyleSheet
-
getTitle
public java.lang.String getTitle()
Description copied from interface:StyleSheetThe advisory title. The title is often specified in theownerNode. See the title attribute definition for theLINKelement in HTML 4.0, and the title pseudo-attribute for the XML style sheet processing instruction.- Specified by:
getTitlein interfaceStyleSheet
-
getMedia
public MediaList getMedia()
Description copied from interface:StyleSheetThe intended destination media for style information. The media is often specified in theownerNode. If no media has been specified, theMediaListwill be empty. See the media attribute definition for theLINKelement 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 attributedisabled.- Specified by:
getMediain interfaceStyleSheet
-
getOwnerRule
public CSSRule getOwnerRule()
Description copied from interface:CSSStyleSheetIf this style sheet comes from an@importrule, theownerRuleattribute will contain theCSSImportRule. In that case, theownerNodeattribute in theStyleSheetinterface will benull. If the style sheet comes from an element or a processing instruction, theownerRuleattribute will benulland theownerNodeattribute will contain theNode.- Specified by:
getOwnerRulein interfaceCSSStyleSheet
-
getCssRules
public CSSRuleList getCssRules()
Description copied from interface:CSSStyleSheetThe list of all CSS rules contained within the style sheet. This includes both rule sets and at-rules.- Specified by:
getCssRulesin interfaceCSSStyleSheet
-
insertRule
public int insertRule(java.lang.String rule, int index) throws org.w3c.dom.DOMExceptionDescription copied from interface:CSSStyleSheetUsed to insert a new rule into the style sheet. The new rule now becomes part of the cascade.- Specified by:
insertRulein interfaceCSSStyleSheet- 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:
org.w3c.dom.DOMException- HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the specified index e.g. if an@importrule 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 org.w3c.dom.DOMExceptionDescription copied from interface:CSSStyleSheetUsed to delete a rule from the style sheet.- Specified by:
deleteRulein interfaceCSSStyleSheet- Parameters:
index- The index within the style sheet's rule list of the rule to remove.- Throws:
org.w3c.dom.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.
-
isReadOnly
public boolean isReadOnly()
-
setReadOnly
public void setReadOnly(boolean b)
-
setOwnerNode
public void setOwnerNode(org.w3c.dom.Node ownerNode)
-
setParentStyleSheet
public void setParentStyleSheet(StyleSheet parentStyleSheet)
-
setHref
public void setHref(java.lang.String href)
-
setTitle
public void setTitle(java.lang.String title)
-
setMedia
public void setMedia(java.lang.String mediaText)
-
setOwnerRule
public void setOwnerRule(CSSRule ownerRule)
-
setRuleList
public void setRuleList(CSSRuleListImpl rules)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-