KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > css > engine > value > svg > GlyphOrientationVerticalManager


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.svg;
19
20 import org.apache.batik.css.engine.CSSEngine;
21 import org.apache.batik.css.engine.value.Value;
22 import org.apache.batik.css.engine.value.ValueManager;
23 import org.apache.batik.util.CSSConstants;
24 import org.w3c.css.sac.LexicalUnit;
25 import org.w3c.dom.DOMException JavaDoc;
26 import org.w3c.dom.css.CSSPrimitiveValue;
27
28 /**
29  * This class provides a manager for the 'glyph-orientation-vertical'
30  * property values.
31  *
32  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
33  * @version $Id: GlyphOrientationVerticalManager.java,v 1.5 2005/03/27 08:58:31 cam Exp $
34  */

35 public class GlyphOrientationVerticalManager
36     extends GlyphOrientationManager {
37     
38     /**
39      * Implements {@link ValueManager#getPropertyName()}.
40      */

41     public String JavaDoc getPropertyName() {
42     return CSSConstants.CSS_GLYPH_ORIENTATION_VERTICAL_PROPERTY;
43     }
44     
45     /**
46      * Implements {@link ValueManager#getDefaultValue()}.
47      */

48     public Value getDefaultValue() {
49         return SVGValueConstants.AUTO_VALUE;
50     }
51
52     /**
53      * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
54      */

55     public Value createValue(LexicalUnit lu, CSSEngine engine)
56         throws DOMException JavaDoc {
57         if (lu.getLexicalUnitType() == LexicalUnit.SAC_IDENT) {
58             if (lu.getStringValue().equalsIgnoreCase
59                 (CSSConstants.CSS_AUTO_VALUE)) {
60                 return SVGValueConstants.AUTO_VALUE;
61             }
62             throw createInvalidIdentifierDOMException(lu.getStringValue());
63         }
64         return super.createValue(lu, engine);
65     }
66
67     /**
68      * Implements {@link
69      * ValueManager#createStringValue(short,String,CSSEngine)}.
70      */

71     public Value createStringValue(short type, String JavaDoc value, CSSEngine engine)
72     throws DOMException JavaDoc {
73     if (type != CSSPrimitiveValue.CSS_IDENT) {
74             throw createInvalidStringTypeDOMException(type);
75     }
76     if (value.equalsIgnoreCase(CSSConstants.CSS_AUTO_VALUE)) {
77             return SVGValueConstants.AUTO_VALUE;
78         }
79         throw createInvalidIdentifierDOMException(value);
80     }
81 }
82
Popular Tags