jeremias 2005/02/07 08:26:13 Modified: src/java/org/apache/fop/fo/properties LengthPairProperty.java src/java/org/apache/fop/fo FOPropertyMapping.java src/java/org/apache/fop/fo/flow Table.java Added: src/java/org/apache/fop/fo/properties BorderSpacingShorthandParser.java Log: Support for border-spacing shorthand. Accessor for border-separation on table. Revision Changes Path 1.4 +35 -8 xml-fop/src/java/org/apache/fop/fo/properties/LengthPairProperty.java Index: LengthPairProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/LengthPairProperty.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- LengthPairProperty.java 28 Oct 2004 10:00:24 -0000 1.3 +++ LengthPairProperty.java 7 Feb 2005 16:26:13 -0000 1.4 @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-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. @@ -36,7 +36,7 @@ public static class Maker extends CompoundPropertyMaker { /** - * @param name name of property for which this Maker should be created + * @param propId name of property for which this Maker should be created */ public Maker(int propId) { super(propId); @@ -54,8 +54,7 @@ * @see CompoundPropertyMaker#convertProperty */ public Property convertProperty(Property p, PropertyList propertyList, FObj fo) - throws PropertyException - { + throws PropertyException { if (p instanceof LengthPairProperty) { return p; } @@ -64,6 +63,33 @@ } /** + * Creates a new LengthPairProperty with empty values. + */ + public LengthPairProperty() { + super(); + } + + /** + * Creates a new LengthPairProperty. + * @param ipd inline-progression-dimension + * @param bpd block-progression-dimension + */ + public LengthPairProperty(Property ipd, Property bpd) { + this(); + this.ipd = ipd; + this.bpd = bpd; + } + + /** + * Creates a new LengthPairProperty which sets both bpd and ipd to the + * same value. + * @param len length for both dimensions + */ + public LengthPairProperty(Property len) { + this(len, len); + } + + /** * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean) */ public void setComponent(int cmpId, Property cmpnValue, @@ -102,10 +128,11 @@ return this.bpd; } + /** @see java.lang.Object#toString() */ public String toString() { - return "LengthPair[" + - "ipd:" + getIPD().getObject() + - ", bpd:" + getBPD().getObject() + "]"; + return "LengthPair[" + + "ipd:" + getIPD().getObject() + + ", bpd:" + getBPD().getObject() + "]"; } /** 1.1 xml-fop/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java Index: BorderSpacingShorthandParser.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: BorderSpacingShorthandParser.java,v 1.1 2005/02/07 16:26:13 jeremias Exp $ */ package org.apache.fop.fo.properties; import java.util.List; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.expr.PropertyException; /** * Shorthand parser for the "border-spacing" shorthand property. */ public class BorderSpacingShorthandParser extends GenericShorthandParser { protected Property convertValueForProperty(int propId, Property property, PropertyMaker maker, PropertyList propertyList) throws PropertyException { List lst = property.getList(); if (lst != null) { if (lst.size() == 1) { Property len = (Property)lst.get(0); return new LengthPairProperty(len); } else if (lst.size() == 2) { Property ipd = (Property)lst.get(0); Property bpd = (Property)lst.get(1); return new LengthPairProperty(ipd, bpd); } } throw new PropertyException("list with 1 or 2 length values expected"); } } 1.42 +7 -3 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.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- FOPropertyMapping.java 25 Jan 2005 10:55:46 -0000 1.41 +++ FOPropertyMapping.java 7 Feb 2005 16:26:13 -0000 1.42 @@ -23,6 +23,7 @@ import org.apache.fop.datatypes.LengthBase; import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.properties.BorderSpacingShorthandParser; import org.apache.fop.fo.properties.BorderWidthPropertyMaker; import org.apache.fop.fo.properties.BoxPropShorthandParser; import org.apache.fop.fo.properties.CharacterProperty; @@ -2296,7 +2297,8 @@ m.setInherited(true); m.setDefault("collapse"); m.addEnum("separate", getEnumProperty(EN_SEPARATE, "SEPARATE")); - m.addEnum("collapse-with-precedence", getEnumProperty(EN_COLLAPSE_WITH_PRECEDENCE, "COLLAPSE_WITH_PRECEDENCE")); + m.addEnum("collapse-with-precedence", getEnumProperty( + EN_COLLAPSE_WITH_PRECEDENCE, "COLLAPSE_WITH_PRECEDENCE")); m.addEnum("collapse", getEnumProperty(EN_COLLAPSE, "COLLAPSE")); addPropertyMaker("border-collapse", m); @@ -2309,6 +2311,7 @@ // border-separation m = new LengthPairProperty.Maker(PR_BORDER_SEPARATION); m.setInherited(true); + m.addShorthand(s_generics[PR_BORDER_SPACING]); sub = new LengthProperty.Maker(CP_BLOCK_PROGRESSION_DIRECTION); sub.setDefault("0pt"); @@ -2589,9 +2592,10 @@ addPropertyMaker("border-style", m); // border-spacing - m = new ToBeImplementedProperty.Maker(PR_BORDER_SPACING); + m = new ListProperty.Maker(PR_BORDER_SPACING); m.setInherited(true); m.setDefault("0pt"); + m.setDatatypeParser(new BorderSpacingShorthandParser()); addPropertyMaker("border-spacing", m); // border-top 1.44 +5 -0 xml-fop/src/java/org/apache/fop/fo/flow/Table.java Index: Table.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Table.java,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- Table.java 31 Jan 2005 21:16:45 -0000 1.43 +++ Table.java 7 Feb 2005 16:26:13 -0000 1.44 @@ -199,6 +199,11 @@ public int getBreakBefore() { return breakBefore; } + + /** @return the "border-separation" property. */ + public LengthPairProperty getBorderSeparation() { + return borderSeparation; + } /** * @return the "id" property.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]