Package org.daisy.dotify.api.formatter
Class BlockProperties.Builder
- java.lang.Object
-
- org.daisy.dotify.api.formatter.BlockProperties.Builder
-
- Enclosing class:
- BlockProperties
public static class BlockProperties.Builder extends Object
The Builder is used when creating a BlockProperties instance.
-
-
Constructor Summary
Constructors Constructor Description Builder()Create a new Builder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BlockProperties.Builderalign(FormattingTypes.Alignment align)Sets the alignment property for the block.BlockProperties.BuilderblockIndent(int blockIndent)Set the block indent for the block, in characters.BlockProperties.BuilderbottomMargin(int bottomMargin)Set the bottom margin for the block, in characters.BlockProperties.BuilderbottomPadding(int bottomPadding)Set the bottom padding for the block, in characters.BlockProperties.BuilderbreakBefore(FormattingTypes.BreakBefore breakBefore)Set the break before property for the block.BlockPropertiesbuild()Build BlockProperties using the current state of the Builder.BlockProperties.BuilderdefaultListLabel(String label)Sets the default label for list items in the block.BlockProperties.BuilderfirstLineIndent(int firstLineIndent)Set the first line indent for the block, in characters.BlockProperties.Builderidentifier(String identifier)Sets the identifier for the blockBlockProperties.Builderkeep(FormattingTypes.Keep keep)Set the keep property for the block.BlockProperties.BuilderkeepWithNext(int keepWithNext)Set the keep with next property for the block.BlockProperties.BuilderkeepWithNextSheets(int keepWithNextSheets)Sets the keep with next sheets property for the block.BlockProperties.BuilderkeepWithPreviousSheets(int keepWithPreviousSheets)Sets the keep with previous sheets property for the block.BlockProperties.BuilderleftMargin(int leftMargin)Set the left margin for the block, in characters.BlockProperties.BuilderleftPadding(int leftPadding)Set the left padding for the block, in characters.BlockProperties.BuilderlistItemLabel(String label)Sets the list item label for the block.BlockProperties.BuilderlistNumberFormat(NumeralStyle listFormat)Sets the number format for the block.BlockProperties.BuilderlistType(FormattingTypes.ListStyle listType)Set the list type for the block.BlockProperties.Builderorphans(int value)Sets the orphans propertyBlockProperties.BuilderrightMargin(int rightMargin)Set the right margin for the block, in characters.BlockProperties.BuilderrightPadding(int rightPadding)Set the right padding for the block, in characters.BlockProperties.BuilderrowSpacing(float value)Sets the row spacing for the blockBlockProperties.BuildertextBorderStyle(TextBorderStyle value)Sets the text border style for the block.BlockProperties.BuildertextIndent(int textIndent)Set the text indent for the block, in characters.BlockProperties.BuildertopMargin(int topMargin)Set the top margin for the block, in characters.BlockProperties.BuildertopPadding(int topPadding)Set the top padding for the block, in characters.BlockProperties.BuilderunderlineStyle(String value)Sets the underline pattern for the block.BlockProperties.BuilderverticalAlignment(BlockPosition.VerticalAlignment alignment)Sets the vertical alignment for this block.BlockProperties.BuilderverticalPosition(Position position)Sets the vertical position for this block.BlockProperties.BuildervolumeKeepPriority(Integer value)Sets the volume keep priority for the block.BlockProperties.Builderwidows(int value)Sets the widows property
-
-
-
Method Detail
-
leftMargin
public BlockProperties.Builder leftMargin(int leftMargin)
Set the left margin for the block, in characters.- Parameters:
leftMargin- left margin, in characters- Returns:
- returns "this" object
-
rightMargin
public BlockProperties.Builder rightMargin(int rightMargin)
Set the right margin for the block, in characters.- Parameters:
rightMargin- right margin, in characters- Returns:
- returns "this" object
-
topMargin
public BlockProperties.Builder topMargin(int topMargin)
Set the top margin for the block, in characters.- Parameters:
topMargin- top margin, in characters- Returns:
- returns "this" object
-
bottomMargin
public BlockProperties.Builder bottomMargin(int bottomMargin)
Set the bottom margin for the block, in characters.- Parameters:
bottomMargin- bottom margin, in characters- Returns:
- returns "this" object
-
leftPadding
public BlockProperties.Builder leftPadding(int leftPadding)
Set the left padding for the block, in characters.- Parameters:
leftPadding- left padding, in characters- Returns:
- returns "this" object
-
rightPadding
public BlockProperties.Builder rightPadding(int rightPadding)
Set the right padding for the block, in characters.- Parameters:
rightPadding- right padding, in characters- Returns:
- returns "this" object
-
topPadding
public BlockProperties.Builder topPadding(int topPadding)
Set the top padding for the block, in characters.- Parameters:
topPadding- top padding, in characters- Returns:
- returns "this" object
-
bottomPadding
public BlockProperties.Builder bottomPadding(int bottomPadding)
Set the bottom padding for the block, in characters.- Parameters:
bottomPadding- bottom padding, in characters- Returns:
- returns "this" object
-
textIndent
public BlockProperties.Builder textIndent(int textIndent)
Set the text indent for the block, in characters. The text indent controls the indent of all text rows except the first one, seefirstLineIndent(int). The text indent is applied to text directly within the block, but is not inherited to block children.- Parameters:
textIndent- the indent, in characters- Returns:
- returns "this" object
-
firstLineIndent
public BlockProperties.Builder firstLineIndent(int firstLineIndent)
Set the first line indent for the block, in characters. The first line indent controls the indent of the first text row in a block. The first line indent is applied to text directly within the block, but is not inherited to block children.- Parameters:
firstLineIndent- the indent, in characters.- Returns:
- returns "this" object
-
listType
public BlockProperties.Builder listType(FormattingTypes.ListStyle listType)
Set the list type for the block. The list type is applied to block's children.- Parameters:
listType- the type of list- Returns:
- returns "this" object
-
listNumberFormat
public BlockProperties.Builder listNumberFormat(NumeralStyle listFormat)
Sets the number format for the block. Note that the listType must be of type 'ol'.- Parameters:
listFormat- the numeral style- Returns:
- returns this object
-
defaultListLabel
public BlockProperties.Builder defaultListLabel(String label)
Sets the default label for list items in the block. Note that listType must be of type 'ul'.- Parameters:
label- the default list label- Returns:
- returns this object
-
listItemLabel
public BlockProperties.Builder listItemLabel(String label)
Sets the list item label for the block. Note that this block must be a child of a block with a listType of 'ol' or 'ul'. If the list is ordered, the label it must be an integer.- Parameters:
label- the label- Returns:
- returns this object
-
breakBefore
public BlockProperties.Builder breakBefore(FormattingTypes.BreakBefore breakBefore)
Set the break before property for the block.- Parameters:
breakBefore- the break before type- Returns:
- returns "this" object
-
keep
public BlockProperties.Builder keep(FormattingTypes.Keep keep)
Set the keep property for the block.- Parameters:
keep- the keep type- Returns:
- returns "this" object
-
align
public BlockProperties.Builder align(FormattingTypes.Alignment align)
Sets the alignment property for the block.- Parameters:
align- the alignment- Returns:
- returns "this" object
-
keepWithNext
public BlockProperties.Builder keepWithNext(int keepWithNext)
Set the keep with next property for the block.- Parameters:
keepWithNext- the number of rows in the next block to keep together with this block- Returns:
- returns "this" object
-
keepWithPreviousSheets
public BlockProperties.Builder keepWithPreviousSheets(int keepWithPreviousSheets)
Sets the keep with previous sheets property for the block. In other words, the number of previous sheets to keep in the same volume as the end of this block.- Parameters:
keepWithPreviousSheets- the number of sheets- Returns:
- returns this object
-
keepWithNextSheets
public BlockProperties.Builder keepWithNextSheets(int keepWithNextSheets)
Sets the keep with next sheets property for the block. In other words, the number of following sheets to keep in the same volume as the start of this block.- Parameters:
keepWithNextSheets- the number of sheets- Returns:
- returns this object
-
verticalPosition
public BlockProperties.Builder verticalPosition(Position position)
Sets the vertical position for this block. This behavior is similar to leader but in a vertical orientation. If the position has already been passed when this block is rendered, it is ignored.- Parameters:
position- the position- Returns:
- returns this object
-
verticalAlignment
public BlockProperties.Builder verticalAlignment(BlockPosition.VerticalAlignment alignment)
Sets the vertical alignment for this block. This will only have have an effect if vertical position is also set.- Parameters:
alignment- the alignment- Returns:
- returns this object
-
rowSpacing
public BlockProperties.Builder rowSpacing(float value)
Sets the row spacing for the block- Parameters:
value- the row spacing- Returns:
- returns this builder
-
blockIndent
public BlockProperties.Builder blockIndent(int blockIndent)
Set the block indent for the block, in characters. The block indent controls the indent of child blocks in a block. This is useful when building lists.- Parameters:
blockIndent- the indent, in characters- Returns:
- returns "this" object
-
volumeKeepPriority
public BlockProperties.Builder volumeKeepPriority(Integer value)
Sets the volume keep priority for the block.- Parameters:
value- a value between 1-9- Returns:
- returns "this" object
- Throws:
IllegalArgumentException- if the value is out of range
-
identifier
public BlockProperties.Builder identifier(String identifier)
Sets the identifier for the block- Parameters:
identifier- the identifier- Returns:
- returns "this" object
-
textBorderStyle
public BlockProperties.Builder textBorderStyle(TextBorderStyle value)
Sets the text border style for the block.- Parameters:
value- the text border- Returns:
- returns this object
-
underlineStyle
public BlockProperties.Builder underlineStyle(String value)
Sets the underline pattern for the block. This should be either a single-character string, or null for no underlining.- Parameters:
value- the value- Returns:
- returns this object
-
orphans
public BlockProperties.Builder orphans(int value)
Sets the orphans property- Parameters:
value- the value- Returns:
- returns this object
-
widows
public BlockProperties.Builder widows(int value)
Sets the widows property- Parameters:
value- the value- Returns:
- returns this object
-
build
public BlockProperties build()
Build BlockProperties using the current state of the Builder.- Returns:
- returns a new BlockProperties instance
-
-