[FOray-commit] SF.net SVN: foray:[12773] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2022-12-03 21:57:19
|
Revision: 12773
http://sourceforge.net/p/foray/code/12773
Author: victormote
Date: 2022-12-03 21:57:16 +0000 (Sat, 03 Dec 2022)
Log Message:
-----------
Fixes to property handling in the axsl namespace.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
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/axsl/obj/Metadata4a.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2022-12-03 20:53:53 UTC (rev 12772)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/AbstractAreaTreeTest.java 2022-12-03 21:57:16 UTC (rev 12773)
@@ -64,9 +64,8 @@
* @throws FontException For errors during server creation.
*/
protected FontServer4a getFontServer() throws FontException {
- final FontServer4a fontServer = new FontServer4a();
-// fontServer.setup(null, null);
- return fontServer;
+ /* Use the basic font server. No need to configure additional fonts for this set of testing. */
+ return new FontServer4a();
}
/**
Modified: 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-03 20:53:53 UTC (rev 12772)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/ObjectMakerAxsl.java 2022-12-03 21:57:16 UTC (rev 12773)
@@ -61,7 +61,7 @@
switch (enumeration) {
case METADATA: {
if (parent instanceof Declarations4a) {
- return new Metadata4a((Declarations4a) parent);
+ return new Metadata4a((Declarations4a) parent, propertyList);
}
throw new IllegalArgumentException("Parent of " + Metadata4a.class.getName() + " must be instance of "
+ Declarations4a.class.getName());
Modified: 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-03 20:53:53 UTC (rev 12772)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/PropertyMakerAxsl.java 2022-12-03 21:57:16 UTC (rev 12773)
@@ -39,8 +39,7 @@
public final class PropertyMakerAxsl {
/**
- * Private constructor. This is a utility class and should never be
- * instantiated.
+ * Private constructor. This is a utility class and should never be instantiated.
*/
private PropertyMakerAxsl() { }
@@ -49,10 +48,8 @@
* @param inputPropertyName The property name to be enumerated.
* @return The enumerated value of the property name.
*/
- public static AxslProperty enumeratePropertyName(
- final String inputPropertyName) {
- final String propertyName = Property.getBasePropertyName(
- inputPropertyName);
+ public static AxslProperty enumeratePropertyName(final String inputPropertyName) {
+ final String propertyName = Property.getBasePropertyName(inputPropertyName);
return AxslProperty.xslValueOf(propertyName);
}
@@ -64,26 +61,20 @@
* @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)
+ public static Property makeProperty(final String propertyFullName, final String attributeValue, final FoObj fobj)
throws PropertyException {
- final String basePropertyName = Property.getBasePropertyName(
- propertyFullName);
- final AxslProperty enumeration = enumeratePropertyName(
- basePropertyName);
- final Property property = checkCompoundProperty(fobj,
- enumeration, propertyFullName, attributeValue);
+ final String basePropertyName = Property.getBasePropertyName(propertyFullName);
+ final AxslProperty 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);
+ throw new PropertyException("Invalid property for axsl namespace: " + propertyFullName);
}
switch (enumeration) {
case METADATA_KEY: {
- return new MetadataKey(fobj, propertyFullName,
- attributeValue);
+ return new MetadataKey(fobj, propertyFullName, attributeValue);
}
default: {
return null;
@@ -92,8 +83,8 @@
}
/**
- * 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.
+ * 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.
@@ -101,9 +92,8 @@
* @return The parsed property.
* @throws PropertyException For errors in the property or its value.
*/
- private static Property checkCompoundProperty(final FoObj fobj,
- final AxslProperty enumeration, final String propertyFullName,
- final String attributeValue) throws PropertyException {
+ private static Property checkCompoundProperty(final FoObj fobj, final AxslProperty enumeration,
+ final String propertyFullName, final String attributeValue) throws PropertyException {
if (enumeration == null) {
return null;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/obj/Metadata4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/obj/Metadata4a.java 2022-12-03 20:53:53 UTC (rev 12772)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/obj/Metadata4a.java 2022-12-03 21:57:16 UTC (rev 12773)
@@ -35,9 +35,8 @@
import org.foray.fotree.axsl.AxslProperty;
import org.foray.fotree.axsl.AxslValue;
import org.foray.fotree.axsl.prop.AxslEnumerated;
-import org.foray.fotree.fo.obj.AbstractCharacterSequence;
import org.foray.fotree.fo.obj.Declarations4a;
-import org.foray.fotree.fo.obj.FoTextCharacters4a;
+import org.foray.fotree.fo.obj.FoText4a;
import org.axsl.fotree.FoContext;
import org.axsl.fotree.FoTreeException;
@@ -55,19 +54,24 @@
*/
public class Metadata4a extends FoObj implements Metadata {
+ /** The property list for this object. */
+ private PropertyList propertyList;
+
/** The parent of this node. */
private Declarations4a parent;
/** The children of this object. */
- private List<AbstractCharacterSequence> children = new ArrayList<AbstractCharacterSequence>(1);
+ private List<FoText4a> children = new ArrayList<FoText4a>(1);
/**
* Constructor.
* @param parent The parent FoObj.
+ * @param propertyList The property list for this FoObj.
*/
- public Metadata4a(final Declarations4a parent) {
+ public Metadata4a(final Declarations4a parent, final PropertyList propertyList) {
super(parent);
this.parent = parent;
+ this.propertyList = propertyList;
}
@Override
@@ -99,7 +103,7 @@
@Override
protected void validateDescendants() throws FoTreeException {
if (this.getChildren().size() != 1
- || ! (this.formattingObjectChildAt(0) instanceof FoTextCharacters4a)) {
+ || ! (this.formattingObjectChildAt(0) instanceof FoText4a)) {
throwException("The content model for " + this.getFullName()
+ " is: (#PCDATA).");
}
@@ -141,9 +145,8 @@
@Override
public String getMetadataValue() {
/* Existence and casting verified at validateDescendants(). */
- final FoTextCharacters4a text =
- (FoTextCharacters4a) this.formattingObjectChildAt(0);
- return text.getRefinedText(null).toString();
+ final FoText4a text = (FoText4a) this.formattingObjectChildAt(0);
+ return text.toString();
}
/**
@@ -188,14 +191,14 @@
}
@Override
- public List<AbstractCharacterSequence> getChildren() {
+ public List<FoText4a> getChildren() {
return this.children;
}
@Override
public void addChild(final FoObj fobj) throws FoTreeException {
- if (fobj instanceof AbstractCharacterSequence) {
- this.children.add((AbstractCharacterSequence) fobj);
+ if (fobj instanceof FoText4a) {
+ this.children.add((FoText4a) fobj);
} else {
fobj.throwException("Violation of parent (" + fobj.getFullName() + ")content model.");
}
@@ -223,7 +226,7 @@
@Override
public PropertyList getPropertyList() {
- return null;
+ return this.propertyList;
}
@Override
@@ -233,7 +236,7 @@
@Override
public boolean canHavePcdataChildren() {
- return false;
+ return true;
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|