001: /*
002:
003: Licensed to the Apache Software Foundation (ASF) under one or more
004: contributor license agreements. See the NOTICE file distributed with
005: this work for additional information regarding copyright ownership.
006: The ASF licenses this file to You under the Apache License, Version 2.0
007: (the "License"); you may not use this file except in compliance with
008: the License. You may obtain a copy of the License at
009:
010: http://www.apache.org/licenses/LICENSE-2.0
011:
012: Unless required by applicable law or agreed to in writing, software
013: distributed under the License is distributed on an "AS IS" BASIS,
014: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: See the License for the specific language governing permissions and
016: limitations under the License.
017:
018: */
019: package org.apache.batik.css.engine.value;
020:
021: import org.w3c.dom.DOMException;
022: import org.w3c.dom.css.CSSValue;
023:
024: /**
025: * This class provides an abstract implementation of the Value interface.
026: *
027: * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
028: * @version $Id: AbstractValue.java 475477 2006-11-15 22:44:28Z cam $
029: */
030: public abstract class AbstractValue implements Value {
031:
032: /**
033: * Implements {@link Value#getCssValueType()}.
034: */
035: public short getCssValueType() {
036: return CSSValue.CSS_PRIMITIVE_VALUE;
037: }
038:
039: /**
040: * Implements {@link Value#getPrimitiveType()}.
041: */
042: public short getPrimitiveType() {
043: throw createDOMException();
044: }
045:
046: /**
047: * Implements {@link Value#getFloatValue()}.
048: */
049: public float getFloatValue() throws DOMException {
050: throw createDOMException();
051: }
052:
053: /**
054: * Implements {@link Value#getStringValue()}.
055: */
056: public String getStringValue() throws DOMException {
057: throw createDOMException();
058: }
059:
060: /**
061: * Implements {@link Value#getRed()}.
062: */
063: public Value getRed() throws DOMException {
064: throw createDOMException();
065: }
066:
067: /**
068: * Implements {@link Value#getGreen()}.
069: */
070: public Value getGreen() throws DOMException {
071: throw createDOMException();
072: }
073:
074: /**
075: * Implements {@link Value#getBlue()}.
076: */
077: public Value getBlue() throws DOMException {
078: throw createDOMException();
079: }
080:
081: /**
082: * Implements {@link Value#getLength()}.
083: */
084: public int getLength() throws DOMException {
085: throw createDOMException();
086: }
087:
088: /**
089: * Implements {@link Value#item(int)}.
090: */
091: public Value item(int index) throws DOMException {
092: throw createDOMException();
093: }
094:
095: /**
096: * Implements {@link Value#getTop()}.
097: */
098: public Value getTop() throws DOMException {
099: throw createDOMException();
100: }
101:
102: /**
103: * Implements {@link Value#getRight()}.
104: */
105: public Value getRight() throws DOMException {
106: throw createDOMException();
107: }
108:
109: /**
110: * Implements {@link Value#getBottom()}.
111: */
112: public Value getBottom() throws DOMException {
113: throw createDOMException();
114: }
115:
116: /**
117: * Implements {@link Value#getLeft()}.
118: */
119: public Value getLeft() throws DOMException {
120: throw createDOMException();
121: }
122:
123: /**
124: * Implements {@link Value#getIdentifier()}.
125: */
126: public String getIdentifier() throws DOMException {
127: throw createDOMException();
128: }
129:
130: /**
131: * Implements {@link Value#getListStyle()}.
132: */
133: public String getListStyle() throws DOMException {
134: throw createDOMException();
135: }
136:
137: /**
138: * Implements {@link Value#getSeparator()}.
139: */
140: public String getSeparator() throws DOMException {
141: throw createDOMException();
142: }
143:
144: /**
145: * Creates an INVALID_ACCESS_ERR exception.
146: */
147: protected DOMException createDOMException() {
148: Object[] p = new Object[] { new Integer(getCssValueType()) };
149: String s = Messages.formatMessage("invalid.value.access", p);
150: return new DOMException(DOMException.INVALID_ACCESS_ERR, s);
151: }
152: }
|