This is a helper class used for setting common traits on areas.
addBackground
public static void addBackground(Area area,
CommonBorderPaddingBackground backProps,
PercentBaseContext context)
Add background to an area.
Layout managers that create areas with a background can use this to
add the background to the area.
Note: The area's IPD and BPD must be set before calling this method.
area
- the area to set the traits onbackProps
- the background propertiescontext
- Property evaluation context
addBorders
public static void addBorders(Area area,
CommonBorderPaddingBackground bordProps,
boolean discardBefore,
boolean discardAfter,
boolean discardStart,
boolean discardEnd,
PercentBaseContext context)
Add borders to an area.
Layout managers that create areas with borders can use this to
add the borders to the area.
area
- the area to set the traits on.bordProps
- border propertiesdiscardBefore
- true if the before border should be discardeddiscardAfter
- true if the after border should be discardeddiscardStart
- true if the start border should be discardeddiscardEnd
- true if the end border should be discardedcontext
- Property evaluation context
addBorders
public static void addBorders(Area area,
CommonBorderPaddingBackground bordProps,
PercentBaseContext context)
Call the other addBorders() method and addPadding separately.
Add borders to an area. Note: this method also adds unconditional padding. Don't use!
Layout managers that create areas with borders can use this to
add the borders to the area.
area
- the area to set the traits on.bordProps
- border propertiescontext
- Property evaluation context
addBreaks
public static void addBreaks(Area area,
int breakBefore,
int breakAfter)
Sets the traits for breaks on an area.
area
- the area to set the traits on.breakBefore
- the value for break-beforebreakAfter
- the value for break-after
addCollapsingBorders
public static void addCollapsingBorders(Area area,
CommonBorderPaddingBackground bordProps,
boolean[] outer,
PercentBaseContext context)
Add borders to an area for the collapsing border model in tables.
Layout managers that create areas with borders can use this to
add the borders to the area.
area
- the area to set the traits on.bordProps
- border propertiesouter
- 4 boolean values indicating if the side represents the
table's outer border. Order: before, after, start, endcontext
- Property evaluation context
addFontTraits
public static void addFontTraits(Area area,
Font font)
Adds font traits to an area
area
- the target arefont
- the font to use
addMargins
public static void addMargins(Area area,
CommonBorderPaddingBackground bpProps,
int startIndent,
int endIndent,
PercentBaseContext context)
Add space to a block area.
Layout managers that create block areas can use this to add space
outside of the border rectangle to the area.
area
- the area to set the traits on.bpProps
- the border, padding and background propertiesstartIndent
- the effective start-indent valueendIndent
- the effective end-indent valuecontext
- the context for evaluation of percentages
addMargins
public static void addMargins(Area area,
CommonBorderPaddingBackground bpProps,
CommonMarginBlock marginProps,
PercentBaseContext context)
Add space to a block area.
Layout managers that create block areas can use this to add space
outside of the border rectangle to the area.
area
- the area to set the traits on.bpProps
- the border, padding and background propertiesmarginProps
- the margin properties.context
- the context for evaluation of percentages
addPadding
public static void addPadding(Area area,
CommonBorderPaddingBackground bordProps,
boolean discardBefore,
boolean discardAfter,
boolean discardStart,
boolean discardEnd,
PercentBaseContext context)
Add padding to an area.
Layout managers that create areas with padding can use this to
add the borders to the area.
area
- the area to set the traits on.bordProps
- border and padding propertiesdiscardBefore
- true if the before padding should be discardeddiscardAfter
- true if the after padding should be discardeddiscardStart
- true if the start padding should be discardeddiscardEnd
- true if the end padding should be discardedcontext
- Property evaluation context
addSpaceBeforeAfter
public static void addSpaceBeforeAfter(Area area,
double adjust,
MinOptMax spaceBefore,
MinOptMax spaceAfter)
Adds traits for space-before and space-after to an area.
area
- the target areaadjust
- the adjustment valuespaceBefore
- the space-before space specifierspaceAfter
- the space-after space specifier
addTextDecoration
public static void addTextDecoration(Area area,
CommonTextDecoration deco)
Adds the text-decoration traits to the area.
area
- the area to set the traits ondeco
- the text decorations
getEffectiveSpace
public static int getEffectiveSpace(double adjust,
MinOptMax space)
Returns the effective space length of a resolved space specifier based on the adjustment
value.
adjust
- the adjustment valuespace
- the space specifier
- the effective space length
setBorderPaddingTraits
public static void setBorderPaddingTraits(Area area,
CommonBorderPaddingBackground bpProps,
boolean bNotFirst,
boolean bNotLast,
PercentBaseContext context)
Sets border and padding traits on areas.
area
- area to set the traits onbpProps
- border and padding propertiesbNotFirst
- True if the area is not the first areabNotLast
- True if the area is not the last areacontext
- Property evaluation context
setProducerID
public static void setProducerID(Area area,
String id)
Sets the producer's ID as a trait on the area. This can be used to track back the
generating FO node.
area
- the area to set the traits onid
- the ID to set