pbwest      2002/11/12 19:48:32

  Modified:    src/org/apache/fop/fo/properties Tag: FOP_0-20-0_Alt-Design
                        BackgroundColor.java BorderAfterColor.java
                        BorderBeforeColor.java BorderBottomColor.java
                        BorderBottomWidth.java BorderEndColor.java
                        BorderLeftColor.java BorderLeftWidth.java
                        BorderRightColor.java BorderRightWidth.java
                        BorderStartColor.java BorderTopColor.java
                        BorderTopWidth.java BorderWidth.java Color.java
                        Property.java
  Log:
  Property value fixes.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BackgroundColor.java
  
  Index: BackgroundColor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BackgroundColor.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- BackgroundColor.java      31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ BackgroundColor.java      13 Nov 2002 03:48:32 -0000      1.1.2.4
  @@ -6,7 +6,7 @@
   import org.apache.fop.fo.PropNames;
   
   public class BackgroundColor extends ColorTransparent {
  -    public static final int dataTypes = COLOR_TRANS | INHERIT;
  +    public static final int dataTypes = ENUM | COLOR_TRANS | INHERIT;
       public static final int traitMapping = RENDERING;
       public static final int initialValueType = COLOR_IT;
       public PropertyValue getInitialValue(int property)
  
  
  
  1.1.2.4   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderAfterColor.java
  
  Index: BorderAfterColor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderAfterColor.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- BorderAfterColor.java     31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ BorderAfterColor.java     13 Nov 2002 03:48:32 -0000      1.1.2.4
  @@ -6,7 +6,7 @@
   import org.apache.fop.fo.PropNames;
   
   public class BorderAfterColor extends ColorTransparent {
  -    public static final int dataTypes = COLOR_T | INHERIT;
  +    public static final int dataTypes = ENUM | COLOR_T | INHERIT;
       public static final int traitMapping = RENDERING;
       public static final int initialValueType = COLOR_IT;
       public static final int inherited = NO;
  
  
  
  1.1.2.4   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderBeforeColor.java
  
  Index: BorderBeforeColor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderBeforeColor.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- BorderBeforeColor.java    31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ BorderBeforeColor.java    13 Nov 2002 03:48:32 -0000      1.1.2.4
  @@ -6,7 +6,7 @@
   import org.apache.fop.fo.PropNames;
   
   public class BorderBeforeColor extends ColorTransparent {
  -    public static final int dataTypes = COLOR_T | INHERIT;
  +    public static final int dataTypes = ENUM | COLOR_T | INHERIT;
       public static final int traitMapping = RENDERING;
       public static final int initialValueType = COLOR_IT;
       public static final int inherited = NO;
  
  
  
  1.1.2.4   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderBottomColor.java
  
  Index: BorderBottomColor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderBottomColor.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- BorderBottomColor.java    31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ BorderBottomColor.java    13 Nov 2002 03:48:32 -0000      1.1.2.4
  @@ -6,7 +6,7 @@
   import org.apache.fop.fo.PropNames;
   
   public class BorderBottomColor extends ColorTransparent {
  -    public static final int dataTypes = COLOR_T | INHERIT;
  +    public static final int dataTypes = ENUM | COLOR_T | INHERIT;
       public static final int traitMapping = DISAPPEARS;
       public static final int initialValueType = COLOR_IT;
       public static final int inherited = NO;
  
  
  
  1.1.2.5   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderBottomWidth.java
  
  Index: BorderBottomWidth.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderBottomWidth.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- BorderBottomWidth.java    12 Nov 2002 01:39:41 -0000      1.1.2.4
  +++ BorderBottomWidth.java    13 Nov 2002 03:48:32 -0000      1.1.2.5
  @@ -8,7 +8,7 @@
   import org.apache.fop.fo.properties.BorderCommonWidth;
   
   public class BorderBottomWidth extends BorderCommonWidth {
  -    public static final int dataTypes = MAPPED_LENGTH | INHERIT;
  +    public static final int dataTypes = LENGTH | MAPPED_LENGTH | INHERIT;
       public static final int traitMapping = DISAPPEARS;
       public static final int initialValueType = LENGTH_IT;
       public PropertyValue getInitialValue(int property)
  
  
  
  1.1.2.4   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderEndColor.java
  
  Index: BorderEndColor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderEndColor.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- BorderEndColor.java       31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ BorderEndColor.java       13 Nov 2002 03:48:32 -0000      1.1.2.4
  @@ -6,7 +6,7 @@
   import org.apache.fop.fo.PropNames;
   
   public class BorderEndColor extends ColorTransparent {
  -    public static final int dataTypes = COLOR_T | INHERIT;
  +    public static final int dataTypes = ENUM | COLOR_T | INHERIT;
       public static final int traitMapping = RENDERING;
       public static final int initialValueType = COLOR_IT;
       public static final int inherited = NO;
  
  
  
  1.1.2.4   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderLeftColor.java
  
  Index: BorderLeftColor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderLeftColor.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- BorderLeftColor.java      31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ BorderLeftColor.java      13 Nov 2002 03:48:32 -0000      1.1.2.4
  @@ -7,7 +7,7 @@
   import org.apache.fop.fo.properties.ColorTransparent;
   
   public class BorderLeftColor extends ColorTransparent {
  -    public static final int dataTypes = COLOR_T | INHERIT;
  +    public static final int dataTypes = ENUM | COLOR_T | INHERIT;
       public static final int traitMapping = DISAPPEARS;
       public static final int initialValueType = COLOR_IT;
       public static final int inherited = NO;
  
  
  
  1.1.2.5   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderLeftWidth.java
  
  Index: BorderLeftWidth.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderLeftWidth.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- BorderLeftWidth.java      12 Nov 2002 01:39:41 -0000      1.1.2.4
  +++ BorderLeftWidth.java      13 Nov 2002 03:48:32 -0000      1.1.2.5
  @@ -8,7 +8,7 @@
   import org.apache.fop.fo.properties.BorderCommonWidth;
   
   public class BorderLeftWidth extends BorderCommonWidth {
  -    public static final int dataTypes = MAPPED_LENGTH | INHERIT;
  +    public static final int dataTypes = LENGTH | MAPPED_LENGTH | INHERIT;
       public static final int traitMapping = DISAPPEARS;
       public static final int initialValueType = LENGTH_IT;
       public PropertyValue getInitialValue(int property)
  
  
  
  1.1.2.4   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderRightColor.java
  
  Index: BorderRightColor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderRightColor.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- BorderRightColor.java     31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ BorderRightColor.java     13 Nov 2002 03:48:32 -0000      1.1.2.4
  @@ -7,7 +7,7 @@
   import org.apache.fop.fo.properties.ColorTransparent;
   
   public class BorderRightColor extends ColorTransparent {
  -    public static final int dataTypes = COLOR_T | INHERIT;
  +    public static final int dataTypes = ENUM | COLOR_T | INHERIT;
       public static final int traitMapping = DISAPPEARS;
       public static final int initialValueType = COLOR_IT;
       public static final int inherited = NO;
  
  
  
  1.1.2.5   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderRightWidth.java
  
  Index: BorderRightWidth.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderRightWidth.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- BorderRightWidth.java     12 Nov 2002 01:39:41 -0000      1.1.2.4
  +++ BorderRightWidth.java     13 Nov 2002 03:48:32 -0000      1.1.2.5
  @@ -8,7 +8,7 @@
   import org.apache.fop.fo.properties.BorderCommonWidth;
   
   public class BorderRightWidth extends BorderCommonWidth {
  -    public static final int dataTypes = MAPPED_LENGTH | INHERIT;
  +    public static final int dataTypes = LENGTH | MAPPED_LENGTH | INHERIT;
       public static final int traitMapping = DISAPPEARS;
       public static final int initialValueType = LENGTH_IT;
       public PropertyValue getInitialValue(int property)
  
  
  
  1.1.2.4   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderStartColor.java
  
  Index: BorderStartColor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderStartColor.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- BorderStartColor.java     31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ BorderStartColor.java     13 Nov 2002 03:48:32 -0000      1.1.2.4
  @@ -7,7 +7,7 @@
   import org.apache.fop.fo.properties.ColorTransparent;
   
   public class BorderStartColor extends ColorTransparent {
  -    public static final int dataTypes = COLOR_T | INHERIT;
  +    public static final int dataTypes = ENUM | COLOR_T | INHERIT;
       public static final int traitMapping = RENDERING;
       public static final int initialValueType = COLOR_IT;
       public static final int inherited = NO;
  
  
  
  1.1.2.4   +1 -1      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderTopColor.java
  
  Index: BorderTopColor.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderTopColor.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- BorderTopColor.java       31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ BorderTopColor.java       13 Nov 2002 03:48:32 -0000      1.1.2.4
  @@ -7,7 +7,7 @@
   import org.apache.fop.fo.properties.ColorTransparent;
   
   public class BorderTopColor extends ColorTransparent {
  -    public static final int dataTypes = COLOR_T | INHERIT;
  +    public static final int dataTypes = ENUM | COLOR_T | INHERIT;
       public static final int traitMapping = DISAPPEARS;
       public static final int initialValueType = COLOR_IT;
       public static final int inherited = NO;
  
  
  
  1.1.2.5   +1 -2      
xml-fop/src/org/apache/fop/fo/properties/Attic/BorderTopWidth.java
  
  Index: BorderTopWidth.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderTopWidth.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- BorderTopWidth.java       12 Nov 2002 01:39:41 -0000      1.1.2.4
  +++ BorderTopWidth.java       13 Nov 2002 03:48:32 -0000      1.1.2.5
  @@ -8,13 +8,12 @@
   import org.apache.fop.fo.properties.BorderCommonWidth;
   
   public class BorderTopWidth extends BorderCommonWidth {
  -    public static final int dataTypes = MAPPED_LENGTH | INHERIT;
  +    public static final int dataTypes = LENGTH | MAPPED_LENGTH | INHERIT;
       public static final int traitMapping = DISAPPEARS;
       public static final int initialValueType = LENGTH_IT;
       public PropertyValue getInitialValue(int property)
           throws PropertyException
       {
  -        System.out.println("In BorderTopWidth geInitialValue.");
           return getMappedLength(null, MEDIUM);
       }
   
  
  
  
  1.1.2.5   +44 -42    xml-fop/src/org/apache/fop/fo/properties/Attic/BorderWidth.java
  
  Index: BorderWidth.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/BorderWidth.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- BorderWidth.java  12 Nov 2002 01:31:29 -0000      1.1.2.4
  +++ BorderWidth.java  13 Nov 2002 03:48:32 -0000      1.1.2.5
  @@ -19,6 +19,9 @@
       public static final int initialValueType = NOTYPE_IT;
       public static final int inherited = NO;
   
  +    /** The <tt>FONode</tt> on which this property is defined. */
  +    private FONode foNode;
  +
       /**
        * 'value' is a PropertyValueList or an individual PropertyValue.
        *
  @@ -31,7 +34,7 @@
        *
        * <p>If 'value' is a PropertyValueList, it contains a
        * PropertyValueList which in turn contains a list of
  -     * 2 to 4 NCName enum tokens representing border-widths.
  +     * 2 to 4 NCName enum tokens or Length values representing border-widths.
        *
        * <p>The value(s) provided, if valid, are converted into a list
        * containing the expansion of the shorthand.
  @@ -67,6 +70,7 @@
           (int propindex, FONode foNode, PropertyValue value, boolean nested)
                   throws PropertyException
       {
  +        this.foNode = foNode;
           int type = value.getType();
           if (type != PropertyValue.LIST) {
               if ( ! nested) {
  @@ -76,36 +80,20 @@
                       return refineExpansionList(PropNames.BORDER_WIDTH, foNode,
                               ShorthandPropSets.expandAndCopySHand(value));
               }
  -            if (type == PropertyValue.NCNAME) {
  -                // Must be a border-width
  -                // BorderWidth does not support a mapped enum
  -                // transformation directly, so use BorderTopWidth to
  -                // check for mapped enum.
  -                Numeric mapped;
  -                try {
  -                    mapped = (new MappedNumeric
  -                                    (foNode, PropNames.BORDER_TOP_WIDTH,
  -                                                ((NCName)value).getNCName()))
  -                                .getMappedNumValue();
  -                } catch (PropertyException e) {
  -                    throw new PropertyException
  -                        (((NCName)value).getNCName() +
  -                                                " not a border-width");
  -                }
  -                // Correct the property in the mapped Numeric
  -                mapped.setProperty(PropNames.BORDER_WIDTH);
  -                return refineExpansionList(PropNames.BORDER_WIDTH, foNode,
  -                                ShorthandPropSets.expandAndCopySHand(mapped));
  -            }
  -            else throw new PropertyException
  -                ("Invalid " + value.getClass().getName() +
  -                                            " value for border-width");
  +
  +            return refineExpansionList
  +                    (PropNames.BORDER_WIDTH, foNode,
  +                        ShorthandPropSets.expandAndCopySHand
  +                         (checkBorderWidth(PropNames.BORDER_WIDTH, value)
  +                          )
  +                     );
           } else {
               if (nested) throw new PropertyException
                       ("PropertyValueList invalid for nested border-width "
                           + "refineParsing() method");
               // List may contain only multiple width specifiers
  -            // i.e. NCNames specifying a standard width
  +            // i.e. NCNames specifying a standard width or Numeric
  +            // length values
               PropertyValueList list =
                               spaceSeparatedList((PropertyValueList)value);
               Numeric top, left, bottom, right;
  @@ -117,14 +105,12 @@
               Iterator widths = list.iterator();
   
               // There must be at least two
  -            top = (new MappedNumeric
  -                        (foNode, PropNames.BORDER_TOP_WIDTH,
  -                        ((NCName)(widths.next())).getNCName())
  -                    ).getMappedNumValue();
  -            right = (new MappedNumeric
  -                        (foNode, PropNames.BORDER_RIGHT_WIDTH,
  -                        ((NCName)(widths.next())).getNCName())
  -                    ).getMappedNumValue();
  +            top = checkBorderWidth
  +                            (PropNames.BORDER_TOP_WIDTH,
  +                                             ((PropertyValue)widths.next()));
  +            right = checkBorderWidth
  +                            (PropNames.BORDER_RIGHT_WIDTH,
  +                                             ((PropertyValue)widths.next()));
               try {
                   bottom = (Numeric)(top.clone());
                   bottom.setProperty(PropNames.BORDER_BOTTOM_WIDTH);
  @@ -136,15 +122,13 @@
               }
   
               if (widths.hasNext())
  -                bottom = (new MappedNumeric
  -                            (foNode, PropNames.BORDER_BOTTOM_WIDTH,
  -                            ((NCName)(widths.next())).getNCName())
  -                        ).getMappedNumValue();
  +                bottom = checkBorderWidth
  +                            (PropNames.BORDER_BOTTOM_WIDTH,
  +                                             ((PropertyValue)widths.next()));
               if (widths.hasNext())
  -                left = (new MappedNumeric
  -                            (foNode, PropNames.BORDER_LEFT_WIDTH,
  -                            ((NCName)(widths.next())).getNCName())
  -                        ).getMappedNumValue();
  +                left = checkBorderWidth
  +                            (PropNames.BORDER_LEFT_WIDTH,
  +                                             ((PropertyValue)widths.next()));
   
               list = new PropertyValueList(PropNames.BORDER_WIDTH);
               list.add(top);
  @@ -156,6 +140,24 @@
               // have been specified?
               return list;
           }
  +    }
  +
  +    private Numeric checkBorderWidth(int property, PropertyValue value)
  +        throws PropertyException
  +    {
  +        switch (value.getType()) {
  +        case PropertyValue.NUMERIC:
  +            Numeric length = (Numeric)value;
  +            if (length.isAbsOrRelLength())
  +                return length;
  +            // else fall through to throw exception
  +            break;
  +        case PropertyValue.NCNAME:
  +            return (new MappedNumeric
  +                        (foNode, property, ((NCName)value).getNCName())
  +                    ).getMappedNumValue();
  +        }
  +        throw new PropertyException("Invalid border-width value: " + value);
       }
   }
   
  
  
  
  1.1.2.4   +1 -1      xml-fop/src/org/apache/fop/fo/properties/Attic/Color.java
  
  Index: Color.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/Color.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- Color.java        31 Oct 2002 01:52:08 -0000      1.1.2.3
  +++ Color.java        13 Nov 2002 03:48:32 -0000      1.1.2.4
  @@ -7,7 +7,7 @@
   import org.apache.fop.fo.properties.ColorNonTransparent;
   
   public class Color extends ColorNonTransparent {
  -    public static final int dataTypes = COLOR_T | INHERIT;
  +    public static final int dataTypes = ENUM | COLOR_T | INHERIT;
       public static final int traitMapping = RENDERING;
       public static final int initialValueType = COLOR_IT;
       public static final int inherited = COMPUTED;
  
  
  
  1.1.2.5   +5 -5      xml-fop/src/org/apache/fop/fo/properties/Attic/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/Property.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- Property.java     12 Nov 2002 01:30:04 -0000      1.1.2.4
  +++ Property.java     13 Nov 2002 03:48:32 -0000      1.1.2.5
  @@ -639,8 +639,8 @@
       {
           int initialValueType =
                       PropertyConsts.pconsts.getInitialValueType(property);
  -        System.out.println("In Property getInitialValue property "
  -                            + property);
  +        //System.out.println("In Property getInitialValue property "
  +                            //+ property);
           if ((initialValueType & Property.USE_GET_IT_FUNCTION) != 0)
                throw new PropertyException
                    ("Property.getInitialValue() called for property with "
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to