Source for org.w3c.dom.css.CSSRule

   1: /*
   2:  * Copyright (c) 2000 World Wide Web Consortium,
   3:  * (Massachusetts Institute of Technology, Institut National de
   4:  * Recherche en Informatique et en Automatique, Keio University). All
   5:  * Rights Reserved. This program is distributed under the W3C's Software
   6:  * Intellectual Property License. This program is distributed in the
   7:  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
   8:  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
   9:  * PURPOSE.
  10:  * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  11:  */
  12: 
  13: package org.w3c.dom.css;
  14: 
  15: import org.w3c.dom.DOMException;
  16: 
  17: /**
  18:  *  The <code>CSSRule</code> interface is the abstract base interface for any
  19:  * type of CSS statement. This includes both rule sets and at-rules. An
  20:  * implementation is expected to preserve all rules specified in a CSS style
  21:  * sheet, even if the rule is not recognized by the parser. Unrecognized
  22:  * rules are represented using the <code>CSSUnknownRule</code> interface.
  23:  * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
  24:  * @since DOM Level 2
  25:  */
  26: public interface CSSRule {
  27:     // RuleType
  28:     /**
  29:      * The rule is a <code>CSSUnknownRule</code>.
  30:      */
  31:     public static final short UNKNOWN_RULE              = 0;
  32:     /**
  33:      * The rule is a <code>CSSStyleRule</code>.
  34:      */
  35:     public static final short STYLE_RULE                = 1;
  36:     /**
  37:      * The rule is a <code>CSSCharsetRule</code>.
  38:      */
  39:     public static final short CHARSET_RULE              = 2;
  40:     /**
  41:      * The rule is a <code>CSSImportRule</code>.
  42:      */
  43:     public static final short IMPORT_RULE               = 3;
  44:     /**
  45:      * The rule is a <code>CSSMediaRule</code>.
  46:      */
  47:     public static final short MEDIA_RULE                = 4;
  48:     /**
  49:      * The rule is a <code>CSSFontFaceRule</code>.
  50:      */
  51:     public static final short FONT_FACE_RULE            = 5;
  52:     /**
  53:      * The rule is a <code>CSSPageRule</code>.
  54:      */
  55:     public static final short PAGE_RULE                 = 6;
  56: 
  57:     /**
  58:      *  The type of the rule, as defined above. The expectation is that
  59:      * binding-specific casting methods can be used to cast down from an
  60:      * instance of the <code>CSSRule</code> interface to the specific
  61:      * derived interface implied by the <code>type</code>.
  62:      */
  63:     public short getType();
  64: 
  65:     /**
  66:      *  The parsable textual representation of the rule. This reflects the
  67:      * current state of the rule and not its initial value.
  68:      */
  69:     public String getCssText();
  70:     /**
  71:      *  The parsable textual representation of the rule. This reflects the
  72:      * current state of the rule and not its initial value.
  73:      * @exception DOMException
  74:      *   SYNTAX_ERR: Raised if the specified CSS string value has a syntax
  75:      *   error and is unparsable.
  76:      *   <br>INVALID_MODIFICATION_ERR: Raised if the specified CSS string
  77:      *   value represents a different type of rule than the current one.
  78:      *   <br>HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at
  79:      *   this point in the style sheet.
  80:      *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is readonly.
  81:      */
  82:     public void setCssText(String cssText)
  83:                         throws DOMException;
  84: 
  85:     /**
  86:      *  The style sheet that contains this rule.
  87:      */
  88:     public CSSStyleSheet getParentStyleSheet();
  89: 
  90:     /**
  91:      *  If this rule is contained inside another rule (e.g. a style rule
  92:      * inside an @media block), this is the containing rule. If this rule is
  93:      * not nested inside any other rules, this returns <code>null</code>.
  94:      */
  95:     public CSSRule getParentRule();
  96: 
  97: }