cvs commit: xml-fop/src/org/apache/fop/datatypes/indirect IndirectValue.java

2002-10-04 Thread pbwest

pbwest  2002/10/04 19:40:31

  Modified:src/org/apache/fop/datatypes/indirect Tag:
FOP_0-20-0_Alt-Design IndirectValue.java
  Log:
  Added adjustedPropertyValue() to generate Inherit object
  if property value is unresolved.
  Prevent cloning when resolve() returns an indirect value.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.1.2.4   +18 -4 
xml-fop/src/org/apache/fop/datatypes/indirect/Attic/IndirectValue.java
  
  Index: IndirectValue.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/datatypes/indirect/Attic/IndirectValue.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- IndirectValue.java3 Oct 2002 12:47:23 -   1.1.2.3
  +++ IndirectValue.java5 Oct 2002 02:40:31 -   1.1.2.4
  @@ -156,12 +156,15 @@
   public PropertyValue resolve(FONode node) throws PropertyException {
   PropertyValue pv;
   if (inheritedValue == null)
  -inheritedValue = node.getParentPropertyValue(sourceProperty);
  +inheritedValue = node.fromParent(sourceProperty);
   if (isUnresolved(inheritedValue))
   return this;
   pv = inheritedValue;
   // Check that the property is the same
   if (property != pv.getProperty()) {
  +// Don't clone if it's another indirect value - just keep this one
  +// When the value finally resolves into a length, we will clone.
  +if (pv instanceof IndirectValue) return this;
   try {
   pv = (PropertyValue)(pv.clone());
   } catch (CloneNotSupportedException e) {
  @@ -176,6 +179,17 @@
   {
   return (value.getType() == PropertyValue.NUMERIC
   && ((Numeric)(value)).isPercentage());
  +}
  +
  +public static PropertyValue adjustedPropertyValue(PropertyValue value)
  +throws PropertyException
  +{
  +if (isUnresolved(value)) {
  +Inherit inherit = new Inherit(value.getProperty());
  +inherit.setInheritedValue(value);
  +return inherit;
  +}
  +return value;
   }
   
   // N.B. no validation on this class - subclasses will validate
  
  
  

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




cvs commit: xml-fop/src/org/apache/fop/datatypes/indirect IndirectValue.java

2002-10-03 Thread pbwest

pbwest  2002/10/03 05:47:23

  Modified:src/org/apache/fop/datatypes/indirect Tag:
FOP_0-20-0_Alt-Design IndirectValue.java
  Log:
  Imports: -PropertyTriplet +Numeric.
  Replaced PropertyTriplet references with PropertyValue.
  Removed getInheritedTriplet().
  Added isUnresolved().
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.1.2.3   +30 -36
xml-fop/src/org/apache/fop/datatypes/indirect/Attic/IndirectValue.java
  
  Index: IndirectValue.java
  ===
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/datatypes/indirect/Attic/IndirectValue.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- IndirectValue.java18 Sep 2002 15:31:14 -  1.1.2.2
  +++ IndirectValue.java3 Oct 2002 12:47:23 -   1.1.2.3
  @@ -3,7 +3,7 @@
   import org.apache.fop.fo.expr.PropertyException;
   import org.apache.fop.datatypes.AbstractPropertyValue;
   import org.apache.fop.datatypes.PropertyValue;
  -import org.apache.fop.datatypes.PropertyTriplet;
  +import org.apache.fop.datatypes.Numeric;
   import org.apache.fop.fo.Properties;
   import org.apache.fop.fo.PropertyConsts;
   import org.apache.fop.fo.FONode;
  @@ -24,11 +24,11 @@
* These include Inherit, FromParent and
* FromNearestSpecified objects.  If an InheritedValue
* object is defined, it will also extend this class.
  - * The required value is usually the computed field of the
  - * PropertyTriplet for the source property on the source node.  This
  + * The required value is usually the computed value of the
  + * PropertyValue of the source property on the source node.  This
* property may be different from the property of this object.  This class
  - * provides accessors for the referenced PropertyTriplet and the
  - * computed value of that triplet.  In some cases, the specified value is 
  + * provides accessors for the referenced PropertyValue.
  + * In some cases, the specified value is 
* required.  It is the responsibility of the subclass to determine and
* act upon these cases.  At the time of writing, the only such exception is
* when a line-height is defined as a .
  @@ -46,11 +46,11 @@
   protected int sourceProperty;
   
   /**
  - * The PropertyTriplet from which this object is being
  + * The PropertyValue from which this object is being
* inherited.  Set when the inheritance cannot be immediately resolved,
* e.g. when the specified value is a percentage.
*/
  -protected PropertyTriplet inheritedValue = null;
  +protected PropertyValue inheritedValue = null;
   
   /**
* @param property - the int index of the property on which
  @@ -115,64 +115,51 @@
   }
   
   /**
  - * @return PropertyTriplet which contains or will contain the
  + * @return PropertyValue which contains or will contain the
* the computed value being inherited.  This field will be null except
* when an unresolved computed value is being inherited.  If so,
  - * a null value will be returned.  N.B. This triplet will have a
  - * property value different from this IndirectValue object.
  - */
  -public PropertyTriplet getInheritedTriplet() {
  -return inheritedValue;
  -}
  -
  -/**
  - * @return computed PropertyValue field from the
  - * PropertyTriplet from which this object is inherting.
  - * If the inheritedValue field is null, no resolution of the
  - * inheritance has yet been attempted, and a null value is returned.
  - * If the inheritedValue field is not null, return the
  - * computed field, which may be null.  N.B. This
  + * a null value will be returned.  N.B. This
* PropertyValue may have a property field different from 
* this IndirectValue object.  The source property field is held in
* the sourceProperty field.
*/
   public PropertyValue getInheritedValue() {
  -if (inheritedValue != null) return inheritedValue.getComputed();
  -return null;
  +return inheritedValue;
   }
   
   /**
  - * Set the reference to the PropertyTriplet from which the
  + * Set the reference to the PropertyValue from which the
* value is being inherited.
  - * @param bequeathed - the PropertyTriplet which contains
  + * @param bequeathed - the PropertyValue which contains
* or will contain the the computed value of the percentage being
* inherited.
*/
  -public void setInheritedTriplet(PropertyTriplet bequeathed) {
  +public void setInheritedValue(PropertyValue bequeathed) {
   inheritedValue = bequeathed;
   }
   
   /**
* Attempt to resolve the IndirectValue object.
  - * If no bequeathing PropertyTriplet, assume that the