Interface Block

    • Field Detail

      • LIST_BLOCK_TYPE

        static final Type LIST_BLOCK_TYPE
        Helper to represent the Type for each List<Block>.
        Since:
        10.10RC1
    • Method Detail

      • addChild

        void addChild​(Block blockToAdd)
        Helper method to add a single child block to the end of the children list of the current block. For adding several blocks at once use addChildren(java.util.List).
        Parameters:
        blockToAdd - the child block to add
      • addChildren

        void addChildren​(List<? extends Block> blocksToAdd)
        Adds several children blocks to the end of the children list of the current block. For example a bold sentence is made up of a Bold block to which the different words making up the text have been added to.
        Parameters:
        blocksToAdd - the children blocks to add
      • setChildren

        void setChildren​(List<? extends Block> children)
        Replace current children by the provided list of Blocks.
        Parameters:
        children - the new children
      • insertChildBefore

        void insertChildBefore​(Block blockToInsert,
                               Block nextBlock)
        Helper method to add a single child block to the current block before the provided existing child block. For adding several blocks at once use addChildren(java.util.List).
        Parameters:
        blockToInsert - the child block to add
        nextBlock - the child block that will be just after the added block
        Since:
        1.6M1
      • insertChildAfter

        void insertChildAfter​(Block blockToInsert,
                              Block previousBlock)
        Helper method to add a single child block to the current block after the provided existing child block. For adding several blocks at once use addChildren(java.util.List).
        Parameters:
        blockToInsert - the child block to add
        previousBlock - the child block that will be just before the added block
        Since:
        1.6M1
      • replaceChild

        void replaceChild​(Block newBlock,
                          Block oldBlock)
        Replaces an existing children block with the passed new block. Also sets the new block's parent to be the current block.
        Parameters:
        newBlock - the new block to replace the old block with
        oldBlock - the block to replace with the new block
      • replaceChild

        void replaceChild​(List<Block> newBlocks,
                          Block oldBlock)
        Replaces an existing children block with the passed new blocks. Also sets the new block's parents to be the current block.
        Parameters:
        newBlocks - the new blocks to replace the old block with
        oldBlock - the block to replace with the new blocks
      • getParent

        Block getParent()
        Get the parent block. All blocks have a parent and the top level parent is the XDOM object.
        Returns:
        the parent block
      • setParent

        void setParent​(Block parentBlock)
        Sets the parent block.
        Parameters:
        parentBlock - the parent block
      • getRoot

        Block getRoot()
        Gets the top level Block. If the current block is the top level Block, it return itself.
        Returns:
        the top level Block
      • removeBlock

        void removeBlock​(Block childBlockToRemove)
        Removes a Block.
        Parameters:
        childBlockToRemove - the child block to remove
        Since:
        2.6RC1
      • getNextSibling

        Block getNextSibling()
        Returns:
        the next sibling block or null if there's no next sibling
        Since:
        2.6RC1
      • setNextSiblingBlock

        void setNextSiblingBlock​(Block nextSiblingBlock)
        Parameters:
        nextSiblingBlock - see getNextSibling()
        Since:
        2.6RC1
      • getPreviousSibling

        Block getPreviousSibling()
        Returns:
        the previous sibling block or null if there's no previous sibling
        Since:
        2.6RC1
      • setPreviousSiblingBlock

        void setPreviousSiblingBlock​(Block previousSiblingBlock)
        Parameters:
        previousSiblingBlock - see getPreviousSibling() ()}
        Since:
        2.6RC1
      • clone

        Block clone​(BlockFilter blockFilter)
        Return a copy of the block with filtered children.
        Parameters:
        blockFilter - the Block filter.
        Returns:
        the filtered Block.
        Since:
        1.8RC2
      • getParameters

        Map<String,​String> getParameters()
        Returns:
        all parameters
        Since:
        3.0M1
      • getParameter

        String getParameter​(String name)
        A Parameter is a generic key/value which can be used to add metadata to a block. What is done with the metadata depends on the Renderer's implementations. For example the XHTML Renderer adds them as Element attributes.
        Parameters:
        name - the name of the parameter to return
        Returns:
        the parameter or null if the parameter doesn't exist
        Since:
        3.0M1
      • setParameter

        void setParameter​(String name,
                          String value)
        Set a parameter on the current block. See getParameter(String) for more details.
        Parameters:
        name - the parameter's name
        value - the parameter's value
        Since:
        3.0M1
      • setParameters

        void setParameters​(Map<String,​String> parameters)
        Set several parameters at once.
        Parameters:
        parameters - the parameters to set
        Since:
        3.0M1
        See Also:
        getParameter(String)
      • getBlocks

        <T extends BlockList<T> getBlocks​(BlockMatcher matcher,
                                            Block.Axes axes)
        Get all blocks following provided BlockMatcher and Block.Axes.
        Type Parameters:
        T - the class of the Blocks to return
        Parameters:
        matcher - filter the blocks to return
        axes - indicate the search axes
        Returns:
        the matched Blocks, empty list of none was found
        Since:
        3.0M3
      • getFirstBlock

        <T extends Block> T getFirstBlock​(BlockMatcher matcher,
                                          Block.Axes axes)
        Get the first matched block in the provided Block.Axes.
        Type Parameters:
        T - the class of the Block to return
        Parameters:
        matcher - indicate which block to stop to
        axes - indicate the search axes
        Returns:
        the matched Block, null if none was found
        Since:
        3.0M3