|
||||||||||
| 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,
Map<String,String> parameters)
Construct a block with a child block and parameters. |
|
AbstractBlock(List<? extends Block> childrenBlocks)
Constructs a block with children blocks. |
|
AbstractBlock(List<? extends Block> childrenBlocks,
Map<String,String> parameters)
Construct a block with children blocks and parameters. |
|
AbstractBlock(Map<String,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(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(Object obj)
|
|
|
getBlocks(BlockMatcher matcher,
Block.Axes axes)
Get all blocks following provided BlockMatcher and Block.Axes. |
|
List<Block> |
getChildren()
Gets all children blocks. |
|
|
getChildrenByType(Class<T> blockClass,
boolean recurse)
Deprecated. |
|
|
getFirstBlock(BlockMatcher matcher,
Block.Axes axes)
Get the first matched block in the provided Block.Axes. |
|
Block |
getNextSibling()
|
|
String |
getParameter(String name)
A Parameter is a generic key/value which can be used to add metadata to a block. |
|
Map<String,String> |
getParameters()
|
|
Block |
getParent()
Get the parent block. |
|
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(List<Block> newBlocks,
Block oldBlock)
Replaces an existing children block with the passed new blocks. |
|
void |
setChildren(List<? extends Block> children)
Replace current children by the provided list of Blocks. |
|
void |
setNextSiblingBlock(Block nextSiblingBlock)
|
|
void |
setParameter(String name,
String value)
Set a parameter on the current block. |
|
void |
setParameters(Map<String,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(Map<String,String> parameters)
parameters - the parameters to setpublic AbstractBlock(Block childBlock)
childBlock - the child block of this blockpublic AbstractBlock(List<? extends Block> childrenBlocks)
childrenBlocks - the list of children blocks of the block to construct
public AbstractBlock(Block childBlock,
Map<String,String> parameters)
childBlock - the child block of this blockparameters - the parameters to set
public AbstractBlock(List<? extends Block> childrenBlocks,
Map<String,String> parameters)
childrenBlocks - the list of children blocks of the block to constructparameters - the parameters to set| Method Detail |
|---|
public void addChild(Block blockToAdd)
BlockBlock.addChildren(java.util.List).
addChild in interface BlockblockToAdd - the child block to addpublic void addChildren(List<? extends Block> blocksToAdd)
Block
addChildren in interface BlockblocksToAdd - the children blocks to addpublic void setChildren(List<? extends Block> children)
BlockBlocks.
setChildren in interface Blockchildren - the new childrenpublic void setNextSiblingBlock(Block nextSiblingBlock)
setNextSiblingBlock in interface BlocknextSiblingBlock - see Block.getNextSibling()public void setPreviousSiblingBlock(Block previousSiblingBlock)
setPreviousSiblingBlock in interface BlockpreviousSiblingBlock - see Block.getPreviousSibling() ()}
public void insertChildBefore(Block blockToInsert,
Block nextBlock)
BlockBlock.addChildren(java.util.List).
insertChildBefore in interface BlockblockToInsert - the child block to addnextBlock - the child block that will be just after the added block
public void insertChildAfter(Block blockToInsert,
Block previousBlock)
BlockBlock.addChildren(java.util.List).
insertChildAfter in interface BlockblockToInsert - the child block to addpreviousBlock - the child block that will be just before the added block
public void replaceChild(Block newBlock,
Block oldBlock)
Block
replaceChild in interface BlocknewBlock - the new block to replace the old block witholdBlock - the block to replace with the new block
public void replaceChild(List<Block> newBlocks,
Block oldBlock)
Block
replaceChild in interface BlocknewBlocks - the new blocks to replace the old block witholdBlock - the block to replace with the new blockspublic List<Block> getChildren()
Block
getChildren in interface BlockBlock.addChildren(java.util.List)public Block getParent()
BlockXDOM object.
getParent in interface Blockpublic Map<String,String> getParameters()
getParameters in interface Blockpublic String getParameter(String name)
Block
getParameter in interface Blockname - the name of the parameter to return
public void setParameter(String name,
String value)
BlockBlock.getParameter(String) for more details.
setParameter in interface Blockname - the parameter's namevalue - the parameter's valuepublic void setParameters(Map<String,String> parameters)
Block
setParameters in interface Blockparameters - the parameters to setBlock.getParameter(String)public void setParent(Block parentBlock)
Block
setParent in interface BlockparentBlock - the parent blockpublic Block getRoot()
Block
getRoot in interface Blockpublic Block getNextSibling()
getNextSibling in interface Blockpublic Block getPreviousSibling()
getPreviousSibling in interface Blockpublic void removeBlock(Block childBlockToRemove)
Block
removeBlock in interface BlockchildBlockToRemove - the child block to removepublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic Block clone()
clone in interface Blockclone in class ObjectObject.clone()public Block clone(BlockFilter blockFilter)
clone in interface BlockblockFilter - the Block filter.
public void traverse(Listener listener)
BlockListener 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.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 <T extends Block> List<T> getBlocks(BlockMatcher matcher,
Block.Axes axes)
BlockBlockMatcher and Block.Axes.
getBlocks in interface BlockT - the class of the Blocks to returnmatcher - filter the blocks to returnaxes - indicate the search axes
Blocks, empty list of none was found
public <T extends Block> T getFirstBlock(BlockMatcher matcher,
Block.Axes axes)
BlockBlock.Axes.
getFirstBlock in interface BlockT - the class of the Block to returnmatcher - indicate which block to stop toaxes - indicate the search axes
Block, null if none was found
@Deprecated
public <T extends Block> List<T> getChildrenByType(Class<T> blockClass,
boolean recurse)
Block
getChildrenByType in interface BlockT - the class of the Blocks to returnblockClass - the block class to look forrecurse - if true also search recursively children
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||