Package org.apache.fop.fo.properties
Class PercentLength
java.lang.Object
org.apache.fop.fo.properties.Property
org.apache.fop.fo.properties.LengthProperty
org.apache.fop.fo.properties.PercentLength
a percent specified length quantity in XSL
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.fop.fo.properties.LengthProperty
LengthProperty.Maker
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double
The percentage itself, expressed as a decimal value, e.g.private PercentBase
A PercentBase implementation that contains the base length to which thefactor
should be applied to compute the actual length -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
double
Return the value of this Numericdouble
getNumericValue
(PercentBaseContext context) Return the value of this Numericprotected double
Used during property resolution to check for negative percentagesThis method expects to be overridden by subclasses.int
getValue()
Return the length of this PercentLength.int
getValue
(PercentBaseContext context) Returns the length in 1/1000ths of a point (millipoints)int
hashCode()
boolean
Return false because percent-length are always relative.toString()
Methods inherited from class org.apache.fop.fo.properties.LengthProperty
getDimension, getLength, getNumeric, getObject
Methods inherited from class org.apache.fop.fo.properties.Property
getCharacter, getColor, getCondLength, getEnum, getKeep, getLengthPair, getLengthRange, getList, getNCname, getNumber, getSpace, getSpecifiedValue, isAuto, setSpecifiedValue
-
Field Details
-
factor
private double factorThe percentage itself, expressed as a decimal value, e.g. for 95%, set the value to .95 -
lbase
A PercentBase implementation that contains the base length to which thefactor
should be applied to compute the actual length
-
-
Constructor Details
-
PercentLength
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.- Parameters:
factor
- the percentage factor, expressed as a decimal (e.g. use .95 to represent 95%)lbase
- base property to which the factor should be applied
-
-
Method Details
-
getBaseLength
- Returns:
- the base
-
getPercentage
protected double getPercentage()Used during property resolution to check for negative percentages- Returns:
- the percentage value
-
isAbsolute
public boolean isAbsolute()Return false because percent-length are always relative. Return true if the numeric is an absolute value. Relative values are percentages and table-column-units. All other numerics are absolute.- Returns:
- true when the numeric is absolute.
-
getNumericValue
public double getNumericValue()Return the value of this Numeric- Returns:
- the computed value.
-
getNumericValue
Return the value of this Numeric- Parameters:
context
- The context for the length calculation (for percentage based lengths)- Returns:
- the computed value.
-
getString
This method expects to be overridden by subclasses. -
getValue
public int getValue()Return the length of this PercentLength. Returns the length in 1/1000ths of a point (millipoints)- Returns:
- the length in millipoints
-
getValue
Returns the length in 1/1000ths of a point (millipoints)- Parameters:
context
- The context for the length calculation (for percentage based lengths)- Returns:
- the length in millipoints
-
toString
Description copied from class:Property
-
hashCode
public int hashCode() -
equals
-