You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/03/18 09:11:02 UTC
cvs commit: xml-fop/src/java/org/apache/fop/fo/properties LengthRangeProperty.java
jeremias 2005/03/18 00:11:02
Modified: src/java/org/apache/fop/fo/properties
LengthRangeProperty.java
Log:
Reenabling consistency check.
Had to rename "bChecked" to "consistent" because that first check in checkConsistency() somehow malfunctioned with the other name. Very weird.
Revision Changes Path
1.4 +50 -52 xml-fop/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java
Index: LengthRangeProperty.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/LengthRangeProperty.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LengthRangeProperty.java 28 Oct 2004 10:00:24 -0000 1.3
+++ LengthRangeProperty.java 18 Mar 2005 08:11:02 -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.
@@ -34,7 +34,7 @@
private static final int OPTSET = 2;
private static final int MAXSET = 4;
private int bfSet = 0; // bit field
- private boolean bChecked = false;
+ private boolean consistent = false;
/**
* Inner class for a Maker for LengthProperty objects
@@ -112,6 +112,7 @@
if (!bIsDefault) {
bfSet |= MINSET;
}
+ consistent = false;
}
@@ -126,6 +127,7 @@
if (!bIsDefault) {
bfSet |= MAXSET;
}
+ consistent = false;
}
@@ -140,63 +142,59 @@
if (!bIsDefault) {
bfSet |= OPTSET;
}
+ consistent = false;
}
-
+
// Minimum is prioritaire, if explicit
private void checkConsistency() {
- if (bChecked) {
+ if (consistent) {
return;
}
// Make sure max >= min
// Must also control if have any allowed enum values!
- /**
- * *******************
- * if (minimum.mvalue() > maximum.mvalue()) {
- * if ((bfSet&MINSET)!=0) {
- * // if minimum is explicit, force max to min
- * if ((bfSet&MAXSET)!=0) {
- * // Warning: min>max, resetting max to min
- * log.error("forcing max to min in LengthRange");
- * }
- * maximum = minimum ;
- * }
- * else {
- * minimum = maximum; // minimum was default value
- * }
- * }
- * // Now make sure opt <= max and opt >= min
- * if (optimum.mvalue() > maximum.mvalue()) {
- * if ((bfSet&OPTSET)!=0) {
- * if ((bfSet&MAXSET)!=0) {
- * // Warning: opt > max, resetting opt to max
- * log.error("forcing opt to max in LengthRange");
- * optimum = maximum ;
- * }
- * else {
- * maximum = optimum; // maximum was default value
- * }
- * }
- * else {
- * // opt is default and max is explicit or default
- * optimum = maximum ;
- * }
- * }
- * else if (optimum.mvalue() < minimum.mvalue()) {
- * if ((bfSet&MINSET)!=0) {
- * // if minimum is explicit, force opt to min
- * if ((bfSet&OPTSET)!=0) {
- * log.error("forcing opt to min in LengthRange");
- * }
- * optimum = minimum ;
- * }
- * else {
- * minimum = optimum; // minimum was default value
- * }
- * }
- * *******$*******
- */
- bChecked = true;
+ if (!minimum.isAuto() && !maximum.isAuto()
+ && minimum.getLength().getValue() > maximum.getLength().getValue()) {
+ if ((bfSet & MINSET) != 0) {
+ // if minimum is explicit, force max to min
+ if ((bfSet & MAXSET) != 0) {
+ // Warning: min>max, resetting max to min
+ log.error("forcing max to min in LengthRange");
+ }
+ maximum = minimum;
+ } else {
+ minimum = maximum; // minimum was default value
+ }
+ }
+ // Now make sure opt <= max and opt >= min
+ if (!optimum.isAuto() && !maximum.isAuto()
+ && optimum.getLength().getValue() > maximum.getLength().getValue()) {
+ if ((bfSet & OPTSET) != 0) {
+ if ((bfSet & MAXSET) != 0) {
+ // Warning: opt > max, resetting opt to max
+ log.error("forcing opt to max in LengthRange");
+ optimum = maximum;
+ } else {
+ maximum = optimum; // maximum was default value
+ }
+ } else {
+ // opt is default and max is explicit or default
+ optimum = maximum;
+ }
+ } else if (!optimum.isAuto() && !minimum.isAuto() &&
+ optimum.getLength().getValue() < minimum.getLength().getValue()) {
+ if ((bfSet & MINSET) != 0) {
+ // if minimum is explicit, force opt to min
+ if ((bfSet & OPTSET) != 0) {
+ log.error("forcing opt to min in LengthRange");
+ }
+ optimum = minimum;
+ } else {
+ minimum = optimum; // minimum was default value
+ }
+ }
+
+ consistent = true;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org