de.vc.jfo.flow

## Class Block

- java.lang.Object
- - de.vc.xml.AbstractNode
  - - de.vc.xml.AbstractNodeWithAttributes
    - - de.vc.jfo.FormattingObject
      - - de.vc.jfo.flow.FlowObject
        - - de.vc.jfo.flow.FlowObjectWithElements
          - - de.vc.jfo.flow.Block

- All Implemented Interfaces:
    BlockElement, Node, NodeElement, java.io.Serializable, java.lang.Cloneable

      public class Block
      extends FlowObjectWithElements
      implements BlockElement

  The fo:block formatting object is commonly used for formatting paragraphs, titles, headlines, figure and table captions, etc.

  .

  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class de.vc.jfo.FormattingObject

      `EMPTY_ARRAY`

    - ### Fields inherited from class de.vc.xml.AbstractNodeWithAttributes

      `MAP_TYPE_FLYWEIGHT, MAP_TYPE_HASH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Block()` Creates a new empty Block.
    `Block(BlockElement element)` Creates a new Block and adds the given element to content.
    `Block(BlockElement element, Values.Alignment align)` Creates a new Block, adds the given element to content and sets the alignment.
    `Block(InlineElement element)` Creates a new Block and adds the given element to content.
    `Block(InlineElement element, Values.Alignment align)` Creates a new Block, adds the given element to content and sets the alignment.
    `Block(java.lang.String pcData)` Creates a new Block and adds the given PCData to content.
    `Block(java.lang.String pcData, Values.Alignment align)` Creates a new Block, adds the given PCData to content and sets the alignment.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Block` | `add(BlockElement element)` Adds an formatting object (that is a block-group-member) to this FO at end.
    `Block` | `add(Footnote footnote)` Adds an footnote to this block at end.
    `Block` | `add(InlineElement element)` Adds an formatting object (that is an inline-group-member) to this FO at end.
    `Block` | `add(int idx, BlockElement element)` Adds an formatting object (that is a block-group-member) to this FO at the given index.
    `Block` | `add(int idx, InlineElement element)` Adds an formatting object (that is an inline-group-member) to this FO at the given index.
    `Block` | `add(int idx, java.lang.String pcdata)` Adds PCdata (Text) to this FO at the given index.
    `Block` | `add(java.lang.String pcdata)` Adds PCdata (Text) to this FO.
    `Accessibility` | `getAccessibility()` Gets the accessibilty of this fo.
    `Background` | `getBackground()` Gets the background of this fo.
    `Border` | `getBorder()` Gets the border of this fo.
    `Values.Break` | `getBreakAfter()` Gets the break after this formatting object.
    `Values.Break` | `getBreakBefore()` Gets the break before this formatting object.
    `Values.LinefeedTreatment` | `getLinefeedTreatment()` Gets the linefeed treatment.
    `Measure` | `getLineHeight()` Gets the height of line.
    `boolean` | `getLineHeightShiftAdjustment()`
    `Margin` | `getMargin()` Gets the margin of this fo.
    `Padding` | `getPadding()` Gets the padding of this fo.
    `RelativePosition` | `getRelativePosition()` Gets the relative position of this fo.
    `Values.Alignment` | `getTextAlignment()` Gets alignment (left, right, center...) of text.
    `Values.Alignment` | `getTextAlignmentLast()` Gets last (right) alignment (left, right, center...) of text.
    `Measure` | `getTextIndent()` Gets the text-indent (first-line-indent) of this block.
    `Values.WhiteSpaceTreatment` | `getWhiteSpaceTreatment()` Get the white space treatment.
    `boolean` | `hasBorder()` Returns true if at least one border attribute is set.
    `boolean` | `isWhiteSpaceCollapse()` Gets white space collapsing.
    `Block` | `newLine()` Starts a new line.
    `void` | `setAccessibility(Accessibility access)` Sets the accessibility of this fo.
    `void` | `setAlignment(Values.Alignment alignment)` Deprecated. use setTextAlignment
    `void` | `setBackground(Background bg)` Sets the background of this fo.
    `void` | `setBorder(Border border)` Sets the border of this fo.
    `void` | `setBreakAfter(Values.Break type)` Sets the break before this formatting object.
    `void` | `setBreakBefore(Values.Break type)` Sets the break before this formatting object.
    `void` | `setLinefeedTreatment(Values.LinefeedTreatment treatment)` Sets the linefeed treatment.
    `void` | `setLineHeight(Measure lineHeight)` Sets the height of a line.
    `void` | `setLineHeightShiftAdjustment(boolean considerShift)`
    `void` | `setMargin(Margin margin)` Sets the margin of this fo.
    `void` | `setPadding(Padding padding)` Sets the padding of this fo.
    `void` | `setRelativePosition(RelativePosition pos)` Sets the relative position of this block
    `void` | `setTextAlignment(Values.Alignment alignment)` Sets alignment (left, right, center...) of text.
    `void` | `setTextAlignmentLast(Values.Alignment alignment)` Sets last (right) alignment (left, right, center...) of text.
    `void` | `setTextIndent(Measure indent)` Sets the text-indent (first-line-indent) of this block.
    `void` | `setWhiteSpaceCollapse(boolean b)` Sets white space collapsing.
    `void` | `setWhiteSpaceTreatment(Values.WhiteSpaceTreatment treatment)` Sets the white space treatment.

    - ### Methods inherited from class de.vc.jfo.flow.FlowObjectWithElements

      `add, add, add, add, addAllImpl, addAllUnsafe, addAllUnsafe, addElement, addElement, addElements, addElements, addUnsafe, addUnsafe, clone, firstElement, getElements, isEmpty, lastElement, remove, remove, removeAll, removeElement, removeElement, removeLast, replaceElement, setElement`

    - ### Methods inherited from class de.vc.jfo.FormattingObject

      `cloned, clonedList, createUniqueID, doGetAttribute, doSetAttribute, elementCount, get, getAbsolutePosition, getAttributeMap, getDefinedAttributes, getDocument, getFont, getID, getLanguage, getLogger, getMeasureValue, getObjectValue, getObjectValue, getObjectValue, getObjectValue, getOrphans, getParentFO, getWidows, hasID, hasPadding, isHyphenation, setAbsolutePosition, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setFont, setHyphenation, setID, setLanguage, setLanguage, setOrphans, setWidows`

    - ### Methods inherited from class de.vc.xml.AbstractNodeWithAttributes

      `getDefaultMapType, setDefaultMapType`

    - ### Methods inherited from class de.vc.xml.AbstractNode

      `addAttributeChangeListener, clearEqualAttributes, clearInheratedAttribute, clearInheratedAttributes, clearValue, contains, contains, copyAttributes, createID, findFirstNodeWithText, findNode, findNodesWithText, fire, fireSaxEvents, getAttrAsBoolean, getAttrAsInteger, getAttrAsString, getAttrAsString, getAttribute, getAttribute, getAttributeMap, getContentText, getContentText, getDefinedAttributes, getElements, getElements, getElements, getFirstElement, getIndex, getLocalName, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getParent, getParent, getParent, getParentOrThis, getQName, getRoot, hasEqualAttrs, indexOf, liftInheritedAttribute, removeAttributeChangeListener, setAttribute, setAttributes, setAttrIfNotNull, setEnableAttributeChangeEvent, setNamespace, setParent, setQName, setUndefinedAttributes, writeTo, writeTo, writeTo, writeTo`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface de.vc.xml.Node

      `addAttributeChangeListener, addElement, addElement, clearInheratedAttribute, clearInheratedAttributes, clearValue, contains, fireSaxEvents, firstElement, getAttrAsString, getAttrAsString, getAttribute, getAttribute, getAttributeMap, getContentText, getDefinedAttributes, getElements, getElements, getLocalName, getNamespacePrefix, getNamespacePrefixes, getNamespaceURI, getQName, getRoot, indexOf, isEmpty, lastElement, removeAttributeChangeListener, removeElement, removeElement, replaceElement, setAttribute, setAttributes, setElement, setNamespace`

    - ### Methods inherited from interface de.vc.xml.NodeElement

      `clone, getParent, setParent, writeTo`

- - ### Constructor Detail

    - #### Block

          public Block()

      Creates a new empty Block.

    - #### Block

          public Block(BlockElement element)

      Creates a new Block and adds the given element to content.
      Parameters:
        `element` - A BlockGroupMember.

    - #### Block

          public Block(InlineElement element)

      Creates a new Block and adds the given element to content.
      Parameters:
        `element` - An InlineElement.

    - #### Block

          public Block(java.lang.String pcData)

      Creates a new Block and adds the given PCData to content.
      Parameters:
        `pcData` - Text/PCdata.

    - #### Block

          public Block(BlockElement element,
               Values.Alignment align)

      Creates a new Block, adds the given element to content and sets the alignment.
      Parameters:
        `element` - A BlockGroupMember.
        `align` - Alignment.

    - #### Block

          public Block(InlineElement element,
               Values.Alignment align)

      Creates a new Block, adds the given element to content and sets the alignment.
      Parameters:
        `element` - A BlockGroupMember.
        `align` - Alignment.

    - #### Block

          public Block(java.lang.String pcData,
               Values.Alignment align)

      Creates a new Block, adds the given PCData to content and sets the alignment.
      Parameters:
        `pcData` - Text/PCdata.
        `align` - Alignment.

  - ### Method Detail

    - #### newLine

          public Block newLine()

      Starts a new line.
      Returns:
        this block for chained calls.

    - #### add

          public Block add(InlineElement element)

      Adds an formatting object (that is an inline-group-member) to this FO at end.
      Parameters:
        `element` - FormattingObject.
      Returns:
        this block for chained calls.

    - #### add

          public Block add(BlockElement element)

      Adds an formatting object (that is a block-group-member) to this FO at end.
      Parameters:
        `element` - FormattingObject.
      Returns:
        this block for chained calls.

    - #### add

          public Block add(Footnote footnote)

      Adds an footnote to this block at end.
      Parameters:
        `footnote` - Footnote.
      Returns:
        this block for chained calls.

    - #### add

          public Block add(java.lang.String pcdata)

      Adds PCdata (Text) to this FO.
      Parameters:
        `pcdata` - Text/PCdata.
      Returns:
        this block for chained calls.

    - #### add

          public Block add(int idx,
                  InlineElement element)

      Adds an formatting object (that is an inline-group-member) to this FO at the given index.
      Parameters:
        `idx` - Index.
        `element` - FormattingObject.
      Returns:
        this block for chained calls.

    - #### add

          public Block add(int idx,
                  BlockElement element)

      Adds an formatting object (that is a block-group-member) to this FO at the given index.
      Parameters:
        `idx` - Index.
        `element` - FormattingObject.
      Returns:
        this block for chained calls.

    - #### add

          public Block add(int idx,
                  java.lang.String pcdata)

      Adds PCdata (Text) to this FO at the given index.
      Parameters:
        `idx` - Index.
        `pcdata` - Text/PCdata.
      Returns:
        this block for chained calls.

    - #### setAlignment

          public void setAlignment(Values.Alignment alignment)

      Deprecated. use setTextAlignment
      Sets the text-alignment.
      Parameters:
        `alignment` - Alignment.

    - #### setTextAlignment

          public void setTextAlignment(Values.Alignment alignment)

      Sets alignment (left, right, center...) of text.
      Parameters:
        `alignment` - Alignment.
      See Also:
        `Attributes.TEXT_ALIGN`

    - #### getTextAlignment

          public Values.Alignment getTextAlignment()

      Gets alignment (left, right, center...) of text. Returns ALIGNMENT_LEFT by default.
      Returns:
        Alignment.
      See Also:
        `Attributes.TEXT_ALIGN`

    - #### setTextAlignmentLast

          public void setTextAlignmentLast(Values.Alignment alignment)

      Sets last (right) alignment (left, right, center...) of text.
      Parameters:
        `alignment` - Alignment.
      See Also:
        `Attributes.TEXT_ALIGN_LAST`

    - #### getTextAlignmentLast

          public Values.Alignment getTextAlignmentLast()

      Gets last (right) alignment (left, right, center...) of text. Returns NULL by default.
      Returns:
        Alignment.
      See Also:
        `Attributes.TEXT_ALIGN_LAST`

    - #### getMargin

          public Margin getMargin()

      Gets the margin of this fo. Is never null.
      Overrides:
        `getMargin` in class `FormattingObject`
      Returns:
        Margin.

    - #### setMargin

          public void setMargin(Margin margin)

      Sets the margin of this fo.
      Overrides:
        `setMargin` in class `FormattingObject`
      Parameters:
        `margin` - Margin.

    - #### getPadding

          public Padding getPadding()

      Gets the padding of this fo. Is never null.
      Overrides:
        `getPadding` in class `FormattingObject`
      Returns:
        Padding.

    - #### setPadding

          public void setPadding(Padding padding)

      Sets the padding of this fo.
      Overrides:
        `setPadding` in class `FormattingObject`
      Parameters:
        `padding` - Padding.

    - #### hasBorder

          public boolean hasBorder()

      Returns true if at least one border attribute is set.
      Overrides:
        `hasBorder` in class `FormattingObject`
      Returns:
        True if at least one border attribute is set.

    - #### getBorder

          public Border getBorder()

      Gets the border of this fo. Is never null.
      Overrides:
        `getBorder` in class `FormattingObject`
      Returns:
        Border.

    - #### setBorder

          public void setBorder(Border border)

      Sets the border of this fo. If border is NULL, an empty border is created.
      Overrides:
        `setBorder` in class `FormattingObject`
      Parameters:
        `border` - Border.

    - #### getBackground

          public Background getBackground()

      Gets the background of this fo. Is never null.
      Overrides:
        `getBackground` in class `FormattingObject`
      Returns:
        Background.

    - #### setBackground

          public void setBackground(Background bg)

      Sets the background of this fo.
      Overrides:
        `setBackground` in class `FormattingObject`
      Parameters:
        `bg` - Background.

    - #### getAccessibility

          public Accessibility getAccessibility()

      Gets the accessibilty of this fo. Is never null.
      Overrides:
        `getAccessibility` in class `FormattingObject`
      Returns:
        Accessibility.

    - #### setAccessibility

          public void setAccessibility(Accessibility access)

      Sets the accessibility of this fo.
      Overrides:
        `setAccessibility` in class `FormattingObject`
      Parameters:
        `access` - Accessibility.

    - #### getRelativePosition

          public RelativePosition getRelativePosition()

      Gets the relative position of this fo. Is never null.
      Overrides:
        `getRelativePosition` in class `FormattingObject`
      Returns:
        RelativePosition.

    - #### setRelativePosition

          public void setRelativePosition(RelativePosition pos)

      Sets the relative position of this block
      Overrides:
        `setRelativePosition` in class `FormattingObject`
      Parameters:
        `pos` - RelativePosition.

    - #### setTextIndent

          public void setTextIndent(Measure indent)

      Sets the text-indent (first-line-indent) of this block.
      Parameters:
        `indent` - Indent of text.
      See Also:
        `Attributes.TEXT_INDENT`

    - #### getTextIndent

          public Measure getTextIndent()

      Gets the text-indent (first-line-indent) of this block.
      Returns:
        Text indent (is never null).
      See Also:
        `Attributes.TEXT_INDENT`

    - #### setBreakBefore

          public void setBreakBefore(Values.Break type)

      Sets the break before this formatting object.
      Parameters:
        `type` - Type of break. (see Values.BREAK_*)

    - #### getBreakBefore

          public Values.Break getBreakBefore()

      Gets the break before this formatting object.
      Returns:
        Type of break. By default Values.BREAK_AUTO is returned.

    - #### setBreakAfter

          public void setBreakAfter(Values.Break type)

      Sets the break before this formatting object.
      Parameters:
        `type` - Type of break. (see Values.BREAK_*)
      See Also:
        `Attributes.BREAK_AFTER`

    - #### getBreakAfter

          public Values.Break getBreakAfter()

      Gets the break after this formatting object.
      Returns:
        Type of break. By default Values.BREAK_AUTO is returned.
      See Also:
        `Attributes.BREAK_AFTER`

    - #### setWhiteSpaceCollapse

          public void setWhiteSpaceCollapse(boolean b)

      Sets white space collapsing.
      Parameters:
        `b` - true, if white spaces should be collapse.
      See Also:
        `Attributes.WHITE_SPACE_COLLAPSE`

    - #### isWhiteSpaceCollapse

          public boolean isWhiteSpaceCollapse()

      Gets white space collapsing. Default: true.
      Returns:
        true, if white spaces are collapsed.
      See Also:
        `Attributes.WHITE_SPACE_COLLAPSE`

    - #### setLinefeedTreatment

          public void setLinefeedTreatment(Values.LinefeedTreatment treatment)

      Sets the linefeed treatment. The "linefeed-treatment" property specifies the treatment of linefeeds (character flow objects whose Unicode code point is U+000A) during the refinement process. The default value is "treat-as-space".
      Parameters:
        `treatment` - New linefeed treatment.
      See Also:
        `Attributes.LINEFEED_TREATMENT`

    - #### getLinefeedTreatment

          public Values.LinefeedTreatment getLinefeedTreatment()

      Gets the linefeed treatment. The "linefeed-treatment" property specifies the treatment of linefeeds (character flow objects whose Unicode code point is U+000A) during the refinement process. The default value is "treat-as-space".
      Returns:
        Linefeed treatment.
      See Also:
        `Attributes.LINEFEED_TREATMENT`

    - #### setWhiteSpaceTreatment

          public void setWhiteSpaceTreatment(Values.WhiteSpaceTreatment treatment)

      Sets the white space treatment. The "white-space-treatment" property specifies the treatment during the refinement process of character flow objects, except for linefeeds, that are classified as white space in XML. This includes U+0020 (space) and other white space characters but excludes U+000A (linefeed). Linefeed treatment is determined by the "linefeed-treatment" property. The default value is "ignore-if-surrounding-linefeed".
      Parameters:
        `treatment` - New white space treatment.
      See Also:
        `Attributes.WHITE_SPACE_TREATMENT`

    - #### getWhiteSpaceTreatment

          public Values.WhiteSpaceTreatment getWhiteSpaceTreatment()

      Get the white space treatment. The "white-space-treatment" property specifies the treatment during the refinement process of character flow objects, except for linefeeds, that are classified as white space in XML. This includes U+0020 (space) and other white space characters but excludes U+000A (linefeed). Linefeed treatment is determined by the "linefeed-treatment" property. The default value is "ignore-if-surrounding-linefeed".
      Returns:
        White space treatment.
      See Also:
        `Attributes.WHITE_SPACE_TREATMENT`

    - #### getLineHeight

          public Measure getLineHeight()

      Gets the height of line.
      Returns:
        Line height or null if not specified.

    - #### setLineHeight

          public void setLineHeight(Measure lineHeight)

      Sets the height of a line.
      Parameters:
        `lineHeight` - Hight of line.

    - #### setLineHeightShiftAdjustment

          public void setLineHeightShiftAdjustment(boolean considerShift)

    - #### getLineHeightShiftAdjustment

          public boolean getLineHeightShiftAdjustment()

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.