|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.fotree.value.Expr
org.foray.fotree.value.ExprAdditive
org.foray.fotree.value.ExprMultiplicative
org.foray.fotree.value.ExprUnary
org.foray.fotree.value.ExprPrimary
org.foray.fotree.value.Datatype
org.foray.fotree.value.DtShape
org.foray.fotree.value.DtRectangle
public class DtRectangle
A rectangle datatype in XSL. This datatype is not specifically listed among the datatypes in the XSL-FO Standard 1.0, at Section 5.11. However, it is described at Section 7.20.1, and in the CSS 2.1 Specification at 11.1.2 and other places.
Field Summary |
---|
Fields inherited from class org.foray.fotree.value.Expr |
---|
OPERATION_ADD, OPERATION_DIVIDE, OPERATION_MOD, OPERATION_MULTIPLY, OPERATION_NEGATION, OPERATION_SUBTRACT, UNIT_POWER_AREA, UNIT_POWER_LENGTH, UNIT_POWER_NON_NUMERIC, UNIT_POWER_NUMERIC |
Constructor Summary | |
---|---|
DtRectangle(PropertyValue topOffset,
PropertyValue rightOffset,
PropertyValue bottomOffset,
PropertyValue leftOffset)
Constructor. |
Method Summary | |
---|---|
boolean |
canEvalColor()
Indicates whether this property value has the ability to express itself as a Color. |
boolean |
canEvalInteger()
Indicates whether this property value has the ability to express itself as an integer Numeric item. |
boolean |
canEvalKeyword()
Indicates whether this property value can evaluate to a keyword. |
boolean |
canEvalLength()
Indicates whether this expression can be evaluated to a unit power = 1 (length) or not. |
boolean |
canEvalNumeric()
Indicates whether this property value has the ability to express itself as a Numeric item. |
boolean |
canEvalPercentage()
Indicates whether this property value can evaluate to a percentage. |
Shape |
computeShape(Shape inputShape,
int pointSize)
Computes the shape described by this. |
Color |
evalColor()
Return the color value of "this". |
int |
evalInteger()
Return this value as an int. |
PvKeyword |
evalKeyword()
Returns the keyword value of this property value. |
int |
evalLength(int pointSize)
Evaluates the expression to a unit power of 1 (length). |
double |
evalNumeric()
Return the raw numeric value of "this", without regard to unit power. |
float |
evalPercentage()
Returns the percentage value of this property value. |
int |
getBottomOffset(int pointSize,
int percentBase)
Returns the bottom offset component of this rectangle. |
int |
getLeftOffset(int pointSize,
int percentBase)
Returns the left offset component of this rectangle. |
int |
getRightOffset(int pointSize,
int percentBase)
Returns the right offset component of this rectangle. |
int |
getTopOffset(int pointSize,
int percentBase)
Returns the top offset component of this rectangle. |
byte |
getUnitPower()
Each numeric has a "unit power". |
boolean |
lengthRequiresFontSize()
Indicates whether the computation of the length will require an accurate font-size parameter. |
static DtRectangle |
makeRectangleDT(String input)
Factory method for creating a RectangleDT from a String input. |
Methods inherited from class org.foray.fotree.value.DtShape |
---|
makeShapeDT |
Methods inherited from class org.foray.fotree.value.Datatype |
---|
convertValueToFoValue |
Methods inherited from class org.foray.fotree.value.Expr |
---|
evalColorException, evalIntegerException, evalKeywordException, evalLengthException, evalNumericException, evalPercentageException |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DtRectangle(PropertyValue topOffset, PropertyValue rightOffset, PropertyValue bottomOffset, PropertyValue leftOffset) throws PropertyException
topOffset
- The top offset component of the rectangle.rightOffset
- The right offset component of the rectangle.bottomOffset
- The bottom offset component of the rectangle.leftOffset
- The left offset component of the rectangle.
PropertyException
- If any offset value is invalid.Method Detail |
---|
public int getTopOffset(int pointSize, int percentBase)
pointSize
- The font size.percentBase
- The percent base used for length calculations, if any.
public int getRightOffset(int pointSize, int percentBase)
pointSize
- The font size.percentBase
- The percent base used for length calculations, if any.
public int getBottomOffset(int pointSize, int percentBase)
pointSize
- The font size.percentBase
- The percent base used for length calculations, if any.
public int getLeftOffset(int pointSize, int percentBase)
pointSize
- The font size.percentBase
- The percent base used for length calculations, if any.
public static DtRectangle makeRectangleDT(String input)
input
- The String from which a RectangleDT should be constructed.
public boolean canEvalNumeric()
PropertyValue
public double evalNumeric()
PropertyValue
public boolean canEvalLength()
PropertyValue
public byte getUnitPower()
PropertyValue
Expr.UNIT_POWER_NUMERIC
or Expr.UNIT_POWER_LENGTH
.public int evalLength(int pointSize)
PropertyValue
pointSize
- The point size, in millipoints, of the font.
This is used in calculations that are relative to the point size.
In cases where the computation of the font-size is expensive, check
PropertyValue.lengthRequiresFontSize()
first.
If that method returns false, zero or some other constant can safely
be passed, as it will be ignored anyway.
Integer.MIN_VALUE
otherwise.
The value is expressed in millipoints.public boolean canEvalColor()
PropertyValue
public Color evalColor()
PropertyValue
public boolean lengthRequiresFontSize()
PropertyValue
public boolean canEvalInteger()
PropertyValue
public int evalInteger()
PropertyValue
PropertyValue.canEvalInteger()
returns true.
Doing so on other instances may result in an
IllegalStateException
.
public boolean canEvalKeyword()
PropertyValue
public PvKeyword evalKeyword()
PropertyValue
PropertyValue.canEvalKeyword()
returns true.
Doing so on other instances may result in an
IllegalStateException
.
public boolean canEvalPercentage()
PropertyValue
public float evalPercentage()
PropertyValue
PropertyValue.canEvalPercentage()
returns true.
Doing so on other instances may result in an
IllegalStateException
.
public Shape computeShape(Shape inputShape, int pointSize)
DtShape
computeShape
in class DtShape
inputShape
- The shape to which the computed (returned) shape is
relative.
All encapsulated dimensions are expressed in millipoints.
CSS and XSL-FO shapes are defined as offsets to other shapes, and the
exact dimensions of those shapes are not necessarily known as the
data item is parsed, so the actual shape must be passed in here.pointSize
- The font size.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |