12005
|
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 |
|
|
46 |
/**
|
|
47 |
* The <code>CSSStyleDeclaration</code> interface represents a single CSS
|
|
48 |
* declaration block. This interface may be used to determine the style
|
|
49 |
* properties currently set in a block or to set style properties explicitly
|
|
50 |
* within the block.
|
|
51 |
* <p> While an implementation may not recognize all CSS properties within a
|
|
52 |
* CSS declaration block, it is expected to provide access to all specified
|
|
53 |
* properties in the style sheet through the <code>CSSStyleDeclaration</code>
|
|
54 |
* interface. Furthermore, implementations that support a specific level of
|
|
55 |
* CSS should correctly handle CSS shorthand properties for that level. For
|
|
56 |
* a further discussion of shorthand properties, see the
|
|
57 |
* <code>CSS2Properties</code> interface.
|
|
58 |
* <p> This interface is also used to provide a read-only access to the
|
|
59 |
* computed values of an element. See also the <code>ViewCSS</code>
|
|
60 |
* interface. The CSS Object Model doesn't provide an access to the
|
|
61 |
* specified or actual values of the CSS cascade.
|
|
62 |
* <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>.
|
|
63 |
* @since DOM Level 2
|
|
64 |
*/
|
|
65 |
public interface CSSStyleDeclaration {
|
|
66 |
/**
|
|
67 |
* The parsable textual representation of the declaration block
|
|
68 |
* (excluding the surrounding curly braces). Setting this attribute will
|
|
69 |
* result in the parsing of the new value and resetting of all the
|
|
70 |
* properties in the declaration block including the removal or addition
|
|
71 |
* of properties.
|
|
72 |
*/
|
|
73 |
public String getCssText();
|
|
74 |
/**
|
|
75 |
* The parsable textual representation of the declaration block
|
|
76 |
* (excluding the surrounding curly braces). Setting this attribute will
|
|
77 |
* result in the parsing of the new value and resetting of all the
|
|
78 |
* properties in the declaration block including the removal or addition
|
|
79 |
* of properties.
|
|
80 |
* @exception DOMException
|
|
81 |
* SYNTAX_ERR: Raised if the specified CSS string value has a syntax
|
|
82 |
* error and is unparsable.
|
|
83 |
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
|
|
84 |
* readonly or a property is readonly.
|
|
85 |
*/
|
|
86 |
public void setCssText(String cssText)
|
|
87 |
throws DOMException;
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Used to retrieve the value of a CSS property if it has been explicitly
|
|
91 |
* set within this declaration block.
|
|
92 |
* @param propertyName The name of the CSS property. See the CSS
|
|
93 |
* property index.
|
|
94 |
* @return Returns the value of the property if it has been explicitly
|
|
95 |
* set for this declaration block. Returns the empty string if the
|
|
96 |
* property has not been set.
|
|
97 |
*/
|
|
98 |
public String getPropertyValue(String propertyName);
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Used to retrieve the object representation of the value of a CSS
|
|
102 |
* property if it has been explicitly set within this declaration block.
|
|
103 |
* This method returns <code>null</code> if the property is a shorthand
|
|
104 |
* property. Shorthand property values can only be accessed and modified
|
|
105 |
* as strings, using the <code>getPropertyValue</code> and
|
|
106 |
* <code>setProperty</code> methods.
|
|
107 |
* @param propertyName The name of the CSS property. See the CSS
|
|
108 |
* property index.
|
|
109 |
* @return Returns the value of the property if it has been explicitly
|
|
110 |
* set for this declaration block. Returns <code>null</code> if the
|
|
111 |
* property has not been set.
|
|
112 |
*/
|
|
113 |
public CSSValue getPropertyCSSValue(String propertyName);
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Used to remove a CSS property if it has been explicitly set within
|
|
117 |
* this declaration block.
|
|
118 |
* @param propertyName The name of the CSS property. See the CSS
|
|
119 |
* property index.
|
|
120 |
* @return Returns the value of the property if it has been explicitly
|
|
121 |
* set for this declaration block. Returns the empty string if the
|
|
122 |
* property has not been set or the property name does not correspond
|
|
123 |
* to a known CSS property.
|
|
124 |
* @exception DOMException
|
|
125 |
* NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly
|
|
126 |
* or the property is readonly.
|
|
127 |
*/
|
|
128 |
public String removeProperty(String propertyName)
|
|
129 |
throws DOMException;
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Used to retrieve the priority of a CSS property (e.g. the
|
|
133 |
* <code>"important"</code> qualifier) if the priority has been
|
|
134 |
* explicitly set in this declaration block.
|
|
135 |
* @param propertyName The name of the CSS property. See the CSS
|
|
136 |
* property index.
|
|
137 |
* @return A string representing the priority (e.g.
|
|
138 |
* <code>"important"</code>) if the property has been explicitly set
|
|
139 |
* in this declaration block and has a priority specified. The empty
|
|
140 |
* string otherwise.
|
|
141 |
*/
|
|
142 |
public String getPropertyPriority(String propertyName);
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Used to set a property value and priority within this declaration
|
|
146 |
* block. <code>setProperty</code> permits to modify a property or add a
|
|
147 |
* new one in the declaration block. Any call to this method may modify
|
|
148 |
* the order of properties in the <code>item</code> method.
|
|
149 |
* @param propertyName The name of the CSS property. See the CSS
|
|
150 |
* property index.
|
|
151 |
* @param value The new value of the property.
|
|
152 |
* @param priority The new priority of the property (e.g.
|
|
153 |
* <code>"important"</code>) or the empty string if none.
|
|
154 |
* @exception DOMException
|
|
155 |
* SYNTAX_ERR: Raised if the specified value has a syntax error and is
|
|
156 |
* unparsable.
|
|
157 |
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
|
|
158 |
* readonly or the property is readonly.
|
|
159 |
*/
|
|
160 |
public void setProperty(String propertyName,
|
|
161 |
String value,
|
|
162 |
String priority)
|
|
163 |
throws DOMException;
|
|
164 |
|
|
165 |
/**
|
|
166 |
* The number of properties that have been explicitly set in this
|
|
167 |
* declaration block. The range of valid indices is 0 to length-1
|
|
168 |
* inclusive.
|
|
169 |
*/
|
|
170 |
public int getLength();
|
|
171 |
|
|
172 |
/**
|
|
173 |
* Used to retrieve the properties that have been explicitly set in this
|
|
174 |
* declaration block. The order of the properties retrieved using this
|
|
175 |
* method does not have to be the order in which they were set. This
|
|
176 |
* method can be used to iterate over all properties in this declaration
|
|
177 |
* block.
|
|
178 |
* @param index Index of the property name to retrieve.
|
|
179 |
* @return The name of the property at this ordinal position. The empty
|
|
180 |
* string if no property exists at this position.
|
|
181 |
*/
|
|
182 |
public String item(int index);
|
|
183 |
|
|
184 |
/**
|
|
185 |
* The CSS rule that contains this declaration block or <code>null</code>
|
|
186 |
* if this <code>CSSStyleDeclaration</code> is not attached to a
|
|
187 |
* <code>CSSRule</code>.
|
|
188 |
*/
|
|
189 |
public CSSRule getParentRule();
|
|
190 |
|
|
191 |
}
|