Source for org.w3c.dom.css.CSSMediaRule

   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: import org.w3c.dom.stylesheets.MediaList;
  17: 
  18: /**
  19:  *  The <code>CSSMediaRule</code> interface represents a @media rule in a CSS
  20:  * style sheet. A <code>@media</code> rule can be used to delimit style
  21:  * rules for specific media types.
  22:  * <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>.
  23:  * @since DOM Level 2
  24:  */
  25: public interface CSSMediaRule extends CSSRule {
  26:     /**
  27:      *  A list of media types for this rule.
  28:      */
  29:     public MediaList getMedia();
  30: 
  31:     /**
  32:      *  A list of all CSS rules contained within the media block.
  33:      */
  34:     public CSSRuleList getCssRules();
  35: 
  36:     /**
  37:      *  Used to insert a new rule into the media block.
  38:      * @param rule  The parsable text representing the rule. For rule sets
  39:      *   this contains both the selector and the style declaration. For
  40:      *   at-rules, this specifies both the at-identifier and the rule
  41:      *   content.
  42:      * @param index  The index within the media block's rule collection of
  43:      *   the rule before which to insert the specified rule. If the
  44:      *   specified index is equal to the length of the media blocks's rule
  45:      *   collection, the rule will be added to the end of the media block.
  46:      * @return  The index within the media block's rule collection of the
  47:      *   newly inserted rule.
  48:      * @exception DOMException
  49:      *   HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the
  50:      *   specified index, e.g., if an <code>@import</code> rule is inserted
  51:      *   after a standard rule set or other at-rule.
  52:      *   <br>INDEX_SIZE_ERR: Raised if the specified index is not a valid
  53:      *   insertion point.
  54:      *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is
  55:      *   readonly.
  56:      *   <br>SYNTAX_ERR: Raised if the specified rule has a syntax error and
  57:      *   is unparsable.
  58:      */
  59:     public int insertRule(String rule,
  60:                           int index)
  61:                           throws DOMException;
  62: 
  63:     /**
  64:      *  Used to delete a rule from the media block.
  65:      * @param index  The index within the media block's rule collection of
  66:      *   the rule to remove.
  67:      * @exception DOMException
  68:      *   INDEX_SIZE_ERR: Raised if the specified index does not correspond to
  69:      *   a rule in the media rule list.
  70:      *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is
  71:      *   readonly.
  72:      */
  73:     public void deleteRule(int index)
  74:                            throws DOMException;
  75: 
  76: }