KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > fo > extensions > ExtensionElementMapping


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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 /* $Id: ExtensionElementMapping.java 442282 2006-09-11 18:24:35Z jeremias $ */
19
20 package org.apache.fop.fo.extensions;
21
22 import org.apache.fop.fo.ElementMapping;
23 import org.apache.fop.fo.UnknownXMLObj;
24 import org.apache.fop.util.QName;
25
26 import java.util.HashMap JavaDoc;
27 import java.util.Set JavaDoc;
28
29 /**
30  * Element mapping for FOP's proprietary extension to XSL-FO.
31  */

32 public class ExtensionElementMapping extends ElementMapping {
33     
34     /** The FOP extension namespace URI */
35     public static final String JavaDoc URI = "http://xmlgraphics.apache.org/fop/extensions";
36
37     private static final Set JavaDoc propertyAttributes = new java.util.HashSet JavaDoc();
38     
39     static {
40         //These are FOP's standard extension properties (fox:*)
41
propertyAttributes.add("block-progression-unit");
42         propertyAttributes.add("widow-content-limit");
43         propertyAttributes.add("orphan-content-limit");
44     }
45     
46     /**
47      * Constructor.
48      */

49     public ExtensionElementMapping() {
50         namespaceURI = URI;
51     }
52
53     /**
54      * Initialize the data structures.
55      */

56     protected void initialize() {
57         if (foObjs == null) {
58             foObjs = new HashMap JavaDoc();
59             foObjs.put("outline", new UnknownXMLObj.Maker(URI));
60             foObjs.put("label", new UnknownXMLObj.Maker(URI));
61         }
62     }
63     
64     /** @see org.apache.fop.fo.ElementMapping#getStandardPrefix() */
65     public String JavaDoc getStandardPrefix() {
66         return "fox";
67     }
68     
69     /** @see org.apache.fop.fo.ElementMapping#isAttributeProperty(org.apache.fop.util.QName) */
70     public boolean isAttributeProperty(QName attributeName) {
71         if (!URI.equals(attributeName.getNamespaceURI())) {
72             throw new IllegalArgumentException JavaDoc("The namespace URIs don't match");
73         }
74         return propertyAttributes.contains(attributeName.getLocalName());
75     }
76     
77 }
78
Popular Tags