* Constructor.
*/
public ExtensionElementMapping() {
- URI = "http://xml.apache.org/fop/extensions";
+ namespaceURI = "http://xml.apache.org/fop/extensions";
}
/**
*/
package org.apache.fop.fo;
+/**
+ * Shorthand property parser for Box properties
+ */
public class BoxPropShorthandParser extends GenericShorthandParser {
/**
* Stores 1 to 4 values of same type.
* Set the given property based on the number of values set.
* Example: padding, border-width, border-color, border-style, margin
- * @see org.apache.fop.fo.GenericShorthandParser#convertValueForProperty(String, Property.Maker, PropertyList)
+ * @see org.apache.fop.fo.GenericShorthandParser#convertValueForProperty(String,
+ * Property.Maker, PropertyList)
*/
protected Property convertValueForProperty(String propName,
Property.Maker maker,
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.fo;
+/**
+ * Superclass for properties that wrap a character value
+ */
public class CharacterProperty extends Property {
+ /**
+ * Inner class for creating instances of CharacterProperty
+ */
public static class Maker extends Property.Maker {
+ /**
+ * @param propName name of property for which a Maker should be created
+ */
public Maker(String propName) {
super(propName);
}
private char character;
+ /**
+ * @param character character value to be wrapped in this property
+ */
public CharacterProperty(char character) {
this.character = character;
}
+ /**
+ * @return this.character cast as an Object
+ */
public Object getObject() {
return new Character(character);
}
+ /**
+ * @return this.character
+ */
public char getCharacter() {
return this.character;
}
+ /**
+ * @return this.character cast as a String
+ */
public String getString() {
return new Character(character).toString();
}
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.fo;
import org.apache.fop.datatypes.ColorType;
+/**
+ * Superclass for properties that wrap ColorType values
+ */
public class ColorTypeProperty extends Property {
+ /**
+ * Inner class for creating instances of ColorTypeProperty
+ */
public static class Maker extends Property.Maker {
+ /**
+ * @param propName name of property for which a Maker should be created
+ */
public Maker(String propName) {
super(propName);
}
private ColorType colorType;
+ /**
+ * @param colorType color type object which is to be wrapped in this
+ * Property
+ */
public ColorTypeProperty(ColorType colorType) {
this.colorType = colorType;
}
- // Can't convert to any other types
+ /**
+ * Can't convert to any other types
+ * @return this.colorType
+ */
public ColorType getColorType() {
return this.colorType;
}
+ /**
+ * @return this.colorType cast as an Object
+ */
public Object getObject() {
return this.colorType;
}
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.fo;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.CondLength;
+/**
+ * Superclass for properties that have conditional lengths
+ */
public class CondLengthProperty extends Property {
+ /**
+ * Inner class for creating instances of CondLengthProperty
+ */
public static class Maker extends Property.Maker {
+ /**
+ * @param name of property for which a Maker should be created
+ */
public Maker(String name) {
super(name);
}
private CondLength condLength = null;
+ /**
+ * @param condLength conditional length object which is to be wrapped in
+ * this property
+ */
public CondLengthProperty(CondLength condLength) {
this.condLength = condLength;
}
+ /**
+ * @return this.condLength
+ */
public CondLength getCondLength() {
return this.condLength;
}
- /* Question, should we allow this? */
+ /**
+ * TODO: Should we allow this?
+ * @return this.condLength cast as a Length
+ */
public Length getLength() {
return this.condLength.getLength().getLength();
}
+ /**
+ * @return this.condLength cast as an Object
+ */
public Object getObject() {
return this.condLength;
}
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.fo;
import java.util.HashMap;
/**
- * Interface for adding supported element and property mappings to
- * the given builder.
+ * Abstract base class for Element Mappings (including FO Element Mappings)
+ * which provide the framework of valid elements and attibutes for a given
+ * namespace.
*/
-/** Abstract base class of FO Element Mappings. */
public abstract class ElementMapping {
+ /** constant for defining the default value */
public static final String DEFAULT = "<default>";
/** The HashMap table of formatting objects defined by the ElementMapping */
protected HashMap foObjs = null;
/** The namespace for the ElementMapping */
- protected String URI = null;
+ protected String namespaceURI = null;
/**
* Returns a HashMap of maker objects for this element mapping
* Returns the namespace URI for this element mapping
*
* @return Namespace URI for this element mapping
- */
+ */
public String getNamespaceURI() {
- return URI;
+ return namespaceURI;
}
/**
* Initializes the set of maker objects associated with this ElementMapping
- *
- */
+ */
protected abstract void initialize();
public static class Maker {
+
public FONode make(FONode parent) {
return null;
}
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.fo;
import org.apache.fop.apps.FOPException;
+/**
+ * Superclass for properties that wrap an enumeration value
+ */
public class EnumProperty extends Property {
+ /**
+ * Inner class for creating EnumProperty instances
+ */
public static class Maker extends Property.Maker {
+ /**
+ * @param propName name of property for which a Maker should be created
+ */
protected Maker(String propName) {
super(propName);
}
/**
* Called by subclass if no match found.
+ * @param value string containing the value to be checked
+ * @return null (indicates that an appropriate match was not found)
*/
public Property checkEnumValues(String value) {
//log.error("Unknown enumerated value for property '"
private int value;
+ /**
+ * @param explicitValue enumerated value to be set for this property
+ */
public EnumProperty(int explicitValue) {
this.value = explicitValue;
}
+ /**
+ * @return this.value
+ */
public int getEnum() {
return this.value;
}
+ /**
+ * @return this.value cast as an Object
+ */
public Object getObject() {
// FIXME: return String value: property must reference maker
// return maker.getEnumValue(this.value);
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.fo;
// Java
* Element mapping class for all XSL-FO elements.
*/
public class FOElementMapping extends ElementMapping {
-
+
+ /**
+ * Basic constructor; inititializes the namespace URI for the fo: namespace
+ */
public FOElementMapping() {
- URI = "http://www.w3.org/1999/XSL/Format";
+ namespaceURI = "http://www.w3.org/1999/XSL/Format";
}
+ /**
+ * Initializes the collection of valid objects for the fo: namespace
+ */
protected void initialize() {
if (foObjs == null) {
foObjs = new HashMap();
// do nothing by default
}
+ /**
+ * @param child child node to be added to the children of this node
+ */
protected void addChild(FONode child) {
}
+ /**
+ * @return the parent node of this node
+ */
public FONode getParent() {
return this.parent;
}
public boolean hasData() {
return (rootFObj != null);
}
-
+
}
// code stolen from org.apache.batik.util and modified slightly
* The attributes must be used immediately as the sax attributes
* will be altered for the next element.
* @param attlist Collection of attributes passed to us from the parser.
- * @throws FOPException
+ * @throws FOPException for invalid FO data
*/
public void handleAttrs(Attributes attlist) throws FOPException {
properties = getListBuilder().makeList(FO_URI, name, attlist, this);
// if we got here, it is because parent is null
if (returnRoot) {
return p;
- }
- else {
+ } else {
return null;
}
}
+ /**
+ * For a given namespace, determine whether the properties of this object
+ * match that namespace.
+ * @param nameSpaceURI the namespace URI to be tested against
+ * @return this.properties, if the namespaces match; otherwise, null
+ */
public PropertyList getPropertiesForNamespace(String nameSpaceURI) {
if (this.properties == null) {
return null;
}
- if (! nameSpaceURI.equals(this.properties.getNameSpace())) {
+ if (!nameSpaceURI.equals(this.properties.getNameSpace())) {
return null;
}
return this.properties;
}
+ /**
+ * @param propertyList the collection of Property objects to be managed
+ * @return a PropertyManager for the Property objects
+ */
protected PropertyManager makePropertyManager(
- PropertyList propertyList) {
+ PropertyList propertyList) {
return new PropertyManager(propertyList);
}
}
}
+ /**
+ * @return true if there are any Markers attached to this object
+ */
public boolean hasMarkers() {
return markers != null && !markers.isEmpty();
}
+ /**
+ * @return th collection of Markers attached to this object
+ */
public Map getMarkers() {
return markers;
}
private boolean batik = true;
public SVGElementMapping() {
- URI = SVGDOMImplementation.SVG_NAMESPACE_URI;
+ namespaceURI = SVGDOMImplementation.SVG_NAMESPACE_URI;
}
protected void initialize() {