Package com.itextpdf.layout.properties
Class ParagraphWidowsControl
- java.lang.Object
-
- com.itextpdf.layout.properties.ParagraphWidowsControl
-
public class ParagraphWidowsControl extends java.lang.ObjectA specialized class holding configurable parameters related toParagraph's widows restrictions. This class is meant to be used as the value for theProperty.WIDOWS_CONTROLkey.
-
-
Field Summary
Fields Modifier and Type Field Description private intmaxLinesToMoveprivate intminWidowsprivate booleanoverflowOnWidowsViolation
-
Constructor Summary
Constructors Constructor Description ParagraphWidowsControl(int minWidows, int maxLinesToMove, boolean overflowParagraphOnViolation)Creates aParagraphWidowsControlinstance with specified widows restrictions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMaxLinesToMove()Gets a number of lines that are allowed to be moved to the next area in order to fix widows constraint violation.intgetMinWidows()Gets minimal number of paragraph's lines to be overflowed to the next area.voidhandleViolatedWidows(ParagraphRenderer widowsRenderer, java.lang.String message)Writes a log message reporting that widows constraint is violated and cannot be automatically fixed.booleanisOverflowOnWidowsViolation()Indicates whether paragraph should be completely pushed to the next area if widows constraint is violated and cannot be automatically fixed.ParagraphWidowsControlsetMinAllowedWidows(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 aParagraphWidowsControlinstance 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
ParagraphWidowsControlinstance.
-
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-Stringexplaining the reason for violation
-
-