jeremias 2005/03/11 05:33:32
Modified: src/java/org/apache/fop/fo FOPropertyMapping.java
Added: src/java/org/apache/fop/fo/properties
SpacePropertyMaker.java
Log:
SpacePropertyMaker to handle conditionality as defined by the spec:
"The .conditionality component of any space-before or space-after determined
from a margin property is set to "retain"."
Revision Changes Path
1.1
xml-fop/src/java/org/apache/fop/fo/properties/SpacePropertyMaker.java
Index: SpacePropertyMaker.java
===================================================================
/*
* Copyright 2005 The Apache Software Foundation.
*
* 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.
*/
/* $Id: SpacePropertyMaker.java,v 1.1 2005/03/11 13:33:32 jeremias Exp $ */
package org.apache.fop.fo.properties;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
/**
* Special CorrespondingPropertyMaker that sets the conditionality subproperty
* correctly for space-* properties.
*/
public class SpacePropertyMaker extends CorrespondingPropertyMaker {
/**
* @param baseMaker base property maker
*/
public SpacePropertyMaker(PropertyMaker baseMaker) {
super(baseMaker);
}
/**
* @see
org.apache.fop.fo.properties.CorrespondingPropertyMaker#compute(org.apache.fop.fo.PropertyList)
*/
public Property compute(PropertyList propertyList) throws
PropertyException {
Property prop = super.compute(propertyList);
if (prop != null && prop instanceof SpaceProperty) {
((SpaceProperty)prop).setConditionality(
new EnumProperty(Constants.EN_RETAIN, "RETAIN"), false);
}
return prop;
}
}
1.43 +9 -5 xml-fop/src/java/org/apache/fop/fo/FOPropertyMapping.java
Index: FOPropertyMapping.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/fo/FOPropertyMapping.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- FOPropertyMapping.java 7 Feb 2005 16:26:13 -0000 1.42
+++ FOPropertyMapping.java 11 Mar 2005 13:33:32 -0000 1.43
@@ -45,6 +45,7 @@
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
import org.apache.fop.fo.properties.SpaceProperty;
+import org.apache.fop.fo.properties.SpacePropertyMaker;
import org.apache.fop.fo.properties.SpacingPropertyMaker;
import org.apache.fop.fo.properties.StringProperty;
import org.apache.fop.fo.properties.TextDecorationProperty;
@@ -52,7 +53,9 @@
/**
* This class creates and returns an array of Property.Maker instances
- * indexed by the PR_* propId from Constants.java.
+ * indexed by the PR_* propId from Constants.java.
+ *
+ * @todo Check multi-threading safety of the statics below
*/
public class FOPropertyMapping implements Constants {
private static Map s_htPropNames = new HashMap();
@@ -383,8 +386,9 @@
}
/**
- * Return a (possible cached) enum property based in the enum value.
+ * Return a (possibly cached) enum property based in the enum value.
* @param enum A enum value from Constants.java.
+ * @param text the text value by which this enum property is known
* @return An EnumProperty instance.
*/
private Property getEnumProperty(int enumValue, String text) {
@@ -1216,7 +1220,7 @@
// space-before
m = new SpaceProperty.Maker(PR_SPACE_BEFORE);
m.useGeneric(genericSpace);
- corr = new CorrespondingPropertyMaker(m);
+ corr = new SpacePropertyMaker(m);
corr.setCorresponding(PR_MARGIN_TOP, PR_MARGIN_TOP, PR_MARGIN_RIGHT);
corr.setUseParent(true);
corr.setRelative(true);
@@ -1225,7 +1229,7 @@
// space-after
m = new SpaceProperty.Maker(PR_SPACE_AFTER);
m.useGeneric(genericSpace);
- corr = new CorrespondingPropertyMaker(m);
+ corr = new SpacePropertyMaker(m);
corr.setCorresponding(PR_MARGIN_BOTTOM, PR_MARGIN_BOTTOM,
PR_MARGIN_LEFT);
corr.setUseParent(true);
corr.setRelative(true);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]