Package com.itextpdf.layout.properties
Class ParagraphWidowsControl
java.lang.Object
com.itextpdf.layout.properties.ParagraphWidowsControl
A specialized class holding configurable parameters related to
Paragraph
's widows restrictions. This class is meant to be used as the value for the Property.WIDOWS_CONTROL
key.
-
Constructor Summary
ConstructorDescriptionParagraphWidowsControl
(int minWidows, int maxLinesToMove, boolean overflowParagraphOnViolation) Creates aParagraphWidowsControl
instance with specified widows restrictions. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets a number of lines that are allowed to be moved to the next area in order to fix widows constraint violation.int
Gets minimal number of paragraph's lines to be overflowed to the next area.void
handleViolatedWidows
(ParagraphRenderer widowsRenderer, String message) Writes a log message reporting that widows constraint is violated and cannot be automatically fixed.boolean
Indicates whether paragraph should be completely pushed to the next area if widows constraint is violated and cannot be automatically fixed.setMinAllowedWidows
(int minWidows, int maxLinesToMove, boolean overflowParagraphOnViolation) Sets parameters that define widows restrictions and conditions of handling cases of widows constraint violation.
-
Constructor Details
-
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 Details
-
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
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 widows -
message
-String
explaining the reason for violation
-