~ubuntu-branches/ubuntu/karmic/batik/karmic

« back to all changes in this revision

Viewing changes to sources/org/apache/batik/dom/svg/SVGOMFilterElement.java

  • Committer: Bazaar Package Importer
  • Author(s): Matvey Kozhev, Onkar Shinde, Matvey Kozhev
  • Date: 2008-07-19 01:03:05 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080719010305-0b24skqy185kdsb9
Tags: 1.7.dfsg-0ubuntu1
[ Onkar Shinde ]
* New upstream version (LP: #147818)
* debian/control
  - Add Sun JDK 1.5 as build dependency. Fixes FTBFS on buildd. (LP: #150484)
    Also add Sun JRE as runtime dependencies.
  - Add ant-optional as build dependency.
  - Add libxml-commons-external-java and libxmlgraphics-commons-java as
    build and runtime dependencies.
  - Add 'Homepage' field and correct the url.
  - Change standards version to 3.8.0.
  - Modify Maintainer value to match the DebianMaintainerField
    specification.
* debian/rules
  - Change JAVA_HOME_DIRS for Sun JDK.
  - Add jar file names to DEB_JARS to match new build requirements.
  - Extract version from changelog.
  - Delete bundled jar files in clean target.
  - Don't use hardcoded version in install target.
  - Add get-orig-source target.
* debian/README.Debian-source
  - Change the fo tag name to the one used for this version.
* debian/watch
  - Change expression to match src distribution.
* debian/patches/
  - 01_build_xml.patch, 02_fix_jar_target.patch - Refresh for current source.
  - 03_fix_lib_dirs.patch - Fix the library and classpath references needed
    for pdf transcoder build.
  - 04_fix_transcoder_pkg.patch - Fix transcoder-pkg target to not copy
    files from other jar files.

[ Matvey Kozhev ]
* debian/changelog:
  - Added ".dfsg" to version.
* debian/control, debian/rules:
  - Build with openjdk-6-jdk, depend on openjdk-6-jre.
  - Added java-6-sun as an alternate build JAVA_HOME directory.
  - Fixed get-orig-source to not include debian/ and delete the source dir,
    and made it delete jars from lib/, as done in the current batik package.
* debian/wrappers.sh:
  - Changed java-7-icedtea reference to java-6-openjdk, as the former has been
    removed back in Hardy.
  - Added newline.
* debian/libbatik-java.install:
  - Added newline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 
3
 
   Copyright 2000-2004  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
 
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
8
9
 
9
10
       http://www.apache.org/licenses/LICENSE-2.0
10
11
 
20
21
import org.apache.batik.dom.AbstractDocument;
21
22
import org.apache.batik.dom.util.XLinkSupport;
22
23
import org.apache.batik.dom.util.XMLSupport;
 
24
import org.apache.batik.util.DoublyIndexedTable;
 
25
import org.apache.batik.util.SVGTypes;
 
26
 
23
27
import org.w3c.dom.Node;
24
28
import org.w3c.dom.svg.SVGAnimatedBoolean;
25
29
import org.w3c.dom.svg.SVGAnimatedEnumeration;
32
36
 * This class implements {@link SVGFilterElement}.
33
37
 *
34
38
 * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
35
 
 * @version $Id: SVGOMFilterElement.java,v 1.16 2004/08/18 07:13:16 vhardy Exp $
 
39
 * @version $Id: SVGOMFilterElement.java 592621 2007-11-07 05:58:12Z cam $
36
40
 */
37
41
public class SVGOMFilterElement
38
42
    extends    SVGStylableElement
39
43
    implements SVGFilterElement {
40
44
 
41
45
    /**
 
46
     * Table mapping XML attribute names to TraitInformation objects.
 
47
     */
 
48
    protected static DoublyIndexedTable xmlTraitInformation;
 
49
    static {
 
50
        DoublyIndexedTable t =
 
51
            new DoublyIndexedTable(SVGStylableElement.xmlTraitInformation);
 
52
        t.put(null, SVG_FILTER_UNITS_ATTRIBUTE,
 
53
                new TraitInformation(true, SVGTypes.TYPE_IDENT));
 
54
        t.put(null, SVG_PRIMITIVE_UNITS_ATTRIBUTE,
 
55
                new TraitInformation(true, SVGTypes.TYPE_IDENT));
 
56
        t.put(null, SVG_X_ATTRIBUTE,
 
57
                new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
 
58
        t.put(null, SVG_Y_ATTRIBUTE,
 
59
                new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
 
60
        t.put(null, SVG_WIDTH_ATTRIBUTE,
 
61
                new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_WIDTH));
 
62
        t.put(null, SVG_HEIGHT_ATTRIBUTE,
 
63
                new TraitInformation(true, SVGTypes.TYPE_LENGTH, PERCENTAGE_VIEWPORT_HEIGHT));
 
64
        t.put(null, SVG_FILTER_RES_ATTRIBUTE,
 
65
                new TraitInformation(true, SVGTypes.TYPE_NUMBER_OPTIONAL_NUMBER));
 
66
        xmlTraitInformation = t;
 
67
    }
 
68
 
 
69
    /**
42
70
     * The attribute initializer.
43
71
     */
44
 
    protected final static AttributeInitializer attributeInitializer;
 
72
    protected static final AttributeInitializer attributeInitializer;
45
73
    static {
46
74
        attributeInitializer = new AttributeInitializer(4);
47
75
        attributeInitializer.addAttribute(XMLSupport.XMLNS_NAMESPACE_URI,
58
86
    /**
59
87
     * The units values.
60
88
     */
61
 
    protected final static String[] UNITS_VALUES = {
 
89
    protected static final String[] UNITS_VALUES = {
62
90
        "",
63
91
        SVG_USER_SPACE_ON_USE_VALUE,
64
92
        SVG_OBJECT_BOUNDING_BOX_VALUE
65
93
    };
66
94
 
67
95
    /**
 
96
     * The 'filterUnits' attribute value.
 
97
     */
 
98
    protected SVGOMAnimatedEnumeration filterUnits;
 
99
 
 
100
    /**
 
101
     * The 'primitiveUnits' attribute value.
 
102
     */
 
103
    protected SVGOMAnimatedEnumeration primitiveUnits;
 
104
 
 
105
    /**
 
106
     * The 'x' attribute value.
 
107
     */
 
108
    protected SVGOMAnimatedLength x;
 
109
 
 
110
    /**
 
111
     * The 'y' attribute value.
 
112
     */
 
113
    protected SVGOMAnimatedLength y;
 
114
 
 
115
    /**
 
116
     * The 'width' attribute value.
 
117
     */
 
118
    protected SVGOMAnimatedLength width;
 
119
 
 
120
    /**
 
121
     * The 'height' attribute value.
 
122
     */
 
123
    protected SVGOMAnimatedLength height;
 
124
 
 
125
    /**
 
126
     * The 'xlink:href' attribute value.
 
127
     */
 
128
    protected SVGOMAnimatedString href;
 
129
 
 
130
    /**
 
131
     * The 'externalResourcesRequired' attribute value.
 
132
     */
 
133
    protected SVGOMAnimatedBoolean externalResourcesRequired;
 
134
 
 
135
    /**
68
136
     * Creates a new SVGOMFilterElement object.
69
137
     */
70
138
    protected SVGOMFilterElement() {
77
145
     */
78
146
    public SVGOMFilterElement(String prefix, AbstractDocument owner) {
79
147
        super(prefix, owner);
 
148
        initializeLiveAttributes();
 
149
    }
 
150
 
 
151
    /**
 
152
     * Initializes all live attributes for this element.
 
153
     */
 
154
    protected void initializeAllLiveAttributes() {
 
155
        super.initializeAllLiveAttributes();
 
156
        initializeLiveAttributes();
 
157
    }
 
158
 
 
159
    /**
 
160
     * Initializes the live attribute values of this element.
 
161
     */
 
162
    private void initializeLiveAttributes() {
 
163
        filterUnits =
 
164
            createLiveAnimatedEnumeration
 
165
                (null, SVG_FILTER_UNITS_ATTRIBUTE, UNITS_VALUES, (short) 2);
 
166
        primitiveUnits =
 
167
            createLiveAnimatedEnumeration
 
168
                (null, SVG_PRIMITIVE_UNITS_ATTRIBUTE, UNITS_VALUES, (short) 1);
 
169
        x = createLiveAnimatedLength
 
170
            (null, SVG_X_ATTRIBUTE, SVG_FILTER_X_DEFAULT_VALUE,
 
171
             SVGOMAnimatedLength.HORIZONTAL_LENGTH, false);
 
172
        y = createLiveAnimatedLength
 
173
            (null, SVG_Y_ATTRIBUTE, SVG_FILTER_Y_DEFAULT_VALUE,
 
174
             SVGOMAnimatedLength.VERTICAL_LENGTH, false);
 
175
        width =
 
176
            createLiveAnimatedLength
 
177
                (null, SVG_WIDTH_ATTRIBUTE, SVG_FILTER_WIDTH_DEFAULT_VALUE,
 
178
                 SVGOMAnimatedLength.HORIZONTAL_LENGTH, true);
 
179
        height =
 
180
            createLiveAnimatedLength
 
181
                (null, SVG_HEIGHT_ATTRIBUTE, SVG_FILTER_HEIGHT_DEFAULT_VALUE,
 
182
                 SVGOMAnimatedLength.VERTICAL_LENGTH, true);
 
183
        href =
 
184
            createLiveAnimatedString(XLINK_NAMESPACE_URI, XLINK_HREF_ATTRIBUTE);
 
185
        externalResourcesRequired =
 
186
            createLiveAnimatedBoolean
 
187
                (null, SVG_EXTERNAL_RESOURCES_REQUIRED_ATTRIBUTE, false);
80
188
    }
81
189
 
82
190
    /**
90
198
     * <b>DOM</b>: Implements {@link SVGFilterElement#getFilterUnits()}.
91
199
     */
92
200
    public SVGAnimatedEnumeration getFilterUnits() {
93
 
        return getAnimatedEnumerationAttribute
94
 
            (null, SVG_FILTER_UNITS_ATTRIBUTE, UNITS_VALUES,
95
 
             (short)2);
 
201
        return filterUnits;
96
202
    }
97
203
 
98
204
    /**
99
205
     * <b>DOM</b>: Implements {@link SVGFilterElement#getPrimitiveUnits()}.
100
206
     */
101
207
    public SVGAnimatedEnumeration getPrimitiveUnits() {
102
 
        return getAnimatedEnumerationAttribute
103
 
            (null, SVG_PRIMITIVE_UNITS_ATTRIBUTE, UNITS_VALUES,
104
 
             (short)1);
 
208
        return primitiveUnits;
105
209
    }
106
210
 
107
211
    /**
108
212
     * <b>DOM</b>: Implements {@link SVGFilterElement#getX()}.
109
213
     */
110
214
    public SVGAnimatedLength getX() {
111
 
        return getAnimatedLengthAttribute
112
 
            (null, SVG_X_ATTRIBUTE, SVG_FILTER_X_DEFAULT_VALUE,
113
 
             SVGOMAnimatedLength.HORIZONTAL_LENGTH);
 
215
        return x;
114
216
    }
115
217
 
116
218
    /**
117
219
     * <b>DOM</b>: Implements {@link SVGFilterElement#getY()}.
118
220
     */
119
221
    public SVGAnimatedLength getY() {
120
 
        return getAnimatedLengthAttribute
121
 
            (null, SVG_Y_ATTRIBUTE, SVG_FILTER_Y_DEFAULT_VALUE,
122
 
             SVGOMAnimatedLength.VERTICAL_LENGTH);
 
222
        return y;
123
223
    }
124
224
 
125
225
    /**
126
226
     * <b>DOM</b>: Implements {@link SVGFilterElement#getWidth()}.
127
227
     */
128
228
    public SVGAnimatedLength getWidth() {
129
 
        return getAnimatedLengthAttribute
130
 
            (null, SVG_WIDTH_ATTRIBUTE, SVG_FILTER_WIDTH_DEFAULT_VALUE,
131
 
             SVGOMAnimatedLength.HORIZONTAL_LENGTH);
 
229
        return width;
132
230
    }
133
231
 
134
232
    /**
135
233
     * <b>DOM</b>: Implements {@link SVGFilterElement#getHeight()}.
136
234
     */
137
235
    public SVGAnimatedLength getHeight() {
138
 
        return getAnimatedLengthAttribute
139
 
            (null, SVG_HEIGHT_ATTRIBUTE, SVG_FILTER_HEIGHT_DEFAULT_VALUE,
140
 
             SVGOMAnimatedLength.VERTICAL_LENGTH);
 
236
        return height;
141
237
    }
142
238
 
143
239
    /**
144
240
     * <b>DOM</b>: Implements {@link SVGFilterElement#getFilterResX()}.
145
241
     */
146
242
    public SVGAnimatedInteger getFilterResX() {
147
 
        throw new RuntimeException(" !!! TODO: getFilterResX()");
 
243
        throw new UnsupportedOperationException
 
244
            ("SVGFilterElement.getFilterResX is not implemented"); // XXX
148
245
    }
149
246
 
150
247
    /**
151
248
     * <b>DOM</b>: Implements {@link SVGFilterElement#getFilterResY()}.
152
249
     */
153
250
    public SVGAnimatedInteger getFilterResY() {
154
 
        throw new RuntimeException(" !!! TODO: getFilterResY()");
 
251
        throw new UnsupportedOperationException
 
252
            ("SVGFilterElement.getFilterResY is not implemented"); // XXX
155
253
    }
156
254
 
157
255
    /**
158
256
     * <b>DOM</b>: Implements {@link SVGFilterElement#setFilterRes(int,int)}.
159
257
     */
160
258
    public void setFilterRes(int filterResX, int filterResY) {
161
 
        throw new RuntimeException(" !!! TODO: setFilterRes()");
 
259
        throw new UnsupportedOperationException
 
260
            ("SVGFilterElement.setFilterRes is not implemented"); // XXX
162
261
    }
163
262
 
164
263
    // SVGURIReference support /////////////////////////////////////////////
167
266
     * <b>DOM</b>: Implements {@link org.w3c.dom.svg.SVGURIReference#getHref()}.
168
267
     */
169
268
    public SVGAnimatedString getHref() {
170
 
        return SVGURIReferenceSupport.getHref(this);
 
269
        return href;
171
270
    }
172
271
 
173
272
    // SVGExternalResourcesRequired support /////////////////////////////
177
276
     * org.w3c.dom.svg.SVGExternalResourcesRequired#getExternalResourcesRequired()}.
178
277
     */
179
278
    public SVGAnimatedBoolean getExternalResourcesRequired() {
180
 
        return SVGExternalResourcesRequiredSupport.
181
 
            getExternalResourcesRequired(this);
 
279
        return externalResourcesRequired;
 
280
    }
 
281
 
 
282
    /**
 
283
     * Returns the table of TraitInformation objects for this element.
 
284
     */
 
285
    protected DoublyIndexedTable getTraitInformationTable() {
 
286
        return xmlTraitInformation;
182
287
    }
183
288
 
184
289
    // SVGLangSpace support //////////////////////////////////////////////////
194
299
     * <b>DOM</b>: Sets the xml:lang attribute value.
195
300
     */
196
301
    public void setXMLlang(String lang) {
197
 
        setAttributeNS(XMLSupport.XML_NAMESPACE_URI,
198
 
                       XMLSupport.XML_LANG_ATTRIBUTE,
199
 
                       lang);
 
302
        setAttributeNS(XML_NAMESPACE_URI, XML_LANG_QNAME, lang);
200
303
    }
201
304
 
202
305
    /**
210
313
     * <b>DOM</b>: Sets the xml:space attribute value.
211
314
     */
212
315
    public void setXMLspace(String space) {
213
 
        setAttributeNS(XMLSupport.XML_NAMESPACE_URI,
214
 
                       XMLSupport.XML_SPACE_ATTRIBUTE,
215
 
                       space);
 
316
        setAttributeNS(XML_NAMESPACE_URI, XML_SPACE_QNAME, space);
216
317
    }
217
318
 
218
319
    /**
229
330
    protected Node newNode() {
230
331
        return new SVGOMFilterElement();
231
332
    }
 
333
 
 
334
    // AnimationTarget ///////////////////////////////////////////////////////
 
335
 
 
336
// XXX TBD
 
337
//     /**
 
338
//      * Updates an attribute value in this target.
 
339
//      */
 
340
//     public void updateAttributeValue(String ns, String ln,
 
341
//                                      AnimatableValue val) {
 
342
//         if (ns == null) {
 
343
//             if (ln.equals(SVG_FILTER_RES_ATTRIBUTE)) {
 
344
//                 // XXX Needs testing.
 
345
//                 if (val == null) {
 
346
//                     updateIntegerAttributeValue(getFilterResX(), null);
 
347
//                     updateIntegerAttributeValue(getFilterResY(), null);
 
348
//                 } else {
 
349
//                     AnimatableNumberOptionalNumberValue anonv =
 
350
//                         (AnimatableNumberOptionalNumberValue) val;
 
351
//                     SVGOMAnimatedInteger ai =
 
352
//                         (SVGOMAnimatedInteger) getFilterResX();
 
353
//                     ai.setAnimatedValue(Math.round(anonv.getNumber()));
 
354
//                     ai = (SVGOMAnimatedInteger) getFilterResY();
 
355
//                     if (anonv.hasOptionalNumber()) {
 
356
//                         ai.setAnimatedValue
 
357
//                             (Math.round(anonv.getOptionalNumber()));
 
358
//                     } else {
 
359
//                         ai.setAnimatedValue(Math.round(anonv.getNumber()));
 
360
//                     }
 
361
//                 }
 
362
//                 return;
 
363
//             }
 
364
//         }
 
365
//         super.updateAttributeValue(ns, ln, val);
 
366
//     }
 
367
// 
 
368
//     /**
 
369
//      * Returns the underlying value of an animatable XML attribute.
 
370
//      */
 
371
//     public AnimatableValue getUnderlyingValue(String ns, String ln) {
 
372
//         if (ns == null) {
 
373
//             if (ln.equals(SVG_FILTER_RES_ATTRIBUTE)) {
 
374
//                 return getBaseValue(getFilterResX(), getFilterResY());
 
375
//             }
 
376
//         }
 
377
//         return super.getUnderlyingValue(ns, ln);
 
378
//     }
232
379
}