Package com.itextpdf.layout.properties
Class ParagraphWidowsControl
- java.lang.Object
-
- com.itextpdf.layout.properties.ParagraphWidowsControl
-
public class ParagraphWidowsControl extends java.lang.Object
A specialized class holding configurable parameters related toParagraph
's widows restrictions. This class is meant to be used as the value for theProperty.WIDOWS_CONTROL
key.
-
-
Field Summary
Fields Modifier and Type Field Description private int
maxLinesToMove
private int
minWidows
private boolean
overflowOnWidowsViolation
-
Constructor Summary
Constructors Constructor Description ParagraphWidowsControl(int minWidows, int maxLinesToMove, boolean overflowParagraphOnViolation)
Creates aParagraphWidowsControl
instance with specified widows restrictions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getMaxLinesToMove()
Gets a number of lines that are allowed to be moved to the next area in order to fix widows constraint violation.int
getMinWidows()
Gets minimal number of paragraph's lines to be overflowed to the next area.void
handleViolatedWidows(ParagraphRenderer widowsRenderer, java.lang.String message)
Writes a log message reporting that widows constraint is violated and cannot be automatically fixed.boolean
isOverflowOnWidowsViolation()
Indicates whether paragraph should be completely pushed to the next area if widows constraint is violated and cannot be automatically fixed.ParagraphWidowsControl
setMinAllowedWidows(int minWidows, int maxLinesToMove, boolean overflowParagraphOnViolation)
Sets parameters that define widows restrictions and conditions of handling cases of widows constraint violation.
-
-
-
Constructor Detail
-
ParagraphWidowsControl
public ParagraphWidowsControl(int minWidows, int maxLinesToMove, boolean overflowParagraphOnViolation)
Creates aParagraphWidowsControl
instance with specified widows restrictions.- Parameters:
minWidows
- minimal number of paragraph's lines to be overflowed to the next area.maxLinesToMove
- a number of lines that are allowed to be moved to the next area in order to fix widows constraint violation.overflowParagraphOnViolation
- defines whether the entire paragraph should be pushed to the next area if widows constraint is violated and cannot be automatically fixed.
-
-
Method Detail
-
setMinAllowedWidows
public ParagraphWidowsControl setMinAllowedWidows(int minWidows, int maxLinesToMove, boolean overflowParagraphOnViolation)
Sets parameters that define widows restrictions and conditions of handling cases of widows constraint violation.- Parameters:
minWidows
- minimal number of paragraph's lines to be overflowed to the next area.maxLinesToMove
- a number of lines that are allowed to be moved to the next area in order to fix widows constraint violation.overflowParagraphOnViolation
- defines whether paragraph should be completely pushed to the next area if widows constraint is violated and cannot be automatically fixed.- Returns:
- this
ParagraphWidowsControl
instance.
-
getMinWidows
public int getMinWidows()
Gets minimal number of paragraph's lines to be overflowed to the next area.- Returns:
- minimal number of paragraph's lines to be overflowed to the next area
-
getMaxLinesToMove
public int getMaxLinesToMove()
Gets a number of lines that are allowed to be moved to the next area in order to fix widows constraint violation.- Returns:
- a number of lines that are allowed to be moved to the next are
-
isOverflowOnWidowsViolation
public boolean isOverflowOnWidowsViolation()
Indicates whether paragraph should be completely pushed to the next area if widows constraint is violated and cannot be automatically fixed.- Returns:
- true if paragraph should be completely pushed to the next area if widows constraint is violated and cannot be automatically fixed, otherwise - false
-
handleViolatedWidows
public void handleViolatedWidows(ParagraphRenderer widowsRenderer, java.lang.String message)
Writes a log message reporting that widows constraint is violated and cannot be automatically fixed. This method is to be overridden if violation scenarios need to be handled in some other way.- Parameters:
widowsRenderer
- a renderer processing widowsmessage
-String
explaining the reason for violation
-
-