KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > css > engine > value > AbstractValueManager


1 /*
2
3    Copyright 2002-2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.css.engine.value;
19
20 import org.apache.batik.css.engine.CSSEngine;
21 import org.apache.batik.css.engine.CSSStylableElement;
22 import org.apache.batik.css.engine.StyleMap;
23 import org.w3c.dom.css.CSSPrimitiveValue;
24 import org.w3c.dom.css.CSSValue;
25 import org.w3c.dom.DOMException JavaDoc;
26
27 /**
28  * This class provides an abstract implementation of the ValueManager
29  * interface.
30  *
31  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
32  * @version $Id: AbstractValueManager.java,v 1.5 2004/08/18 07:12:53 vhardy Exp $
33  */

34 public abstract class AbstractValueManager
35     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 JavaDoc {
43         throw createDOMException();
44     }
45
46     /**
47      * Implements {@link
48      * ValueManager#createStringValue(short,String,CSSEngine)}.
49      */

50     public Value createStringValue(short type, String JavaDoc value, CSSEngine engine)
51         throws DOMException JavaDoc {
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,
60                               String JavaDoc pseudo,
61                               CSSEngine engine,
62                               int idx,
63                               StyleMap sm,
64                               Value value) {
65         
66         if ((value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) &&
67             (value.getPrimitiveType() == CSSPrimitiveValue.CSS_URI)) {
68             // Reveal the absolute value as the cssText now.
69
return new URIValue(value.getStringValue(),
70                                 value.getStringValue());
71         }
72         return value;
73     }
74 }
75
Popular Tags