01: /*
02: * Copyright (c) 2000 World Wide Web Consortium,
03: * (Massachusetts Institute of Technology, Institut National de
04: * Recherche en Informatique et en Automatique, Keio University). All
05: * Rights Reserved. This program is distributed under the W3C's Software
06: * Intellectual Property License. This program is distributed in the
07: * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
08: * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
09: * 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, int index) throws DOMException;
60:
61: /**
62: * Used to delete a rule from the media block.
63: * @param index The index within the media block's rule collection of
64: * the rule to remove.
65: * @exception DOMException
66: * INDEX_SIZE_ERR: Raised if the specified index does not correspond to
67: * a rule in the media rule list.
68: * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is
69: * readonly.
70: */
71: public void deleteRule(int index) throws DOMException;
72:
73: }
|