|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.rendering.block.AbstractBlock
public abstract class AbstractBlock
Implementation for Block operations. All blocks should extend this class. Supports the notion of generic parameters
which can be added to a block (see getParameter(String) for more details.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.xwiki.rendering.block.Block |
|---|
Block.Axes |
| Constructor Summary | |
|---|---|
AbstractBlock()
Empty constructor to construct an empty block. |
|
AbstractBlock(Block childBlock)
Constructs a block with a child block. |
|
AbstractBlock(Block childBlock,
java.util.Map<java.lang.String,java.lang.String> parameters)
Construct a block with a child block and parameters. |
|
AbstractBlock(java.util.List<? extends Block> childrenBlocks)
Constructs a block with children blocks. |
|
AbstractBlock(java.util.List<? extends Block> childrenBlocks,
java.util.Map<java.lang.String,java.lang.String> parameters)
Construct a block with children blocks and parameters. |
|
AbstractBlock(java.util.Map<java.lang.String,java.lang.String> parameters)
Construct a block with parameters. |
|
| Method Summary | ||
|---|---|---|
void |
addChild(Block blockToAdd)
Helper method to add a single child block to the end of the children list of the current block. |
|
void |
addChildren(java.util.List<? extends Block> blocksToAdd)
Adds several children blocks to the end of the children list of the current block. |
|
void |
after(Listener listener)
Send Listener events corresponding to the end of the block. |
|
void |
before(Listener listener)
Send Listener events corresponding to the start of the block. |
|
Block |
clone()
|
|
Block |
clone(BlockFilter blockFilter)
Return a copy of the block with filtered children. |
|
boolean |
equals(java.lang.Object obj)
|
|
java.util.List<Block> |
getBlocks(BlockMatcher matcher,
Block.Axes axes)
Get all blocks following provided BlockMatcher and Block.Axes. |
|
java.util.List<Block> |
getChildren()
Gets all children blocks. |
|
|
getChildrenByType(java.lang.Class<T> blockClass,
boolean recurse)
Deprecated. |
|
Block |
getFirstBlock(BlockMatcher matcher,
Block.Axes axes)
Get the first matched block in the provided Block.Axes. |
|
Block |
getNextSibling()
|
|
java.lang.String |
getParameter(java.lang.String name)
A Parameter is a generic key/value which can be used to add metadata to a block. |
|
java.util.Map<java.lang.String,java.lang.String> |
getParameters()
|
|
Block |
getParent()
Get the parent block. |
|
|
getParentBlockByType(java.lang.Class<T> blockClass)
Deprecated. |
|
|
getPreviousBlockByType(java.lang.Class<T> blockClass,
boolean recurse)
Deprecated. |
|
Block |
getPreviousSibling()
|
|
Block |
getRoot()
Gets the top level Block. |
|
int |
hashCode()
|
|
void |
insertChildAfter(Block blockToInsert,
Block previousBlock)
Helper method to add a single child block to the current block after the provided existing child block. |
|
void |
insertChildBefore(Block blockToInsert,
Block nextBlock)
Helper method to add a single child block to the current block before the provided existing child block. |
|
void |
removeBlock(Block childBlockToRemove)
Removes a Block. |
|
void |
replaceChild(Block newBlock,
Block oldBlock)
Replaces an existing children block with the passed new block. |
|
void |
replaceChild(java.util.List<Block> newBlocks,
Block oldBlock)
Replaces an existing children block with the passed new blocks. |
|
void |
setChildren(java.util.List<? extends Block> children)
Replace current children by the provided list of Blocks. |
|
void |
setNextSiblingBlock(Block nextSiblingBlock)
|
|
void |
setParameter(java.lang.String name,
java.lang.String value)
Set a parameter on the current block. |
|
void |
setParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
Set several parameters at once. |
|
void |
setParent(Block parentBlock)
Sets the parent block. |
|
void |
setPreviousSiblingBlock(Block previousSiblingBlock)
|
|
void |
traverse(Listener listener)
Let the block send Listener events corresponding to its content. |
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractBlock()
public AbstractBlock(java.util.Map<java.lang.String,java.lang.String> parameters)
parameters - the parameters to setpublic AbstractBlock(Block childBlock)
childBlock - the child block of this blockpublic AbstractBlock(java.util.List<? extends Block> childrenBlocks)
childrenBlocks - the list of children blocks of the block to construct
public AbstractBlock(Block childBlock,
java.util.Map<java.lang.String,java.lang.String> parameters)
childBlock - the child block of this blockparameters - the parameters to set
public AbstractBlock(java.util.List<? extends Block> childrenBlocks,
java.util.Map<java.lang.String,java.lang.String> parameters)
childrenBlocks - the list of children blocks of the block to constructparameters - the parameters to set| Method Detail |
|---|
public void addChild(Block blockToAdd)
Block.addChildren(java.util.List).
addChild in interface BlockblockToAdd - the child block to addBlock.addChild(org.xwiki.rendering.block.Block)public void addChildren(java.util.List<? extends Block> blocksToAdd)
addChildren in interface BlockblocksToAdd - the children blocks to addBlock.addChildren(java.util.List)public void setChildren(java.util.List<? extends Block> children)
Blocks.
setChildren in interface Blockchildren - the new childrenBlock.setChildren(java.util.List)public void setNextSiblingBlock(Block nextSiblingBlock)
setNextSiblingBlock in interface BlocknextSiblingBlock - see Block.getNextSibling()Block.setNextSiblingBlock(Block)public void setPreviousSiblingBlock(Block previousSiblingBlock)
setPreviousSiblingBlock in interface BlockpreviousSiblingBlock - see Block.getPreviousSibling() ()}Block.setPreviousSiblingBlock(Block)
public void insertChildBefore(Block blockToInsert,
Block nextBlock)
Block.addChildren(java.util.List).
insertChildBefore in interface BlockblockToInsert - the child block to addnextBlock - the child block that will be just after the added blockBlock.insertChildBefore(org.xwiki.rendering.block.Block,
org.xwiki.rendering.block.Block)
public void insertChildAfter(Block blockToInsert,
Block previousBlock)
Block.addChildren(java.util.List).
insertChildAfter in interface BlockblockToInsert - the child block to addpreviousBlock - the child block that will be just before the added blockBlock.insertChildAfter(org.xwiki.rendering.block.Block,
org.xwiki.rendering.block.Block)
public void replaceChild(Block newBlock,
Block oldBlock)
replaceChild in interface BlocknewBlock - the new block to replace the old block witholdBlock - the block to replace with the new blockBlock.replaceChild(Block, Block)
public void replaceChild(java.util.List<Block> newBlocks,
Block oldBlock)
replaceChild in interface BlocknewBlocks - the new blocks to replace the old block witholdBlock - the block to replace with the new blocksBlock.replaceChild(List, Block)public java.util.List<Block> getChildren()
getChildren in interface BlockBlock.getChildren()public Block getParent()
XDOM object.
getParent in interface BlockBlock.getParent()public java.util.Map<java.lang.String,java.lang.String> getParameters()
getParameters in interface BlockBlock.getParameters()public java.lang.String getParameter(java.lang.String name)
getParameter in interface Blockname - the name of the parameter to return
Block.getParameter(java.lang.String)
public void setParameter(java.lang.String name,
java.lang.String value)
Block.getParameter(String) for more details.
setParameter in interface Blockname - the parameter's namevalue - the parameter's valueBlock.setParameter(java.lang.String, java.lang.String)public void setParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
setParameters in interface Blockparameters - the parameters to setBlock.setParameters(java.util.Map)public void setParent(Block parentBlock)
setParent in interface BlockparentBlock - the parent blockBlock.setParent(org.xwiki.rendering.block.Block)public Block getRoot()
getRoot in interface BlockBlock.getRoot()public Block getNextSibling()
getNextSibling in interface BlockBlock.getNextSibling()public Block getPreviousSibling()
getPreviousSibling in interface BlockBlock.getPreviousSibling()public void removeBlock(Block childBlockToRemove)
removeBlock in interface BlockchildBlockToRemove - the child block to removeBlock.removeBlock(Block)public boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectEqualsBuilder.reflectionEquals(Object, Object)public int hashCode()
hashCode in class java.lang.ObjectHashCodeBuilder.reflectionHashCode(Object)public Block clone()
clone in interface Blockclone in class java.lang.ObjectBlock.clone()public Block clone(BlockFilter blockFilter)
clone in interface BlockblockFilter - the Block filter.
Block.clone(org.xwiki.rendering.block.BlockFilter)public void traverse(Listener listener)
Listener events corresponding to its content. For example a Paragraph block will send
the Listener.beginParagraph(java.util.Map) and
Listener.endParagraph(java.util.Map) events when this method is called.
traverse in interface Blocklistener - the listener to which to send the events to.traverse(org.xwiki.rendering.listener.Listener)public void before(Listener listener)
Listener events corresponding to the start of the block. For example
for a Bold block, this allows an XHTML Listener (aka a Renderer) to output <b>.
listener - the listener that will receive the events sent by this block before its children blocks have
emitted their own events.public void after(Listener listener)
Listener events corresponding to the end of the block. For example for a Bold block, this allows an
XHTML Listener (aka a Renderer) to output </b>.
listener - the listener that will receive the events sent by this block before its children blocks have
emitted their own events.
public java.util.List<Block> getBlocks(BlockMatcher matcher,
Block.Axes axes)
BlockMatcher and Block.Axes.
getBlocks in interface Blockmatcher - filter the blocks to returnaxes - indicate the search axes
Blocks, empty list of none was foundBlock.getBlocks(org.xwiki.rendering.block.match.BlockMatcher,
org.xwiki.rendering.block.Block.Axes)
public Block getFirstBlock(BlockMatcher matcher,
Block.Axes axes)
Block.Axes.
getFirstBlock in interface Blockmatcher - indicate which block to stop toaxes - indicate the search axes
Block, null if none was foundBlock.getFirstBlock(org.xwiki.rendering.block.match.BlockMatcher,
org.xwiki.rendering.block.Block.Axes)
@Deprecated
public <T extends Block> java.util.List<T> getChildrenByType(java.lang.Class<T> blockClass,
boolean recurse)
getChildrenByType in interface BlockT - the class of the Blocks to returnblockClass - the block class to look forrecurse - if true also search recursively children
Block.getChildrenByType(java.lang.Class, boolean)
@Deprecated
public <T extends Block> T getPreviousBlockByType(java.lang.Class<T> blockClass,
boolean recurse)
The difference with Block.getParentBlockByType(Class) is that this one look also at previous block in the same
parent when Block.getParentBlockByType(Class) only look at parents.
getPreviousBlockByType in interface BlockT - the class of the Blocks to returnblockClass - the block class to look forrecurse - if true also search in parents levels
Block.getPreviousBlockByType(java.lang.Class, boolean)@Deprecated public <T extends Block> T getParentBlockByType(java.lang.Class<T> blockClass)
The difference with Block.getPreviousBlockByType(Class, boolean) is that this one only look at parent when
Block.getPreviousBlockByType(Class, boolean) look at previous block in the same parent.
getParentBlockByType in interface BlockT - the class of the Blocks to returnblockClass - the block class to look for
Block.getParentBlockByType(java.lang.Class)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||