Package org.apache.fop.fo.flow.table
Class ConditionalBorder
- java.lang.Object
-
- org.apache.fop.fo.flow.table.ConditionalBorder
-
public class ConditionalBorder extends java.lang.Object
A class that holds the three possible values for a border-before/after on a table-cell, in the collapsing model. These three values are (for border-before, similar for border-after):- normal: common case, when a cell follows the cell before on a same page;
- leading: when the table is broken and the cell appears at the top of a page, in which case its border must be resolved with the header (or the top of the table) instead of with the previous cell;
- rest: when a cell is broken over several pages; same as leading but with conditionality taken into account.
-
-
Field Summary
Fields Modifier and Type Field Description private CollapsingBorderModel
collapsingBorderModel
The model used to resolve borders.static int
LEADING_TRAILING
leading and trailing border(package private) BorderSpecification
leadingTrailing
Special case: the cell is at the top or the bottom of the page.(package private) BorderSpecification
normal
Normal case, no break.static int
NORMAL
normal border(package private) BorderSpecification
rest
Special case: break inside the cell.static int
REST
all the rest
-
Constructor Summary
Constructors Modifier Constructor Description private
ConditionalBorder(BorderSpecification normal, BorderSpecification leadingTrailing, BorderSpecification rest, CollapsingBorderModel collapsingBorderModel)
(package private)
ConditionalBorder(BorderSpecification borderSpecification, CollapsingBorderModel collapsingBorderModel)
Creates a new conditional border.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) ConditionalBorder
copy()
Returns a shallow copy of this border.(package private) static ConditionalBorder
getDefaultBorder(CollapsingBorderModel collapsingBorderModel)
Returns a default border specification.(package private) void
integrateCompetingSegment(ConditionalBorder competitor, boolean withNormal, boolean withLeadingTrailing, boolean withRest)
Integrates the given segment in this border.(package private) void
integrateSegment(ConditionalBorder segment, boolean withNormal, boolean withLeadingTrailing, boolean withRest)
Updates this border after taking into account the given segment.(package private) void
resolve(ConditionalBorder competitor, boolean withNormal, boolean withLeadingTrailing, boolean withRest)
Resolves and updates the relevant parts of this border as well as the given one.java.lang.String
toString()
-
-
-
Field Detail
-
NORMAL
public static final int NORMAL
normal border- See Also:
- Constant Field Values
-
LEADING_TRAILING
public static final int LEADING_TRAILING
leading and trailing border- See Also:
- Constant Field Values
-
REST
public static final int REST
all the rest- See Also:
- Constant Field Values
-
normal
BorderSpecification normal
Normal case, no break.
-
leadingTrailing
BorderSpecification leadingTrailing
Special case: the cell is at the top or the bottom of the page.
-
rest
BorderSpecification rest
Special case: break inside the cell.
-
collapsingBorderModel
private CollapsingBorderModel collapsingBorderModel
The model used to resolve borders.
-
-
Constructor Detail
-
ConditionalBorder
private ConditionalBorder(BorderSpecification normal, BorderSpecification leadingTrailing, BorderSpecification rest, CollapsingBorderModel collapsingBorderModel)
-
ConditionalBorder
ConditionalBorder(BorderSpecification borderSpecification, CollapsingBorderModel collapsingBorderModel)
Creates a new conditional border.- Parameters:
borderSpecification
- the border specification to take as a basiscollapsingBorderModel
- the model that will be used to resolved borders
-
-
Method Detail
-
resolve
void resolve(ConditionalBorder competitor, boolean withNormal, boolean withLeadingTrailing, boolean withRest)
Resolves and updates the relevant parts of this border as well as the given one.- Parameters:
competitor
-withNormal
-withLeadingTrailing
-withRest
-
-
integrateCompetingSegment
void integrateCompetingSegment(ConditionalBorder competitor, boolean withNormal, boolean withLeadingTrailing, boolean withRest)
Integrates the given segment in this border. Unlike forintegrateSegment(ConditionalBorder, boolean, boolean, boolean)
, this method nicely handles the case where the CollapsingBorderModel returns null, by keeping the components to their old values.- Parameters:
competitor
-withNormal
-withLeadingTrailing
-withRest
-
-
integrateSegment
void integrateSegment(ConditionalBorder segment, boolean withNormal, boolean withLeadingTrailing, boolean withRest)
Updates this border after taking into account the given segment. The CollapsingBorderModel is not expected to return null.- Parameters:
segment
-withNormal
-withLeadingTrailing
-withRest
-
-
copy
ConditionalBorder copy()
Returns a shallow copy of this border.- Returns:
- a copy of this border
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getDefaultBorder
static ConditionalBorder getDefaultBorder(CollapsingBorderModel collapsingBorderModel)
Returns a default border specification.- Parameters:
collapsingBorderModel
- the model that will be used to resolve borders- Returns:
- a border with style 'none' for all of the three components
-
-