foray-commit Mailing List for FOray (Page 39)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(2) |
Dec
|
|
From: <vic...@us...> - 2022-12-23 18:06:04
|
Revision: 12926
http://sourceforge.net/p/foray/code/12926
Author: victormote
Date: 2022-12-23 18:06:01 +0000 (Fri, 23 Dec 2022)
Log Message:
-----------
Remove no-longer-needed FoObj method parameters.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/AbstractAxslProperty.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/AbstractFoProperty.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/AbstractXmlProperty.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/AbstractAxslProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/AbstractAxslProperty.java 2022-12-23 17:54:48 UTC (rev 12925)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/AbstractAxslProperty.java 2022-12-23 18:06:01 UTC (rev 12926)
@@ -58,8 +58,7 @@
if (pv != null) {
return pv;
}
- pv = PropertyParser.parse(fobj, rawPropertyValue,
- this.getPropertyType());
+ pv = PropertyParser.parse(rawPropertyValue, this.getPropertyType());
return pv;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/AbstractFoProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/AbstractFoProperty.java 2022-12-23 17:54:48 UTC (rev 12925)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/AbstractFoProperty.java 2022-12-23 18:06:01 UTC (rev 12926)
@@ -82,7 +82,7 @@
if (pv != null) {
return pv;
}
- return PropertyParser.parse(fobj, rawPropertyValue, this.getPropertyType());
+ return PropertyParser.parse(rawPropertyValue, this.getPropertyType());
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java 2022-12-23 17:54:48 UTC (rev 12925)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java 2022-12-23 18:06:01 UTC (rev 12926)
@@ -29,7 +29,6 @@
package org.foray.fotree.parse;
-import org.foray.fotree.FoObj;
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyId;
import org.foray.fotree.value.DtColor;
@@ -71,16 +70,14 @@
/**
* Public entrypoint to the Property expression parser.
* @param expr The specified value (attribute on the xml element).
- * @param fobj The parent FoObj of the expression being parsed.
* @param propertyType The property type for which the value is being parsed.
* This is needed for some functions, for example "from-parent".
* @return A PropertyValue instance holding the parsed result.
* @throws PropertyException If the "expr" cannot be parsed as a Property.
*/
- public static PropertyValue parse(final FoObj fobj, final String expr, final PropertyId propertyType)
- throws PropertyException {
+ public static PropertyValue parse(final String expr, final PropertyId propertyType) throws PropertyException {
final PropertyParser parser = new PropertyParser(expr);
- PropertyValue pv = parser.parseProperty(fobj, propertyType);
+ PropertyValue pv = parser.parseProperty(propertyType);
if (pv == null) {
pv = new DtString(expr);
}
@@ -90,12 +87,11 @@
/**
* Parse the property expression described in the instance variables.
* Note: If the property expression String is empty, a StringProperty object holding an empty String is returned.
- * @param fobj The FoObj of the expression being parsed.
* @param propertyType The property type for which the value is being parsed.
* @return A Property object holding the parsed result.
* @throws PropertyException If the "expr" cannot be parsed as a Property.
*/
- private PropertyValue parseProperty(final FoObj fobj, final PropertyId propertyType) throws PropertyException {
+ private PropertyValue parseProperty(final PropertyId propertyType) throws PropertyException {
next();
if (getCurrentToken() == Token.EOF) {
// if prop value is empty string, force to StringProperty
@@ -102,7 +98,7 @@
return new DtString("");
}
while (true) {
- final PropertyValue prop = parseAdditiveExpr(fobj, propertyType);
+ final PropertyValue prop = parseAdditiveExpr(propertyType);
if (getCurrentToken() == Token.EOF) {
return prop;
}
@@ -117,25 +113,24 @@
/**
* Parse an addition or subtraction expression.
- * @param fobj The FoObj of the expression being parsed.
* @param propertyType The property type for which the value is being parsed.
* @return The expression parsed.
* @throws PropertyException For errors parsing the expression.
*/
- private ExprAdditive parseAdditiveExpr(final FoObj fobj, final PropertyId propertyType) throws PropertyException {
+ private ExprAdditive parseAdditiveExpr(final PropertyId propertyType) throws PropertyException {
// Evaluate and put result on the operand stack
- ExprAdditive prop = parseMultiplicativeExpr(fobj, propertyType);
+ ExprAdditive prop = parseMultiplicativeExpr(propertyType);
loop:
for (;;) {
switch (getCurrentToken()) {
case PLUS:
next();
- prop = evalAddition(prop, parseMultiplicativeExpr(fobj, propertyType));
+ prop = evalAddition(prop, parseMultiplicativeExpr(propertyType));
break;
case MINUS:
next();
prop =
- evalSubtraction(prop, parseMultiplicativeExpr(fobj, propertyType));
+ evalSubtraction(prop, parseMultiplicativeExpr(propertyType));
break;
default:
break loop;
@@ -146,28 +141,27 @@
/**
* Parse a multiply, divide or modulo expression.
- * @param fobj The FoObj of the expression being parsed.
* @param propertyType The property type for which the value is being parsed.
* @return The expression parsed.
* @throws PropertyException For errors parsing the expression.
*/
- private ExprMultiplicative parseMultiplicativeExpr(final FoObj fobj, final PropertyId propertyType)
+ private ExprMultiplicative parseMultiplicativeExpr(final PropertyId propertyType)
throws PropertyException {
- ExprMultiplicative prop = parseUnaryExpr(fobj, propertyType);
+ ExprMultiplicative prop = parseUnaryExpr(propertyType);
loop:
for (;;) {
switch (getCurrentToken()) {
case DIV:
next();
- prop = evalDivide(prop, parseUnaryExpr(fobj, propertyType));
+ prop = evalDivide(prop, parseUnaryExpr(propertyType));
break;
case MOD:
next();
- prop = evalModulo(prop, parseUnaryExpr(fobj, propertyType));
+ prop = evalModulo(prop, parseUnaryExpr(propertyType));
break;
case MULTIPLY:
next();
- prop = evalMultiply(prop, parseUnaryExpr(fobj, propertyType));
+ prop = evalMultiply(prop, parseUnaryExpr(propertyType));
break;
default:
break loop;
@@ -178,17 +172,16 @@
/**
* Parse a unary minus expression.
- * @param fobj The FoObj of the expression being parsed.
* @param propertyType The property type for which the value is being parsed.
* @return The expression parsed.
* @throws PropertyException For errors parsing the expression.
*/
- private ExprUnary parseUnaryExpr(final FoObj fobj, final PropertyId propertyType) throws PropertyException {
+ private ExprUnary parseUnaryExpr(final PropertyId propertyType) throws PropertyException {
if (getCurrentToken() == Token.MINUS) {
next();
- return evalNegate(parseUnaryExpr(fobj, propertyType));
+ return evalNegate(parseUnaryExpr(propertyType));
}
- return parsePrimaryExpr(fobj, propertyType);
+ return parsePrimaryExpr(propertyType);
}
@@ -209,12 +202,11 @@
* Parse a primary expression.
* A primary expression is either a parenthesized expression or an expression representing a primitive Property
* datatype, such as a string literal, an NCname, a number or a unit expression, or a function call expression.
- * @param fobj The FoObj of the expression being parsed.
* @param propertyType The property type for which the value is being parsed.
* @return The expression parsed.
* @throws PropertyException For errors parsing the expression.
*/
- private ExprPrimary parsePrimaryExpr(final FoObj fobj, final PropertyId propertyType)
+ private ExprPrimary parsePrimaryExpr(final PropertyId propertyType)
throws PropertyException {
final ExprPrimary prop;
final Token currentToken = this.getCurrentToken();
@@ -221,7 +213,7 @@
switch (currentToken) {
case LPAR:
next();
- prop = parseInnerExpression(fobj, propertyType);
+ prop = parseInnerExpression(propertyType);
expectRpar();
return prop;
@@ -270,7 +262,7 @@
case FUNCTION_LPAR: {
next();
final String functionType = getCurrentTokenValue();
- final Expr[] functionArguments = parseArgs(fobj, propertyType);
+ final Expr[] functionArguments = parseArgs(propertyType);
final Function function = Function.makeFunction(functionType, functionArguments, propertyType);
if (function == null) {
throw new PropertyException("No such function: " + getCurrentTokenValue());
@@ -286,13 +278,12 @@
/**
* Parse an inner expression.
- * @param fobj The FoObj of the expression being parsed.
* @param propertyType The property type for which the value is being parsed.
* @return The expression parsed.
* @throws PropertyException For errors parsing the expression.
*/
- private ExprInner parseInnerExpression(final FoObj fobj, final PropertyId propertyType) throws PropertyException {
- final ExprAdditive expr = parseAdditiveExpr(fobj, propertyType);
+ private ExprInner parseInnerExpression(final PropertyId propertyType) throws PropertyException {
+ final ExprAdditive expr = parseAdditiveExpr(propertyType);
return new ExprInner(expr);
}
@@ -304,11 +295,10 @@
* It simply parses them and passes them on.
* They can be counted and evaluated downstream.
* @param propertyType The property type for which the value is being parsed.
- * @param fobj The FoObj of the expression being parsed.
* @return An array of PropertyValue instances representing the arguments found.
* @throws PropertyException If the number of arguments found isn't equal to the number expected.
*/
- Expr[] parseArgs(final FoObj fobj, final PropertyId propertyType) throws PropertyException {
+ Expr[] parseArgs(final PropertyId propertyType) throws PropertyException {
final List<PropertyValue> args = new ArrayList<PropertyValue>();
PropertyValue prop;
if (getCurrentToken() == Token.RPAR) {
@@ -316,7 +306,7 @@
next();
} else {
while (true) {
- prop = parseAdditiveExpr(fobj, propertyType);
+ prop = parseAdditiveExpr(propertyType);
args.add(prop);
if (getCurrentToken() != Token.COMMA) {
break;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/AbstractXmlProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/AbstractXmlProperty.java 2022-12-23 17:54:48 UTC (rev 12925)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/AbstractXmlProperty.java 2022-12-23 18:06:01 UTC (rev 12926)
@@ -54,8 +54,7 @@
if (pv != null) {
return pv;
}
- pv = PropertyParser.parse(fobj, rawPropertyValue,
- this.getPropertyType());
+ pv = PropertyParser.parse(rawPropertyValue, getPropertyType());
return pv;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-23 17:54:53
|
Revision: 12925
http://sourceforge.net/p/foray/code/12925
Author: victormote
Date: 2022-12-23 17:54:48 +0000 (Fri, 23 Dec 2022)
Log Message:
-----------
Move validation of property values out of the property parser and into the function classes.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColWidth.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java 2022-12-23 17:10:20 UTC (rev 12924)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java 2022-12-23 17:54:48 UTC (rev 12925)
@@ -32,7 +32,6 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyId;
-import org.foray.fotree.fo.obj.TableColumn4a;
import org.foray.fotree.value.DtColor;
import org.foray.fotree.value.DtInteger;
import org.foray.fotree.value.DtLength;
@@ -52,10 +51,6 @@
import org.foray.fotree.value.Function;
import org.foray.fotree.value.PropertyValue;
-import org.axsl.fotree.fo.ListItem;
-import org.axsl.fotree.fo.Table;
-import org.axsl.value.TableLayout;
-
import java.util.ArrayList;
import java.util.List;
@@ -280,7 +275,6 @@
if (function == null) {
throw new PropertyException("No such function: " + getCurrentTokenValue());
}
- validateFunctionHeritage(functionType, fobj);
return function;
}
default:
@@ -291,68 +285,6 @@
}
/**
- * Validates any restrictions that are placed on a function for which
- * objects or properties it can be used with.
- * @param functionType The enumerated function.
- * @param fobj The parent FoObj of the expression being parsed.
- * @throws PropertyException For invalid uses of the function.
- */
- private void validateFunctionHeritage(final String functionType, final FoObj fobj) throws PropertyException {
- switch (functionType) {
- case "body-start": {
- /* TODO: Provide the right context. */
- final ListItem listItem = fobj.getNearestListItem(null);
- if (listItem == null) {
- throw new PropertyException("body-start() called from outside "
- + "an fo:list-item");
- }
- break;
- }
- case "label-end": {
- /* TODO: Provide the right context. */
- final ListItem listItem = fobj.getNearestListItem(null);
- if (listItem == null) {
- throw new PropertyException("label-end() called from outside "
- + "an fo:list-item");
- }
- break;
- }
- case "proportional-column-width": {
- /* Per the XSL-FO standard 1.0, Section 5.10.4, it is an error for
- * this function to be used by anything but a table-column. */
- if (! (fobj instanceof TableColumn4a)) {
- throw new PropertyException(
- "Function 'proportional-column-width' "
- + "is only valid for object 'fo:table-column'.");
- }
- /* Per the XSL-FO standard 1.0, Section 5.10.4, it is an error for
- * this function to be used within a table unless the table-layout
- * is "fixed".
- */
- Table table = null;
- if (fobj instanceof Table) {
- table = (Table) fobj;
- } else {
- /* TODO: Provide the right context. */
- table = fobj.ancestorTable(null);
- }
- if (table == null) {
- throw new PropertyException("Ancestor 'table' object not found "
- + "for function \"proportional-column-width\".");
- }
- if (table.traitTableLayout() != TableLayout.FIXED) {
- throw new PropertyException("Table layout must be \"fixed\" "
- + "for function \"proportional-column-width\".");
- }
- break;
- }
- default: {
- return;
- }
- }
- }
-
- /**
* Parse an inner expression.
* @param fobj The FoObj of the expression being parsed.
* @param propertyType The property type for which the value is being parsed.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-23 17:10:20 UTC (rev 12924)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-23 17:54:48 UTC (rev 12925)
@@ -33,6 +33,7 @@
import org.axsl.constants.TypographicConstants;
import org.axsl.fotree.FoContext;
+import org.axsl.fotree.fo.ListItem;
import java.awt.Color;
@@ -153,4 +154,13 @@
throw evalPercentageException();
}
+ @Override
+ public boolean isValidForObject(final FoObj fobj) {
+ final ListItem listItem = fobj.getNearestListItem(null);
+ if (listItem == null) {
+ return false;
+ }
+ return true;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-23 17:10:20 UTC (rev 12924)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-23 17:54:48 UTC (rev 12925)
@@ -34,6 +34,7 @@
import org.axsl.constants.TypographicConstants;
import org.axsl.fotree.FoContext;
import org.axsl.fotree.fo.ListBlock;
+import org.axsl.fotree.fo.ListItem;
import java.awt.Color;
@@ -157,4 +158,13 @@
throw evalPercentageException();
}
+ @Override
+ public boolean isValidForObject(final FoObj fobj) {
+ final ListItem listItem = fobj.getNearestListItem(null);
+ if (listItem == null) {
+ return false;
+ }
+ return true;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColWidth.java 2022-12-23 17:10:20 UTC (rev 12924)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColWidth.java 2022-12-23 17:54:48 UTC (rev 12925)
@@ -28,8 +28,13 @@
package org.foray.fotree.value;
+import org.foray.fotree.FoObj;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.obj.TableColumn4a;
+import org.axsl.fotree.fo.Table;
+import org.axsl.value.TableLayout;
+
import java.awt.Color;
/**
@@ -134,4 +139,31 @@
throw evalPercentageException();
}
+ @Override
+ public boolean isValidForObject(final FoObj fobj) {
+ /* Per the XSL-FO standard 1.0, Section 5.10.4, it is an error for
+ * this function to be used by anything but a table-column. */
+ if (! (fobj instanceof TableColumn4a)) {
+ return false;
+ }
+ /* Per the XSL-FO standard 1.0, Section 5.10.4, it is an error for
+ * this function to be used within a table unless the table-layout
+ * is "fixed".
+ */
+ Table table = null;
+ if (fobj instanceof Table) {
+ table = (Table) fobj;
+ } else {
+ /* TODO: Provide the right context. */
+ table = fobj.ancestorTable(null);
+ }
+ if (table == null) {
+ return false;
+ }
+ if (table.traitTableLayout() != TableLayout.FIXED) {
+ return false;
+ }
+ return true;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-23 17:10:22
|
Revision: 12924
http://sourceforge.net/p/foray/code/12924
Author: victormote
Date: 2022-12-23 17:10:20 +0000 (Fri, 23 Dec 2022)
Log Message:
-----------
Add mechanism to validate property values, mostly so that functions can report if their ancestry is invalid.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-23 15:27:26 UTC (rev 12923)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-23 17:10:20 UTC (rev 12924)
@@ -466,6 +466,22 @@
protected abstract void validateProperties() throws FoTreeException;
/**
+ * Checks each property value for validity when applied to this object.
+ * This is useful mostly at parse time, and mostly for functions that require specific ancestors.
+ * @throws FoTreeException If an property value attached to this object is not valid.
+ */
+ protected void validatePropertyValues() throws FoTreeException {
+ final PropertyList properties = getPropertyList();
+ for (int index = 0; index < properties.qtyProperties(); index ++) {
+ final Property property = properties.getProperty(index);
+ if (! property.value().isValidForObject(this)) {
+ this.throwExceptionContentModelViolation();
+ }
+ }
+ }
+
+
+ /**
* A hook into the parsing process which allows the subclass instance to do some initialization-type work after all
* of the properties have been parsed, but before any of the children have been parsed.
* @throws FoTreeException For errors during initialization.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-23 15:27:26 UTC (rev 12923)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-23 17:10:20 UTC (rev 12924)
@@ -340,6 +340,7 @@
nativeNamespace.parseAttributes(list, attlist, fobj, getLocator(), this, this);
}
fobj.validateProperties();
+ fobj.validatePropertyValues();
/* If the parent is not null (which it can be for Root), register
* the newly-created object as a child of the parent. */
if (this.currentFObj != null) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-23 15:27:26 UTC (rev 12923)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-23 17:10:20 UTC (rev 12924)
@@ -329,6 +329,15 @@
}
/**
+ * Returns the property at a given index in this list.
+ * @param index The index of the property to be returned.
+ * @return The property at index {@code index}.
+ */
+ public Property getProperty(final int index) {
+ return this.properties.get(index);
+ }
+
+ /**
* Returns the text decoration property.
* @param fobj The FoObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context issues.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-23 15:27:26 UTC (rev 12923)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-23 17:10:20 UTC (rev 12924)
@@ -28,6 +28,8 @@
package org.foray.fotree.value;
+import org.foray.fotree.FoObj;
+
import java.awt.Color;
/**
@@ -158,4 +160,15 @@
*/
PvKeyword evalKeyword();
+ /**
+ * Indicates whether this function can be evaluated in the context of a given object.
+ * For example, some functions require specific ancestors, which, if not present, are an error.
+ * This method is probably only used at parse time.
+ * @param fobj The object being evaluated, usually the object to which this value's property is attached.
+ * @return True if and only if this function can be evaluated relative to {@code fobj}.
+ */
+ default boolean isValidForObject(FoObj fobj) {
+ return true;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-23 15:27:29
|
Revision: 12923
http://sourceforge.net/p/foray/code/12923
Author: victormote
Date: 2022-12-23 15:27:26 +0000 (Fri, 23 Dec 2022)
Log Message:
-----------
Remove unnecessary FoObj instances as method parameters.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/prop/AxslEnumerated.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteOffset.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBackgroundPosition.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBoolean.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorder.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderPrecedence.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderStyle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractCharacter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractContentDimension.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractCue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractEnumeration.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractIndent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractKeep.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractMargin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractName.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPadding.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPageDimension.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentAdjust.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentBaseline.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackground.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundImage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBaselineShift.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderSeparation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderSpacing.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderStyle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarOffset.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarPlacement.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarStyle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdClip.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnCount.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnGap.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentType.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdCountry.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdDestinationPlacementOffset.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdDisplayAlign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdElevation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdExtent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontFamily.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSize.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSizeAdjust.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontStretch.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontStyle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontVariant.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontWeight.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdForcePageCount.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdGroupingSize.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationLadderCount.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationPushCharacterCount.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationRemainCharacterCount.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdId.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdInitialPageNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdIntrinsicScaleValue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdIntrusionDisplace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLanguage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLastLineEndIndent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderPatternWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLetterSpacing.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdMargin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdMaximumRepeats.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberColumnsRepeated.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberColumnsSpanned.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberRowsSpanned.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdOrphans.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPadding.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPlayDuring.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdProvisionalDistanceBetweenStarts.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdProvisionalLabelSeparation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdRefId.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdRegionName.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdRole.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdRuleThickness.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdScript.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSize.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSourceDocument.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSwitchTo.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTableLayout.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextAlign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextAlignLast.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextAltitude.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDecoration.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDepth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextIndent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextShadow.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTreatAsWordSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVerticalAlign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVoiceFamily.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdWidows.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdWordSpacing.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdWritingMode.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdZindex.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -43,8 +43,7 @@
*/
public abstract class Property {
- /** Constant defining a precedence of "force" (the maximum integer
- * value). */
+ /** Constant defining a precedence of "force" (the maximum integer value). */
public static final int PRECEDENCE_FORCE = Integer.MAX_VALUE;
/**
@@ -54,20 +53,17 @@
public abstract PropertyId getPropertyType();
/**
- * Convenience method which returns an exception indicating that the value
- * of this property does not meet the properties requirements.
+ * Convenience method which returns an exception indicating that the value of this property does not meet the
+ * property's requirements.
* @param value The unparsed property value.
- * @param fobj The FoObj to which this property belongs.
* @return The newly-constructed exception.
*/
- protected PropertyException unexpectedValue(final String value,
- final FoObj fobj) {
+ protected PropertyException unexpectedValue(final String value) {
return unexpectedValue(value, (String) null);
}
/**
- * Returns an exception indicating that the value of this property does not
- * meet the property's requirements.
+ * Returns an exception indicating that the value of this property does not meet the property's requirements.
* @param value The unparsed property value.
* @param reason The reason for the failure.
* @return The newly-constructed exception.
@@ -96,8 +92,7 @@
}
/**
- * Returns an exception indicating that the passed property name is not
- * valid.
+ * Returns an exception indicating that the passed property name is not valid.
* @param propertyName The name of the property that is not valid.
* @return The newly-created exception.
*/
@@ -108,10 +103,8 @@
}
/**
- * Returns an {@link IllegalStateException} indicating that the stored value
- * is not expected at retrieval time.
- * @return An IllegalStateException instance that can be thrown by
- * subclasses.
+ * Returns an {@link IllegalStateException} indicating that the stored value is not expected at retrieval time.
+ * @return An IllegalStateException instance that can be thrown by subclasses.
*/
protected IllegalStateException unexpectedRetrieval() {
return new IllegalStateException("Unexpected property value while "
@@ -122,14 +115,11 @@
}
/**
- * Returns an {@link IllegalArgumentException} indicating that the arguments
- * presented for retrieving an initial value for a given property are not
- * valid.
- * @param propertyType The property type for which the initial value is
- * being obtained.
+ * Returns an {@link IllegalArgumentException} indicating that the arguments presented for retrieving an initial
+ * value for a given property are not valid.
+ * @param propertyType The property type for which the initial value is being obtained.
* @param theClass The class reporting the illegal argument exception.
- * @return An IllegalArgumentException instance that can be thrown by
- * subclasses.
+ * @return An IllegalArgumentException instance that can be thrown by subclasses.
*/
protected static IllegalArgumentException unexpectedInitialValueArgument(
final PropertyId propertyType,
@@ -142,12 +132,10 @@
}
/**
- * Searches an array of keywords to see if a keyword candidate is found in
- * that list.
+ * Searches an array of keywords to see if a keyword candidate is found in that list.
* @param possibleKeyword The candidate keyword being tested.
* @param validKeywords The array of valid keywords.
- * @return If found, returns the index into {@code validKeywords},
- * otherwise returns -1.
+ * @return If found, returns the index into {@code validKeywords}, otherwise returns -1.
*/
public static int getKeywordIndex(final FoValue possibleKeyword,
final FoValue[] validKeywords) {
@@ -164,8 +152,7 @@
}
/**
- * Determines whether a given keyword is included in a given keyword
- * set.
+ * Determines whether a given keyword is included in a given keyword set.
* @param keyword The keyword whose inclusion is being tested.
* @param keywordSet The array of keywords that is being tested against.
* @return The keyword if it is found, or null if it is not.
@@ -181,11 +168,9 @@
}
/**
- * Determines whether a given keyword index is included in a given keyword
- * set.
+ * Determines whether a given keyword index is included in a given keyword set.
* @param keyword The keyword index whose inclusion is being tested.
- * @param keywordSet The short array that keywordIndex is being tested
- * against.
+ * @param keywordSet The short array that keywordIndex is being tested against.
* @return True if keywordIndex is found in keywordSet, false otherwise.
*/
public static boolean keywordInSet(final FoValue keyword,
@@ -194,12 +179,10 @@
}
/**
- * Find the "base" portion of the property Name. For example, for the
- * property "inline-progression-dimension.minimum", the base portion is
- * "inline-progression-dimension".
+ * Find the "base" portion of the property Name. For example, for the property
+ * "inline-progression-dimension.minimum", the base portion is "inline-progression-dimension".
* @param propertyName The raw, unparsed property name.
- * @return The "base" portion of the property Name, or null if the input
- * is null.
+ * @return The "base" portion of the property Name, or null if the input is null.
*/
public static String getBasePropertyName(final String propertyName) {
if (propertyName == null) {
@@ -213,12 +196,10 @@
}
/**
- * Find the "sub" portion of the property Name. For example, for the
- * property "inline-progression-dimension.minimum", the sub portion is
- * "minimum".
+ * Find the "sub" portion of the property Name. For example, for the property
+ * "inline-progression-dimension.minimum", the sub portion is "minimum".
* @param propertyName The raw, unparsed property name.
- * @return The "sub" portion of the property Name, or null if the input
- * is null, or if there is no sub-property.
+ * @return The "sub" portion of the property Name, or null if the input is null, or if there is no sub-property.
*/
public static String getSubPropertyName(final String propertyName) {
if (propertyName == null) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/prop/AxslEnumerated.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/prop/AxslEnumerated.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/prop/AxslEnumerated.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -72,7 +72,7 @@
if (pv instanceof AxslPropertyKeyword) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -102,7 +102,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteOffset.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteOffset.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteOffset.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -87,7 +87,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -91,7 +91,7 @@
if (pv != null) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
@@ -107,7 +107,7 @@
final ValueCollection collection = new ValueCollection();
final StringTokenizer tokenizer = new StringTokenizer(attributeValue);
if (tokenizer.countTokens() < 1) {
- throw unexpectedValue(attributeValue, fobj);
+ throw unexpectedValue(attributeValue);
}
while (tokenizer.hasMoreTokens()) {
final String token = tokenizer.nextToken();
@@ -134,7 +134,7 @@
if (pv.canEvalPercentage()) {
return pv;
}
- throw unexpectedValue(token, fobj);
+ throw unexpectedValue(token);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -92,7 +92,7 @@
return pv;
}
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBackgroundPosition.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBackgroundPosition.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBackgroundPosition.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -80,7 +80,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBoolean.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBoolean.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBoolean.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -82,7 +82,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorder.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorder.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorder.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -101,7 +101,7 @@
while (st.hasMoreTokens()) {
final Property property = parseToken(fobj, st.nextToken());
if (property == null) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
if (collection == null) {
collection = new PropertyCollection();
@@ -111,7 +111,7 @@
if (collection != null) {
return collection;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderColor.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderColor.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -90,7 +90,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderPrecedence.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderPrecedence.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderPrecedence.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -112,7 +112,7 @@
if (pv.canEvalInteger()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderStyle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderStyle.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderStyle.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -99,7 +99,7 @@
if (this.canEvalBorderStyle(pv)) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderWidth.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderWidth.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -103,7 +103,7 @@
if (this.isKeywordInherit(pv)) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractCharacter.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractCharacter.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractCharacter.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -77,7 +77,7 @@
if (value.length() == 1) {
return new DtCharacter(value.charAt(0));
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractContentDimension.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractContentDimension.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractContentDimension.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -89,7 +89,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractCue.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractCue.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractCue.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -99,7 +99,7 @@
if (pv instanceof DtUri) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
@@ -114,7 +114,7 @@
final String value) throws PropertyException {
final StringTokenizer st = new StringTokenizer(value);
if (st.countTokens() != 1 && st.countTokens() != 2) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
final PropertyCollection collection = new PropertyCollection();
while (st.hasMoreTokens()) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractEnumeration.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractEnumeration.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractEnumeration.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -51,7 +51,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -97,7 +97,7 @@
if (pv != null) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractIndent.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractIndent.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractIndent.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -97,7 +97,7 @@
if (pv instanceof FnBodyStart) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractKeep.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractKeep.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractKeep.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -108,7 +108,7 @@
if (pv.canEvalInteger()) {
return new DtKeep(pv, pv, pv);
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
@@ -129,7 +129,7 @@
if (keepDT != null) {
return keepDT;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
@@ -323,7 +323,7 @@
return keepDT;
}
default: {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
}
}
@@ -332,7 +332,7 @@
setComponent(keepDT, subPropertyName, pv);
return keepDT;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractMargin.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractMargin.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractMargin.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -88,7 +88,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractName.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractName.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractName.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -74,7 +74,7 @@
if (pv instanceof DtName) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPadding.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPadding.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPadding.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -89,7 +89,7 @@
if (pv instanceof DtLengthConditional) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPageDimension.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPageDimension.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPageDimension.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -83,7 +83,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -102,7 +102,7 @@
if (pv.canEvalPercentage()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
@@ -122,7 +122,7 @@
final PropertyCollection collection = new PropertyCollection();
final StringTokenizer st = new StringTokenizer(value);
if (st.countTokens() < 1 || st.countTokens() > 2) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
while (st.hasMoreTokens()) {
PropertyValue insideValue = null;
@@ -132,12 +132,12 @@
insideValue = DtPercentage.makePercentageDT(value);
}
if (insideValue == null) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
insideProperty = new PdPause(insideValue);
collection.addItem(insideProperty);
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -94,7 +94,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
@@ -216,7 +216,7 @@
final DtLengthRange lr = (DtLengthRange) value();
final PropertyValue pv = standardParse(fobj, attributeValue);
if (! (pv instanceof DtLength)) {
- throw unexpectedValue(attributeValue, fobj);
+ throw unexpectedValue(attributeValue);
}
final DtLength length = (DtLength) pv;
final String subPropertyName = getSubPropertyName(propertyFullName);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -106,7 +106,7 @@
return new DtSpace(pv, pv, pv, FoValue.DISCARD,
new DtInteger(0));
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
@@ -127,7 +127,7 @@
if (spaceDT != null) {
return spaceDT;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
@@ -374,7 +374,7 @@
final boolean componentAdded = spaceDT.addComponent(subPropertyName,
pv);
if (! componentAdded) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
}
return spaceDT;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentAdjust.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentAdjust.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentAdjust.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -97,7 +97,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentBaseline.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentBaseline.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentBaseline.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -92,7 +92,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -157,7 +157,7 @@
}
}
if (! this.isBehind) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
}
PropertyValue pv = checkKeywords(this.getValidKeywords(),
@@ -169,7 +169,7 @@
case RIGHTWARDS:
case INHERIT: {
if (this.isBehind) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
break;
}
@@ -180,13 +180,13 @@
return pv;
}
if (this.isBehind) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
pv = DtAngle.makeAngleDT(value);
if (pv != null) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackground.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackground.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackground.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -99,7 +99,7 @@
// Tokenize the input & put the tokens into an ArrayList
final StringTokenizer st = new StringTokenizer(value);
if (st.countTokens() < 1 || st.countTokens() > maxTokens) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
final List<String> tokenList = new ArrayList<String>(st.countTokens());
while (st.hasMoreTokens()) {
@@ -110,7 +110,7 @@
for (int i = 0; i < tokenList.size(); i++) {
final FoPropertyId contentType = getContentType(tokenList.get(i));
if (contentType == null) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
positionArray[i] = contentType;
}
@@ -123,7 +123,7 @@
switch (positionArray[i]) {
case BACKGROUND_COLOR: {
if (colorFound) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
collection.addItem(new PdBackgroundColor(fobj,
propertyFullName, tokenList.get(i)));
@@ -132,7 +132,7 @@
}
case BACKGROUND_IMAGE: {
if (imageFound) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
collection.addItem(new PdBackgroundImage(fobj,
propertyFullName, tokenList.get(i)));
@@ -141,7 +141,7 @@
}
case BACKGROUND_REPEAT: {
if (repeatFound) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
collection.addItem(new PdBackgroundRepeat(fobj,
propertyFullName, tokenList.get(i)));
@@ -150,7 +150,7 @@
}
case BACKGROUND_ATTACHMENT: {
if (attachmentFound) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
collection.addItem(new PdBackgroundAttachment(fobj,
propertyFullName, tokenList.get(i)));
@@ -159,7 +159,7 @@
}
case BACKGROUND_POSITION: {
if (positionFound) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
final String propertyInput = tokenList.get(i);
if (i < positionArray.length && positionArray[i + 1]
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundColor.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundColor.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -101,7 +101,7 @@
if (pv.canEvalColor()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundImage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundImage.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundImage.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -95,7 +95,7 @@
if (pv instanceof DtUri) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -106,7 +106,7 @@
}
final StringTokenizer st = new StringTokenizer(value);
if (st.countTokens() < 1 || st.countTokens() > 2) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
while (st.hasMoreTokens()) {
final String token = st.nextToken();
@@ -135,7 +135,7 @@
new PdBackgroundPosition(pv);
collection.addItem(property);
} else {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
}
if (collection.getCount() == 1) {
@@ -151,12 +151,12 @@
|| pv2.canEvalLength()) {
return collection;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/* If the first item is a keyword, the other needs to be also. */
if (pv.canEvalKeyword()) {
if (! (pv2.canEvalKeyword())) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
}
// The two keywords need to be from each of the two sets.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBaselineShift.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBaselineShift.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBaselineShift.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -88,7 +88,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderColor.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderColor.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -116,7 +116,7 @@
final StringTokenizer st = new StringTokenizer(value);
if (st.countTokens() < 1
|| st.countTokens() > PdBorderColor.MAX_TOKENS) {
- throw this.unexpectedValue(value, fobj);
+ throw this.unexpectedValue(value);
}
while (st.hasMoreTokens()) {
final String token = st.nextToken();
@@ -126,7 +126,7 @@
|| parsedToken.canEvalKeyword()) {
collection.addItem(parsedToken);
} else {
- throw this.unexpectedValue(token, fobj);
+ throw this.unexpectedValue(token);
}
}
return collection;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderSeparation.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderSeparation.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderSeparation.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -114,11 +114,11 @@
} else if ("inline-progression-direction".equals(subPropertyName)) {
bpip.setIPDLength(pv);
} else {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
return bpip;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
@@ -213,7 +213,7 @@
return true;
}
}
- throw unexpectedValue(attributeValue, fobj);
+ throw unexpectedValue(attributeValue);
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderSpacing.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderSpacing.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderSpacing.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -90,7 +90,7 @@
/* The only other valid option is that there are two lengths. */
final StringTokenizer st = new StringTokenizer(value);
if (st.countTokens() != 2) {
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
final PropertyValue token1 = standardParse(fobj, st.nextToken());
@@ -101,7 +101,7 @@
token2);
return new PdBorderSeparation(bpip);
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderStyle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderStyle.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderStyle.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -109,7 +109,7 @@
final StringTokenizer st = new StringTokenizer(value);
if (st.countTokens() < 1
|| st.countTokens() > PdBorderStyle.MAX_TOKENS) {
- throw this.unexpectedValue(value, fobj);
+ throw this.unexpectedValue(value);
}
while (st.hasMoreTokens()) {
final String token = st.nextToken();
@@ -121,7 +121,7 @@
foValue);
collection.addItem(borderStyle);
} else {
- throw this.unexpectedValue(token, fobj);
+ throw this.unexpectedValue(token);
}
}
return collection;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderWidth.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderWidth.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -108,7 +108,7 @@
final StringTokenizer st = new StringTokenizer(value);
if (st.countTokens() < 1
|| st.countTokens() > PdBorderWidth.MAX_TOKENS) {
- throw this.unexpectedValue(value, fobj);
+ throw this.unexpectedValue(value);
}
while (st.hasMoreTokens()) {
final String token = st.nextToken();
@@ -117,7 +117,7 @@
if (DtBorderWidth.isBorderWidth(parsedToken)) {
collection.addItem(parsedToken);
} else {
- throw this.unexpectedValue(token, fobj);
+ throw this.unexpectedValue(token);
}
}
return collection;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarColor.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarColor.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -77,7 +77,7 @@
if (pv.canEvalColor()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarOffset.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarOffset.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarOffset.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -75,7 +75,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarPlacement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarPlacement.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarPlacement.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -82,7 +82,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarStyle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarStyle.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarStyle.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -71,7 +71,7 @@
if (this.canEvalBorderStyle(pv)) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarWidth.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarWidth.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -74,7 +74,7 @@
if (DtBorderWidth.isBorderWidth(pv)) {
return new DtBorderWidth(pv);
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdClip.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdClip.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdClip.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -85,7 +85,7 @@
if (pv != null) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColor.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColor.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -85,7 +85,7 @@
if (pv.canEvalColor()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnCount.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnCount.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnCount.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -80,7 +80,7 @@
if (pv.canEvalNumeric()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnGap.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnGap.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnGap.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -89,7 +89,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnNumber.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnNumber.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -75,7 +75,7 @@
if (pv.canEvalNumeric()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -80,7 +80,7 @@
// Used to store proportional column width
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentType.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentType.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentType.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -85,7 +85,7 @@
* values specified in the standard. */
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdCountry.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdCountry.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdCountry.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -94,7 +94,7 @@
&& dtCountry.getValue() != Country4a.UNDETERMINED) {
return dtCountry;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdDestinationPlacementOffset.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdDestinationPlacementOffset.java 2022-12-23 15:19:24 UTC (rev 12922)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdDestinationPlacementOffset.java 2022-12-23 15:27:26 UTC (rev 12923)
@@ -72,7 +72,7 @@
if (pv.canEvalLength()) {
return pv;
}
- throw unexpectedValue(value, fobj);
+ throw unexpectedValue(value...
[truncated message content] |
|
From: <vic...@us...> - 2022-12-23 15:19:27
|
Revision: 12922
http://sourceforge.net/p/foray/code/12922
Author: victormote
Date: 2022-12-23 15:19:24 +0000 (Fri, 23 Dec 2022)
Log Message:
-----------
Remove unnecessary FoObj instances as method parameters.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdInternalDestination.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java 2022-12-23 15:05:38 UTC (rev 12921)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java 2022-12-23 15:19:24 UTC (rev 12922)
@@ -62,7 +62,7 @@
*/
protected PropertyException unexpectedValue(final String value,
final FoObj fobj) {
- return unexpectedValue(value, fobj, null);
+ return unexpectedValue(value, (String) null);
}
/**
@@ -69,28 +69,22 @@
* Returns an exception indicating that the value of this property does not
* meet the property's requirements.
* @param value The unparsed property value.
- * @param fobj The FoObj to which this property belongs.
* @param reason The reason for the failure.
* @return The newly-constructed exception.
*/
- protected PropertyException unexpectedValue(final String value,
- final FoObj fobj, final String reason) {
- return new PropertyException(unexpectedValueMessage(reason, value,
- fobj));
+ protected PropertyException unexpectedValue(final String value, final String reason) {
+ return new PropertyException(unexpectedValueMessage(reason, value));
}
/**
- * Creates an "Unexpected value" message suitable for user messages or
- * exception reporting.
- * @param reason A description of the reason the value is considered
- * invalid. Set this to null if the reason is self-explanatory.
+ * Creates an "Unexpected value" message suitable for user messages or exception reporting.
+ * @param reason A description of the reason the value is considered invalid.
+ * Set this to null if the reason is self-explanatory.
* @param value The property value as submitted in the input.
- * @param fobj The FoObj to which this property belongs.
* @return A formatted, ready-to-present message describing the error.
* @see #unexpectedValue(String, FoObj, String)
*/
- private String unexpectedValueMessage(final String reason,
- final String value, final FoObj fobj) {
+ private String unexpectedValueMessage(final String reason, final String value) {
final StringBuilder buffer = new StringBuilder();
buffer.append("Unexpected value for property \"");
buffer.append(getPropertyType().getAttributeName());
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdInternalDestination.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdInternalDestination.java 2022-12-23 15:05:38 UTC (rev 12921)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdInternalDestination.java 2022-12-23 15:19:24 UTC (rev 12922)
@@ -69,7 +69,7 @@
final String value) throws PropertyException {
final DtName pv = DtName.makeNameDT(value);
if (pv == null) {
- throw unexpectedValue(value, fobj, "Invalid NCName");
+ throw unexpectedValue(value, "Invalid NCName");
}
return pv;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-23 15:05:41
|
Revision: 12921
http://sourceforge.net/p/foray/code/12921
Author: victormote
Date: 2022-12-23 15:05:38 +0000 (Fri, 23 Dec 2022)
Log Message:
-----------
Remove FoObj as parameter from method adding a property to a property list.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/LayoutMasterSet4a.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ForcePageCountTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LineHeightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VerticalAlignTests.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2022-12-23 14:27:49 UTC (rev 12920)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2022-12-23 15:05:38 UTC (rev 12921)
@@ -223,7 +223,7 @@
final Property property = nativeNamespace.parseAttribute(attributes, localName, attributeValue,
parentFO, locator, builder, creator);
if (property != null) {
- propertyList.addProperty(parentFO, property);
+ propertyList.addProperty(property);
}
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-23 14:27:49 UTC (rev 12920)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-23 15:05:38 UTC (rev 12921)
@@ -292,10 +292,10 @@
/**
* Adds a property to this PropertyList.
- * @param fobj The FoObj to which the property belongs.
* @param property The property to be added.
+ * @throws PropertyException If the property already exists in this property list.
*/
- public void addProperty(final FoObj fobj, final Property property) {
+ public void addProperty(final Property property) throws PropertyException {
final Property existingProperty = getProperty(property.getPropertyType());
/*
* Check to see if a property of this type is already in the collection.
@@ -304,9 +304,8 @@
* If they are not the same object, then the user has specified the same property twice.
*/
if (existingProperty != null && property != existingProperty) {
- fobj.getFoTree().logError("Property "
- + property.getPropertyType().getAttributeName()
- + " already exists.\n" + fobj.getContextMessage());
+ throw new PropertyException("Property " + property.getPropertyType().getAttributeName()
+ + " already exists.");
}
this.properties.add(property);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/LayoutMasterSet4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/LayoutMasterSet4a.java 2022-12-23 14:27:49 UTC (rev 12920)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/LayoutMasterSet4a.java 2022-12-23 15:05:38 UTC (rev 12921)
@@ -393,7 +393,7 @@
sourceList.addChild(flowNameSpecifier);
Property property = new PdFlowNameReference(flowNameSpecifier,
FoPropertyId.FLOW_NAME_REFERENCE.toXslFo(), impliedName);
- propertyList.addProperty(flowNameSpecifier, property);
+ propertyList.addProperty(property);
/* The target part. */
final FlowTargetList4a targetList = new FlowTargetList4a(assignment,
@@ -406,7 +406,7 @@
targetList.addChild(regionNameSpecifier);
property = new PdRegionNameReference(regionNameSpecifier,
FoPropertyId.REGION_NAME_REFERENCE.toXslFo(), impliedName);
- propertyList.addProperty(regionNameSpecifier, property);
+ propertyList.addProperty(property);
}
@Override
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ForcePageCountTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ForcePageCountTests.java 2022-12-23 14:27:49 UTC (rev 12920)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ForcePageCountTests.java 2022-12-23 15:05:38 UTC (rev 12921)
@@ -61,7 +61,7 @@
final PropertyList propertyList = fobj.getPropertyList();
final PdForcePageCount property = new PdForcePageCount(fobj, "",
keyword);
- propertyList.addProperty(fobj, property);
+ propertyList.addProperty(property);
return fobj.traitForcePageCount(STD_FO_CONTEXT);
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LineHeightTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LineHeightTests.java 2022-12-23 14:27:49 UTC (rev 12920)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LineHeightTests.java 2022-12-23 15:05:38 UTC (rev 12921)
@@ -84,7 +84,7 @@
final FoObj fobj = makeTestFObj();
final PropertyList propertyList = fobj.getPropertyList();
final PdLineHeight property = new PdLineHeight(fobj, "", "normal");
- propertyList.addProperty(fobj, property);
+ propertyList.addProperty(property);
final int halfLeadingOpt = fobj.traitHalfLeadingOpt(STD_FO_CONTEXT);
/* Default font-size is 12 points or 12,000 millipoints. The "normal"
* line height is 1.2 times that or 14,400 millipoints. The difference
@@ -102,7 +102,7 @@
final FoObj fobj = makeTestFObj();
final PropertyList propertyList = fobj.getPropertyList();
final PdLineHeight lh = new PdLineHeight(fobj, "", "3.7cm");
- propertyList.addProperty(fobj, lh);
+ propertyList.addProperty(lh);
final int halfLeadingMax = fobj.traitHalfLeadingMax(STD_FO_CONTEXT);
/* D = Distance between baselines = 3.7cm = 104,882 millipoints.
* L = Leading = D - the default font size of 12,000 = 92,882
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VerticalAlignTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VerticalAlignTests.java 2022-12-23 14:27:49 UTC (rev 12920)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VerticalAlignTests.java 2022-12-23 15:05:38 UTC (rev 12921)
@@ -65,7 +65,7 @@
final int expectedAlignmentAdjust) throws PropertyException {
final FoObj fobj = VerticalAlignTests.makeTestFObj();
final PdVerticalAlign property = createProperty(fobj, rawValue);
- fobj.getPropertyList().addProperty(fobj, property);
+ fobj.getPropertyList().addProperty(property);
final FoContext context = VerticalAlignTests.STD_FO_CONTEXT;
final BaselineIdentifier actualAlignmentBaseline = fobj.traitAlignmentBaseline(context);
assertEquals(expectedAlignmentBaseline, actualAlignmentBaseline);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-23 14:27:51
|
Revision: 12920
http://sourceforge.net/p/foray/code/12920
Author: victormote
Date: 2022-12-23 14:27:49 +0000 (Fri, 23 Dec 2022)
Log Message:
-----------
Minor doc change.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java 2022-12-22 17:22:25 UTC (rev 12919)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java 2022-12-23 14:27:49 UTC (rev 12920)
@@ -45,6 +45,9 @@
/**
* An "instream-foreign-object" object in XSL-FO.
+ * Instances of this class have one "child," the root node of an XML document from a foreign namespace.
+ * We do not treat that child as being part of the FO tree, but more like a single black box that is attached laterally
+ * to the parent instance of this class, kind of like a property.
*/
public class InstreamForeignObject4a extends FoScalable4a implements InstreamForeignObject {
@@ -86,8 +89,6 @@
@Override
protected void validateDescendants() throws FoTreeException {
- /* This object has descendants, but always from a foreign namespace. From the standpoint of the FO Tree, that
- * descendant document is not part of the FO Tree, but more like a property of this. */
this.validateEmptyContent();
}
@@ -112,7 +113,7 @@
}
@Override
- public List<ForeignXml<Document>> getChildren() {
+ public List<FoObj> getChildren() {
return Collections.emptyList();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-22 17:22:28
|
Revision: 12919
http://sourceforge.net/p/foray/code/12919
Author: victormote
Date: 2022-12-22 17:22:25 +0000 (Thu, 22 Dec 2022)
Log Message:
-----------
Clarify that the "child" of an instream-foreign-object is not really part of the FO tree.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 16:13:47 UTC (rev 12918)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 17:22:25 UTC (rev 12919)
@@ -496,22 +496,18 @@
@Override
public void rootElementEnded() {
- ForeignXml<?> foreignXml = null;
+ ForeignXml<? extends Document> foreignXml = null;
+ final InstreamForeignObject4a parent = (InstreamForeignObject4a) this.currentFObj;
+
if (this.foreignDocument instanceof SVGDocument) {
- final InstreamForeignObject4a parent = (InstreamForeignObject4a) this.currentFObj;
foreignXml = new InstreamSvgElement(parent, (SVGDocument) this.foreignDocument);
} else if (this.foreignDocument instanceof MathMLDocument) {
- final InstreamForeignObject4a parent = (InstreamForeignObject4a) this.currentFObj;
foreignXml = new InstreamMathElement(parent, (MathMLDocument) this.foreignDocument);
} else {
throw new IllegalStateException("Unexpected document type:" + this.foreignDocument.getClass().getName());
}
- try {
- this.currentFObj.addChild(foreignXml);
- } catch (final FoTreeException e) {
- /* Convert to unchecked exception. */
- throw new IllegalStateException(e);
- }
+
+ parent.setForeignXml(foreignXml);
this.currentFObj = foreignXml;
this.proxyParser = null;
this.foreignDocument = null;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java 2022-12-22 16:13:47 UTC (rev 12918)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java 2022-12-22 17:22:25 UTC (rev 12919)
@@ -40,7 +40,7 @@
import org.w3c.dom.Document;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -51,8 +51,8 @@
/** The parent of this node. */
private FoObj parent;
- /** The children of this object. */
- private List<ForeignXml<Document>> children = new ArrayList<ForeignXml<Document>>(1);
+ /** The attached foreign XML. */
+ private ForeignXml<? extends Document> foreignXml;
/**
* Constructor.
@@ -86,11 +86,9 @@
@Override
protected void validateDescendants() throws FoTreeException {
- /* XSL-FO Standard 1.1, Section 6.6.6, Heading "Contents" seems to
- * indicate that only one child is allowed. */
- if (getChildren().size() != 1) {
- throwException(getFullName() + " must have exactly one child.");
- }
+ /* This object has descendants, but always from a foreign namespace. From the standpoint of the FO Tree, that
+ * descendant document is not part of the FO Tree, but more like a property of this. */
+ this.validateEmptyContent();
}
@Override
@@ -115,18 +113,12 @@
@Override
public List<ForeignXml<Document>> getChildren() {
- return this.children;
+ return Collections.emptyList();
}
@Override
public void addChild(final FoObj child) throws FoTreeException {
- if (! (child instanceof ForeignXml)) {
- child.throwException(getFullName() + " child must be a supported "
- + "type of foreign xml.");
- }
- @SuppressWarnings("unchecked")
- final ForeignXml<Document> foreignXmlChild = (ForeignXml<Document>) child;
- this.getChildren().add(foreignXmlChild);
+ this.throwExceptionContentModelViolation();
}
@Override
@@ -135,11 +127,6 @@
}
@Override
- public FoObj formattingObjectChildAt(final int index) {
- return this.children.get(index);
- }
-
- @Override
public boolean isValid() {
return true;
}
@@ -181,7 +168,15 @@
@Override
public Document getXmlDocument() {
- return this.children.get(0).getDocument();
+ return this.foreignXml.getDocument();
}
+ /**
+ * Sets the foreign XML.
+ * @param foreignXml The foreign XML to set.
+ */
+ public void setForeignXml(final ForeignXml<? extends Document> foreignXml) {
+ this.foreignXml = foreignXml;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-22 16:13:50
|
Revision: 12918
http://sourceforge.net/p/foray/code/12918
Author: victormote
Date: 2022-12-22 16:13:47 +0000 (Thu, 22 Dec 2022)
Log Message:
-----------
Consolidate code related to foreign namespaces into one package.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/InstreamMathElement.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/InstreamSvgElement.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/NamespaceMath.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/NamespaceSvg.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/package-info.java
trunk/foray/foray-zz-attic/src/main/java/org/foray/svg/
trunk/foray/foray-zz-attic/src/main/java/org/foray/svg/SvgObjectId.java
trunk/foray/foray-zz-attic/src/main/java/org/foray/svg/package-info.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java 2022-12-22 15:54:52 UTC (rev 12917)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java 2022-12-22 16:13:47 UTC (rev 12918)
@@ -34,7 +34,7 @@
import org.foray.fotree.fo.obj.Block4a;
import org.foray.fotree.fo.obj.Flow4a;
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
-import org.foray.fotree.svg.obj.InstreamSvgElement;
+import org.foray.fotree.foreign.InstreamSvgElement;
import org.axsl.fotree.FoTreeException;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-12-22 15:54:52 UTC (rev 12917)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-12-22 16:13:47 UTC (rev 12918)
@@ -32,8 +32,8 @@
import org.foray.fotree.fo.NamespaceFo;
import org.foray.fotree.fo.obj.Root4a;
import org.foray.fotree.foray.NamespaceForay;
-import org.foray.fotree.math.NamespaceMath;
-import org.foray.fotree.svg.NamespaceSvg;
+import org.foray.fotree.foreign.NamespaceMath;
+import org.foray.fotree.foreign.NamespaceSvg;
import org.foray.fotree.xml.NamespaceXml;
import org.axsl.fotree.FoTree;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 15:54:52 UTC (rev 12917)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 16:13:47 UTC (rev 12918)
@@ -34,8 +34,8 @@
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
import org.foray.fotree.fo.obj.PageSequence4a;
import org.foray.fotree.fo.obj.Root4a;
-import org.foray.fotree.math.obj.InstreamMathElement;
-import org.foray.fotree.svg.obj.InstreamSvgElement;
+import org.foray.fotree.foreign.InstreamMathElement;
+import org.foray.fotree.foreign.InstreamSvgElement;
import org.foray.primitive.StringUtils;
import org.foray.xml.Sax2DomParser;
import org.foray.xml.SaxParser;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2022-12-22 15:54:52 UTC (rev 12917)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2022-12-22 16:13:47 UTC (rev 12918)
@@ -32,8 +32,8 @@
import org.foray.fotree.axsl.NamespaceAxsl;
import org.foray.fotree.fo.NamespaceFo;
import org.foray.fotree.foray.NamespaceForay;
-import org.foray.fotree.math.NamespaceMath;
-import org.foray.fotree.svg.NamespaceSvg;
+import org.foray.fotree.foreign.NamespaceMath;
+import org.foray.fotree.foreign.NamespaceSvg;
import org.foray.fotree.xml.NamespaceXml;
import org.axsl.fotree.FoTreeFactory;
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/InstreamMathElement.java (from rev 12917, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/InstreamMathElement.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/InstreamMathElement.java 2022-12-22 16:13:47 UTC (rev 12918)
@@ -0,0 +1,65 @@
+/*
+ * 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.foreign;
+
+import org.foray.fotree.ForeignXml;
+import org.foray.fotree.Namespace;
+import org.foray.fotree.fo.obj.InstreamForeignObject4a;
+
+import org.w3c.dom.mathml.MathMLDocument;
+
+/**
+ * The content of an instream Math (MathML) document.
+ */
+public class InstreamMathElement extends ForeignXml<MathMLDocument> {
+
+ /** The parsed instream document. */
+ private MathMLDocument document;
+
+ /**
+ * Constructor.
+ * @param parent The parent FoObj.
+ * @param document The DOM document.
+ */
+ public InstreamMathElement(final InstreamForeignObject4a parent, final MathMLDocument document) {
+ super(parent);
+ this.document = document;
+ }
+
+ @Override
+ public Namespace getNamespace() {
+ return this.getFoTree().getMathNamespace();
+ }
+
+ @Override
+ public MathMLDocument getDocument() {
+ return this.document;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/InstreamSvgElement.java (from rev 12917, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/InstreamSvgElement.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/InstreamSvgElement.java 2022-12-22 16:13:47 UTC (rev 12918)
@@ -0,0 +1,65 @@
+/*
+ * 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.foreign;
+
+import org.foray.fotree.ForeignXml;
+import org.foray.fotree.Namespace;
+import org.foray.fotree.fo.obj.InstreamForeignObject4a;
+
+import org.w3c.dom.svg.SVGDocument;
+
+/**
+ * The content of an inline SVG document.
+ */
+public class InstreamSvgElement extends ForeignXml<SVGDocument> {
+
+ /** The parsed instream document. */
+ private SVGDocument document;
+
+ /**
+ * Constructor.
+ * @param parent The parent FoObj.
+ * @param document The DOM document.
+ */
+ public InstreamSvgElement(final InstreamForeignObject4a parent, final SVGDocument document) {
+ super(parent);
+ this.document = document;
+ }
+
+ @Override
+ public Namespace getNamespace() {
+ return this.getFoTree().getSVGNamespace();
+ }
+
+ @Override
+ public SVGDocument getDocument() {
+ return this.document;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/NamespaceMath.java (from rev 12915, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/NamespaceMath.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/NamespaceMath.java 2022-12-22 16:13:47 UTC (rev 12918)
@@ -0,0 +1,71 @@
+/*
+ * 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.foreign;
+
+import org.foray.fotree.NamespaceForeign;
+import org.foray.xml.domImpl.MathMlDocument4a;
+
+import org.axsl.constants.XmlConstants;
+
+/**
+ * This class manages the namespace that is used for the Math Markup Language
+ * (MathML).
+ */
+public final class NamespaceMath extends NamespaceForeign {
+
+ /** The singleton instance. */
+ private static NamespaceMath theInstance;
+
+ /**
+ * Private constructor. To obtain the singleton instance, use {@link #getInstance()}.
+ */
+ private NamespaceMath() { }
+
+ @Override
+ public String getNamespaceURI() {
+ return XmlConstants.MATHML_NS_URI;
+ }
+
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton instance of this class.
+ */
+ public static NamespaceMath getInstance() {
+ if (NamespaceMath.theInstance == null) {
+ NamespaceMath.theInstance = new NamespaceMath();
+ }
+ return NamespaceMath.theInstance;
+ }
+
+ @Override
+ protected MathMlDocument4a createDomDocument() {
+ return new MathMlDocument4a(null, null, null);
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/NamespaceSvg.java (from rev 12915, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/NamespaceSvg.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/NamespaceSvg.java 2022-12-22 16:13:47 UTC (rev 12918)
@@ -0,0 +1,75 @@
+/*
+ * 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.foreign;
+
+import org.foray.fotree.NamespaceForeign;
+
+import org.axsl.constants.XmlConstants;
+
+import org.apache.batik.anim.dom.SVGDOMImplementation;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.svg.SVGDocument;
+
+/**
+ * This class manages the namespace that is used for SVG.
+ */
+public final class NamespaceSvg extends NamespaceForeign {
+
+ /** The singleton instance. */
+ private static NamespaceSvg theInstance;
+
+ /**
+ * Private constructor. To obtain the singleton instance, use {@link #getInstance()}.
+ */
+ private NamespaceSvg() { }
+
+
+ @Override
+ public String getNamespaceURI() {
+ return XmlConstants.SVG_NS_URI;
+ }
+
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton instance of this class.
+ */
+ public static NamespaceSvg getInstance() {
+ if (NamespaceSvg.theInstance == null) {
+ NamespaceSvg.theInstance = new NamespaceSvg();
+ }
+ return NamespaceSvg.theInstance;
+ }
+
+ @Override
+ protected SVGDocument createDomDocument() {
+ final DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
+ return (SVGDocument) impl.createDocument(XmlConstants.SVG_NS_URI, "svg", null);
+ }
+
+}
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/package-info.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/package-info.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/package-info.java 2022-12-22 16:13:47 UTC (rev 12918)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2022 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$
+ */
+
+/**
+ * Namespace and other classes related to foreign XML.
+ */
+package org.foray.fotree.foreign;
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foreign/package-info.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Copied: trunk/foray/foray-zz-attic/src/main/java/org/foray/svg/SvgObjectId.java (from rev 12880, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/SvgObjectId.java)
===================================================================
--- trunk/foray/foray-zz-attic/src/main/java/org/foray/svg/SvgObjectId.java (rev 0)
+++ trunk/foray/foray-zz-attic/src/main/java/org/foray/svg/SvgObjectId.java 2022-12-22 16:13:47 UTC (rev 12918)
@@ -0,0 +1,281 @@
+/*
+ * 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.svg;
+
+import java.util.Arrays;
+
+/**
+ * An enumeration for SVG objects.
+ */
+public enum SvgObjectId {
+
+ /*
+ * This list is maintained in the same order as OBJECT_NAME_LIST to
+ * facilitate using a binary search on that array and having the index
+ * correspond to the ordinal value of the enumeration.
+ */
+
+ /** Constant indicating SVG element "a". */
+ A, // 0
+
+ /** Constant indicating SVG element "altGlyph". */
+ ALTGLYPH, // 1
+
+ /** Constant indicating SVG element "animate". */
+ ANIMATE, // 2
+
+ /** Constant indicating SVG element "animateColor". */
+ ANIMATECOLOR, // 3
+
+ /** Constant indicating SVG element "animateMotion". */
+ ANIMATEMOTION, // 4
+
+ /** Constant indicating SVG element "animateTransform". */
+ ANIMATETRANSFORM, // 5
+
+ /** Constant indicating SVG element "circle". */
+ CIRCLE, // 6
+
+ /** Constant indicating SVG element "clipPath". */
+ CLIPPATH, // 7
+
+ /** Constant indicating SVG element "cursor". */
+ CURSOR, // 8
+
+ /** Constant indicating SVG element "defs". */
+ DEFS, // 9
+
+ /** Constant indicating SVG element "desc". */
+ DESC, // 10
+
+ /** Constant indicating SVG element "ellipse". */
+ ELLIPSE, // 11
+
+ /** Constant indicating SVG element "feFlood". */
+ FEFLOOD, // 12
+
+ /** Constant indicating SVG element "feGaussianBlur". */
+ FEGAUSSIANBLUR, // 13
+
+ /** Constant indicating SVG element "feMerge". */
+ FEMERGE, // 14
+
+ /** Constant indicating SVG element "feMergeNode". */
+ FEMERGENODE, // 15
+
+ /** Constant indicating SVG element "feOffset". */
+ FEOFFSET, // 16
+
+ /** Constant indicating SVG element "filter". */
+ FILTER, // 17
+
+ /** Constant indicating SVG element "font". */
+ FONT, // 18
+
+ /** Constant indicating SVG element "font-face". */
+ FONT_FACE, // 19
+
+ /** Constant indicating SVG element "font-face-src". */
+ FONT_FACE_SRC, // 20
+
+ /** Constant indicating SVG element "font-face-uri". */
+ FONT_FACE_URI, // 21
+
+ /** Constant indicating SVG element "g". */
+ G, // 22
+
+ /** Constant indicating SVG element "glyph". */
+ GLYPH, // 23
+
+ /** Constant indicating SVG element "hkern". */
+ HKERN, // 24
+
+ /** Constant indicating SVG element "image". */
+ IMAGE, // 25
+
+ /** Constant indicating SVG element "line". */
+ LINE, // 26
+
+ /** Constant indicating SVG element "linearGradient". */
+ LINEARGRADIENT, // 27
+
+ /** Constant indicating SVG element "marker". */
+ MARKER, // 28
+
+ /** Constant indicating SVG element "mask". */
+ MASK, // 29
+
+ /** Constant indicating SVG element "missing-glyph". */
+ MISSING_GLYPH, // 30
+
+ /** Constant indicating SVG element "path". */
+ PATH, // 31
+
+ /** Constant indicating SVG element "pattern". */
+ PATTERN, // 32
+
+ /** Constant indicating SVG element "polygon". */
+ POLYGON, // 33
+
+ /** Constant indicating SVG element "polyline". */
+ POLYLINE, // 34
+
+ /** Constant indicating SVG element "radialGradient". */
+ RADIALGRADIENT, // 35
+
+ /** Constant indicating SVG element "rect". */
+ RECT, // 36
+
+ /** Constant indicating SVG element "set". */
+ SET, // 37
+
+ /** Constant indicating SVG element "stop". */
+ STOP, // 38
+
+ /** Constant indicating SVG element "style". */
+ STYLE, // 39
+
+ /** Constant indicating SVG element "svg". */
+ SVG, // 40
+
+ /** Constant indicating SVG element "switch". */
+ SWITCH, // 41
+
+ /** Constant indicating SVG element "symbol". */
+ SYMBOL, // 42
+
+ /** Constant indicating SVG element "text". */
+ TEXT, // 43
+
+ /** Constant indicating SVG element "textPath". */
+ TEXTPATH, // 44
+
+ /** Constant indicating SVG element "title". */
+ TITLE, // 45
+
+ /** Constant indicating SVG element "tref". */
+ TREF, // 46
+
+ /** Constant indicating SVG element "tspan". */
+ TSPAN, // 47
+
+ /** Constant indicating SVG element "use". */
+ USE, // 48
+
+ /** Constant indicating SVG element "vkern". */
+ VKERN; // 49
+
+
+ /**
+ * A sorted list of valid object names.
+ * This list should always be maintained in sorted order, so that binary
+ * searches can be used.
+ */
+ private static final String[] OBJECT_NAME_LIST = {
+ "a", // 0
+ "altGlyph", // 1
+ "animate", // 2
+ "animateColor", // 3
+ "animateMotion", // 4
+ "animateTransform", // 5
+ "circle", // 6
+ "clipPath", // 7
+ "cursor", // 8
+ "defs", // 9
+ "desc", // 10
+ "ellipse", // 11
+ "feFlood", // 12
+ "feGaussianBlur", // 13
+ "feMerge", // 14
+ "feMergeNode", // 15
+ "feOffset", // 16
+ "filter", // 17
+ "font", // 18
+ "font-face", // 19
+ "font-face-src", // 20
+ "font-face-uri", // 21
+ "g", // 22
+ "glyph", // 23
+ "hkern", // 24
+ "image", // 25
+ "line", // 26
+ "linearGradient", // 27
+ "marker", // 28
+ "mask", // 29
+ "missing-glyph", // 30
+ "path", // 31
+ "pattern", // 32
+ "polygon", // 33
+ "polyline", // 34
+ "radialGradient", // 35
+ "rect", // 36
+ "set", // 37
+ "stop", // 38
+ "style", // 39
+ "svg", // 40
+ "switch", // 41
+ "symbol", // 42
+ "text", // 43
+ "textPath", // 44
+ "title", // 45
+ "tref", // 46
+ "tspan", // 47
+ "use", // 48
+ "vkern", // 49
+ };
+
+ /**
+ * Converts an object name enumeration to its SVG name.
+ * For example, the enumeration {@link SvgObjectId#SYMBOL} converts to the
+ * SVG name "symbol".
+ * @return The SVG name for the object enumeration.
+ */
+ public String toSVG() {
+ return SvgObjectId.OBJECT_NAME_LIST[this.ordinal()];
+ }
+
+ /**
+ * Similar to the Java 1.5 Enum valueOf(String) method, but operates on the
+ * SVG name of the object instead of its enumerated name.
+ * For example, for the SVG object "symbol", the enum is
+ * {@link SvgObjectId#SYMBOL}.
+ * The Java 1.5 Enum valueOf(String) method would operate on the enum name
+ * "SYMBOL".
+ * This method instead operates on "symbol".
+ * @param svgName The name of the SVG object for which the enumerated
+ * value is needed.
+ * @return The enumerated value for {@code svgName}.
+ */
+ public static SvgObjectId svgValueOf(final String svgName) {
+ final int ordinal = Arrays.binarySearch(SvgObjectId.OBJECT_NAME_LIST,
+ svgName);
+ return SvgObjectId.values()[ordinal];
+ }
+
+}
Added: trunk/foray/foray-zz-attic/src/main/java/org/foray/svg/package-info.java
===================================================================
--- trunk/foray/foray-zz-attic/src/main/java/org/foray/svg/package-info.java (rev 0)
+++ trunk/foray/foray-zz-attic/src/main/java/org/foray/svg/package-info.java 2022-12-22 16:13:47 UTC (rev 12918)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2022 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$
+ */
+
+/**
+ * SVG-related classes. These might belong in XML or in Graphic.
+ */
+package org.foray.svg;
Property changes on: trunk/foray/foray-zz-attic/src/main/java/org/foray/svg/package-info.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-22 15:54:55
|
Revision: 12917
http://sourceforge.net/p/foray/code/12917
Author: victormote
Date: 2022-12-22 15:54:52 +0000 (Thu, 22 Dec 2022)
Log Message:
-----------
Conform to aXSL change: Remove generic type from InstreamForeignObject.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/MathArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/SvgArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java
trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentHeight.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/InstreamForeignObjectPnr.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/OverrideGraftingContext.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestGraphic.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -63,7 +63,7 @@
/* ... which contains an InstreamForeignObject ... */
node = block.formattingObjectChildAt(0);
assertTrue(node instanceof InstreamForeignObject4a);
- final InstreamForeignObject4a<?> ifo = (InstreamForeignObject4a<?>) node;
+ final InstreamForeignObject4a ifo = (InstreamForeignObject4a) node;
/* ... which contains an SVGElement ... */
node = ifo.formattingObjectChildAt(0);
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -103,7 +103,7 @@
}
@Override
- public ForeignObjectArea createForeignObjectArea(final InstreamForeignObject<?> ifo, final int ipd) {
+ public ForeignObjectArea createForeignObjectArea(final InstreamForeignObject ifo, final int ipd) {
final ForeignObjectArea newForeignArea = ForeignObjectArea.makeForeignObjectArea(ifo, this, ipd);
this.children.add(newForeignArea);
return newForeignArea;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AreaNode4a.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -968,7 +968,7 @@
}
@Override
- public int getIntrinsicWidth(final InstreamForeignObject<?> instreamForeign) {
+ public int getIntrinsicWidth(final InstreamForeignObject instreamForeign) {
final int pixelDensity = getAreaTree().getPixelDensity();
try {
final Graphic graphic = getGraphicForForeign(instreamForeign);
@@ -979,7 +979,7 @@
}
@Override
- public int getIntrinsicHeight(final InstreamForeignObject<?> instreamForeign) {
+ public int getIntrinsicHeight(final InstreamForeignObject instreamForeign) {
final int pixelDensity = getAreaTree().getPixelDensity();
try {
final Graphic graphic = getGraphicForForeign(instreamForeign);
@@ -995,7 +995,7 @@
* @return The graphic for {@code foreignXml}.
* @throws GraphicException For errors creating the graphic.
*/
- private Graphic getGraphicForForeign(final InstreamForeignObject<?> instreamForeign) throws GraphicException {
+ private Graphic getGraphicForForeign(final InstreamForeignObject instreamForeign) throws GraphicException {
final GraphicServer server = getAreaTree().getGraphicServer();
if (instreamForeign.getXmlDocument() instanceof MathMLDocument) {
final MathMLDocument document = (MathMLDocument) instreamForeign.getXmlDocument();
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ForeignObjectArea.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -51,7 +51,7 @@
org.axsl.area.NormalInlineArea {
/** The link to the FO tree. */
- private Link<InstreamForeignObject<?>> foLink;
+ private Link<InstreamForeignObject> foLink;
/** The parent of this node. The parent can be either a {@link LineArea4a}
* or another {@link AbstractInlineArea}. */
@@ -83,7 +83,7 @@
* @param width The width, in millipoints, of the Area.
* @return The new instance.
*/
- static ForeignObjectArea makeForeignObjectArea(final InstreamForeignObject<?> generatedBy,
+ static ForeignObjectArea makeForeignObjectArea(final InstreamForeignObject generatedBy,
final LineArea4a parentArea, final int width) {
final ForeignObjectArea newFoArea = new ForeignObjectArea(parentArea);
ForeignObjectArea.init(newFoArea, generatedBy, width);
@@ -97,7 +97,7 @@
* @param width The width, in millipoints, of the Area.
* @return The new instance.
*/
- static ForeignObjectArea makeForeignObjectArea(final InstreamForeignObject<?> generatedBy,
+ static ForeignObjectArea makeForeignObjectArea(final InstreamForeignObject generatedBy,
final AbstractInlineArea parentArea, final int width) {
final ForeignObjectArea newFoArea = new ForeignObjectArea(parentArea);
ForeignObjectArea.init(newFoArea, generatedBy, width);
@@ -110,7 +110,7 @@
* @param newFoArea The newly-created ForeignObjectArea instance.
* @param width The width, in millipoints, of the Area.
*/
- private static void init(final ForeignObjectArea newFoArea, final InstreamForeignObject<?> generatedBy,
+ private static void init(final ForeignObjectArea newFoArea, final InstreamForeignObject generatedBy,
final int width) {
newFoArea.foLink = newFoArea.getLink(generatedBy);
newFoArea.registerLink(generatedBy);
@@ -124,14 +124,12 @@
// Create the reference area for the content.
if (generatedBy.getXmlDocument() instanceof SVGDocument) {
- @SuppressWarnings("unchecked")
- final InstreamForeignObject<SVGDocument> svgElement = (InstreamForeignObject<SVGDocument>) generatedBy;
+ final InstreamForeignObject svgElement = (InstreamForeignObject) generatedBy;
final SvgArea svgArea = SvgArea.makeSvgArea(svgElement, newFoArea);
newFoArea.foreignContent = svgArea;
} else if (generatedBy.getXmlDocument() instanceof MathMLDocument) {
- @SuppressWarnings("unchecked")
- final InstreamForeignObject<MathMLDocument> mathElement =
- (InstreamForeignObject<MathMLDocument>) generatedBy;
+ final InstreamForeignObject mathElement =
+ (InstreamForeignObject) generatedBy;
final MathArea mathArea = MathArea.makeMathArea(mathElement, newFoArea);
newFoArea.foreignContent = mathArea;
}
@@ -148,7 +146,7 @@
* @return The bpd of the viewport for this area.
*/
public int viewportBPD() {
- final InstreamForeignObject<?> ifo = this.traitGeneratedBy();
+ final InstreamForeignObject ifo = this.traitGeneratedBy();
return ifo.viewportBpd(this);
}
@@ -157,7 +155,7 @@
* @return The ipd of the viewport for this area.
*/
public int viewportIPD() {
- final InstreamForeignObject<?> ifo = this.traitGeneratedBy();
+ final InstreamForeignObject ifo = this.traitGeneratedBy();
return ifo.viewportIpd(this);
}
@@ -188,12 +186,12 @@
}
@Override
- public Link<InstreamForeignObject<?>> getFoLink() {
+ public Link<InstreamForeignObject> getFoLink() {
return this.foLink;
}
@Override
- public InstreamForeignObject<?> traitGeneratedBy() {
+ public InstreamForeignObject traitGeneratedBy() {
return this.getFoLink().getGenerator();
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/LineArea4a.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -1020,7 +1020,7 @@
}
@Override
- public ForeignObjectArea createForeignObjectArea(final InstreamForeignObject<?> ifo, final int ipd) {
+ public ForeignObjectArea createForeignObjectArea(final InstreamForeignObject ifo, final int ipd) {
final ForeignObjectArea newForeignArea = ForeignObjectArea.makeForeignObjectArea(ifo, this, ipd);
this.children.add(newForeignArea);
return newForeignArea;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/MathArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/MathArea.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/MathArea.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -45,7 +45,7 @@
private ForeignObjectArea parent;
/** The link to the FO tree. */
- private InstreamForeignObject<MathMLDocument> foLink;
+ private InstreamForeignObject foLink;
/**
* Construct a MathArea.
@@ -61,7 +61,7 @@
* @param parentArea The parent area.
* @return The new instance.
*/
- static MathArea makeMathArea(final InstreamForeignObject<MathMLDocument> generatedBy,
+ static MathArea makeMathArea(final InstreamForeignObject generatedBy,
final ForeignObjectArea parentArea) {
final MathArea newMathArea = new MathArea(parentArea);
newMathArea.foLink = generatedBy;
@@ -71,7 +71,8 @@
@Override
public MathGraphic getGraphic() {
try {
- return this.parent.getAreaTree().getGraphicServer().procureMathGraphic(this.foLink.getXmlDocument());
+ return this.parent.getAreaTree().getGraphicServer().procureMathGraphic(
+ (MathMLDocument) this.foLink.getXmlDocument());
} catch (final GraphicException e) {
this.parent.getAreaTree().logError(e.getMessage());
return null;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/SvgArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/SvgArea.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/SvgArea.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -46,7 +46,7 @@
private ForeignObjectArea parent;
/** The link to the FO tree. */
- private InstreamForeignObject<SVGDocument> foLink;
+ private InstreamForeignObject foLink;
/**
* Construct an SvgArea.
@@ -62,7 +62,7 @@
* @param parentArea The parent area.
* @return The new instance.
*/
- static SvgArea makeSvgArea(final InstreamForeignObject<SVGDocument> generatedBy,
+ static SvgArea makeSvgArea(final InstreamForeignObject generatedBy,
final ForeignObjectArea parentArea) {
final SvgArea newSvgArea = new SvgArea(parentArea);
newSvgArea.foLink = generatedBy;
@@ -72,7 +72,8 @@
@Override
public SvgGraphic getGraphic() {
try {
- return this.parent.getAreaTree().getGraphicServer().procureSvgGraphic(this.foLink.getXmlDocument());
+ return this.parent.getAreaTree().getGraphicServer().procureSvgGraphic(
+ (SVGDocument) this.foLink.getXmlDocument());
} catch (final GraphicException e) {
this.parent.getAreaTree().logError(e.getMessage());
return null;
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/link/LinkFactory.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -191,8 +191,8 @@
}
@Override
- public NormalLink<InstreamForeignObject<?>> visit(final InstreamForeignObject<?> host) {
- return new NormalLink<InstreamForeignObject<?>>(host);
+ public NormalLink<InstreamForeignObject> visit(final InstreamForeignObject host) {
+ return new NormalLink<InstreamForeignObject>(host);
}
@Override
Modified: trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java
===================================================================
--- trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-content/src/main/java/org/foray/content/ContentTree4a.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -104,7 +104,7 @@
this.children.add(new ScalableContent(externalGraphic, fontUse, context));
return;
} else if (fo instanceof InstreamForeignObject) {
- final InstreamForeignObject<?> instreamForeign = (InstreamForeignObject<?>) fo;
+ final InstreamForeignObject instreamForeign = (InstreamForeignObject) fo;
this.children.add(new ScalableContent(instreamForeign, fontUse, context));
return;
} else if (fo instanceof Inline) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -498,13 +498,10 @@
public void rootElementEnded() {
ForeignXml<?> foreignXml = null;
if (this.foreignDocument instanceof SVGDocument) {
- @SuppressWarnings("unchecked")
- final InstreamForeignObject4a<SVGDocument> parent = (InstreamForeignObject4a<SVGDocument>) this.currentFObj;
+ final InstreamForeignObject4a parent = (InstreamForeignObject4a) this.currentFObj;
foreignXml = new InstreamSvgElement(parent, (SVGDocument) this.foreignDocument);
} else if (this.foreignDocument instanceof MathMLDocument) {
- @SuppressWarnings("unchecked")
- final InstreamForeignObject4a<MathMLDocument> parent =
- (InstreamForeignObject4a<MathMLDocument>) this.currentFObj;
+ final InstreamForeignObject4a parent = (InstreamForeignObject4a) this.currentFObj;
foreignXml = new InstreamMathElement(parent, (MathMLDocument) this.foreignDocument);
} else {
throw new IllegalStateException("Unexpected document type:" + this.foreignDocument.getClass().getName());
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -63,13 +63,13 @@
public abstract class ForeignXml<D extends Document> extends FoObj {
/** The parent of this node. */
- private InstreamForeignObject4a<D> parent;
+ private InstreamForeignObject4a parent;
/**
* Constructor.
* @param parent The parent FoObj.
*/
- public ForeignXml(final InstreamForeignObject4a<D> parent) {
+ public ForeignXml(final InstreamForeignObject4a parent) {
super(parent);
this.parent = parent;
}
@@ -107,7 +107,7 @@
}
@Override
- public InstreamForeignObject4a<D> getParent() {
+ public InstreamForeignObject4a getParent() {
return this.parent;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/InstreamForeignObject4a.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -45,15 +45,14 @@
/**
* An "instream-foreign-object" object in XSL-FO.
- * @param <D> The document type stored in this object.
*/
-public class InstreamForeignObject4a<D extends Document> extends FoScalable4a implements InstreamForeignObject<D> {
+public class InstreamForeignObject4a extends FoScalable4a implements InstreamForeignObject {
/** The parent of this node. */
private FoObj parent;
/** The children of this object. */
- private List<ForeignXml<D>> children = new ArrayList<ForeignXml<D>>(1);
+ private List<ForeignXml<Document>> children = new ArrayList<ForeignXml<Document>>(1);
/**
* Constructor.
@@ -115,7 +114,7 @@
}
@Override
- public List<ForeignXml<D>> getChildren() {
+ public List<ForeignXml<Document>> getChildren() {
return this.children;
}
@@ -126,7 +125,7 @@
+ "type of foreign xml.");
}
@SuppressWarnings("unchecked")
- final ForeignXml<D> foreignXmlChild = (ForeignXml<D>) child;
+ final ForeignXml<Document> foreignXmlChild = (ForeignXml<Document>) child;
this.getChildren().add(foreignXmlChild);
}
@@ -181,7 +180,7 @@
}
@Override
- public D getXmlDocument() {
+ public Document getXmlDocument() {
return this.children.get(0).getDocument();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentHeight.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentHeight.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentHeight.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -74,7 +74,7 @@
return context.getIntrinsicHeight((ExternalGraphic) fobjScaled);
}
if (fobjScaled instanceof InstreamForeignObject) {
- final InstreamForeignObject<?> ifo = (InstreamForeignObject<?>) fobjScaled;
+ final InstreamForeignObject ifo = (InstreamForeignObject) fobjScaled;
context.getIntrinsicHeight(ifo);
}
throw new IllegalStateException("Unexpected FO: " + fobjScaled.getClass().getName());
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentWidth.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentWidth.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -74,7 +74,7 @@
return context.getIntrinsicWidth((ExternalGraphic) fobjScaled);
}
if (fobjScaled instanceof InstreamForeignObject) {
- final InstreamForeignObject<?> ifo = (InstreamForeignObject<?>) fobjScaled;
+ final InstreamForeignObject ifo = (InstreamForeignObject) fobjScaled;
context.getIntrinsicWidth(ifo);
}
throw new IllegalStateException("Unexpected FO: " + fobjScaled.getClass().getName());
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -47,7 +47,7 @@
* @param parent The parent FoObj.
* @param document The DOM document.
*/
- public InstreamMathElement(final InstreamForeignObject4a<MathMLDocument> parent, final MathMLDocument document) {
+ public InstreamMathElement(final InstreamForeignObject4a parent, final MathMLDocument document) {
super(parent);
this.document = document;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -47,7 +47,7 @@
* @param parent The parent FoObj.
* @param document The DOM document.
*/
- public InstreamSvgElement(final InstreamForeignObject4a<SVGDocument> parent, final SVGDocument document) {
+ public InstreamSvgElement(final InstreamForeignObject4a parent, final SVGDocument document) {
super(parent);
this.document = document;
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -168,12 +168,12 @@
return -1;
}
@Override
- public int getIntrinsicWidth(final InstreamForeignObject<?> instreamForeign) {
+ public int getIntrinsicWidth(final InstreamForeignObject instreamForeign) {
/* We don't care about this for now. */
return -1;
}
@Override
- public int getIntrinsicHeight(final InstreamForeignObject<?> instreamForeign) {
+ public int getIntrinsicHeight(final InstreamForeignObject instreamForeign) {
/* We don't care about this for now. */
return -1;
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/InstreamForeignObjectPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/InstreamForeignObjectPnr.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/InstreamForeignObjectPnr.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -41,7 +41,7 @@
public class InstreamForeignObjectPnr extends FoObjPnr {
/** The real FONode which this proxy represents. */
- private InstreamForeignObject<?> node;
+ private InstreamForeignObject node;
/**
* Constructor.
@@ -48,7 +48,7 @@
* @param foreignObject The FO Tree object which is being laid out.
* @param layout The ancestor layout system.
*/
- public InstreamForeignObjectPnr(final InstreamForeignObject<?> foreignObject,
+ public InstreamForeignObjectPnr(final InstreamForeignObject foreignObject,
final PioneerLayoutStrategy layout) {
super(foreignObject, layout);
this.node = foreignObject;
@@ -65,7 +65,7 @@
}
@Override
- public InstreamForeignObject<?> getFONode() {
+ public InstreamForeignObject getFONode() {
return this.node;
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/OverrideGraftingContext.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/OverrideGraftingContext.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/OverrideGraftingContext.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -200,12 +200,12 @@
}
@Override
- public int getIntrinsicWidth(final InstreamForeignObject<?> instreamForeign) {
+ public int getIntrinsicWidth(final InstreamForeignObject instreamForeign) {
return this.wrappedContext.getIntrinsicWidth(instreamForeign);
}
@Override
- public int getIntrinsicHeight(final InstreamForeignObject<?> instreamForeign) {
+ public int getIntrinsicHeight(final InstreamForeignObject instreamForeign) {
return this.wrappedContext.getIntrinsicHeight(instreamForeign);
}
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-12-22 14:04:15 UTC (rev 12916)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/PioneerLayoutStrategy.java 2022-12-22 15:54:52 UTC (rev 12917)
@@ -472,7 +472,7 @@
}
@Override
- public InstreamForeignObjectPnr visit(final InstreamForeignObject<?> node) {
+ public InstreamForeignObjectPnr visit(final InstreamForeignObject node) {
return new InstreamForeignObjectPnr(node, this);
}
@@ -776,7 +776,7 @@
final Object nonTextToUse = nonText.getContent();
if (nonTextToUse instanceof InstreamForeignObject) {
- final InstreamForeignObject<?> ifo = (InstreamForeignObject<?>) nonTextToUse;
+ final InstreamForeignObject ifo = (InstreamForeignObject) nonTextToUse;
factory.createForeignObjectArea(ifo, sizeInline);
} else if (nonTextToUse instanceof ExternalGraphic) {
final ExternalGraphic graphic = (ExternalGraphic) nonTextToUse;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-22 14:04:20
|
Revision: 12916
http://sourceforge.net/p/foray/code/12916
Author: victormote
Date: 2022-12-22 14:04:15 +0000 (Thu, 22 Dec 2022)
Log Message:
-----------
Validate the namespace and name of the root element.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/Sax2DomParser.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/Sax2DomParser.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/Sax2DomParser.java 2022-12-22 13:39:09 UTC (rev 12915)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/Sax2DomParser.java 2022-12-22 14:04:15 UTC (rev 12916)
@@ -121,9 +121,17 @@
final Attributes attributes) throws SAXException {
if (this.currentElement == null) {
- /* We are trying to parse the root element, which was created when the document was created. Verify that it
- * is the same element name, then process the attributes. */
+ /* We are trying to parse the root element, which was created when the document was created. */
+ /* Verify that it is the same element name. */
+ if (! this.domDocument.getDocumentElement().getNamespaceURI().equals(namespaceURI)) {
+ throw new SAXException("Namespace mismatch on root element.");
+ }
+ if (! this.domDocument.getDocumentElement().getLocalName().equals(localName)) {
+ throw new SAXException("Unexpected root element name: " + localName);
+ }
this.currentElement = this.domDocument.getDocumentElement();
+ /* Process the attributes. The element was created when the document was, but any attributes that it has
+ * could not have been known then. */
processAttributes(this.currentElement, attributes);
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-22 13:39:11
|
Revision: 12915
http://sourceforge.net/p/foray/code/12915
Author: victormote
Date: 2022-12-22 13:39:09 +0000 (Thu, 22 Dec 2022)
Log Message:
-----------
Remove code related to foreign namespace parsing.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.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
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 13:25:17 UTC (rev 12914)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 13:39:09 UTC (rev 12915)
@@ -324,13 +324,13 @@
/* Before creating the new object, allow an existing FoObjMixed to capture any text that has accumulated, so
* that the text will be a sibling of the new object. */
finalizeText();
- final PropertyList list = namespace.createNewPropertyList(attlist);
+ final PropertyList list = nativeNamespace.createNewPropertyList(attlist);
if (this.currentFObj == null) {
if (! "root".equals(localName)) {
throw new SAXException("fo:root must be first element parsed");
}
}
- fobj = namespace.parseElement(this.foTree, localName, this.currentFObj, list, getLocator(), this);
+ fobj = nativeNamespace.parseElement(this.foTree, localName, this.currentFObj, list, getLocator(), this);
if (getLocator() != null) {
final Locator locator = getLocator();
fobj.setLocation(locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber());
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-22 13:25:17 UTC (rev 12914)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-22 13:39:09 UTC (rev 12915)
@@ -30,7 +30,6 @@
import org.axsl.fotree.FoTreeException;
-import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import javax.xml.namespace.QName;
@@ -63,40 +62,6 @@
public abstract String getNamespaceURI();
/**
- * Parse an element in this namespace.
- * @param foTree The parent FO Tree.
- * @param localName The local name of the element.
- * @param currentFObj The current FoObj, that is, the parent of the one being parsed.
- * @param list The property list into which properties for the new FoObj should be placed.
- * @param locator The SAX locator.
- * @param errorHandler Object that wants to be notified if an element unknown to this Namespace is encountered.
- * @return The newly-created FoObj instance.
- * @throws FoTreeException For parsing errors.
- */
- public abstract FoObj parseElement(FoTree4a foTree, String localName, FoObj currentFObj, PropertyList list,
- Locator locator, ErrorHandler errorHandler) throws FoTreeException;
-
- /**
- * The namespace-specific logic for parsing an element.
- * @param foTree The parent FO Tree.
- * @param localName The local name of the element.
- * @param currentFObj The current FoObj, that is, the parent of the one being parsed.
- * @param list The property list into which properties for the new FoObj should be placed.
- * @param locator The SAX locator.
- * @return The newly-created FoObj instance.
- * @throws FoTreeException For parsing errors.
- */
- protected abstract FoObj parseElementForNS(FoTree4a foTree, String localName, FoObj currentFObj, PropertyList list,
- Locator locator) throws FoTreeException;
-
- /**
- * Return a newly-created appropriate PropertyList for this namespace.
- * @param attlist The attributes that will become the properties in the list.
- * @return The newly-created property list.
- */
- protected abstract PropertyList createNewPropertyList(Attributes attlist);
-
- /**
* Returns a fully-qualified name for a given element in this namespace.
* @param elementName The name of the element for which a QName is needed.
* @return The QName for {@code elementName} in this namespace.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-22 13:25:17 UTC (rev 12914)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-22 13:39:09 UTC (rev 12915)
@@ -30,10 +30,7 @@
import org.foray.xml.Sax2DomParser;
-import org.axsl.fotree.FoTreeException;
-
import org.w3c.dom.Document;
-import org.xml.sax.Locator;
/**
* Abstract superclass for {@link Namespace} instances whose members are parsed as foreign objects in the FO tree.
@@ -40,18 +37,6 @@
*/
public abstract class NamespaceForeign extends Namespace {
- @Override
- public FoObj parseElement(final FoTree4a foTree, final String localName, final FoObj currentFObj,
- final PropertyList list, final Locator locator, final ErrorHandler errorHandler)
- throws FoTreeException {
- final FoObj fobj = parseElementForNS(foTree, localName, currentFObj, list, locator);
- if (fobj == null
- && errorHandler != null) {
- errorHandler.processUnknownElement(this, localName);
- }
- return fobj;
- }
-
/**
* Create a DOM {@link Document} instance.
* @return The newly-created {@link Document} instance for this namespace.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2022-12-22 13:25:17 UTC (rev 12914)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2022-12-22 13:39:09 UTC (rev 12915)
@@ -39,7 +39,17 @@
*/
public abstract class NamespaceNative extends Namespace {
- @Override
+ /**
+ * Parse an element in this namespace.
+ * @param foTree The parent FO Tree.
+ * @param localName The local name of the element.
+ * @param currentFObj The current FoObj, that is, the parent of the one being parsed.
+ * @param list The property list into which properties for the new FoObj should be placed.
+ * @param locator The SAX locator.
+ * @param errorHandler Object that wants to be notified if an element unknown to this Namespace is encountered.
+ * @return The newly-created FoObj instance.
+ * @throws FoTreeException For parsing errors.
+ */
public FoObj parseElement(final FoTree4a foTree, final String localName, final FoObj currentFObj,
final PropertyList list, final Locator locator, final ErrorHandler errorHandler)
throws FoTreeException {
@@ -52,6 +62,19 @@
}
/**
+ * The namespace-specific logic for parsing an element.
+ * @param foTree The parent FO Tree.
+ * @param localName The local name of the element.
+ * @param currentFObj The current FoObj, that is, the parent of the one being parsed.
+ * @param list The property list into which properties for the new FoObj should be placed.
+ * @param locator The SAX locator.
+ * @return The newly-created FoObj instance.
+ * @throws FoTreeException For parsing errors.
+ */
+ protected abstract FoObj parseElementForNS(FoTree4a foTree, String localName, FoObj currentFObj, PropertyList list,
+ Locator locator) throws FoTreeException;
+
+ /**
* Reads through the list of attributes and returns an array that contains the order in which they should be
* processed.
* The routine currently sorts the attributes alphabetically.
@@ -96,6 +119,13 @@
}
/**
+ * Return a newly-created appropriate PropertyList for this namespace.
+ * @param attlist The attributes that will become the properties in the list.
+ * @return The newly-created property list.
+ */
+ protected abstract PropertyList createNewPropertyList(Attributes attlist);
+
+ /**
* Parse the attributes for an element in this namespace.
* @param list The property list into which the parsed values should be placed.
* @param attlist The unparsed SAX attributes.
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-22 13:25:17 UTC (rev 12914)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java 2022-12-22 13:39:09 UTC (rev 12915)
@@ -28,22 +28,11 @@
package org.foray.fotree.math;
-import org.foray.fotree.FoObj;
-import org.foray.fotree.FoTree4a;
import org.foray.fotree.NamespaceForeign;
-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.foray.xml.domImpl.MathMlDocument4a;
import org.axsl.constants.XmlConstants;
-import org.axsl.fotree.FoTreeException;
-import org.w3c.dom.mathml.MathMLDocument;
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-
/**
* This class manages the namespace that is used for the Math Markup Language
* (MathML).
@@ -63,18 +52,6 @@
return XmlConstants.MATHML_NS_URI;
}
- @Override
- public FoObj parseElementForNS(final FoTree4a foTree, final String localName,
- final FoObj currentFObj, final PropertyList list,
- final Locator locator) throws FoTreeException {
- return makeObject(localName, currentFObj, list);
- }
-
- @Override
- protected PropertyList createNewPropertyList(final Attributes attlist) {
- return new PropertyListUnparsed(attlist);
- }
-
/**
* Returns the singleton instance of this class.
* @return The singleton instance of this class.
@@ -91,32 +68,4 @@
return new MathMlDocument4a(null, null, null);
}
- /**
- * 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\".");
- }
- if (parent instanceof InstreamForeignObject4a<?>) {
- @SuppressWarnings("unchecked")
- final InstreamForeignObject4a<MathMLDocument> ifo = (InstreamForeignObject4a<MathMLDocument>) parent;
- final MathMlDocument4a document = createDomDocument();
- return new InstreamMathElement(ifo, document);
- } 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-22 13:25:17 UTC (rev 12914)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-12-22 13:39:09 UTC (rev 12915)
@@ -28,22 +28,13 @@
package org.foray.fotree.svg;
-import org.foray.fotree.FoObj;
-import org.foray.fotree.FoTree4a;
import org.foray.fotree.NamespaceForeign;
-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.constants.XmlConstants;
-import org.axsl.fotree.FoTreeException;
import org.apache.batik.anim.dom.SVGDOMImplementation;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.svg.SVGDocument;
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
/**
* This class manages the namespace that is used for SVG.
@@ -64,17 +55,6 @@
return XmlConstants.SVG_NS_URI;
}
- @Override
- public FoObj parseElementForNS(final FoTree4a foTree, final String localName, final FoObj currentFObj,
- final PropertyList list, final Locator locator) throws FoTreeException {
- return makeObject(localName, currentFObj, list);
- }
-
- @Override
- protected PropertyList createNewPropertyList(final Attributes attlist) {
- return new PropertyListUnparsed(attlist);
- }
-
/**
* Returns the singleton instance of this class.
* @return The singleton instance of this class.
@@ -92,35 +72,4 @@
return (SVGDocument) impl.createDocument(XmlConstants.SVG_NS_URI, "svg", null);
}
- /**
- * 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 SvgObjectId enumeration = SvgObjectId.svgValueOf(objectName);
- if (enumeration == null) {
- return null;
- }
- switch (enumeration) {
- default: {
- if (parent instanceof InstreamForeignObject4a<?>) {
- @SuppressWarnings("unchecked")
- final InstreamForeignObject4a<SVGDocument> ifo = (InstreamForeignObject4a<SVGDocument>) parent;
- final SVGDocument document = createDomDocument();
- return new InstreamSvgElement(ifo, document);
- } else {
- parent.throwException("Instream SVG content must be inside "
- + "an fo:instream-foreign-object.");
- return null;
- }
- }
- }
- }
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-22 13:25:35
|
Revision: 12914
http://sourceforge.net/p/foray/code/12914
Author: victormote
Date: 2022-12-22 13:25:17 +0000 (Thu, 22 Dec 2022)
Log Message:
-----------
Remove parsing logic from ForeignXml.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 13:11:38 UTC (rev 12913)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 13:25:17 UTC (rev 12914)
@@ -500,14 +500,12 @@
if (this.foreignDocument instanceof SVGDocument) {
@SuppressWarnings("unchecked")
final InstreamForeignObject4a<SVGDocument> parent = (InstreamForeignObject4a<SVGDocument>) this.currentFObj;
- foreignXml = new InstreamSvgElement(parent, (PropertyListUnparsed) null,
- (SVGDocument) this.foreignDocument);
+ foreignXml = new InstreamSvgElement(parent, (SVGDocument) this.foreignDocument);
} else if (this.foreignDocument instanceof MathMLDocument) {
@SuppressWarnings("unchecked")
final InstreamForeignObject4a<MathMLDocument> parent =
(InstreamForeignObject4a<MathMLDocument>) this.currentFObj;
- foreignXml = new InstreamMathElement(parent, (PropertyListUnparsed) null,
- (MathMLDocument) this.foreignDocument);
+ foreignXml = new InstreamMathElement(parent, (MathMLDocument) this.foreignDocument);
} else {
throw new IllegalStateException("Unexpected document type:" + this.foreignDocument.getClass().getName());
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-22 13:11:38 UTC (rev 12913)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-22 13:25:17 UTC (rev 12914)
@@ -34,11 +34,6 @@
import org.axsl.fotree.FoVisitor;
import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
import java.util.Collections;
import java.util.List;
@@ -70,34 +65,13 @@
/** The parent of this node. */
private InstreamForeignObject4a<D> parent;
- /** The property list for this object. */
- private PropertyList propertyList;
-
/**
- * Tracks which element in the DOM is the current element during
- * parsing.
- */
- private transient Element currentElement;
-
- /**
- * Buffer for accumulating text in the element as it is parsed.
- */
- private transient StringBuilder stringBuilder = new StringBuilder();
-
- /**
* Constructor.
* @param parent The parent FoObj.
- * @param propertyList The property list for this FoObj.
- * @param document The DOM document.
*/
- public ForeignXml(final InstreamForeignObject4a<D> parent,
- final PropertyListUnparsed propertyList, final Document document) {
+ public ForeignXml(final InstreamForeignObject4a<D> parent) {
super(parent);
this.parent = parent;
- this.propertyList = propertyList;
- this.currentElement = document.getDocumentElement();
-// processAttributes(this.currentElement, propertyList.getAttributes());
-// parent.getFoTree().activateForeignXML(this);
}
@Override
@@ -132,99 +106,6 @@
return "foreign-xml";
}
- /**
- * This is pretending to be a SAX Handler for the start of an element.
- * Control is passed here from {@link FoTreeParser4a#startElement(String,
- * String, String, Attributes)} while foreign XML is being processed.
- * @param namespaceURI The Namespace URI, or the empty string if the element
- * has no Namespace URI or if Namespace processing is not being performed.
- * @param localName The local name (without prefix), or the empty string if
- * Namespace processing is not being performed.
- * @param rawName The qualified name (with prefix), or the empty string if
- * qualified names are not available.
- * @param attlist The attributes attached to the element. If there are no
- * attributes, it shall be an empty Attributes object.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly wrapping
- * another exception.
- */
- public void startElement(final String namespaceURI, final String localName,
- final String rawName, final Attributes attlist)
- throws SAXException {
- Element newElement = null;
- if (namespaceURI.equals("")) {
- newElement = getDocument().createElement(rawName);
- } else {
- newElement = getDocument().createElementNS(namespaceURI, rawName);
- }
- processAttributes(newElement, attlist);
- this.currentElement.appendChild(newElement);
- this.currentElement = newElement;
- }
-
- /**
- * Processes the attributes of an element in the foreign XML.
- * @param element The element being processed.
- * @param attlist The attributes of {@code element}.
- */
- private void processAttributes(final Element element,
- final Attributes attlist) {
- for (int i = 0; i < attlist.getLength(); i++) {
- final String localName = attlist.getLocalName(i);
- if (localName != null
- && ! "".equals(localName)) {
- final String value = attlist.getValue(i);
- element.setAttribute(localName, value);
- }
- }
- }
-
- /**
- * This is pretending to be a SAX Handler for the end of an element.
- * Control is passed here from {@link FoTreeParser4a#endElement(String,
- * String, String)} while foreign XML is being processed.
- * @param uri The Namespace URI, or the empty string if the element has no
- * Namespace URI or if Namespace processing is not being performed.
- * @param localName The local name (without prefix), or the empty string if
- * Namespace processing is not being performed.
- * @param rawName The qualified name (with prefix), or the empty string if
- * qualified names are not available.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly wrapping
- * another exception.
- */
- public void endElement(final String uri, final String localName,
- final String rawName) throws SAXException {
- if (this.stringBuilder.length() > 0) {
- // Create a Text node
- final String textString = this.stringBuilder.toString();
- final Text text = getDocument().createTextNode(textString);
- this.currentElement.appendChild(text);
- // Reuse the builder.
- this.stringBuilder.setLength(0);
- }
- // If this is the end of the root element, clean up and turn control
- // back over to the FoTreeBuilder.
- if (this.currentElement == getDocument().getDocumentElement()) {
- this.currentElement.normalize();
-// getFoTree().deactivateForeignXML();
- return;
- }
- // Otherwise go back up the tree one level.
- final Node parent = this.currentElement.getParentNode();
- this.currentElement = (Element) parent;
- }
-
- /**
- * This is pretending to be a SAX Handler for the characters (content) of an element.
- * Control is passed here from {@link FoTreeParser4a#characters(char[], int, int)} while foreign XML is being
- * processed.
- * @param data The characters.
- * @param start The start position in the character array.
- * @param length The number of characters to use from the character array.
- */
- protected void characters(final char[] data, final int start, final int length) {
- this.stringBuilder.append(data, start, length);
- }
-
@Override
public InstreamForeignObject4a<D> getParent() {
return this.parent;
@@ -242,7 +123,7 @@
@Override
public PropertyList getPropertyList() {
- return this.propertyList;
+ return PropertyList.emptyPropertyList();
}
@Override
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-22 13:11:38 UTC (rev 12913)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java 2022-12-22 13:25:17 UTC (rev 12914)
@@ -107,13 +107,11 @@
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<?>) {
@SuppressWarnings("unchecked")
final InstreamForeignObject4a<MathMLDocument> ifo = (InstreamForeignObject4a<MathMLDocument>) parent;
final MathMlDocument4a document = createDomDocument();
- return new InstreamMathElement(ifo, propertyListUnparsed, document);
+ return new InstreamMathElement(ifo, document);
} else {
parent.throwException("Instream MathML content must be inside "
+ "an fo:instream-foreign-object.");
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-22 13:11:38 UTC (rev 12913)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-22 13:25:17 UTC (rev 12914)
@@ -30,7 +30,6 @@
import org.foray.fotree.ForeignXml;
import org.foray.fotree.Namespace;
-import org.foray.fotree.PropertyListUnparsed;
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
import org.w3c.dom.mathml.MathMLDocument;
@@ -46,12 +45,10 @@
/**
* Constructor.
* @param parent The parent FoObj.
- * @param propertyList The property list for this FoObj.
* @param document The DOM document.
*/
- public InstreamMathElement(final InstreamForeignObject4a<MathMLDocument> parent,
- final PropertyListUnparsed propertyList, final MathMLDocument document) {
- super(parent, propertyList, document);
+ public InstreamMathElement(final InstreamForeignObject4a<MathMLDocument> parent, final MathMLDocument document) {
+ super(parent);
this.document = document;
}
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-22 13:11:38 UTC (rev 12913)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-12-22 13:25:17 UTC (rev 12914)
@@ -107,8 +107,6 @@
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<?>) {
@@ -115,7 +113,7 @@
@SuppressWarnings("unchecked")
final InstreamForeignObject4a<SVGDocument> ifo = (InstreamForeignObject4a<SVGDocument>) parent;
final SVGDocument document = createDomDocument();
- return new InstreamSvgElement(ifo, propertyListUnparsed, document);
+ return new InstreamSvgElement(ifo, document);
} else {
parent.throwException("Instream SVG content must be inside "
+ "an fo:instream-foreign-object.");
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-22 13:11:38 UTC (rev 12913)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-22 13:25:17 UTC (rev 12914)
@@ -30,7 +30,6 @@
import org.foray.fotree.ForeignXml;
import org.foray.fotree.Namespace;
-import org.foray.fotree.PropertyListUnparsed;
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
import org.w3c.dom.svg.SVGDocument;
@@ -46,12 +45,10 @@
/**
* Constructor.
* @param parent The parent FoObj.
- * @param propertyList The property list for this FoObj.
* @param document The DOM document.
*/
- public InstreamSvgElement(final InstreamForeignObject4a<SVGDocument> parent,
- final PropertyListUnparsed propertyList, final SVGDocument document) {
- super(parent, propertyList, document);
+ public InstreamSvgElement(final InstreamForeignObject4a<SVGDocument> parent, final SVGDocument document) {
+ super(parent);
this.document = document;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-22 13:11:40
|
Revision: 12913
http://sourceforge.net/p/foray/code/12913
Author: victormote
Date: 2022-12-22 13:11:38 +0000 (Thu, 22 Dec 2022)
Log Message:
-----------
Move parsing of InstreamForeignObject from ForeignXml to Sax2DomParser.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/Sax2DomParser.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-12-22 11:11:54 UTC (rev 12912)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-12-22 13:11:38 UTC (rev 12913)
@@ -53,9 +53,6 @@
/** The parent server. */
private FoTreeServer4a treeServer;
- /** The builder building this tree. */
- private FoTreeParser4a treeBuilder;
-
/** The root of the FO tree. */
private org.foray.fotree.fo.obj.Root4a root;
@@ -76,11 +73,9 @@
/**
* Constructor.
* @param treeServer The parent tree server.
- * @param treeBuilder The tree builder building this instance.
*/
- public FoTree4a(final FoTreeServer4a treeServer, final FoTreeParser4a treeBuilder) {
+ public FoTree4a(final FoTreeServer4a treeServer) {
this.treeServer = treeServer;
- this.treeBuilder = treeBuilder;
}
@Override
@@ -189,21 +184,6 @@
}
/**
- * Set a flag indicating that we are currently processing foreign XML.
- * @param foreign The foreign XML item that we are currently processing.
- */
- public void activateForeignXML(final ForeignXml<?> foreign) {
- this.treeBuilder.activateForeignXML(foreign);
- }
-
- /**
- * Unset the flag indicating that we are currently processing foreign XML.
- */
- public void deactivateForeignXML() {
- this.treeBuilder.deactivateForeignXML();
- }
-
- /**
* Logs an error message.
* @param message The message to be logged.
* @param arguments Parameters for the string template, if needed.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 11:11:54 UTC (rev 12912)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-22 13:11:38 UTC (rev 12913)
@@ -31,9 +31,13 @@
import org.foray.fotree.fo.obj.BookmarkTitle4a;
import org.foray.fotree.fo.obj.FoTextCharacters4a;
import org.foray.fotree.fo.obj.FoTextWords4a;
+import org.foray.fotree.fo.obj.InstreamForeignObject4a;
import org.foray.fotree.fo.obj.PageSequence4a;
import org.foray.fotree.fo.obj.Root4a;
+import org.foray.fotree.math.obj.InstreamMathElement;
+import org.foray.fotree.svg.obj.InstreamSvgElement;
import org.foray.primitive.StringUtils;
+import org.foray.xml.Sax2DomParser;
import org.foray.xml.SaxParser;
import org.axsl.constants.XmlConstants;
@@ -41,8 +45,12 @@
import org.axsl.fotree.FoTreeException;
import org.axsl.fotree.FoTreeListener;
import org.axsl.fotree.FoTreeParser;
+import org.axsl.fotree.fo.InstreamForeignObject;
import org.axsl.orthography.OrthographyException;
+import org.w3c.dom.Document;
+import org.w3c.dom.mathml.MathMLDocument;
+import org.w3c.dom.svg.SVGDocument;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
@@ -65,7 +73,8 @@
/**
* SAX Handler that builds the formatting object tree.
*/
-public class FoTreeParser4a extends SaxParser<FoTree4a> implements FoTreeParser, Namespace.ErrorHandler {
+public class FoTreeParser4a extends SaxParser<FoTree4a> implements FoTreeParser, Namespace.ErrorHandler,
+ Sax2DomParser.Listener {
/** The initial size of the text buffer for accumulating text. */
private static final int INITIAL_TEXT_BUFFER_SIZE = 4096;
@@ -93,9 +102,14 @@
/** Collection of objects that have registered to be notified about FOTreeEvent firings. */
private List<FoTreeListener> foTreeListeners = new ArrayList<FoTreeListener>();
- /** Indicates whether we are currently inside foreign XML. */
- private ForeignXml<?> activeForeignXML = null;
+ /** The current proxy parser, if any. This will be null during normal FO document parsing, but will contain a parser
+ * when instream-foreign-object content is being parsed. */
+ private Sax2DomParser proxyParser = null;
+ /** The current foreign document, if any. This will be null during normal FO document parsing, but will contain the
+ * document being parsed by {@link #proxyParser} when instream-foreign-object content is being parsed. */
+ private Document foreignDocument;
+
/** The parent server. */
private FoTreeServer4a server;
@@ -135,7 +149,7 @@
this.rootFObj = null;
this.foTreeListeners.clear();
StringUtils.clear(this.textBuffer);
- this.foTree = new FoTree4a(this.server, this);
+ this.foTree = new FoTree4a(this.server);
foTree.setOrthographyServer(this.server.getOrthographyServer());
this.resourceSearchPath = this.server.getResourceSearchPath() == null ?
Collections.emptyList() : this.server.getResourceSearchPath();
@@ -173,9 +187,9 @@
return;
}
- if (this.activeForeignXML != null) {
+ if (this.proxyParser != null) {
// If inside foreign XML, let the ForeignXml instance handle it.
- this.activeForeignXML.characters(data, start, length);
+ this.proxyParser.characters(data, start, length);
return;
}
@@ -269,10 +283,9 @@
@Override
public void startElement(final String namespaceURI, final String localName, final String rawName,
final Attributes attlist) throws SAXException {
- if (this.activeForeignXML != null) {
+ if (this.proxyParser != null) {
// If inside foreign XML, let the ForeignXml instance handle it.
- this.activeForeignXML.startElement(namespaceURI, localName, rawName,
- attlist);
+ this.proxyParser.startElement(namespaceURI, localName, rawName, attlist);
return;
}
final Namespace namespace = getTreeServer().getNamespace(namespaceURI);
@@ -282,6 +295,23 @@
throw new SAXException(message);
}
+ if (namespace instanceof NamespaceForeign) {
+ if (this.currentFObj instanceof InstreamForeignObject) {
+ final NamespaceForeign foreignNamespace = (NamespaceForeign) namespace;
+ this.foreignDocument = foreignNamespace.createDomDocument();
+ this.proxyParser = foreignNamespace.createSaxParser(this.foreignDocument);
+ this.proxyParser.setListener(this);
+ this.proxyParser.startElement(namespaceURI, localName, rawName, attlist);
+ return;
+ } else {
+ try {
+ namespace.throwException(getLocator(), localName);
+ } catch (final FoTreeException e) {
+ throw new SAXException(e);
+ }
+ }
+ }
+
NamespaceNative nativeNamespace = null;
if (namespace instanceof NamespaceNative) {
nativeNamespace = (NamespaceNative) namespace;
@@ -331,11 +361,11 @@
@Override
public void endElement(final String uri, final String localName, final String rawName) throws SAXException {
- if (this.activeForeignXML != null) {
+ if (this.proxyParser != null) {
// If inside foreign XML, let the ForeignXml instance handle it.
- this.activeForeignXML.endElement(uri, localName, rawName);
+ this.proxyParser.endElement(uri, localName, rawName);
// It may have disactivated the foreign XML, so check again.
- if (this.activeForeignXML != null) {
+ if (this.proxyParser != null) {
return;
}
}
@@ -464,22 +494,35 @@
}
}
- /**
- * Set a flag indicating that we are currently processing foreign XML.
- * @param foreign The foreign XML item that we are currently processing.
- */
- public void activateForeignXML(final ForeignXml<?> foreign) {
- this.activeForeignXML = foreign;
+ @Override
+ public void rootElementEnded() {
+ ForeignXml<?> foreignXml = null;
+ if (this.foreignDocument instanceof SVGDocument) {
+ @SuppressWarnings("unchecked")
+ final InstreamForeignObject4a<SVGDocument> parent = (InstreamForeignObject4a<SVGDocument>) this.currentFObj;
+ foreignXml = new InstreamSvgElement(parent, (PropertyListUnparsed) null,
+ (SVGDocument) this.foreignDocument);
+ } else if (this.foreignDocument instanceof MathMLDocument) {
+ @SuppressWarnings("unchecked")
+ final InstreamForeignObject4a<MathMLDocument> parent =
+ (InstreamForeignObject4a<MathMLDocument>) this.currentFObj;
+ foreignXml = new InstreamMathElement(parent, (PropertyListUnparsed) null,
+ (MathMLDocument) this.foreignDocument);
+ } else {
+ throw new IllegalStateException("Unexpected document type:" + this.foreignDocument.getClass().getName());
+ }
+ try {
+ this.currentFObj.addChild(foreignXml);
+ } catch (final FoTreeException e) {
+ /* Convert to unchecked exception. */
+ throw new IllegalStateException(e);
+ }
+ this.currentFObj = foreignXml;
+ this.proxyParser = null;
+ this.foreignDocument = null;
}
/**
- * Unset the flag indicating that we are currently processing foreign XML.
- */
- public void deactivateForeignXML() {
- this.activeForeignXML = null;
- }
-
- /**
* Return the "parent" FO Tree server.
* @return The FO Tree server.
*/
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-22 11:11:54 UTC (rev 12912)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-22 13:11:38 UTC (rev 12913)
@@ -89,16 +89,15 @@
* @param parent The parent FoObj.
* @param propertyList The property list for this FoObj.
* @param document The DOM document.
- * @throws FoTreeException For errors during construction.
*/
public ForeignXml(final InstreamForeignObject4a<D> parent,
- final PropertyListUnparsed propertyList, final Document document) throws FoTreeException {
+ final PropertyListUnparsed propertyList, final Document document) {
super(parent);
this.parent = parent;
this.propertyList = propertyList;
this.currentElement = document.getDocumentElement();
- processAttributes(this.currentElement, propertyList.getAttributes());
- parent.getFoTree().activateForeignXML(this);
+// processAttributes(this.currentElement, propertyList.getAttributes());
+// parent.getFoTree().activateForeignXML(this);
}
@Override
@@ -206,7 +205,7 @@
// back over to the FoTreeBuilder.
if (this.currentElement == getDocument().getDocumentElement()) {
this.currentElement.normalize();
- getFoTree().deactivateForeignXML();
+// getFoTree().deactivateForeignXML();
return;
}
// Otherwise go back up the tree one level.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-22 11:11:54 UTC (rev 12912)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-22 13:11:38 UTC (rev 12913)
@@ -34,7 +34,6 @@
import org.w3c.dom.Document;
import org.xml.sax.Locator;
-import org.xml.sax.ext.DefaultHandler2;
/**
* Abstract superclass for {@link Namespace} instances whose members are parsed as foreign objects in the FO tree.
@@ -57,19 +56,19 @@
* Create a DOM {@link Document} instance.
* @return The newly-created {@link Document} instance for this namespace.
*/
- protected abstract Document createDOMDocument();
+ protected abstract Document createDomDocument();
/**
* Create a SAX parser suitable for parsing a document created in this namespace.
- * The parser should contain an empty {@link Document}, and should be ready to build that document from SAX events
- * that are fed to it.
+ * The parser should be ready to build {@code document} from SAX events that are fed to it.
* This parser will be interposed in the process of parsing the FO document, and will serve as a proxy parser to
* parse the foreign XML.
+ * @param document The document which is to be built by the parser.
* @return The parser.
*/
- public DefaultHandler2 createSaxParser() {
- final Document newDocument = createDOMDocument();
- return new Sax2DomParser(newDocument);
+ public Sax2DomParser createSaxParser(final Document document) {
+ final Sax2DomParser parser = new Sax2DomParser(document);
+ return parser;
}
}
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-22 11:11:54 UTC (rev 12912)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java 2022-12-22 13:11:38 UTC (rev 12913)
@@ -87,7 +87,7 @@
}
@Override
- protected MathMlDocument4a createDOMDocument() {
+ protected MathMlDocument4a createDomDocument() {
return new MathMlDocument4a(null, null, null);
}
@@ -112,7 +112,7 @@
if (parent instanceof InstreamForeignObject4a<?>) {
@SuppressWarnings("unchecked")
final InstreamForeignObject4a<MathMLDocument> ifo = (InstreamForeignObject4a<MathMLDocument>) parent;
- final MathMlDocument4a document = createDOMDocument();
+ final MathMlDocument4a document = createDomDocument();
return new InstreamMathElement(ifo, propertyListUnparsed, document);
} else {
parent.throwException("Instream MathML content must be inside "
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-22 11:11:54 UTC (rev 12912)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-22 13:11:38 UTC (rev 12913)
@@ -33,8 +33,6 @@
import org.foray.fotree.PropertyListUnparsed;
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
-import org.axsl.fotree.FoTreeException;
-
import org.w3c.dom.mathml.MathMLDocument;
/**
@@ -50,10 +48,9 @@
* @param parent The parent FoObj.
* @param propertyList The property list for this FoObj.
* @param document The DOM document.
- * @throws FoTreeException For errors during construction.
*/
public InstreamMathElement(final InstreamForeignObject4a<MathMLDocument> parent,
- final PropertyListUnparsed propertyList, final MathMLDocument document) throws FoTreeException {
+ final PropertyListUnparsed propertyList, final MathMLDocument document) {
super(parent, propertyList, document);
this.document = document;
}
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-22 11:11:54 UTC (rev 12912)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-12-22 13:11:38 UTC (rev 12913)
@@ -87,7 +87,7 @@
}
@Override
- protected SVGDocument createDOMDocument() {
+ protected SVGDocument createDomDocument() {
final DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
return (SVGDocument) impl.createDocument(XmlConstants.SVG_NS_URI, "svg", null);
}
@@ -114,7 +114,7 @@
if (parent instanceof InstreamForeignObject4a<?>) {
@SuppressWarnings("unchecked")
final InstreamForeignObject4a<SVGDocument> ifo = (InstreamForeignObject4a<SVGDocument>) parent;
- final SVGDocument document = createDOMDocument();
+ final SVGDocument document = createDomDocument();
return new InstreamSvgElement(ifo, propertyListUnparsed, document);
} else {
parent.throwException("Instream SVG content must be inside "
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-22 11:11:54 UTC (rev 12912)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-22 13:11:38 UTC (rev 12913)
@@ -33,8 +33,6 @@
import org.foray.fotree.PropertyListUnparsed;
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
-import org.axsl.fotree.FoTreeException;
-
import org.w3c.dom.svg.SVGDocument;
/**
@@ -50,10 +48,9 @@
* @param parent The parent FoObj.
* @param propertyList The property list for this FoObj.
* @param document The DOM document.
- * @throws FoTreeException For errors during construction.
*/
public InstreamSvgElement(final InstreamForeignObject4a<SVGDocument> parent,
- final PropertyListUnparsed propertyList, final SVGDocument document) throws FoTreeException {
+ final PropertyListUnparsed propertyList, final SVGDocument document) {
super(parent, propertyList, document);
this.document = document;
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java 2022-12-22 11:11:54 UTC (rev 12912)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java 2022-12-22 13:11:38 UTC (rev 12913)
@@ -44,7 +44,6 @@
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
import java.net.URL;
import java.util.Collections;
@@ -193,10 +192,7 @@
* @return The newly-created FoObj.
*/
protected static final FoObj makeTestFObj() {
- final FoTreeServer4a server = Mockito.mock(FoTreeServer4a.class);
-
- final FoTreeParser4a foTreeBuilder = new FoTreeParser4a(server, null);
- final FoTree4a foTree = new FoTree4a(null, foTreeBuilder);
+ final FoTree4a foTree = new FoTree4a(null);
final PropertyList propertyList = new PropertyList(0);
final Root4a root = new Root4a(foTree, propertyList);
root.setFOTreeBuilder(foTree);
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/Sax2DomParser.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/Sax2DomParser.java 2022-12-22 11:11:54 UTC (rev 12912)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/Sax2DomParser.java 2022-12-22 13:11:38 UTC (rev 12913)
@@ -119,6 +119,15 @@
@Override
public void startElement(final String namespaceURI, final String localName, final String qName,
final Attributes attributes) throws SAXException {
+
+ if (this.currentElement == null) {
+ /* We are trying to parse the root element, which was created when the document was created. Verify that it
+ * is the same element name, then process the attributes. */
+ this.currentElement = this.domDocument.getDocumentElement();
+ processAttributes(this.currentElement, attributes);
+ return;
+ }
+
Element newElement = null;
if (namespaceURI.equals("")) {
newElement = this.domDocument.createElement(qName);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-22 11:11:56
|
Revision: 12912
http://sourceforge.net/p/foray/code/12912
Author: victormote
Date: 2022-12-22 11:11:54 +0000 (Thu, 22 Dec 2022)
Log Message:
-----------
Add parser creation method to NamespaceForeign.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 23:39:00 UTC (rev 12911)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-22 11:11:54 UTC (rev 12912)
@@ -28,10 +28,13 @@
package org.foray.fotree;
+import org.foray.xml.Sax2DomParser;
+
import org.axsl.fotree.FoTreeException;
import org.w3c.dom.Document;
import org.xml.sax.Locator;
+import org.xml.sax.ext.DefaultHandler2;
/**
* Abstract superclass for {@link Namespace} instances whose members are parsed as foreign objects in the FO tree.
@@ -53,8 +56,20 @@
/**
* Create a DOM {@link Document} instance.
* @return The newly-created {@link Document} instance for this namespace.
- * @throws FoTreeException For errors creating an appropriate DOM document for this object.
*/
- protected abstract Document createDOMDocument() throws FoTreeException;
+ protected abstract Document createDOMDocument();
+ /**
+ * Create a SAX parser suitable for parsing a document created in this namespace.
+ * The parser should contain an empty {@link Document}, and should be ready to build that document from SAX events
+ * that are fed to it.
+ * This parser will be interposed in the process of parsing the FO document, and will serve as a proxy parser to
+ * parse the foreign XML.
+ * @return The parser.
+ */
+ public DefaultHandler2 createSaxParser() {
+ final Document newDocument = createDOMDocument();
+ return new Sax2DomParser(newDocument);
+ }
+
}
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-21 23:39:00 UTC (rev 12911)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-12-22 11:11:54 UTC (rev 12912)
@@ -87,7 +87,7 @@
}
@Override
- protected SVGDocument createDOMDocument() throws FoTreeException {
+ protected SVGDocument createDOMDocument() {
final DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
return (SVGDocument) impl.createDocument(XmlConstants.SVG_NS_URI, "svg", null);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-21 23:39:02
|
Revision: 12911
http://sourceforge.net/p/foray/code/12911
Author: victormote
Date: 2022-12-21 23:39:00 +0000 (Wed, 21 Dec 2022)
Log Message:
-----------
Move Document creation to the NamespaceForeign subclass.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-21 14:49:17 UTC (rev 12910)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-21 23:39:00 UTC (rev 12911)
@@ -88,15 +88,15 @@
* Constructor.
* @param parent The parent FoObj.
* @param propertyList The property list for this FoObj.
+ * @param document The DOM document.
* @throws FoTreeException For errors during construction.
*/
public ForeignXml(final InstreamForeignObject4a<D> parent,
- final PropertyListUnparsed propertyList) throws FoTreeException {
+ final PropertyListUnparsed propertyList, final Document document) throws FoTreeException {
super(parent);
this.parent = parent;
this.propertyList = propertyList;
- this.createDOMDocument();
- this.currentElement = getDocument().getDocumentElement();
+ this.currentElement = document.getDocumentElement();
processAttributes(this.currentElement, propertyList.getAttributes());
parent.getFoTree().activateForeignXML(this);
}
@@ -123,12 +123,6 @@
}
/**
- * Create a DOM {@link Document} instance.
- * @throws FoTreeException For errors creating an appropriate DOM document for this object.
- */
- protected abstract void createDOMDocument() throws FoTreeException;
-
- /**
* Returns the DOM Document accumulated within this foreign XML.
* @return The DOM Document.
*/
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 14:49:17 UTC (rev 12910)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 23:39:00 UTC (rev 12911)
@@ -30,6 +30,7 @@
import org.axsl.fotree.FoTreeException;
+import org.w3c.dom.Document;
import org.xml.sax.Locator;
/**
@@ -49,4 +50,11 @@
return fobj;
}
+ /**
+ * Create a DOM {@link Document} instance.
+ * @return The newly-created {@link Document} instance for this namespace.
+ * @throws FoTreeException For errors creating an appropriate DOM document for this object.
+ */
+ protected abstract Document createDOMDocument() throws FoTreeException;
+
}
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-21 14:49:17 UTC (rev 12910)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java 2022-12-21 23:39:00 UTC (rev 12911)
@@ -35,6 +35,7 @@
import org.foray.fotree.PropertyListUnparsed;
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
import org.foray.fotree.math.obj.InstreamMathElement;
+import org.foray.xml.domImpl.MathMlDocument4a;
import org.axsl.constants.XmlConstants;
import org.axsl.fotree.FoTreeException;
@@ -85,6 +86,11 @@
return NamespaceMath.theInstance;
}
+ @Override
+ protected MathMlDocument4a createDOMDocument() {
+ return new MathMlDocument4a(null, null, null);
+ }
+
/**
* Converts an unparsed MathML element into an FoObj instance that can be added to the FO Tree.
* @param objectName The unparsed MathML element name.
@@ -106,7 +112,8 @@
if (parent instanceof InstreamForeignObject4a<?>) {
@SuppressWarnings("unchecked")
final InstreamForeignObject4a<MathMLDocument> ifo = (InstreamForeignObject4a<MathMLDocument>) parent;
- return new InstreamMathElement(ifo, propertyListUnparsed);
+ final MathMlDocument4a document = createDOMDocument();
+ return new InstreamMathElement(ifo, propertyListUnparsed, document);
} else {
parent.throwException("Instream MathML content must be inside "
+ "an fo:instream-foreign-object.");
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-21 14:49:17 UTC (rev 12910)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-21 23:39:00 UTC (rev 12911)
@@ -32,7 +32,6 @@
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyListUnparsed;
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
-import org.foray.xml.domImpl.MathMlDocument4a;
import org.axsl.fotree.FoTreeException;
@@ -50,19 +49,16 @@
* Constructor.
* @param parent The parent FoObj.
* @param propertyList The property list for this FoObj.
+ * @param document The DOM document.
* @throws FoTreeException For errors during construction.
*/
public InstreamMathElement(final InstreamForeignObject4a<MathMLDocument> parent,
- final PropertyListUnparsed propertyList) throws FoTreeException {
- super(parent, propertyList);
+ final PropertyListUnparsed propertyList, final MathMLDocument document) throws FoTreeException {
+ super(parent, propertyList, document);
+ this.document = document;
}
@Override
- protected void createDOMDocument() {
- this.document = new MathMlDocument4a(null, null, null);
- }
-
- @Override
public Namespace getNamespace() {
return this.getFoTree().getMathNamespace();
}
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-21 14:49:17 UTC (rev 12910)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-12-21 23:39:00 UTC (rev 12911)
@@ -39,6 +39,8 @@
import org.axsl.constants.XmlConstants;
import org.axsl.fotree.FoTreeException;
+import org.apache.batik.anim.dom.SVGDOMImplementation;
+import org.w3c.dom.DOMImplementation;
import org.w3c.dom.svg.SVGDocument;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
@@ -84,6 +86,12 @@
return NamespaceSvg.theInstance;
}
+ @Override
+ protected SVGDocument createDOMDocument() throws FoTreeException {
+ final DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
+ return (SVGDocument) impl.createDocument(XmlConstants.SVG_NS_URI, "svg", null);
+ }
+
/**
* Converts an unparsed SVG element into an FoObj instance that can be added to the FO Tree.
* @param objectName The unparsed SVG element name.
@@ -106,7 +114,8 @@
if (parent instanceof InstreamForeignObject4a<?>) {
@SuppressWarnings("unchecked")
final InstreamForeignObject4a<SVGDocument> ifo = (InstreamForeignObject4a<SVGDocument>) parent;
- return new InstreamSvgElement(ifo, propertyListUnparsed);
+ final SVGDocument document = createDOMDocument();
+ return new InstreamSvgElement(ifo, propertyListUnparsed, document);
} else {
parent.throwException("Instream SVG content must be inside "
+ "an fo:instream-foreign-object.");
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-21 14:49:17 UTC (rev 12910)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-21 23:39:00 UTC (rev 12911)
@@ -33,11 +33,8 @@
import org.foray.fotree.PropertyListUnparsed;
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
-import org.axsl.constants.XmlConstants;
import org.axsl.fotree.FoTreeException;
-import org.apache.batik.anim.dom.SVGDOMImplementation;
-import org.w3c.dom.DOMImplementation;
import org.w3c.dom.svg.SVGDocument;
/**
@@ -52,20 +49,16 @@
* Constructor.
* @param parent The parent FoObj.
* @param propertyList The property list for this FoObj.
+ * @param document The DOM document.
* @throws FoTreeException For errors during construction.
*/
public InstreamSvgElement(final InstreamForeignObject4a<SVGDocument> parent,
- final PropertyListUnparsed propertyList) throws FoTreeException {
- super(parent, propertyList);
+ final PropertyListUnparsed propertyList, final SVGDocument document) throws FoTreeException {
+ super(parent, propertyList, document);
+ this.document = document;
}
@Override
- protected void createDOMDocument() throws FoTreeException {
- final DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
- this.document = (SVGDocument) impl.createDocument(XmlConstants.SVG_NS_URI, "svg", null);
- }
-
- @Override
public Namespace getNamespace() {
return this.getFoTree().getSVGNamespace();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-21 14:49:19
|
Revision: 12910
http://sourceforge.net/p/foray/code/12910
Author: victormote
Date: 2022-12-21 14:49:17 +0000 (Wed, 21 Dec 2022)
Log Message:
-----------
Remove "standard" namespace prefix in favor of using QName.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.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
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-21 14:30:31 UTC (rev 12909)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-21 14:49:17 UTC (rev 12910)
@@ -147,6 +147,8 @@
import java.util.List;
import java.util.NoSuchElementException;
+import javax.xml.namespace.QName;
+
/**
* Base class for formatting objects.
*/
@@ -401,7 +403,8 @@
* @return The name of this object, with the typical namespace abbreviation prepended.
*/
public String getFullName() {
- return getNamespace().getTypicalPrefix() + ":" + getName();
+ final QName qname = getNamespace().getQname(getName());
+ return qname.toString();
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2022-12-21 14:30:31 UTC (rev 12909)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2022-12-21 14:49:17 UTC (rev 12910)
@@ -194,22 +194,6 @@
}
/**
- * Returns the text property name for a given PropertyType instance.
- * @param propertyType The property type whose name is needed.
- * @return The text property name.
- */
- public String getPropertyName(final PropertyId propertyType) {
- final String propertyName = propertyType.getAttributeName();
- for (Namespace ns : this.namespaceMap.values()) {
- if (propertyName != null
- && ! propertyName.equals("")) {
- return ns.getTypicalPrefix() + ":" + propertyName;
- }
- }
- return null;
- }
-
- /**
* Creates a Namespace instance for the given class name.
* @param mappingClassName The name of the Namespace subclass for which
* an instance should be created.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-21 14:30:31 UTC (rev 12909)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-21 14:49:17 UTC (rev 12910)
@@ -63,13 +63,6 @@
public abstract String getNamespaceURI();
/**
- * Returns the typical prefix for this namespace, minus the ":".
- * For example, the SVG namespace should return "svg".
- * @return The typical prefix for this namespace.
- */
- public abstract String getTypicalPrefix();
-
- /**
* Parse an element in this namespace.
* @param foTree The parent FO Tree.
* @param localName The local name of the element.
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-21 14:30:31 UTC (rev 12909)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java 2022-12-21 14:49:17 UTC (rev 12910)
@@ -65,11 +65,6 @@
}
@Override
- public String getTypicalPrefix() {
- return "axsl";
- }
-
- @Override
public FoObj parseElementForNS(final FoTree4a foTree, final String localName, final FoObj currentFObj,
final PropertyList list, final Locator locator) throws FoTreeException {
return makeObject(localName, currentFObj, list, locator);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.java 2022-12-21 14:30:31 UTC (rev 12909)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.java 2022-12-21 14:49:17 UTC (rev 12910)
@@ -414,11 +414,6 @@
}
@Override
- public String getTypicalPrefix() {
- return "fo";
- }
-
- @Override
public FoObj parseElementForNS(final FoTree4a foTree, final String localName, final FoObj currentFObj,
final PropertyList list, final Locator locator) throws FoTreeException {
return makeObject(foTree, localName, currentFObj, list, locator);
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-21 14:30:31 UTC (rev 12909)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/NamespaceForay.java 2022-12-21 14:49:17 UTC (rev 12910)
@@ -62,11 +62,6 @@
}
@Override
- public String getTypicalPrefix() {
- return "foray";
- }
-
- @Override
public FoObj parseElementForNS(final FoTree4a foTree, final String localName, final FoObj currentFObj,
final PropertyList list, final Locator locator) throws FoTreeException {
return makeObject(localName, currentFObj, list);
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-21 14:30:31 UTC (rev 12909)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java 2022-12-21 14:49:17 UTC (rev 12910)
@@ -63,11 +63,6 @@
}
@Override
- public String getTypicalPrefix() {
- return "m";
- }
-
- @Override
public FoObj parseElementForNS(final FoTree4a foTree, final String localName,
final FoObj currentFObj, final PropertyList list,
final Locator locator) throws FoTreeException {
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-21 14:30:31 UTC (rev 12909)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-12-21 14:49:17 UTC (rev 12910)
@@ -63,11 +63,6 @@
}
@Override
- public String getTypicalPrefix() {
- return "svg";
- }
-
- @Override
public FoObj parseElementForNS(final FoTree4a foTree, final String localName, final FoObj currentFObj,
final PropertyList list, final Locator locator) throws FoTreeException {
return makeObject(localName, currentFObj, list);
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-21 14:30:31 UTC (rev 12909)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/NamespaceXml.java 2022-12-21 14:49:17 UTC (rev 12910)
@@ -65,11 +65,6 @@
}
@Override
- public String getTypicalPrefix() {
- return "xml";
- }
-
- @Override
public FoObj parseElementForNS(final FoTree4a foTree, final String localName, final FoObj currentFObj,
final PropertyList list, final Locator locator) throws FoTreeException {
// This isn't needed for the xml: namespace.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-21 14:30:35
|
Revision: 12909
http://sourceforge.net/p/foray/code/12909
Author: victormote
Date: 2022-12-21 14:30:31 +0000 (Wed, 21 Dec 2022)
Log Message:
-----------
Simplify attribute processing for foreign namespaces.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-21 14:21:17 UTC (rev 12908)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-21 14:30:31 UTC (rev 12909)
@@ -281,6 +281,13 @@
getShortLocationString(getLocator());
throw new SAXException(message);
}
+
+ NamespaceNative nativeNamespace = null;
+ if (namespace instanceof NamespaceNative) {
+ nativeNamespace = (NamespaceNative) namespace;
+ }
+
+
/* the formatting object started */
FoObj fobj = null;
try {
@@ -299,7 +306,9 @@
fobj.setLocation(locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber());
}
fobj.validateAncestry();
- namespace.parseAttributes(list, attlist, fobj, getLocator(), this, this);
+ if (nativeNamespace != null) {
+ nativeNamespace.parseAttributes(list, attlist, fobj, getLocator(), this, this);
+ }
fobj.validateProperties();
/* If the parent is not null (which it can be for Root), register
* the newly-created object as a child of the parent. */
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-21 14:21:17 UTC (rev 12908)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-21 14:30:31 UTC (rev 12909)
@@ -28,7 +28,6 @@
package org.foray.fotree;
-import org.axsl.fotree.FoTreeCreator;
import org.axsl.fotree.FoTreeException;
import org.xml.sax.Attributes;
@@ -98,19 +97,6 @@
Locator locator) throws FoTreeException;
/**
- * Parse the attributes for an element in this namespace.
- * @param list The property list into which the parsed values should be placed.
- * @param attlist The unparsed SAX attributes.
- * @param currentFObj The FoObj instance to whom the attributes belong.
- * @param locator The SAX locator.
- * @param builder The FOTree builder.
- * @param creator The FO Tree creation context.
- * @throws FoTreeException For errors during attribute/property parsing.
- */
- public abstract void parseAttributes(PropertyList list, Attributes attlist, FoObj currentFObj, Locator locator,
- FoTreeParser4a builder, FoTreeCreator creator) throws FoTreeException;
-
- /**
* Return a newly-created appropriate PropertyList for this namespace.
* @param attlist The attributes that will become the properties in the list.
* @return The newly-created property list.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 14:21:17 UTC (rev 12908)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 14:30:31 UTC (rev 12909)
@@ -28,10 +28,8 @@
package org.foray.fotree;
-import org.axsl.fotree.FoTreeCreator;
import org.axsl.fotree.FoTreeException;
-import org.xml.sax.Attributes;
import org.xml.sax.Locator;
/**
@@ -51,14 +49,4 @@
return fobj;
}
- @Override
- public void parseAttributes(final PropertyList propertyList, final Attributes attlist, final FoObj currentFObj,
- final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator) {
- /*
- * There is nothing to do here. We passed the raw attributes when
- * we created the propertyList instance.
- */
- return;
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2022-12-21 14:21:17 UTC (rev 12908)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2022-12-21 14:30:31 UTC (rev 12909)
@@ -96,6 +96,19 @@
}
/**
+ * Parse the attributes for an element in this namespace.
+ * @param list The property list into which the parsed values should be placed.
+ * @param attlist The unparsed SAX attributes.
+ * @param currentFObj The FoObj instance to whom the attributes belong.
+ * @param locator The SAX locator.
+ * @param builder The FOTree builder.
+ * @param creator The FO Tree creation context.
+ * @throws FoTreeException For errors during attribute/property parsing.
+ */
+ public abstract void parseAttributes(PropertyList list, Attributes attlist, FoObj currentFObj, Locator locator,
+ FoTreeParser4a builder, FoTreeCreator creator) throws FoTreeException;
+
+ /**
* Parses one attribute.
* @param attributes The unparsed SAX attributes.
* @param attributeName The name of the attribute to be parsed.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-21 14:21:19
|
Revision: 12908
http://sourceforge.net/p/foray/code/12908
Author: victormote
Date: 2022-12-21 14:21:17 +0000 (Wed, 21 Dec 2022)
Log Message:
-----------
Simplify attribute processing for foreign namespaces.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-21 13:59:10 UTC (rev 12907)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-21 14:21:17 UTC (rev 12908)
@@ -111,21 +111,6 @@
FoTreeParser4a builder, FoTreeCreator creator) throws FoTreeException;
/**
- * Parses one attribute.
- * @param attributes The unparsed SAX attributes.
- * @param attributeName The name of the attribute to be parsed.
- * @param attributeValue The value of the attribute to be parsed.
- * @param fobj The FoObj to which the properties belong.
- * @param locator The SAX locator.
- * @param builder The FOTree builder.
- * @param creator The FO Tree creation context.
- * @return The parsed property.
- * @throws PropertyException For errors during parsing.
- */
- public abstract Property parseAttribute(Attributes attributes, String attributeName, String attributeValue,
- FoObj fobj, Locator locator, FoTreeParser4a builder, FoTreeCreator creator) throws PropertyException;
-
- /**
* Return a newly-created appropriate PropertyList for this namespace.
* @param attlist The attributes that will become the properties in the list.
* @return The newly-created property list.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 13:59:10 UTC (rev 12907)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 14:21:17 UTC (rev 12908)
@@ -61,13 +61,4 @@
return;
}
- @Override
- public Property parseAttribute(final Attributes attributes, final String attributeName, final String attributeValue,
- final FoObj fobj, final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator)
- throws PropertyException {
- /* This method is required by the abstract superclass Namespace, but is
- * not used, because the parseAttributes method does all of the work. */
- return null;
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2022-12-21 13:59:10 UTC (rev 12907)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2022-12-21 14:21:17 UTC (rev 12908)
@@ -95,7 +95,18 @@
return sorted;
}
- @Override
+ /**
+ * Parses one attribute.
+ * @param attributes The unparsed SAX attributes.
+ * @param attributeName The name of the attribute to be parsed.
+ * @param attributeValue The value of the attribute to be parsed.
+ * @param fobj The FoObj to which the properties belong.
+ * @param locator The SAX locator.
+ * @param builder The FOTree builder.
+ * @param creator The FO Tree creation context.
+ * @return The parsed property.
+ * @throws PropertyException For errors during parsing.
+ */
public Property parseAttribute(final Attributes attributes, final String attributeName, final String attributeValue,
final FoObj fobj, final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator)
throws PropertyException {
@@ -164,10 +175,13 @@
if (namespace == null) {
throw new PropertyException("Unknown namespace: " + namespaceURI);
}
- final Property property = namespace.parseAttribute(attributes, localName, attributeValue, parentFO, locator,
- builder, creator);
- if (property != null) {
- propertyList.addProperty(parentFO, property);
+ if (namespace instanceof NamespaceNative) {
+ final NamespaceNative nativeNamespace = (NamespaceNative) namespace;
+ final Property property = nativeNamespace.parseAttribute(attributes, localName, attributeValue,
+ parentFO, locator, builder, creator);
+ if (property != null) {
+ propertyList.addProperty(parentFO, property);
+ }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-21 13:59:12
|
Revision: 12907
http://sourceforge.net/p/foray/code/12907
Author: victormote
Date: 2022-12-21 13:59:10 +0000 (Wed, 21 Dec 2022)
Log Message:
-----------
Pull method implemented identically up into the abstract superclass.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.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
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 13:50:48 UTC (rev 12906)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 13:59:10 UTC (rev 12907)
@@ -52,6 +52,16 @@
}
@Override
+ public void parseAttributes(final PropertyList propertyList, final Attributes attlist, final FoObj currentFObj,
+ final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator) {
+ /*
+ * There is nothing to do here. We passed the raw attributes when
+ * we created the propertyList instance.
+ */
+ return;
+ }
+
+ @Override
public Property parseAttribute(final Attributes attributes, final String attributeName, final String attributeValue,
final FoObj fobj, final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator)
throws PropertyException {
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-21 13:50:48 UTC (rev 12906)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java 2022-12-21 13:59:10 UTC (rev 12907)
@@ -30,7 +30,6 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
-import org.foray.fotree.FoTreeParser4a;
import org.foray.fotree.NamespaceForeign;
import org.foray.fotree.PropertyList;
import org.foray.fotree.PropertyListUnparsed;
@@ -38,7 +37,6 @@
import org.foray.fotree.math.obj.InstreamMathElement;
import org.axsl.constants.XmlConstants;
-import org.axsl.fotree.FoTreeCreator;
import org.axsl.fotree.FoTreeException;
import org.w3c.dom.mathml.MathMLDocument;
@@ -77,16 +75,6 @@
}
@Override
- public void parseAttributes(final PropertyList propertyList, final Attributes attlist, final FoObj currentFObj,
- final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator) {
- /*
- * There is nothing to do here. We passed the raw attributes when
- * we created the propertyList instance.
- */
- return;
- }
-
- @Override
protected PropertyList createNewPropertyList(final Attributes attlist) {
return new PropertyListUnparsed(attlist);
}
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-21 13:50:48 UTC (rev 12906)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-12-21 13:59:10 UTC (rev 12907)
@@ -30,7 +30,6 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
-import org.foray.fotree.FoTreeParser4a;
import org.foray.fotree.NamespaceForeign;
import org.foray.fotree.PropertyList;
import org.foray.fotree.PropertyListUnparsed;
@@ -38,7 +37,6 @@
import org.foray.fotree.svg.obj.InstreamSvgElement;
import org.axsl.constants.XmlConstants;
-import org.axsl.fotree.FoTreeCreator;
import org.axsl.fotree.FoTreeException;
import org.w3c.dom.svg.SVGDocument;
@@ -76,16 +74,6 @@
}
@Override
- public void parseAttributes(final PropertyList propertyList, final Attributes attlist, final FoObj currentFObj,
- final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator) {
- /*
- * There is nothing to do here. We passed the raw attributes when
- * we created the propertyList instance.
- */
- return;
- }
-
- @Override
protected PropertyList createNewPropertyList(final Attributes attlist) {
return new PropertyListUnparsed(attlist);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-21 13:50:50
|
Revision: 12906
http://sourceforge.net/p/foray/code/12906
Author: victormote
Date: 2022-12-21 13:50:48 +0000 (Wed, 21 Dec 2022)
Log Message:
-----------
Simplify attribute processing for foreign namespaces.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.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
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-21 13:12:02 UTC (rev 12905)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-21 13:50:48 UTC (rev 12906)
@@ -126,20 +126,6 @@
FoObj fobj, Locator locator, FoTreeParser4a builder, FoTreeCreator creator) throws PropertyException;
/**
- * Parses one attribute in this namespace.
- * @param attributes The unparsed SAX attributes.
- * @param attributeName The name of the attribute to be parsed.
- * @param attributeValue The value of the attribute to be parsed.
- * @param fobj The FoObj to which the properties belongs.
- * @param locator The SAX locator.
- * @param creator The FO Tree creation context.
- * @return The parsed property.
- * @throws PropertyException For errors during parsing.
- */
- public abstract Property parseAttributeForNS(Attributes attributes, String attributeName, String attributeValue,
- FoObj fobj, Locator locator, FoTreeCreator creator) throws PropertyException;
-
- /**
* Return a newly-created appropriate PropertyList for this namespace.
* @param attlist The attributes that will become the properties in the list.
* @return The newly-created property list.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 13:12:02 UTC (rev 12905)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 13:50:48 UTC (rev 12906)
@@ -55,9 +55,9 @@
public Property parseAttribute(final Attributes attributes, final String attributeName, final String attributeValue,
final FoObj fobj, final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator)
throws PropertyException {
- final Property property = parseAttributeForNS(attributes, attributeName, attributeValue, fobj, locator,
- creator);
- return property;
+ /* This method is required by the abstract superclass Namespace, but is
+ * not used, because the parseAttributes method does all of the work. */
+ return null;
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2022-12-21 13:12:02 UTC (rev 12905)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2022-12-21 13:50:48 UTC (rev 12906)
@@ -105,6 +105,20 @@
}
/**
+ * Parses one attribute in this namespace.
+ * @param attributes The unparsed SAX attributes.
+ * @param attributeName The name of the attribute to be parsed.
+ * @param attributeValue The value of the attribute to be parsed.
+ * @param fobj The FoObj to which the properties belongs.
+ * @param locator The SAX locator.
+ * @param creator The FO Tree creation context.
+ * @return The parsed property.
+ * @throws PropertyException For errors during parsing.
+ */
+ public abstract Property parseAttributeForNS(Attributes attributes, String attributeName, String attributeValue,
+ FoObj fobj, Locator locator, FoTreeCreator creator) throws PropertyException;
+
+ /**
* Parses the attributes for an object in a pre-specified order, building the PropertyList from them.
* @param propertyList The property list into which the parsed values should be placed.
* @param attributes The unparsed SAX attributes.
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-21 13:12:02 UTC (rev 12905)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java 2022-12-21 13:50:48 UTC (rev 12906)
@@ -32,8 +32,6 @@
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
import org.foray.fotree.NamespaceForeign;
-import org.foray.fotree.Property;
-import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
import org.foray.fotree.PropertyListUnparsed;
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
@@ -89,15 +87,6 @@
}
@Override
- public Property parseAttributeForNS(final Attributes attributes, final String attributeName,
- final String attributeValue, final FoObj fobj, final Locator locator, final FoTreeCreator creator)
- throws PropertyException {
- /* This method is required by the abstract superclass Namespace, but is
- * not used, because the parseAttributes method does all of the work. */
- return null;
- }
-
- @Override
protected PropertyList createNewPropertyList(final Attributes attlist) {
return new PropertyListUnparsed(attlist);
}
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-21 13:12:02 UTC (rev 12905)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-12-21 13:50:48 UTC (rev 12906)
@@ -32,8 +32,6 @@
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
import org.foray.fotree.NamespaceForeign;
-import org.foray.fotree.Property;
-import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
import org.foray.fotree.PropertyListUnparsed;
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
@@ -88,15 +86,6 @@
}
@Override
- public Property parseAttributeForNS(final Attributes attributes, final String attributeName,
- final String attributeValue, final FoObj fobj, final Locator locator, final FoTreeCreator creator)
- throws PropertyException {
- /* This method is required by the abstract superclass Namespace, but is
- * not used, because the parseAttributes method does all of the work. */
- return null;
- }
-
- @Override
protected PropertyList createNewPropertyList(final Attributes attlist) {
return new PropertyListUnparsed(attlist);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-21 13:12:05
|
Revision: 12905
http://sourceforge.net/p/foray/code/12905
Author: victormote
Date: 2022-12-21 13:12:02 +0000 (Wed, 21 Dec 2022)
Log Message:
-----------
Split Namespace classes into Foreign and Native, depending on whether their elements go directly into the Fo Tree as Fo objects, or whether they are parsed as DOM Documents.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.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
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-21 00:48:54 UTC (rev 12904)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Namespace.java 2022-12-21 13:12:02 UTC (rev 12905)
@@ -81,16 +81,8 @@
* @return The newly-created FoObj instance.
* @throws FoTreeException For parsing errors.
*/
- public FoObj parseElement(final FoTree4a foTree, final String localName, final FoObj currentFObj,
- final PropertyList list, final Locator locator, final ErrorHandler errorHandler)
- throws FoTreeException {
- final FoObj fobj = parseElementForNS(foTree, localName, currentFObj, list, locator);
- if (fobj == null
- && errorHandler != null) {
- errorHandler.processUnknownElement(this, localName);
- }
- return fobj;
- }
+ public abstract FoObj parseElement(FoTree4a foTree, String localName, FoObj currentFObj, PropertyList list,
+ Locator locator, ErrorHandler errorHandler) throws FoTreeException;
/**
* The namespace-specific logic for parsing an element.
@@ -119,50 +111,6 @@
FoTreeParser4a builder, FoTreeCreator creator) throws FoTreeException;
/**
- * Reads through the list of attributes and returns an array that contains the order in which they should be
- * processed.
- * The routine currently sorts the attributes alphabetically.
- * The purpose of this is to ensure that any short forms of compound properties are processed before their more
- * complete forms are processed.
- * For example, downstream processing is simplified if we know that property "leader-length" was processed before
- * property "leader-length.minimum".
- * @param attlist The Attributes instance that contains the attributes to be sorted
- * @return An int array containing the order in which the attributes should be processed.
- * If element 0 contains an 8 and element 1 contains a 3, then element 8 of Attributes should be processed first,
- * and element 3 should be processed second.
- */
- protected int[] sortAttributes(final Attributes attlist) {
- final int[] sorted = new int[attlist.getLength()];
- // Initialize each element of the array with its own index
- for (int sortedIndex = 0; sortedIndex < sorted.length; sortedIndex++) {
- sorted[sortedIndex] = sortedIndex;
- }
- int numChanges = 1;
- // Until there are no more changes being made
- while (numChanges > 0) {
- numChanges = 0;
- // Read through each item
- for (int sortedIndex = 0; sortedIndex < sorted.length - 1; sortedIndex++) {
- // Compare the two local names
- // TODO: This might need to handle namespaces.
- final String localName1 = attlist.getLocalName(sorted[sortedIndex]);
- final String localName2 = attlist.getLocalName(sorted[sortedIndex + 1]);
- /*
- * If i's local name is greater than i + 1's, switch their
- * pointers.
- */
- if (localName1.compareTo(localName2) > 0) {
- final int saveValue = sorted[sortedIndex];
- sorted[sortedIndex] = sorted[sortedIndex + 1];
- sorted[sortedIndex + 1] = saveValue;
- numChanges ++;
- }
- }
- }
- return sorted;
- }
-
- /**
* Parses one attribute.
* @param attributes The unparsed SAX attributes.
* @param attributeName The name of the attribute to be parsed.
@@ -174,13 +122,8 @@
* @return The parsed property.
* @throws PropertyException For errors during parsing.
*/
- public Property parseAttribute(final Attributes attributes, final String attributeName, final String attributeValue,
- final FoObj fobj, final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator)
- throws PropertyException {
- final Property property = parseAttributeForNS(attributes, attributeName, attributeValue, fobj, locator,
- creator);
- return property;
- }
+ public abstract Property parseAttribute(Attributes attributes, String attributeName, String attributeValue,
+ FoObj fobj, Locator locator, FoTreeParser4a builder, FoTreeCreator creator) throws PropertyException;
/**
* Parses one attribute in this namespace.
@@ -197,60 +140,6 @@
FoObj fobj, Locator locator, FoTreeCreator creator) throws PropertyException;
/**
- * Parses the attributes for an object in a pre-specified order, building the PropertyList from them.
- * @param propertyList The property list into which the parsed values should be placed.
- * @param attributes The unparsed SAX attributes.
- * @param parentFO The parent FO.
- * @param attributeSort The order in which the various attributes should be parsed, so that compound values are
- * handled properly.
- * @param locator The SAX locator.
- * @param builder The FO Tree builder.
- * @param creator The FO Tree creation context.
- * @throws PropertyException For errors during parsing.
- */
- protected void makeList(final PropertyList propertyList, final Attributes attributes, final FoObj parentFO,
- final int[] attributeSort, final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator)
- throws PropertyException {
- for (int j = 0; j < attributeSort.length; j++) {
- /* We are reading through the attributes elements in attributeSort
- * order. */
- final int i = attributeSort[j];
- final String qualifiedName = attributes.getQName(i);
- final String localName = attributes.getLocalName(i);
- final String attributeValue = attributes.getValue(i);
-
- /* The namespace on the attribute can be different than the one on
- * the element. So first we need to parse the correct namespace to
- * use. */
- if (qualifiedName != null
- && qualifiedName.startsWith("xmlns:")) {
- /* This is a namespace entry. This is processed by the SAX
- * parser & ignored by us. */
- continue;
- }
- final FoTreeServer4a treeServer = builder.getTreeServer();
- final String namespaceURI = attributes.getURI(i);
- Namespace namespace = null;
- if (namespaceURI == null
- || "".equals(namespaceURI)) {
- /* If no namespace is specified on the attribute, use the
- * namespace from the element. */
- namespace = this;
- } else {
- namespace = treeServer.getNamespace(namespaceURI);
- }
- if (namespace == null) {
- throw new PropertyException("Unknown namespace: " + namespaceURI);
- }
- final Property property = namespace.parseAttribute(attributes, localName, attributeValue, parentFO, locator,
- builder, creator);
- if (property != null) {
- propertyList.addProperty(parentFO, property);
- }
- }
- }
-
- /**
* Return a newly-created appropriate PropertyList for this namespace.
* @param attlist The attributes that will become the properties in the list.
* @return The newly-created property list.
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java 2022-12-21 13:12:02 UTC (rev 12905)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2022 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;
+
+import org.axsl.fotree.FoTreeCreator;
+import org.axsl.fotree.FoTreeException;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
+/**
+ * Abstract superclass for {@link Namespace} instances whose members are parsed as foreign objects in the FO tree.
+ */
+public abstract class NamespaceForeign extends Namespace {
+
+ @Override
+ public FoObj parseElement(final FoTree4a foTree, final String localName, final FoObj currentFObj,
+ final PropertyList list, final Locator locator, final ErrorHandler errorHandler)
+ throws FoTreeException {
+ final FoObj fobj = parseElementForNS(foTree, localName, currentFObj, list, locator);
+ if (fobj == null
+ && errorHandler != null) {
+ errorHandler.processUnknownElement(this, localName);
+ }
+ return fobj;
+ }
+
+ @Override
+ public Property parseAttribute(final Attributes attributes, final String attributeName, final String attributeValue,
+ final FoObj fobj, final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator)
+ throws PropertyException {
+ final Property property = parseAttributeForNS(attributes, attributeName, attributeValue, fobj, locator,
+ creator);
+ return property;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceForeign.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2022-12-21 13:12:02 UTC (rev 12905)
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2022 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;
+
+import org.axsl.fotree.FoTreeCreator;
+import org.axsl.fotree.FoTreeException;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
+/**
+ * Abstract superclass for {@link Namespace} instances whose members are parsed as native objects in the FO tree.
+ */
+public abstract class NamespaceNative extends Namespace {
+
+ @Override
+ public FoObj parseElement(final FoTree4a foTree, final String localName, final FoObj currentFObj,
+ final PropertyList list, final Locator locator, final ErrorHandler errorHandler)
+ throws FoTreeException {
+ final FoObj fobj = parseElementForNS(foTree, localName, currentFObj, list, locator);
+ if (fobj == null
+ && errorHandler != null) {
+ errorHandler.processUnknownElement(this, localName);
+ }
+ return fobj;
+ }
+
+ /**
+ * Reads through the list of attributes and returns an array that contains the order in which they should be
+ * processed.
+ * The routine currently sorts the attributes alphabetically.
+ * The purpose of this is to ensure that any short forms of compound properties are processed before their more
+ * complete forms are processed.
+ * For example, downstream processing is simplified if we know that property "leader-length" was processed before
+ * property "leader-length.minimum".
+ * @param attlist The Attributes instance that contains the attributes to be sorted
+ * @return An int array containing the order in which the attributes should be processed.
+ * If element 0 contains an 8 and element 1 contains a 3, then element 8 of Attributes should be processed first,
+ * and element 3 should be processed second.
+ */
+ protected int[] sortAttributes(final Attributes attlist) {
+ final int[] sorted = new int[attlist.getLength()];
+ // Initialize each element of the array with its own index
+ for (int sortedIndex = 0; sortedIndex < sorted.length; sortedIndex++) {
+ sorted[sortedIndex] = sortedIndex;
+ }
+ int numChanges = 1;
+ // Until there are no more changes being made
+ while (numChanges > 0) {
+ numChanges = 0;
+ // Read through each item
+ for (int sortedIndex = 0; sortedIndex < sorted.length - 1; sortedIndex++) {
+ // Compare the two local names
+ // TODO: This might need to handle namespaces.
+ final String localName1 = attlist.getLocalName(sorted[sortedIndex]);
+ final String localName2 = attlist.getLocalName(sorted[sortedIndex + 1]);
+ /*
+ * If i's local name is greater than i + 1's, switch their
+ * pointers.
+ */
+ if (localName1.compareTo(localName2) > 0) {
+ final int saveValue = sorted[sortedIndex];
+ sorted[sortedIndex] = sorted[sortedIndex + 1];
+ sorted[sortedIndex + 1] = saveValue;
+ numChanges ++;
+ }
+ }
+ }
+ return sorted;
+ }
+
+ @Override
+ public Property parseAttribute(final Attributes attributes, final String attributeName, final String attributeValue,
+ final FoObj fobj, final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator)
+ throws PropertyException {
+ final Property property = parseAttributeForNS(attributes, attributeName, attributeValue, fobj, locator,
+ creator);
+ return property;
+ }
+
+ /**
+ * Parses the attributes for an object in a pre-specified order, building the PropertyList from them.
+ * @param propertyList The property list into which the parsed values should be placed.
+ * @param attributes The unparsed SAX attributes.
+ * @param parentFO The parent FO.
+ * @param attributeSort The order in which the various attributes should be parsed, so that compound values are
+ * handled properly.
+ * @param locator The SAX locator.
+ * @param builder The FO Tree builder.
+ * @param creator The FO Tree creation context.
+ * @throws PropertyException For errors during parsing.
+ */
+ protected void makeList(final PropertyList propertyList, final Attributes attributes, final FoObj parentFO,
+ final int[] attributeSort, final Locator locator, final FoTreeParser4a builder, final FoTreeCreator creator)
+ throws PropertyException {
+ for (int j = 0; j < attributeSort.length; j++) {
+ /* We are reading through the attributes elements in attributeSort
+ * order. */
+ final int i = attributeSort[j];
+ final String qualifiedName = attributes.getQName(i);
+ final String localName = attributes.getLocalName(i);
+ final String attributeValue = attributes.getValue(i);
+
+ /* The namespace on the attribute can be different than the one on
+ * the element. So first we need to parse the correct namespace to
+ * use. */
+ if (qualifiedName != null
+ && qualifiedName.startsWith("xmlns:")) {
+ /* This is a namespace entry. This is processed by the SAX
+ * parser & ignored by us. */
+ continue;
+ }
+ final FoTreeServer4a treeServer = builder.getTreeServer();
+ final String namespaceURI = attributes.getURI(i);
+ Namespace namespace = null;
+ if (namespaceURI == null
+ || "".equals(namespaceURI)) {
+ /* If no namespace is specified on the attribute, use the
+ * namespace from the element. */
+ namespace = this;
+ } else {
+ namespace = treeServer.getNamespace(namespaceURI);
+ }
+ if (namespace == null) {
+ throw new PropertyException("Unknown namespace: " + namespaceURI);
+ }
+ final Property property = namespace.parseAttribute(attributes, localName, attributeValue, parentFO, locator,
+ builder, creator);
+ if (property != null) {
+ propertyList.addProperty(parentFO, property);
+ }
+ }
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
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-21 00:48:54 UTC (rev 12904)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/axsl/NamespaceAxsl.java 2022-12-21 13:12:02 UTC (rev 12905)
@@ -31,7 +31,7 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
-import org.foray.fotree.Namespace;
+import org.foray.fotree.NamespaceNative;
import org.foray.fotree.Property;
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
@@ -49,7 +49,7 @@
/**
* This class manages the namespace that is used for aXSL extensions to XSL-FO.
*/
-public final class NamespaceAxsl extends Namespace {
+public final class NamespaceAxsl extends NamespaceNative {
/** The singleton instance. */
private static NamespaceAxsl theInstance;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.java 2022-12-21 00:48:54 UTC (rev 12904)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/NamespaceFo.java 2022-12-21 13:12:02 UTC (rev 12905)
@@ -31,7 +31,7 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
-import org.foray.fotree.Namespace;
+import org.foray.fotree.NamespaceNative;
import org.foray.fotree.Property;
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
@@ -398,7 +398,7 @@
/**
* This class manages the namespace that is used for XSL-FO elements.
*/
-public final class NamespaceFo extends Namespace {
+public final class NamespaceFo extends NamespaceNative {
/** The singleton instance. */
private static NamespaceFo theInstance;
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-21 00:48:54 UTC (rev 12904)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/foray/NamespaceForay.java 2022-12-21 13:12:02 UTC (rev 12905)
@@ -31,7 +31,7 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
-import org.foray.fotree.Namespace;
+import org.foray.fotree.NamespaceNative;
import org.foray.fotree.Property;
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
@@ -46,7 +46,7 @@
/**
* This class manages the namespace that is used for FOray extensions to XSL-FO.
*/
-public final class NamespaceForay extends Namespace {
+public final class NamespaceForay extends NamespaceNative {
/** The singleton instance. */
private static NamespaceForay theInstance;
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-21 00:48:54 UTC (rev 12904)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java 2022-12-21 13:12:02 UTC (rev 12905)
@@ -31,7 +31,7 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
-import org.foray.fotree.Namespace;
+import org.foray.fotree.NamespaceForeign;
import org.foray.fotree.Property;
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
@@ -51,7 +51,7 @@
* This class manages the namespace that is used for the Math Markup Language
* (MathML).
*/
-public final class NamespaceMath extends Namespace {
+public final class NamespaceMath extends NamespaceForeign {
/** The singleton instance. */
private static NamespaceMath theInstance;
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-21 00:48:54 UTC (rev 12904)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/NamespaceSvg.java 2022-12-21 13:12:02 UTC (rev 12905)
@@ -31,7 +31,7 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
-import org.foray.fotree.Namespace;
+import org.foray.fotree.NamespaceForeign;
import org.foray.fotree.Property;
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
@@ -50,7 +50,7 @@
/**
* This class manages the namespace that is used for SVG.
*/
-public final class NamespaceSvg extends Namespace {
+public final class NamespaceSvg extends NamespaceForeign {
/** The singleton instance. */
private static NamespaceSvg theInstance;
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-21 00:48:54 UTC (rev 12904)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/xml/NamespaceXml.java 2022-12-21 13:12:02 UTC (rev 12905)
@@ -31,7 +31,7 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.FoTree4a;
import org.foray.fotree.FoTreeParser4a;
-import org.foray.fotree.Namespace;
+import org.foray.fotree.NamespaceNative;
import org.foray.fotree.Property;
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyList;
@@ -48,7 +48,7 @@
/**
* This class manages the namespace that is used for elements with the "xml:" prefix.
*/
-public final class NamespaceXml extends Namespace {
+public final class NamespaceXml extends NamespaceNative {
/** The singleton instance. */
private static NamespaceXml theInstance;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-21 00:48:58
|
Revision: 12904
http://sourceforge.net/p/foray/code/12904
Author: victormote
Date: 2022-12-21 00:48:54 +0000 (Wed, 21 Dec 2022)
Log Message:
-----------
Style changes only.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-21 00:32:08 UTC (rev 12903)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2022-12-21 00:48:54 UTC (rev 12904)
@@ -250,36 +250,6 @@
}
@Override
- public void endElement(final String uri, final String localName, final String rawName) throws SAXException {
- if (this.activeForeignXML != null) {
- // If inside foreign XML, let the ForeignXml instance handle it.
- this.activeForeignXML.endElement(uri, localName, rawName);
- // It may have disactivated the foreign XML, so check again.
- if (this.activeForeignXML != null) {
- return;
- }
- }
- try {
- finalizeText();
- this.currentFObj.end();
- this.currentFObj.validateDescendants();
- } catch (final FoTreeException e) {
- throw new SAXException(e);
- }
- try {
- notifyFObjComplete(this.currentFObj);
-
- if (this.currentFObj instanceof PageSequence4a) {
- // Notify the listeners that this page-sequence is complete.
- notifyPageSequenceComplete((PageSequence4a) this.currentFObj);
- }
- } catch (final FoTreeException e) {
- throw new SAXException(e);
- }
- this.currentFObj = this.currentFObj.getParsedParent();
- }
-
- @Override
public void startDocument() throws SAXException {
// Allow the FoTreeBuilder to be reused
this.rootFObj = null;
@@ -350,6 +320,36 @@
this.currentFObj = fobj;
}
+ @Override
+ public void endElement(final String uri, final String localName, final String rawName) throws SAXException {
+ if (this.activeForeignXML != null) {
+ // If inside foreign XML, let the ForeignXml instance handle it.
+ this.activeForeignXML.endElement(uri, localName, rawName);
+ // It may have disactivated the foreign XML, so check again.
+ if (this.activeForeignXML != null) {
+ return;
+ }
+ }
+ try {
+ finalizeText();
+ this.currentFObj.end();
+ this.currentFObj.validateDescendants();
+ } catch (final FoTreeException e) {
+ throw new SAXException(e);
+ }
+ try {
+ notifyFObjComplete(this.currentFObj);
+
+ if (this.currentFObj instanceof PageSequence4a) {
+ // Notify the listeners that this page-sequence is complete.
+ notifyPageSequenceComplete((PageSequence4a) this.currentFObj);
+ }
+ } catch (final FoTreeException e) {
+ throw new SAXException(e);
+ }
+ this.currentFObj = this.currentFObj.getParsedParent();
+ }
+
/**
* Sets the root object if it is not already set.
* @param fobj The FoObj that is being processed, which is a candidate to be the root element if it is not already
@@ -386,8 +386,7 @@
}
/**
- * Remove an object from the collection of objects that should be notified
- * about FOTreeEvent firings.
+ * Remove an object from the collection of objects that should be notified about FOTreeEvent firings.
* @param listener the Object which should no longer be notified
*/
public void removeFOTreeListener(final FoTreeListener listener) {
@@ -413,8 +412,7 @@
}
/**
- * Notify all objects in the foTreeListeners that an "FoObj Complete"
- * FOTreeEvent has been fired.
+ * Notify all objects in the foTreeListeners that an "FoObj Complete" FOTreeEvent has been fired.
* @param fobj The FoObj instance that was just completed.
* @throws FoTreeException For errors while the event is being processed.
*/
@@ -432,8 +430,7 @@
}
/**
- * Notify all objects in the foTreeListeners that a "PageSequence Complete"
- * FOTreeEvent has been fired.
+ * Notify all objects in the foTreeListeners that a "PageSequence Complete" FOTreeEvent has been fired.
* @param pageSequence The PageSequence instance that was just completed.
* @throws FoTreeException For errors while the event is being processed.
*/
@@ -447,8 +444,7 @@
}
/**
- * Notify all objects in the foTreeListeners that a "Document Complete"
- * FOTreeEvent has been fired.
+ * Notify all objects in the foTreeListeners that a "Document Complete" FOTreeEvent has been fired.
* @throws FoTreeException For errors while the event is being processed.
*/
private void notifyDocumentComplete() throws FoTreeException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-21 00:32:10
|
Revision: 12903
http://sourceforge.net/p/foray/code/12903
Author: victormote
Date: 2022-12-21 00:32:08 +0000 (Wed, 21 Dec 2022)
Log Message:
-----------
Remove storage of the Document from the superclass.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-20 23:49:27 UTC (rev 12902)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-21 00:32:08 UTC (rev 12903)
@@ -74,11 +74,6 @@
private PropertyList propertyList;
/**
- * The DOM Document instance built by and encapsulated within this object.
- */
- private Document domDocument;
-
- /**
* Tracks which element in the DOM is the current element during
* parsing.
*/
@@ -100,8 +95,8 @@
super(parent);
this.parent = parent;
this.propertyList = propertyList;
- this.domDocument = createDOMDocument();
- this.currentElement = this.domDocument.getDocumentElement();
+ this.createDOMDocument();
+ this.currentElement = getDocument().getDocumentElement();
processAttributes(this.currentElement, propertyList.getAttributes());
parent.getFoTree().activateForeignXML(this);
}
@@ -128,12 +123,10 @@
}
/**
- * Create and return a DOM {@link Document} instance.
- * @return The newly-created DOM {@link Document} instance.
- * @throws FoTreeException For errors creating an appropriate DOM document
- * for this object.
+ * Create a DOM {@link Document} instance.
+ * @throws FoTreeException For errors creating an appropriate DOM document for this object.
*/
- protected abstract Document createDOMDocument() throws FoTreeException;
+ protected abstract void createDOMDocument() throws FoTreeException;
/**
* Returns the DOM Document accumulated within this foreign XML.
@@ -166,10 +159,9 @@
throws SAXException {
Element newElement = null;
if (namespaceURI.equals("")) {
- newElement = this.domDocument.createElement(rawName);
+ newElement = getDocument().createElement(rawName);
} else {
- newElement = this.domDocument.createElementNS(namespaceURI,
- rawName);
+ newElement = getDocument().createElementNS(namespaceURI, rawName);
}
processAttributes(newElement, attlist);
this.currentElement.appendChild(newElement);
@@ -211,7 +203,7 @@
if (this.stringBuilder.length() > 0) {
// Create a Text node
final String textString = this.stringBuilder.toString();
- final Text text = this.domDocument.createTextNode(textString);
+ final Text text = getDocument().createTextNode(textString);
this.currentElement.appendChild(text);
// Reuse the builder.
this.stringBuilder.setLength(0);
@@ -218,7 +210,7 @@
}
// If this is the end of the root element, clean up and turn control
// back over to the FoTreeBuilder.
- if (this.currentElement == this.domDocument.getDocumentElement()) {
+ if (this.currentElement == getDocument().getDocumentElement()) {
this.currentElement.normalize();
getFoTree().deactivateForeignXML();
return;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-20 23:49:27 UTC (rev 12902)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-21 00:32:08 UTC (rev 12903)
@@ -58,9 +58,8 @@
}
@Override
- protected MathMLDocument createDOMDocument() {
+ protected void createDOMDocument() {
this.document = new MathMlDocument4a(null, null, null);
- return this.document;
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-20 23:49:27 UTC (rev 12902)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-21 00:32:08 UTC (rev 12903)
@@ -60,10 +60,9 @@
}
@Override
- protected SVGDocument createDOMDocument() throws FoTreeException {
+ protected void createDOMDocument() throws FoTreeException {
final DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
this.document = (SVGDocument) impl.createDocument(XmlConstants.SVG_NS_URI, "svg", null);
- return this.document;
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-20 23:49:31
|
Revision: 12902
http://sourceforge.net/p/foray/code/12902
Author: victormote
Date: 2022-12-20 23:49:27 +0000 (Tue, 20 Dec 2022)
Log Message:
-----------
Push some identical code in subclasses to the superclass.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-20 23:39:15 UTC (rev 12901)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2022-12-20 23:49:27 UTC (rev 12902)
@@ -31,6 +31,7 @@
import org.foray.fotree.fo.obj.InstreamForeignObject4a;
import org.axsl.fotree.FoTreeException;
+import org.axsl.fotree.FoVisitor;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -260,13 +261,42 @@
}
@Override
- public FoObj formattingObjectChildAt(final int index) {
- return null;
+ public boolean isPcdataContent() {
+ return false;
}
@Override
- public boolean isPcdataContent() {
+ protected void end() throws FoTreeException {
+ }
+
+ @Override
+ public <T> T acceptVisitor(final FoVisitor<T> visitor) {
+ return visitor.visit(this);
+ }
+
+ @Override
+ public boolean isValid() {
+ return this.getDocument() != null;
+ }
+
+ @Override
+ public boolean canHaveMarkerChildren() {
return false;
}
+ @Override
+ public boolean canHavePcdataChildren() {
+ return false;
+ }
+
+ @Override
+ public boolean canHaveInlineChildren() {
+ return false;
+ }
+
+ @Override
+ public boolean canHaveBlockChildren() {
+ return false;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-20 23:39:15 UTC (rev 12901)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/obj/InstreamMathElement.java 2022-12-20 23:49:27 UTC (rev 12902)
@@ -35,7 +35,6 @@
import org.foray.xml.domImpl.MathMlDocument4a;
import org.axsl.fotree.FoTreeException;
-import org.axsl.fotree.FoVisitor;
import org.w3c.dom.mathml.MathMLDocument;
@@ -65,45 +64,11 @@
}
@Override
- protected void end() throws FoTreeException {
- }
-
- @Override
public Namespace getNamespace() {
return this.getFoTree().getMathNamespace();
}
@Override
- public <T> T acceptVisitor(final FoVisitor<T> visitor) {
- return visitor.visit(this);
- }
-
- @Override
- public boolean isValid() {
- return this.document != null;
- }
-
- @Override
- public boolean canHaveMarkerChildren() {
- return false;
- }
-
- @Override
- public boolean canHavePcdataChildren() {
- return false;
- }
-
- @Override
- public boolean canHaveInlineChildren() {
- return false;
- }
-
- @Override
- public boolean canHaveBlockChildren() {
- return false;
- }
-
- @Override
public MathMLDocument getDocument() {
return this.document;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-20 23:39:15 UTC (rev 12901)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2022-12-20 23:49:27 UTC (rev 12902)
@@ -35,7 +35,6 @@
import org.axsl.constants.XmlConstants;
import org.axsl.fotree.FoTreeException;
-import org.axsl.fotree.FoVisitor;
import org.apache.batik.anim.dom.SVGDOMImplementation;
import org.w3c.dom.DOMImplementation;
@@ -68,45 +67,11 @@
}
@Override
- protected void end() throws FoTreeException {
- }
-
- @Override
public Namespace getNamespace() {
return this.getFoTree().getSVGNamespace();
}
@Override
- public <T> T acceptVisitor(final FoVisitor<T> visitor) {
- return visitor.visit(this);
- }
-
- @Override
- public boolean isValid() {
- return this.document != null;
- }
-
- @Override
- public boolean canHaveMarkerChildren() {
- return false;
- }
-
- @Override
- public boolean canHavePcdataChildren() {
- return false;
- }
-
- @Override
- public boolean canHaveInlineChildren() {
- return false;
- }
-
- @Override
- public boolean canHaveBlockChildren() {
- return false;
- }
-
- @Override
public SVGDocument getDocument() {
return this.document;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|