Class BlockProperties.Builder

  • Enclosing class:
    BlockProperties

    public static class BlockProperties.Builder
    extends Object
    The Builder is used when creating a BlockProperties instance.
    • Constructor Detail

      • Builder

        public Builder()
        Create a new Builder.
    • 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, see firstLineIndent(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
      • rightTextIndent

        public BlockProperties.Builder rightTextIndent​(int rightTextIndent)
        Set the right text indent for the block, in characters. The right text indent controls the right indent of all text rows except the last one, see rightLastLineIndent(int). The indent is applied to text directly within the block, but is not inherited to block children.
        Parameters:
        rightTextIndent - the indent, in characters
        Returns:
        returns "this" object
      • rightLastLineIndent

        public BlockProperties.Builder rightLastLineIndent​(int rightLastLineIndent)
        Set the right last line indent for the block, in characters. The right last line indent controls the right indent of the last text row in a block. The indent is applied to text directly within the block, but is not inherited to block children.
        Parameters:
        rightLastLineIndent - 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
      • 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
      • displayWhen

        public BlockProperties.Builder displayWhen​(Condition value)
        Sets the display-when expression.
        Parameters:
        value - Expression to decide if the block should be shown
        Returns:
        returns this object
      • build

        public BlockProperties build()
        Build BlockProperties using the current state of the Builder.
        Returns:
        returns a new BlockProperties instance