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 ttInherit/tt, ttFromParent/tt and
* ttFromNearestSpecified/tt objects.  If an ttInheritedValue/tt
* object is defined, it will also extend this class.
  - * pThe required value is usually the computed field of the
  - * ttPropertyTriplet/tt for the source property on the source node.  This
  + * pThe required value is usually the computed value of the
  + * ttPropertyValue/tt 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 ttPropertyTriplet/tt and the
  - * computed value of that triplet.  In some cases, the specified value is 
  + * provides accessors for the referenced ttPropertyValue/tt.
  + * 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 iline-height/i is defined as a lt;numbergt;.
  @@ -46,11 +46,11 @@
   protected int sourceProperty;
   
   /**
  - * The ttPropertyTriplet/tt from which this object is being
  + * The ttPropertyValue/tt 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 ttint/tt index of the property on which
  @@ -115,64 +115,51 @@
   }
   
   /**
  - * @return ttPropertyTriplet/tt which contains or will contain the
  + * @return ttPropertyValue/tt 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 iIndirectValue/i object.
  - */
  -public PropertyTriplet getInheritedTriplet() {
  -return inheritedValue;
  -}
  -
  -/**
  - * @return computed ttPropertyValue/tt field from the
  - * ttPropertyTriplet/tt from which this object is inherting.
  - * If the iinheritedValue/i field is null, no resolution of the
  - * inheritance has yet been attempted, and a null value is returned.
  - * If the iinheritedValue/i field is not null, return the
  - * icomputed/i field, which may be null.  N.B. This
  + * a null value will be returned.  N.B. This
* ttPropertyValue/tt may have a property field different from 
* this iIndirectValue/i object.  The source property field is held in
* the isourceProperty/i field.
*/
   public PropertyValue getInheritedValue() {
  -if (inheritedValue != null) return inheritedValue.getComputed();
  -return null;
  +return inheritedValue;
   }
   
   /**
  - * Set the reference to the ttPropertyTriplet/tt from which the
  + * Set the reference to the ttPropertyValue/tt from which the
* value is being inherited.
  - * @param bequeathed - the ttPropertyTriplet/tt which contains
  + * @param bequeathed - the ttPropertyValue/tt 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;
   }