KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > css > engine > SVG12CSSEngine


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;
19
20 import java.net.URL JavaDoc;
21
22 import org.apache.batik.css.engine.value.ShorthandManager;
23 import org.apache.batik.css.engine.value.ValueConstants;
24 import org.apache.batik.css.engine.value.ValueManager;
25 import org.apache.batik.css.engine.value.svg.SVGColorManager;
26 import org.apache.batik.css.engine.value.svg.OpacityManager;
27 import org.apache.batik.css.engine.value.svg12.LineHeightManager;
28 import org.apache.batik.css.engine.value.svg12.MarginLengthManager;
29 import org.apache.batik.css.engine.value.svg12.MarginShorthandManager;
30 import org.apache.batik.css.engine.value.svg12.TextAlignManager;
31 import org.apache.batik.css.parser.ExtendedParser;
32 import org.apache.batik.util.SVG12CSSConstants;
33 import org.w3c.dom.Document JavaDoc;
34
35 /**
36  * This class provides a CSS engine initialized for SVG.
37  *
38  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
39  * @version $Id: SVG12CSSEngine.java,v 1.1 2004/11/18 01:46:56 deweese Exp $
40  */

41 public class SVG12CSSEngine extends SVGCSSEngine {
42     
43     /**
44      * Creates a new SVGCSSEngine.
45      * @param doc The associated document.
46      * @param uri The document URI.
47      * @param p The CSS parser to use.
48      * @param ctx The CSS context.
49      */

50     public SVG12CSSEngine(Document JavaDoc doc,
51                           URL JavaDoc uri,
52                           ExtendedParser p,
53                           CSSContext ctx) {
54         super(doc, uri, p,
55               SVG_VALUE_MANAGERS,
56               SVG_SHORTHAND_MANAGERS,
57               ctx);
58         lineHeightIndex = LINE_HEIGHT_INDEX;
59     }
60
61     /**
62      * Creates a new SVGCSSEngine.
63      * @param doc The associated document.
64      * @param uri The document URI.
65      * @param p The CSS parser to use.
66      * @param vms Extension value managers.
67      * @param sms Extension shorthand managers.
68      * @param ctx The CSS context.
69      */

70     public SVG12CSSEngine(Document JavaDoc doc,
71                         URL JavaDoc uri,
72                         ExtendedParser p,
73                         ValueManager[] vms,
74                         ShorthandManager[] sms,
75                         CSSContext ctx) {
76         super(doc, uri, p,
77               mergeArrays(SVG_VALUE_MANAGERS, vms),
78               mergeArrays(SVG_SHORTHAND_MANAGERS, sms),
79               ctx);
80         lineHeightIndex = LINE_HEIGHT_INDEX;
81     }
82
83     /**
84      * The value managers for SVG.
85      */

86     public final static ValueManager[] SVG_VALUE_MANAGERS = {
87         new LineHeightManager (),
88         new MarginLengthManager(SVG12CSSConstants.CSS_INDENT_PROPERTY),
89         new MarginLengthManager(SVG12CSSConstants.CSS_MARGIN_BOTTOM_PROPERTY),
90         new MarginLengthManager(SVG12CSSConstants.CSS_MARGIN_LEFT_PROPERTY),
91         new MarginLengthManager(SVG12CSSConstants.CSS_MARGIN_RIGHT_PROPERTY),
92         new MarginLengthManager(SVG12CSSConstants.CSS_MARGIN_TOP_PROPERTY),
93         new SVGColorManager (SVG12CSSConstants.CSS_SOLID_COLOR_PROPERTY),
94         new OpacityManager (SVG12CSSConstants.CSS_SOLID_OPACITY_PROPERTY,
95                                 true),
96         new TextAlignManager (),
97     };
98     
99     /**
100      * The shorthand managers for SVG.
101      */

102     public final static ShorthandManager[] SVG_SHORTHAND_MANAGERS = {
103         new MarginShorthandManager(),
104     };
105
106     //
107
// The property indexes.
108
//
109
public final static int LINE_HEIGHT_INDEX = SVGCSSEngine.FINAL_INDEX+1;
110     public final static int INDENT_INDEX = LINE_HEIGHT_INDEX+1;
111     public final static int MARGIN_BOTTOM_INDEX = INDENT_INDEX+1;
112     public final static int MARGIN_LEFT_INDEX = MARGIN_BOTTOM_INDEX+1;
113     public final static int MARGIN_RIGHT_INDEX = MARGIN_LEFT_INDEX+1;
114     public final static int MARGIN_TOP_INDEX = MARGIN_RIGHT_INDEX+1;
115     public final static int SOLID_COLOR_INDEX = MARGIN_TOP_INDEX+1;
116     public final static int SOLID_OPACITY_INDEX = SOLID_COLOR_INDEX+1;
117     public final static int TEXT_ALIGN_INDEX = SOLID_OPACITY_INDEX+1;
118     public final static int FINAL_INDEX = TEXT_ALIGN_INDEX;
119 }
120
Popular Tags