org.apache.fop.fo.properties

Class PercentLength

Implemented Interfaces:
Length, Numeric

public class PercentLength
extends LengthProperty

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

Fields inherited from class org.apache.fop.fo.properties.Property

log

Constructor Summary

PercentLength(double factor, PercentBase lbase)
Main constructor.

Method Summary

PercentBase
getBaseLength()
double
getNumericValue()
double
getNumericValue(PercentBaseContext context)
protected double
getPercentage()
Used during property resolution to check for negative percentages
int
getValue()
Return the length of this PercentLength.
int
getValue(PercentBaseContext context)
boolean
isAbsolute()
Return false because percent-length are always relative.
String
toString()

Methods inherited from class org.apache.fop.fo.properties.LengthProperty

getDimension, getLength, getNumeric, getObject, getTableUnits

Methods inherited from class org.apache.fop.fo.properties.Property

getCharacter, getColor, getCondLength, getEnum, getKeep, getLength, getLengthPair, getLengthRange, getList, getNCname, getNumber, getNumeric, getObject, getSpace, getSpecifiedValue, getString, isAuto, setSpecifiedValue, toString

Constructor Details

PercentLength

public PercentLength(double factor,
                     PercentBase lbase)
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

public PercentBase getBaseLength()
Returns:
the base

getNumericValue

public double getNumericValue()
Specified by:
getNumericValue in interface Numeric

getNumericValue

public double getNumericValue(PercentBaseContext context)
Specified by:
getNumericValue in interface Numeric

getPercentage

protected double getPercentage()
Used during property resolution to check for negative percentages
Returns:
the percentage value

getValue

public int getValue()
Return the length of this PercentLength.
Specified by:
getValue in interface Length
getValue in interface Numeric

getValue

public int getValue(PercentBaseContext context)
Specified by:
getValue in interface Length
getValue in interface Numeric

isAbsolute

public boolean isAbsolute()
Return false because percent-length are always relative.
Specified by:
isAbsolute in interface Numeric

toString

public String toString()
Overrides:
toString in interface Property
Returns:
the String equivalent of this

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.