286N/A/*
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/A/*
286N/A * This file is available under and governed by the GNU General Public
286N/A * License version 2 only, as published by the Free Software Foundation.
286N/A * However, the following notice accompanied the original version of this
286N/A * file and, per its terms, should not be removed:
286N/A *
286N/A * Copyright (c) 2000 World Wide Web Consortium,
286N/A * (Massachusetts Institute of Technology, Institut National de
286N/A * Recherche en Informatique et en Automatique, Keio University). All
286N/A * Rights Reserved. This program is distributed under the W3C's Software
286N/A * Intellectual Property License. This program is distributed in the
286N/A * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
286N/A * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
286N/A * PURPOSE.
286N/A * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
286N/A */
286N/A
286N/Apackage org.w3c.dom.css;
286N/A
286N/Aimport org.w3c.dom.DOMException;
286N/A
286N/A/**
286N/A * The <code>CSSPrimitiveValue</code> interface represents a single CSS value
286N/A * . This interface may be used to determine the value of a specific style
286N/A * property currently set in a block or to set a specific style property
286N/A * explicitly within the block. An instance of this interface might be
286N/A * obtained from the <code>getPropertyCSSValue</code> method of the
286N/A * <code>CSSStyleDeclaration</code> interface. A
286N/A * <code>CSSPrimitiveValue</code> object only occurs in a context of a CSS
286N/A * property.
286N/A * <p> Conversions are allowed between absolute values (from millimeters to
286N/A * centimeters, from degrees to radians, and so on) but not between relative
286N/A * values. (For example, a pixel value cannot be converted to a centimeter
286N/A * value.) Percentage values can't be converted since they are relative to
286N/A * the parent value (or another property value). There is one exception for
286N/A * color percentage values: since a color percentage value is relative to
286N/A * the range 0-255, a color percentage value can be converted to a number;
286N/A * (see also the <code>RGBColor</code> interface).
286N/A * <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>.
286N/A * @since DOM Level 2
286N/A */
286N/Apublic interface CSSPrimitiveValue extends CSSValue {
286N/A // UnitTypes
286N/A /**
286N/A * The value is not a recognized CSS2 value. The value can only be
286N/A * obtained by using the <code>cssText</code> attribute.
286N/A */
286N/A public static final short CSS_UNKNOWN = 0;
286N/A /**
286N/A * The value is a simple number. The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_NUMBER = 1;
286N/A /**
286N/A * The value is a percentage. The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_PERCENTAGE = 2;
286N/A /**
286N/A * The value is a length (ems). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_EMS = 3;
286N/A /**
286N/A * The value is a length (exs). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_EXS = 4;
286N/A /**
286N/A * The value is a length (px). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_PX = 5;
286N/A /**
286N/A * The value is a length (cm). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_CM = 6;
286N/A /**
286N/A * The value is a length (mm). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_MM = 7;
286N/A /**
286N/A * The value is a length (in). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_IN = 8;
286N/A /**
286N/A * The value is a length (pt). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_PT = 9;
286N/A /**
286N/A * The value is a length (pc). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_PC = 10;
286N/A /**
286N/A * The value is an angle (deg). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_DEG = 11;
286N/A /**
286N/A * The value is an angle (rad). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_RAD = 12;
286N/A /**
286N/A * The value is an angle (grad). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_GRAD = 13;
286N/A /**
286N/A * The value is a time (ms). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_MS = 14;
286N/A /**
286N/A * The value is a time (s). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_S = 15;
286N/A /**
286N/A * The value is a frequency (Hz). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_HZ = 16;
286N/A /**
286N/A * The value is a frequency (kHz). The value can be obtained by using the
286N/A * <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_KHZ = 17;
286N/A /**
286N/A * The value is a number with an unknown dimension. The value can be
286N/A * obtained by using the <code>getFloatValue</code> method.
286N/A */
286N/A public static final short CSS_DIMENSION = 18;
286N/A /**
286N/A * The value is a STRING. The value can be obtained by using the
286N/A * <code>getStringValue</code> method.
286N/A */
286N/A public static final short CSS_STRING = 19;
286N/A /**
286N/A * The value is a URI. The value can be obtained by using the
286N/A * <code>getStringValue</code> method.
286N/A */
286N/A public static final short CSS_URI = 20;
286N/A /**
286N/A * The value is an identifier. The value can be obtained by using the
286N/A * <code>getStringValue</code> method.
286N/A */
286N/A public static final short CSS_IDENT = 21;
286N/A /**
286N/A * The value is a attribute function. The value can be obtained by using
286N/A * the <code>getStringValue</code> method.
286N/A */
286N/A public static final short CSS_ATTR = 22;
286N/A /**
286N/A * The value is a counter or counters function. The value can be obtained
286N/A * by using the <code>getCounterValue</code> method.
286N/A */
286N/A public static final short CSS_COUNTER = 23;
286N/A /**
286N/A * The value is a rect function. The value can be obtained by using the
286N/A * <code>getRectValue</code> method.
286N/A */
286N/A public static final short CSS_RECT = 24;
286N/A /**
286N/A * The value is a RGB color. The value can be obtained by using the
286N/A * <code>getRGBColorValue</code> method.
286N/A */
286N/A public static final short CSS_RGBCOLOR = 25;
286N/A
286N/A /**
286N/A * The type of the value as defined by the constants specified above.
286N/A */
286N/A public short getPrimitiveType();
286N/A
286N/A /**
286N/A * A method to set the float value with a specified unit. If the property
286N/A * attached with this value can not accept the specified unit or the
286N/A * float value, the value will be unchanged and a
286N/A * <code>DOMException</code> will be raised.
286N/A * @param unitType A unit code as defined above. The unit code can only
286N/A * be a float unit type (i.e. <code>CSS_NUMBER</code>,
286N/A * <code>CSS_PERCENTAGE</code>, <code>CSS_EMS</code>,
286N/A * <code>CSS_EXS</code>, <code>CSS_PX</code>, <code>CSS_CM</code>,
286N/A * <code>CSS_MM</code>, <code>CSS_IN</code>, <code>CSS_PT</code>,
286N/A * <code>CSS_PC</code>, <code>CSS_DEG</code>, <code>CSS_RAD</code>,
286N/A * <code>CSS_GRAD</code>, <code>CSS_MS</code>, <code>CSS_S</code>,
286N/A * <code>CSS_HZ</code>, <code>CSS_KHZ</code>,
286N/A * <code>CSS_DIMENSION</code>).
286N/A * @param floatValue The new float value.
286N/A * @exception DOMException
286N/A * INVALID_ACCESS_ERR: Raised if the attached property doesn't support
286N/A * the float value or the unit type.
286N/A * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
286N/A */
286N/A public void setFloatValue(short unitType,
286N/A float floatValue)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * This method is used to get a float value in a specified unit. If this
286N/A * CSS value doesn't contain a float value or can't be converted into
286N/A * the specified unit, a <code>DOMException</code> is raised.
286N/A * @param unitType A unit code to get the float value. The unit code can
286N/A * only be a float unit type (i.e. <code>CSS_NUMBER</code>,
286N/A * <code>CSS_PERCENTAGE</code>, <code>CSS_EMS</code>,
286N/A * <code>CSS_EXS</code>, <code>CSS_PX</code>, <code>CSS_CM</code>,
286N/A * <code>CSS_MM</code>, <code>CSS_IN</code>, <code>CSS_PT</code>,
286N/A * <code>CSS_PC</code>, <code>CSS_DEG</code>, <code>CSS_RAD</code>,
286N/A * <code>CSS_GRAD</code>, <code>CSS_MS</code>, <code>CSS_S</code>,
286N/A * <code>CSS_HZ</code>, <code>CSS_KHZ</code>,
286N/A * <code>CSS_DIMENSION</code>).
286N/A * @return The float value in the specified unit.
286N/A * @exception DOMException
286N/A * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a float
286N/A * value or if the float value can't be converted into the specified
286N/A * unit.
286N/A */
286N/A public float getFloatValue(short unitType)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * A method to set the string value with the specified unit. If the
286N/A * property attached to this value can't accept the specified unit or
286N/A * the string value, the value will be unchanged and a
286N/A * <code>DOMException</code> will be raised.
286N/A * @param stringType A string code as defined above. The string code can
286N/A * only be a string unit type (i.e. <code>CSS_STRING</code>,
286N/A * <code>CSS_URI</code>, <code>CSS_IDENT</code>, and
286N/A * <code>CSS_ATTR</code>).
286N/A * @param stringValue The new string value.
286N/A * @exception DOMException
286N/A * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a string
286N/A * value or if the string value can't be converted into the specified
286N/A * unit.
286N/A * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
286N/A */
286N/A public void setStringValue(short stringType,
286N/A String stringValue)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * This method is used to get the string value. If the CSS value doesn't
286N/A * contain a string value, a <code>DOMException</code> is raised. Some
286N/A * properties (like 'font-family' or 'voice-family') convert a
286N/A * whitespace separated list of idents to a string.
286N/A * @return The string value in the current unit. The current
286N/A * <code>primitiveType</code> can only be a string unit type (i.e.
286N/A * <code>CSS_STRING</code>, <code>CSS_URI</code>,
286N/A * <code>CSS_IDENT</code> and <code>CSS_ATTR</code>).
286N/A * @exception DOMException
286N/A * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a string
286N/A * value.
286N/A */
286N/A public String getStringValue()
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * This method is used to get the Counter value. If this CSS value
286N/A * doesn't contain a counter value, a <code>DOMException</code> is
286N/A * raised. Modification to the corresponding style property can be
286N/A * achieved using the <code>Counter</code> interface.
286N/A * @return The Counter value.
286N/A * @exception DOMException
286N/A * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a
286N/A * Counter value (e.g. this is not <code>CSS_COUNTER</code>).
286N/A */
286N/A public Counter getCounterValue()
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * This method is used to get the Rect value. If this CSS value doesn't
286N/A * contain a rect value, a <code>DOMException</code> is raised.
286N/A * Modification to the corresponding style property can be achieved
286N/A * using the <code>Rect</code> interface.
286N/A * @return The Rect value.
286N/A * @exception DOMException
286N/A * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a Rect
286N/A * value. (e.g. this is not <code>CSS_RECT</code>).
286N/A */
286N/A public Rect getRectValue()
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * This method is used to get the RGB color. If this CSS value doesn't
286N/A * contain a RGB color value, a <code>DOMException</code> is raised.
286N/A * Modification to the corresponding style property can be achieved
286N/A * using the <code>RGBColor</code> interface.
286N/A * @return the RGB color value.
286N/A * @exception DOMException
286N/A * INVALID_ACCESS_ERR: Raised if the attached property can't return a
286N/A * RGB color value (e.g. this is not <code>CSS_RGBCOLOR</code>).
286N/A */
286N/A public RGBColor getRGBColorValue()
286N/A throws DOMException;
286N/A
286N/A}