1 /*
2
3 Licensed to the Apache Software Foundation (ASF) under one or more
4 contributor license agreements. See the NOTICE file distributed with
5 this work for additional information regarding copyright ownership.
6 The ASF licenses this file to You under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with
8 the License. You may obtain a copy of the License at
9
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
20 package org.apache.batik.css.engine.value;
21
22 import org.apache.batik.css.engine.CSSEngine;
23 import org.apache.batik.css.engine.CSSStylableElement;
24 import org.apache.batik.css.engine.StyleMap;
25 import org.w3c.css.sac.LexicalUnit;
26 import org.w3c.dom.DOMException;
27
28 /**
29 * This interface is implemented by objects which manage the values associated
30 * with a property.
31 *
32 * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
33 * @version $Id: ValueManager.java 1808001 2017-09-11 09:51:29Z ssteiner $
34 */
35 public interface ValueManager {
36
37 /**
38 * Returns the name of the property handled.
39 */
40 String getPropertyName();
41
42 /**
43 * Whether the handled property is inherited or not.
44 */
45 boolean isInheritedProperty();
46
47 /**
48 * Whether the handled property can be animated.
49 */
50 boolean isAnimatableProperty();
51
52 /**
53 * Whether the handled property can be additively animated.
54 */
55 boolean isAdditiveProperty();
56
57 /**
58 * Returns the type of value this manager handles. This should be
59 * one of the TYPE_* constants defined in
60 * {@link org.apache.batik.util.SVGTypes}.
61 */
62 int getPropertyType();
63
64 /**
65 * Returns the default value for the handled property.
66 */
67 Value getDefaultValue();
68
69 /**
70 * Creates a value from a lexical unit.
71 * @param lu The SAC lexical unit used to create the value.
72 * @param engine The calling CSSEngine.
73 */
74 Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException;
75
76 /**
77 * Creates and returns a new float value.
78 * @param unitType A unit code as defined above. The unit code can only
79 * be a float unit type
80 * @param floatValue The new float value.
81 */
82 Value createFloatValue(short unitType, float floatValue)
83 throws DOMException;
84
85 /**
86 * Creates and returns a new string value.
87 * @param type A string code as defined in CSSPrimitiveValue. The string
88 * code can only be a string unit type.
89 * @param value The new string value.
90 * @param engine The CSS engine.
91 */
92 Value createStringValue(short type, String value, CSSEngine engine)
93 throws DOMException;
94
95 /**
96 * Computes the given value.
97 * @param elt The owner of the value.
98 * @param pseudo The pseudo element.
99 * @param engine The CSSEngine.
100 * @param idx The property index in the engine.
101 * @param sm The computed style map.
102 * @param value The value to compute.
103 */
104 Value computeValue(CSSStylableElement elt,
105 String pseudo,
106 CSSEngine engine,
107 int idx,
108 StyleMap sm,
109 Value value);
110
111 }
112