01: /*
02:
03: Licensed to the Apache Software Foundation (ASF) under one or more
04: contributor license agreements. See the NOTICE file distributed with
05: this work for additional information regarding copyright ownership.
06: The ASF licenses this file to You under the Apache License, Version 2.0
07: (the "License"); you may not use this file except in compliance with
08: the License. You may obtain a copy of the License at
09:
10: http://www.apache.org/licenses/LICENSE-2.0
11:
12: Unless required by applicable law or agreed to in writing, software
13: distributed under the License is distributed on an "AS IS" BASIS,
14: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: See the License for the specific language governing permissions and
16: limitations under the License.
17:
18: */
19: package org.apache.batik.css.engine.value;
20:
21: import org.apache.batik.css.engine.CSSEngine;
22: import org.apache.batik.css.engine.CSSStylableElement;
23: import org.apache.batik.css.engine.StyleMap;
24: import org.w3c.dom.css.CSSPrimitiveValue;
25: import org.w3c.dom.css.CSSValue;
26: import org.w3c.dom.DOMException;
27:
28: /**
29: * This class provides an abstract implementation of the ValueManager
30: * interface.
31: *
32: * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
33: * @version $Id: AbstractValueManager.java 475685 2006-11-16 11:16:05Z cam $
34: */
35: public abstract class AbstractValueManager extends AbstractValueFactory
36: implements ValueManager {
37:
38: /**
39: * Implements {@link ValueManager#createFloatValue(short,float)}.
40: */
41: public Value createFloatValue(short unitType, float floatValue)
42: throws DOMException {
43: throw createDOMException();
44: }
45:
46: /**
47: * Implements {@link
48: * ValueManager#createStringValue(short,String,CSSEngine)}.
49: */
50: public Value createStringValue(short type, String value,
51: CSSEngine engine) throws DOMException {
52: throw createDOMException();
53: }
54:
55: /**
56: * Implements {@link
57: * ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}.
58: */
59: public Value computeValue(CSSStylableElement elt, String pseudo,
60: CSSEngine engine, int idx, StyleMap sm, Value value) {
61:
62: if ((value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)
63: && (value.getPrimitiveType() == CSSPrimitiveValue.CSS_URI)) {
64: // Reveal the absolute value as the cssText now.
65: return new URIValue(value.getStringValue(), value
66: .getStringValue());
67: }
68: return value;
69: }
70: }
|