src/jdk.xml.dom/share/classes/org/w3c/dom/css/CSSStyleSheet.java
changeset 47216 71c04702a3d5
parent 38500 78aedc2ee005
equal deleted inserted replaced
47215:4ebc2e2fb97c 47216:71c04702a3d5
       
     1 /*
       
     2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     3  *
       
     4  * This code is free software; you can redistribute it and/or modify it
       
     5  * under the terms of the GNU General Public License version 2 only, as
       
     6  * published by the Free Software Foundation.  Oracle designates this
       
     7  * particular file as subject to the "Classpath" exception as provided
       
     8  * by Oracle in the LICENSE file that accompanied this code.
       
     9  *
       
    10  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    13  * version 2 for more details (a copy is included in the LICENSE file that
       
    14  * accompanied this code).
       
    15  *
       
    16  * You should have received a copy of the GNU General Public License version
       
    17  * 2 along with this work; if not, write to the Free Software Foundation,
       
    18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    19  *
       
    20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    21  * or visit www.oracle.com if you need additional information or have any
       
    22  * questions.
       
    23  */
       
    24 
       
    25 /*
       
    26  * This file is available under and governed by the GNU General Public
       
    27  * License version 2 only, as published by the Free Software Foundation.
       
    28  * However, the following notice accompanied the original version of this
       
    29  * file and, per its terms, should not be removed:
       
    30  *
       
    31  * Copyright (c) 2000 World Wide Web Consortium,
       
    32  * (Massachusetts Institute of Technology, Institut National de
       
    33  * Recherche en Informatique et en Automatique, Keio University). All
       
    34  * Rights Reserved. This program is distributed under the W3C's Software
       
    35  * Intellectual Property License. This program is distributed in the
       
    36  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
       
    37  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
       
    38  * PURPOSE.
       
    39  * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
       
    40  */
       
    41 
       
    42 package org.w3c.dom.css;
       
    43 
       
    44 import org.w3c.dom.DOMException;
       
    45 import org.w3c.dom.stylesheets.StyleSheet;
       
    46 
       
    47 /**
       
    48  *  The <code>CSSStyleSheet</code> interface is a concrete interface used to
       
    49  * represent a CSS style sheet i.e., a style sheet whose content type is
       
    50  * "text/css".
       
    51  * <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>.
       
    52  * @since 1.4, DOM Level 2
       
    53  */
       
    54 public interface CSSStyleSheet extends StyleSheet {
       
    55     /**
       
    56      *  If this style sheet comes from an <code>@import</code> rule, the
       
    57      * <code>ownerRule</code> attribute will contain the
       
    58      * <code>CSSImportRule</code>. In that case, the <code>ownerNode</code>
       
    59      * attribute in the <code>StyleSheet</code> interface will be
       
    60      * <code>null</code>. If the style sheet comes from an element or a
       
    61      * processing instruction, the <code>ownerRule</code> attribute will be
       
    62      * <code>null</code> and the <code>ownerNode</code> attribute will
       
    63      * contain the <code>Node</code>.
       
    64      */
       
    65     public CSSRule getOwnerRule();
       
    66 
       
    67     /**
       
    68      *  The list of all CSS rules contained within the style sheet. This
       
    69      * includes both rule sets and at-rules.
       
    70      */
       
    71     public CSSRuleList getCssRules();
       
    72 
       
    73     /**
       
    74      *  Used to insert a new rule into the style sheet. The new rule now
       
    75      * becomes part of the cascade.
       
    76      * @param rule  The parsable text representing the rule. For rule sets
       
    77      *   this contains both the selector and the style declaration. For
       
    78      *   at-rules, this specifies both the at-identifier and the rule
       
    79      *   content.
       
    80      * @param index  The index within the style sheet's rule list of the rule
       
    81      *   before which to insert the specified rule. If the specified index
       
    82      *   is equal to the length of the style sheet's rule collection, the
       
    83      *   rule will be added to the end of the style sheet.
       
    84      * @return  The index within the style sheet's rule collection of the
       
    85      *   newly inserted rule.
       
    86      * @exception DOMException
       
    87      *   HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the
       
    88      *   specified index e.g. if an <code>@import</code> rule is inserted
       
    89      *   after a standard rule set or other at-rule.
       
    90      *   <br>INDEX_SIZE_ERR: Raised if the specified index is not a valid
       
    91      *   insertion point.
       
    92      *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
       
    93      *   readonly.
       
    94      *   <br>SYNTAX_ERR: Raised if the specified rule has a syntax error and
       
    95      *   is unparsable.
       
    96      */
       
    97     public int insertRule(String rule,
       
    98                           int index)
       
    99                           throws DOMException;
       
   100 
       
   101     /**
       
   102      *  Used to delete a rule from the style sheet.
       
   103      * @param index  The index within the style sheet's rule list of the rule
       
   104      *   to remove.
       
   105      * @exception DOMException
       
   106      *   INDEX_SIZE_ERR: Raised if the specified index does not correspond to
       
   107      *   a rule in the style sheet's rule list.
       
   108      *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
       
   109      *   readonly.
       
   110      */
       
   111     public void deleteRule(int index)
       
   112                            throws DOMException;
       
   113 
       
   114 }