Revision: 12799
http://sourceforge.net/p/foray/code/12799
Author: victormote
Date: 2022-12-07 12:44:25 +0000 (Wed, 07 Dec 2022)
Log Message:
-----------
Roll up remaining ObjectMaker and PropertyMaker classes into their respective Namespace implementations.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/NamespaceForay.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/NamespaceXml.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/ObjectMakerAxsl.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/PropertyMakerAxsl.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/ObjectMakerForay.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/ObjectMakerMath.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/ObjectMakerSvg.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/PropertyMakerXml.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java 2022-12-07 12:16:40 UTC (rev 12798)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java 2022-12-07 12:44:25 UTC (rev 12799)
@@ -35,6 +35,9 @@
import org.foray.fotree.Property;
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
+import org.foray.fotree.axsl.obj.Metadata4a;
+import org.foray.fotree.axsl.prop.MetadataKey;
+import org.foray.fotree.fo.obj.Declarations4a;
import org.axsl.fotree.FoTree;
import org.axsl.fotree.FoTreeException;
@@ -68,7 +71,7 @@
@Override
public FoObj parseElementForNS(final FoTree4a foTree, final String localName, final FoObj currentFObj,
final PropertyList list, final Locator locator) throws FoTreeException {
- return ObjectMakerAxsl.makeObject(localName, currentFObj, list, locator);
+ return makeObject(localName, currentFObj, list, locator);
}
@Override
@@ -85,7 +88,7 @@
@Override
public Property parseAttributeForNS(final Attributes attributes, final String attributeName,
final String attributeValue, final FoObj fobj, final Locator locator) throws PropertyException {
- return PropertyMakerAxsl.makeProperty(attributeName, attributeValue, fobj);
+ return makeProperty(attributeName, attributeValue, fobj);
}
@Override
@@ -104,4 +107,90 @@
return NamespaceAxsl.theInstance;
}
+ /**
+ * Converts an unparsed extension element into an FoObj instance that can be
+ * added to the FO Tree.
+ * @param objectName The unparsed extension element name.
+ * @param parent The parent FoObj.
+ * @param propertyList The property list of the parent FoObj.
+ * @param locator The SAX Locator object.
+ * @return The new FoObj instance for this extension element.
+ */
+ public FoObj makeObject(final String objectName, final FoObj parent, final PropertyList propertyList,
+ final Locator locator) {
+ final AxslObject enumeration = AxslObject.extensionValueOf(objectName);
+ switch (enumeration) {
+ case METADATA: {
+ if (parent instanceof Declarations4a) {
+ return new Metadata4a((Declarations4a) parent, propertyList);
+ }
+ throw new IllegalArgumentException("Parent of " + Metadata4a.class.getName() + " must be instance of "
+ + Declarations4a.class.getName());
+ }
+ default: {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Converts a property name to its integral equivalent.
+ * @param inputPropertyName The property name to be enumerated.
+ * @return The enumerated value of the property name.
+ */
+ public AxslPropertyId enumeratePropertyName(final String inputPropertyName) {
+ final String propertyName = Property.getBasePropertyName(inputPropertyName);
+ return AxslPropertyId.xslValueOf(propertyName);
+ }
+
+ /**
+ * Makes a property in this namespace.
+ * @param propertyFullName The unparsed property name.
+ * @param attributeValue The unparsed property value.
+ * @param fobj The FoObj to which this property belongs.
+ * @return The parsed Property instance.
+ * @throws PropertyException For errors in the property or its value.
+ */
+ public Property makeProperty(final String propertyFullName, final String attributeValue, final FoObj fobj)
+ throws PropertyException {
+ final String basePropertyName = Property.getBasePropertyName(propertyFullName);
+ final AxslPropertyId enumeration = enumeratePropertyName(basePropertyName);
+ final Property property = checkCompoundProperty(fobj, enumeration, propertyFullName, attributeValue);
+ if (property != null) {
+ return property;
+ }
+ if (enumeration == null) {
+ throw new PropertyException("Invalid property for axsl namespace: " + propertyFullName);
+ }
+ switch (enumeration) {
+ case METADATA_KEY: {
+ return new MetadataKey(fobj, propertyFullName, attributeValue);
+ }
+ default: {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Checks to see if the property has already been created.
+ * If it has, and if it is a compound property, sets the value for this component.
+ * @param fobj The FoObj to which this property belongs.
+ * @param enumeration The parsed property type.
+ * @param propertyFullName The full unparsed name of the property.
+ * @param attributeValue The unparsed property value.
+ * @return The parsed property.
+ * @throws PropertyException For errors in the property or its value.
+ */
+ private Property checkCompoundProperty(final FoObj fobj, final AxslPropertyId enumeration,
+ final String propertyFullName, final String attributeValue) throws PropertyException {
+ if (enumeration == null) {
+ return null;
+ }
+ switch (enumeration) {
+ default:
+ return null;
+ }
+ }
+
}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/ObjectMakerAxsl.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/ObjectMakerAxsl.java 2022-12-07 12:16:40 UTC (rev 12798)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/ObjectMakerAxsl.java 2022-12-07 12:44:25 UTC (rev 12799)
@@ -1,75 +0,0 @@
-/*
- * Copyright 2007 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree.axsl;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.PropertyList;
-import org.foray.fotree.axsl.obj.Metadata4a;
-import org.foray.fotree.fo.obj.Declarations4a;
-
-import org.xml.sax.Locator;
-
-/**
- * Factory class for creating formatting objects in the "axsl" namespace.
- */
-public final class ObjectMakerAxsl {
-
- /**
- * Private Constructor. This is a utility class and should never be
- * instantiated.
- */
- private ObjectMakerAxsl() { }
-
- /**
- * Converts an unparsed extension element into an FoObj instance that can be
- * added to the FO Tree.
- * @param objectName The unparsed extension element name.
- * @param parent The parent FoObj.
- * @param propertyList The property list of the parent FoObj.
- * @param locator The SAX Locator object.
- * @return The new FoObj instance for this extension element.
- */
- public static FoObj makeObject(final String objectName, final FoObj parent, final PropertyList propertyList,
- final Locator locator) {
- final AxslObject enumeration = AxslObject.extensionValueOf(objectName);
- switch (enumeration) {
- case METADATA: {
- if (parent instanceof Declarations4a) {
- return new Metadata4a((Declarations4a) parent, propertyList);
- }
- throw new IllegalArgumentException("Parent of " + Metadata4a.class.getName() + " must be instance of "
- + Declarations4a.class.getName());
- }
- default: {
- return null;
- }
- }
- }
-
-}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/PropertyMakerAxsl.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/PropertyMakerAxsl.java 2022-12-07 12:16:40 UTC (rev 12798)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/PropertyMakerAxsl.java 2022-12-07 12:44:25 UTC (rev 12799)
@@ -1,106 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree.axsl;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.Property;
-import org.foray.fotree.PropertyException;
-import org.foray.fotree.axsl.prop.MetadataKey;
-
-/**
- * Class for parsing attributes in the axsl: namespace.
- */
-public final class PropertyMakerAxsl {
-
- /**
- * Private constructor. This is a utility class and should never be instantiated.
- */
- private PropertyMakerAxsl() { }
-
- /**
- * Converts a property name to its integral equivalent.
- * @param inputPropertyName The property name to be enumerated.
- * @return The enumerated value of the property name.
- */
- public static AxslPropertyId enumeratePropertyName(final String inputPropertyName) {
- final String propertyName = Property.getBasePropertyName(inputPropertyName);
- return AxslPropertyId.xslValueOf(propertyName);
- }
-
- /**
- * Makes a property in this namespace.
- * @param propertyFullName The unparsed property name.
- * @param attributeValue The unparsed property value.
- * @param fobj The FoObj to which this property belongs.
- * @return The parsed Property instance.
- * @throws PropertyException For errors in the property or its value.
- */
- public static Property makeProperty(final String propertyFullName, final String attributeValue, final FoObj fobj)
- throws PropertyException {
- final String basePropertyName = Property.getBasePropertyName(propertyFullName);
- final AxslPropertyId enumeration = enumeratePropertyName(basePropertyName);
- final Property property = checkCompoundProperty(fobj, enumeration, propertyFullName, attributeValue);
- if (property != null) {
- return property;
- }
- if (enumeration == null) {
- throw new PropertyException("Invalid property for axsl namespace: " + propertyFullName);
- }
- switch (enumeration) {
- case METADATA_KEY: {
- return new MetadataKey(fobj, propertyFullName, attributeValue);
- }
- default: {
- return null;
- }
- }
- }
-
- /**
- * Checks to see if the property has already been created.
- * If it has, and if it is a compound property, sets the value for this component.
- * @param fobj The FoObj to which this property belongs.
- * @param enumeration The parsed property type.
- * @param propertyFullName The full unparsed name of the property.
- * @param attributeValue The unparsed property value.
- * @return The parsed property.
- * @throws PropertyException For errors in the property or its value.
- */
- private static Property checkCompoundProperty(final FoObj fobj, final AxslPropertyId enumeration,
- final String propertyFullName, final String attributeValue) throws PropertyException {
- if (enumeration == null) {
- return null;
- }
- switch (enumeration) {
- default:
- return null;
- }
- }
-
-}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/NamespaceForay.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/NamespaceForay.java 2022-12-07 12:16:40 UTC (rev 12798)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/NamespaceForay.java 2022-12-07 12:44:25 UTC (rev 12799)
@@ -69,7 +69,7 @@
public FoObj parseElementForNS(final FoTree4a foTree, final String localName,
final FoObj currentFObj, final PropertyList list,
final Locator locator) throws FoTreeException {
- return ObjectMakerForay.makeObject(localName, currentFObj, list);
+ return makeObject(localName, currentFObj, list);
}
@Override
@@ -114,4 +114,23 @@
return NamespaceForay.theInstance;
}
+ /**
+ * Converts an unparsed extension element into an FoObj instance that can be
+ * added to the FO Tree.
+ * @param objectName The unparsed extension element name.
+ * @param parent The parent FoObj.
+ * @param propertyList The property list of the parent FoObj.
+ * @return The new FoObj instance for this extension element.
+ */
+ public FoObj makeObject(final String objectName, final FoObj parent,
+ final PropertyList propertyList) {
+ final ForayObject enumeration = ForayObject.extensionValueOf(
+ objectName);
+ switch (enumeration) {
+ default: {
+ return null;
+ }
+ }
+ }
+
}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/ObjectMakerForay.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/ObjectMakerForay.java 2022-12-07 12:16:40 UTC (rev 12798)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/ObjectMakerForay.java 2022-12-07 12:44:25 UTC (rev 12799)
@@ -1,64 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree.foray;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.PropertyList;
-
-/**
- * Factory class for creating formatting objects in the "foray" namespace.
- */
-public final class ObjectMakerForay {
-
- /**
- * Private Constructor. This is a utility class and should never be
- * instantiated.
- */
- private ObjectMakerForay() { }
-
- /**
- * Converts an unparsed extension element into an FoObj instance that can be
- * added to the FO Tree.
- * @param objectName The unparsed extension element name.
- * @param parent The parent FoObj.
- * @param propertyList The property list of the parent FoObj.
- * @return The new FoObj instance for this extension element.
- */
- public static FoObj makeObject(final String objectName, final FoObj parent,
- final PropertyList propertyList) {
- final ForayObject enumeration = ForayObject.extensionValueOf(
- objectName);
- switch (enumeration) {
- default: {
- return null;
- }
- }
- }
-
-}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java 2022-12-07 12:16:40 UTC (rev 12798)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java 2022-12-07 12:44:25 UTC (rev 12799)
@@ -36,6 +36,8 @@
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
import org.foray.fotree.PropertyListUnparsed;
+import org.foray.fotree.fo.obj.InstreamForeignObject4a;
+import org.foray.fotree.math.obj.InstreamMathElement;
import org.axsl.fotree.FoTreeException;
import org.axsl.graphic.MathGraphic;
@@ -71,7 +73,7 @@
public FoObj parseElementForNS(final FoTree4a foTree, final String localName,
final FoObj currentFObj, final PropertyList list,
final Locator locator) throws FoTreeException {
- return ObjectMakerMath.makeObject(localName, currentFObj, list);
+ return makeObject(localName, currentFObj, list);
}
@Override
@@ -111,4 +113,36 @@
return NamespaceMath.theInstance;
}
+ /**
+ * Converts an unparsed MathML element into an FoObj instance that can be
+ * added to the FO Tree.
+ * @param objectName The unparsed MathML element name.
+ * @param parent The parent FoObj.
+ * @param propertyList The property list of the parent FoObj.
+ * @return The new FoObj instance for this MathML element.
+ * @throws FoTreeException If the parent object is not an instance of
+ * {@link InstreamForeignObject4a}.
+ */
+ public FoObj makeObject(final String objectName, final FoObj parent,
+ final PropertyList propertyList) throws FoTreeException {
+ /* We only need to handle one element here, the root element, which is
+ * always "math". */
+ if (! objectName.equals("math")) {
+ throw new IllegalArgumentException("Cannot parse any MathML "
+ + "elements except \"math\".");
+ }
+ /* The PropertyList must be of the unparsed variety. */
+ final PropertyListUnparsed propertyListUnparsed
+ = (PropertyListUnparsed) propertyList;
+ if (parent instanceof InstreamForeignObject4a) {
+ final InstreamForeignObject4a ifo =
+ (InstreamForeignObject4a) parent;
+ return new InstreamMathElement(ifo, propertyListUnparsed);
+ } else {
+ parent.throwException("Instream MathML content must be inside "
+ + "an fo:instream-foreign-object.");
+ return null;
+ }
+ }
+
}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/ObjectMakerMath.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/ObjectMakerMath.java 2022-12-07 12:16:40 UTC (rev 12798)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/ObjectMakerMath.java 2022-12-07 12:44:25 UTC (rev 12799)
@@ -1,82 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree.math;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.PropertyList;
-import org.foray.fotree.PropertyListUnparsed;
-import org.foray.fotree.fo.obj.InstreamForeignObject4a;
-import org.foray.fotree.math.obj.InstreamMathElement;
-
-import org.axsl.fotree.FoTreeException;
-
-/**
- * Factory class for creating formatting objects in the "m" (MathML) namespace.
- */
-public final class ObjectMakerMath {
-
- /**
- * Private constructor. This is a utility class and should never be
- * instantiated.
- */
- private ObjectMakerMath() { }
-
- /**
- * Converts an unparsed MathML element into an FoObj instance that can be
- * added to the FO Tree.
- * @param objectName The unparsed MathML element name.
- * @param parent The parent FoObj.
- * @param propertyList The property list of the parent FoObj.
- * @return The new FoObj instance for this MathML element.
- * @throws FoTreeException If the parent object is not an instance of
- * {@link InstreamForeignObject4a}.
- */
- public static FoObj makeObject(final String objectName, final FoObj parent,
- final PropertyList propertyList) throws FoTreeException {
- /* We only need to handle one element here, the root element, which is
- * always "math". */
- if (! objectName.equals("math")) {
- throw new IllegalArgumentException("Cannot parse any MathML "
- + "elements except \"math\".");
- }
- /* The PropertyList must be of the unparsed variety. */
- final PropertyListUnparsed propertyListUnparsed
- = (PropertyListUnparsed) propertyList;
- if (parent instanceof InstreamForeignObject4a) {
- final InstreamForeignObject4a ifo =
- (InstreamForeignObject4a) parent;
- return new InstreamMathElement(ifo, propertyListUnparsed);
- } else {
- parent.throwException("Instream MathML content must be inside "
- + "an fo:instream-foreign-object.");
- return null;
- }
- }
-
-}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-12-07 12:16:40 UTC (rev 12798)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-12-07 12:44:25 UTC (rev 12799)
@@ -36,6 +36,8 @@
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
import org.foray.fotree.PropertyListUnparsed;
+import org.foray.fotree.fo.obj.InstreamForeignObject4a;
+import org.foray.fotree.svg.obj.InstreamSvgElement;
import org.axsl.fotree.FoTreeException;
import org.axsl.graphic.SvgGraphic;
@@ -71,7 +73,7 @@
public FoObj parseElementForNS(final FoTree4a foTree, final String localName,
final FoObj currentFObj, final PropertyList list,
final Locator locator) throws FoTreeException {
- return ObjectMakerSvg.makeObject(localName, currentFObj, list);
+ return makeObject(localName, currentFObj, list);
}
@Override
@@ -111,4 +113,38 @@
return NamespaceSvg.theInstance;
}
+ /**
+ * Converts an unparsed SVG element into an FoObj instance that can be added
+ * to the FO Tree.
+ * @param objectName The unparsed SVG element name.
+ * @param parent The parent FoObj.
+ * @param propertyList The property list of the parent FoObj.
+ * @return The new FoObj instance for this SVG element.
+ * @throws FoTreeException If the parent object is not an instance of
+ * {@link InstreamForeignObject4a}.
+ */
+ public FoObj makeObject(final String objectName, final FoObj parent,
+ final PropertyList propertyList) throws FoTreeException {
+ final SvgObject enumeration = SvgObject.svgValueOf(objectName);
+ if (enumeration == null) {
+ return null;
+ }
+ // The PropertyList must be of the unparsed variety
+ final PropertyListUnparsed propertyListUnparsed
+ = (PropertyListUnparsed) propertyList;
+ switch (enumeration) {
+ default: {
+ if (parent instanceof InstreamForeignObject4a) {
+ final InstreamForeignObject4a ifo =
+ (InstreamForeignObject4a) parent;
+ return new InstreamSvgElement(ifo, propertyListUnparsed);
+ } else {
+ parent.throwException("Instream SVG content must be inside "
+ + "an fo:instream-foreign-object.");
+ return null;
+ }
+ }
+ }
+ }
+
}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/ObjectMakerSvg.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/ObjectMakerSvg.java 2022-12-07 12:16:40 UTC (rev 12798)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/ObjectMakerSvg.java 2022-12-07 12:44:25 UTC (rev 12799)
@@ -1,84 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree.svg;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.PropertyList;
-import org.foray.fotree.PropertyListUnparsed;
-import org.foray.fotree.fo.obj.InstreamForeignObject4a;
-import org.foray.fotree.svg.obj.InstreamSvgElement;
-
-import org.axsl.fotree.FoTreeException;
-
-/**
- * Factory class for creating formatting objects in the "svg" namespace.
- */
-public final class ObjectMakerSvg {
-
- /**
- * Private constructor. This is a utility class and should never be
- * instantiated.
- */
- private ObjectMakerSvg() { }
-
- /**
- * Converts an unparsed SVG element into an FoObj instance that can be added
- * to the FO Tree.
- * @param objectName The unparsed SVG element name.
- * @param parent The parent FoObj.
- * @param propertyList The property list of the parent FoObj.
- * @return The new FoObj instance for this SVG element.
- * @throws FoTreeException If the parent object is not an instance of
- * {@link InstreamForeignObject4a}.
- */
- public static FoObj makeObject(final String objectName, final FoObj parent,
- final PropertyList propertyList) throws FoTreeException {
- final SvgObject enumeration = SvgObject.svgValueOf(objectName);
- if (enumeration == null) {
- return null;
- }
- // The PropertyList must be of the unparsed variety
- final PropertyListUnparsed propertyListUnparsed
- = (PropertyListUnparsed) propertyList;
- switch (enumeration) {
- default: {
- if (parent instanceof InstreamForeignObject4a) {
- final InstreamForeignObject4a ifo =
- (InstreamForeignObject4a) parent;
- return new InstreamSvgElement(ifo, propertyListUnparsed);
- } else {
- parent.throwException("Instream SVG content must be inside "
- + "an fo:instream-foreign-object.");
- return null;
- }
- }
- }
- }
-
-}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/NamespaceXml.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/NamespaceXml.java 2022-12-07 12:16:40 UTC (rev 12798)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/NamespaceXml.java 2022-12-07 12:44:25 UTC (rev 12799)
@@ -35,6 +35,7 @@
import org.foray.fotree.Property;
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
+import org.foray.fotree.xml.prop.Lang;
import org.axsl.fotree.FoTreeException;
@@ -88,8 +89,7 @@
final String attributeName, final String attributeValue,
final FoObj fobj, final Locator locator)
throws PropertyException {
- final Property property = PropertyMakerXml.makeProperty(attributeName,
- attributeValue, fobj);
+ final Property property = makeProperty(attributeName, attributeValue, fobj);
return property;
}
@@ -109,4 +109,72 @@
return NamespaceXml.theInstance;
}
+ /**
+ * Converts a property name to its integral equivalent.
+ * @param inputPropertyName The property name to be enumerated.
+ * @return The enumerated value of the property name.
+ */
+ public XmlPropertyId enumeratePropertyName(
+ final String inputPropertyName) {
+ final String propertyName = Property.getBasePropertyName(
+ inputPropertyName);
+ return XmlPropertyId.xmlValueOf(propertyName);
+ }
+
+ /**
+ * Makes a property in this namespace.
+ * @param propertyFullName The unparsed property name.
+ * @param attributeValue The unparsed property value.
+ * @param fobj The FoObj to which this property belongs.
+ * @return The parsed Property instance.
+ * @throws PropertyException For errors in the property or its value.
+ */
+ public Property makeProperty(final String propertyFullName,
+ final String attributeValue, final FoObj fobj)
+ throws PropertyException {
+ final String basePropertyName = Property.getBasePropertyName(
+ propertyFullName);
+ final XmlPropertyId enumeration = enumeratePropertyName(
+ basePropertyName);
+ final Property property = checkCompoundProperty(fobj,
+ enumeration, propertyFullName, attributeValue);
+ if (property != null) {
+ return property;
+ }
+ if (enumeration == null) {
+ throw new PropertyException("Invalid property for xml namespace: "
+ + propertyFullName);
+ }
+ switch (enumeration) {
+ case LANG: {
+ return new Lang(fobj, propertyFullName, attributeValue);
+ }
+ default: {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Checks to see if the property has already been created. If it has, and
+ * if it is a compound property, sets the value for this component.
+ * @param fobj The FoObj to which this property belongs.
+ * @param enumeration The parsed property type.
+ * @param propertyFullName The full unparsed name of the property.
+ * @param attributeValue The unparsed property value.
+ * @return The parsed property.
+ * @throws PropertyException For errors in the property or its value.
+ */
+ private Property checkCompoundProperty(final FoObj fobj,
+ final XmlPropertyId enumeration, final String propertyFullName,
+ final String attributeValue) throws PropertyException {
+ if (enumeration == null) {
+ return null;
+ }
+ switch (enumeration) {
+ default:
+ return null;
+ }
+ }
+
}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/PropertyMakerXml.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/PropertyMakerXml.java 2022-12-07 12:16:40 UTC (rev 12798)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/PropertyMakerXml.java 2022-12-07 12:44:25 UTC (rev 12799)
@@ -1,115 +0,0 @@
-/*
- * Copyright 2004 The FOray Project.
- * http://www.foray.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree.xml;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.Property;
-import org.foray.fotree.PropertyException;
-import org.foray.fotree.xml.prop.Lang;
-
-/**
- * Class for parsing attributes in the xml: namespace.
- */
-public final class PropertyMakerXml {
-
- /**
- * Private constructor. This is a utility class and should never be
- * instantiated.
- */
- private PropertyMakerXml() { }
-
- /**
- * Converts a property name to its integral equivalent.
- * @param inputPropertyName The property name to be enumerated.
- * @return The enumerated value of the property name.
- */
- public static XmlPropertyId enumeratePropertyName(
- final String inputPropertyName) {
- final String propertyName = Property.getBasePropertyName(
- inputPropertyName);
- return XmlPropertyId.xmlValueOf(propertyName);
- }
-
- /**
- * Makes a property in this namespace.
- * @param propertyFullName The unparsed property name.
- * @param attributeValue The unparsed property value.
- * @param fobj The FoObj to which this property belongs.
- * @return The parsed Property instance.
- * @throws PropertyException For errors in the property or its value.
- */
- public static Property makeProperty(final String propertyFullName,
- final String attributeValue, final FoObj fobj)
- throws PropertyException {
- final String basePropertyName = Property.getBasePropertyName(
- propertyFullName);
- final XmlPropertyId enumeration = enumeratePropertyName(
- basePropertyName);
- final Property property = checkCompoundProperty(fobj,
- enumeration, propertyFullName, attributeValue);
- if (property != null) {
- return property;
- }
- if (enumeration == null) {
- throw new PropertyException("Invalid property for xml namespace: "
- + propertyFullName);
- }
- switch (enumeration) {
- case LANG: {
- return new Lang(fobj, propertyFullName, attributeValue);
- }
- default: {
- return null;
- }
- }
- }
-
- /**
- * Checks to see if the property has already been created. If it has, and
- * if it is a compound property, sets the value for this component.
- * @param fobj The FoObj to which this property belongs.
- * @param enumeration The parsed property type.
- * @param propertyFullName The full unparsed name of the property.
- * @param attributeValue The unparsed property value.
- * @return The parsed property.
- * @throws PropertyException For errors in the property or its value.
- */
- private static Property checkCompoundProperty(final FoObj fobj,
- final XmlPropertyId enumeration, final String propertyFullName,
- final String attributeValue) throws PropertyException {
- if (enumeration == null) {
- return null;
- }
- switch (enumeration) {
- default:
- return null;
- }
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|