* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
/**
* Stores the different types of keeps in a single convenient format.
*/
public class KeepValue {
+ /** constant for keep-with-always */
public static final String KEEP_WITH_ALWAYS = "KEEP_WITH_ALWAYS";
+ /** constant for automatic keep-with computation */
public static final String KEEP_WITH_AUTO = "KEEP_WITH_AUTO";
+ /** constant for a user-settable keep-with value (??) */
public static final String KEEP_WITH_VALUE = "KEEP_WITH_VALUE";
private String type = KEEP_WITH_AUTO;
private int value = 0;
+ /**
+ * Constructor
+ * @param type one of "KEEP_WITH_ALWAYS", "KEEP_WITH_AUTO", or
+ * "KEEP_WITH_VALUE"
+ * @param val keep-with value to use (used only by KEEP_WITH_VALUE ??).
+ */
public KeepValue(String type, int val) {
this.type = type;
this.value = val;
}
+ /**
+ * @return the keep-with value
+ */
public int getValue() {
return value;
}
+ /**
+ * @return the descriptive type
+ */
public String getType() {
return type;
}
+ /**
+ * @return string representation of this
+ */
public String toString() {
return type;
}
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
import org.apache.fop.fo.expr.Numeric;
public void resolveTableUnit(double dTableUnit) {
}
+ /**
+ * @return null (cannot be converted to a Numeric ??)
+ */
public Numeric asNumeric() {
return null;
}
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+/**
+ * Models a length which can be used as a factor in a percentage length
+ * calculation
+ */
public class LengthBase implements PercentBase {
// Standard kinds of percent-based length
+ /** constant for a custom percent-based length */
public static final int CUSTOM_BASE = 0;
+ /** constant for a font-size percent-based length */
public static final int FONTSIZE = 1;
+ /** constant for an inh (??) font-size percent-based length */
public static final int INH_FONTSIZE = 2;
+ /** constant for a containing box percent-based length */
public static final int CONTAINING_BOX = 3;
+ /** constant for a containing refarea percent-based length */
public static final int CONTAINING_REFAREA = 4;
+ /** array of valid percent-based length types */
+ public static final int[] PERCENT_BASED_LENGTH_TYPES
+ = { CUSTOM_BASE, FONTSIZE, INH_FONTSIZE, CONTAINING_BOX,
+ CONTAINING_REFAREA } ;
/**
* FO parent of the FO for which this property is to be calculated.
*/
private /* final */ int iBaseType;
+ /**
+ * Constructor
+ * @param parentFO parent FO for this
+ * @param plist property list for this
+ * @param iBaseType a member of {@link #PERCENT_BASED_LENGTH_TYPES}
+ */
public LengthBase(FObj parentFO, PropertyList plist, int iBaseType) {
this.parentFO = parentFO;
this.propertyList = plist;
/**
* Accessor for parentFO object from subclasses which define
* custom kinds of LengthBase calculations.
+ * @return this object's parent FO
*/
protected FObj getParentFO() {
return parentFO;
/**
* Accessor for propertyList object from subclasses which define
* custom kinds of LengthBase calculations.
+ * @return this object's PropertyList
*/
protected PropertyList getPropertyList() {
return propertyList;
}
+ /**
+ * @return the dimension of this object (always 1)
+ */
public int getDimension() {
return 1;
}
+ /**
+ * @return the base value of this object (always 1.0)
+ */
public double getBaseValue() {
return 1.0;
}
+ /**
+ * @return the base length (in millipoints ??) of this object
+ */
public int getBaseLength() {
switch (iBaseType) {
case FONTSIZE:
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
import org.apache.fop.fo.Property;
/**
- * This datatype hold a pair of lengths, specifiying the dimensions in
- * both inline and block-progression-directions.
+ * Models a pair of lengths, one specifiying the dimensions for the
+ * inline-progression-direction, the other for the block-progression-direction.
* It is currently only used to specify border-separation in tables.
*/
public class LengthPair implements CompoundDatatype {
private Property ipd;
private Property bpd;
- // From CompoundDatatype
+ /**
+ * From CompoundDatatype
+ * @param sCmpnName component name ("block-progression-direction" or
+ * "inline-progression-direction") which is being set
+ * @param cmpnValue Property containing the value to be set
+ * @param bIsDefault true if this is the default property (??)
+ */
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("block-progression-direction")) {
}
}
- // From CompoundDatatype
+ /**
+ * From CompoundDatatype
+ * @param sCmpnName component name ("block-progression-direction" or
+ * "inline-progression-direction") for which the length is sought
+ * @return Property containing the length sought
+ */
public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("block-progression-direction")) {
return getBPD();
}
}
+ /**
+ * @return Property holding the ipd length
+ */
public Property getIPD() {
return this.ipd;
}
+ /**
+ * @return Property holding the bpd length
+ */
public Property getBPD() {
return this.bpd;
}
private int bfSet = 0; // bit field
private boolean bChecked = false;
- // From CompoundDatatype
+ /**
+ * From CompoundDatatype
+ * @param sCmpnName component name ("minimum", "maximum", or "optimum")
+ * which is being set
+ * @param cmpnValue Property object to be set
+ * @param bIsDefault true of this is the default value (??)
+ */
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("minimum")) {
}
}
- // From CompoundDatatype
+ /**
+ * From CompoundDatatype
+ * @param sCmpnName component name ("minimum", "maximum", or "optimum")
+ * for which the length is sought
+ * @return the requested Property, or null if the component name is invalid
+ */
public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("minimum")) {
return getMinimum();
bChecked = true;
}
+ /**
+ * @return minimum length
+ */
public Property getMinimum() {
checkConsistency();
return this.minimum;
}
+ /**
+ * @return maximum length
+ */
public Property getMaximum() {
checkConsistency();
return this.maximum;
}
+ /**
+ * @return optimum length
+ */
public Property getOptimum() {
checkConsistency();
return this.optimum;
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
import java.util.Vector;
+/**
+ * Class modelling lengths that are build up by combining other lengths
+ */
public class LinearCombinationLength extends Length {
+ /** Collection of factors (1-1 correspondence with {@link #lengths} */
protected Vector factors;
+ /** Collection of Length objects (1-1 correspondence with {@link #factors} */
protected Vector lengths;
+ /**
+ * Constructor. Creates no content. Use {link #addTerm} to build content.
+ */
public LinearCombinationLength() {
factors = new Vector();
lengths = new Vector();
}
+ /**
+ * Add an item to this
+ * @param factor the factor to be added
+ * @param length the Length to be added
+ */
public void addTerm(double factor, Length length) {
factors.addElement(new Double(factor));
lengths.addElement(length);
}
/**
- * Return the computed value in millipoints.
+ * Sets the computed value in millipoints.
*/
protected void computeValue() {
int result = 0;
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
import java.util.Vector;
*/
public class MixedLength extends Length {
+ /** The collection of Length objects comprising this MixedLength object */
private Vector lengths ;
+ /**
+ * Constructor
+ * @param lengths the collection of Length objects which comprise the new
+ * MixedLength object
+ */
public MixedLength(Vector lengths) {
this.lengths = lengths;
}
+ /**
+ * Iterates through each internal component, computing and
+ * summarizing the values, then setting the value for this
+ */
protected void computeValue() {
int computedValue = 0;
boolean bAllComputed = true;
}
}
+ /**
+ * @return String equivalent of this
+ */
public String toString() {
StringBuffer sbuf = new StringBuffer();
Enumeration e = lengths.elements();
return sbuf.toString();
}
+ /**
+ * @return Numeric equivalent of this
+ */
public Numeric asNumeric() {
Numeric numeric = null;
for (Enumeration e = lengths.elements(); e.hasMoreElements();) {
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
+/**
+ * Interface for objects that can be used as base objects for percentage
+ * computations
+ */
public interface PercentBase {
int getDimension();
double getBaseValue();
+
+ /**
+ * @return the integer size of the object (this will be used as the base to
+ * which a percentage will be applied to compute the length of the
+ * referencing item)
+ */
int getBaseLength();
}
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
import org.apache.fop.fo.expr.Numeric;
*/
public class PercentLength extends Length {
+ /**
+ * The percentage itself, expressed as a decimal value, e.g. for 95%, set
+ * the value to .95
+ */
private double factor;
- private PercentBase lbase = null;
/**
- * construct an object based on a factor (the percent, as a
- * a factor) and an object which has a method to return the
- * Length which provides the "base" for this calculation.
+ * A PercentBase implementation that contains the base length to which the
+ * {@link #factor} should be applied to compute the actual length
*/
- public PercentLength(double factor) {
- this(factor, null);
- }
+ private PercentBase lbase = null;
+ /**
+ * Main constructor. Construct an object based on a factor (the percent,
+ * as a factor) and an object which has a method to return the Length which
+ * provides the "base" for the actual length that is modeled.
+ * @param factor the percentage factor, expressed as a decimal (e.g. use
+ * .95 to represent 95%)
+ * @param lbase base property to which the factor should be applied
+ */
public PercentLength(double factor, PercentBase lbase) {
this.factor = factor;
this.lbase = lbase;
}
+ /**
+ * Convenience constructor when only the factor is known
+ * @param factor the percentage factor, expressed as a decimal (e.g. use
+ * .95 to represent 95%)
+ */
+ public PercentLength(double factor) {
+ this(factor, null);
+ }
+
+ /**
+ * @param lbase the base to set
+ */
public void setBaseLength(PercentBase lbase) {
this.lbase = lbase;
}
+ /**
+ * @return the base
+ */
public PercentBase getBaseLength() {
return this.lbase;
}
setComputedValue((int)(factor * (double)lbase.getBaseLength()));
}
+ /**
+ *
+ * @return the factor
+ */
public double value() {
return factor;
}
+ /**
+ * @return the String equivalent of this
+ */
public String toString() {
- // return the factor as a percent
- // What about the base value?
+ // TODO: What about the base value?
return (new Double(factor * 100.0).toString()) + "%";
}
+ /**
+ * @return new Numeric object that is equivalent to this
+ */
public Numeric asNumeric() {
return new Numeric(this);
}
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
import org.apache.fop.fo.Property;
private Property precedence;
private Property conditionality;
- // From CompoundDatatype
+ /**
+ * From CompoundDatatype
+ * @param sCmpnName name of component
+ * @param cmpnValue Property object for the component
+ * @param bIsDefault true if this is the default (??)
+ */
public void setComponent(String sCmpnName, Property cmpnValue,
boolean bIsDefault) {
if (sCmpnName.equals("precedence")) {
}
}
- // From CompoundDatatype
+ /**
+ * From CompoundDatatype
+ * @param sCmpnName name of component
+ * @return Property matching the component name
+ */
public Property getComponent(String sCmpnName) {
if (sCmpnName.equals("precedence")) {
return getPrecedence();
}
}
+ /**
+ *
+ * @param precedence precedence Property to set
+ * @param bIsDefault (is not used anywhere)
+ */
protected void setPrecedence(Property precedence, boolean bIsDefault) {
this.precedence = precedence;
}
+ /**
+ *
+ * @param conditionality conditionality Property to set
+ * @param bIsDefault (is not used anywhere)
+ */
protected void setConditionality(Property conditionality,
boolean bIsDefault) {
this.conditionality = conditionality;
}
+ /**
+ * @return precedence Property
+ */
public Property getPrecedence() {
return this.precedence;
}
+ /**
+ * @return conditionality Property
+ */
public Property getConditionality() {
return this.conditionality;
}
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
import org.apache.fop.fo.expr.Numeric;
/**
* Construct an object with tcolUnits of proportional measure.
+ * @param tcolUnits number of table-column proportional units
*/
public TableColLength(double tcolUnits) {
this.tcolUnits = tcolUnits;
}
/**
- * Override the method in Length to return the number of specified
- * proportional table-column units.
+ * Override the method in Length
+ * @return the number of specified proportional table-column units.
*/
public double getTableUnits() {
return tcolUnits;
/**
* Calculate the number of millipoints and set it.
+ * @param mpointsPerUnit density of millipoints per unit
*/
public void resolveTableUnit(double mpointsPerUnit) {
setComputedValue((int)(tcolUnits * mpointsPerUnit));
}
}*/
+ /**
+ * Convert this to a String
+ * @return the string representation of this
+ */
public String toString() {
return (Double.toString(tcolUnits) + " table-column-units");
}
+ /**
+ * Converts this to a new Numeric object
+ * @return the Numeric object
+ */
public Numeric asNumeric() {
return new Numeric(this);
}
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
/**
- * a not as yet implemented value
+ * Models a datatype that has not yet been implemented
*/
public class ToBeImplemented {
+ /**
+ *
+ * @param value name of datatype
+ */
public ToBeImplemented(String value) {
}
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.datatypes;
import org.apache.fop.fo.FObj;
}
}
+ /**
+ * Constructor
+ * @param propName name of Property
+ */
public ToBeImplementedProperty(String propName) {
//XXX: (mjg@recalldesign.com) This is a bit of a kluge, perhaps an
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
- *
+ *
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
- *
+ *
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
- */
+ */
package org.apache.fop.fo;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.apps.FOPException;
import java.util.Vector;
+/**
+ * Base class for all property objects
+ * @author unascribed
+ */
public class Property {
+ /**
+ * Base class for all property makers
+ * @author unascribed
+ */
public static class Maker {
private static final String UNKNOWN = "UNKNOWN";
private String propName;
/**
- * Return the name of the property whose value is being set.
+ * @return the name of the property for this Maker
*/
protected String getPropName() {
return propName;
* Return a boolean indicating whether this property inherits the
* "specified" value rather than the "computed" value. The default is
* to inherit the "computed" value.
- * @return If true, property inherits the value specified.
+ * @return true, if the property inherits the value specified.
*/
public boolean inheritsSpecified() {
return false;
/**
- * Return an object implementing the PercentBase interface.
* This is used to handle properties specified as a percentage of
* some "base length", such as the content width of their containing
* box.
* Overridden by subclasses which allow percent specifications. See
* the documentation on properties.xsl for details.
+ * @return an object implementing the PercentBase interface.
*/
public PercentBase getPercentBase(FObj fo, PropertyList pl) {
return null;