org.xwiki.rendering.block
Class MacroBlock

java.lang.Object
  extended by org.xwiki.rendering.block.AbstractBlock
      extended by org.xwiki.rendering.block.MacroBlock
All Implemented Interfaces:
Cloneable, Block

public class MacroBlock
extends AbstractBlock

Represents a Macro (standalone or inline) defined in a page.

Note: You can get macro parameters using AbstractBlock.getParameters() for example. Macro block is reusing Block standard custom parameters API since macro by definition already have parameters and don't need also block parameters. So in this case MacroBlock parameters and Block parameters are the same thing.

Since:
1.8M2
Version:
$Id$

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.xwiki.rendering.block.Block
Block.Axes
 
Constructor Summary
MacroBlock(String id, Map<String,String> parameters, boolean isInline)
           
MacroBlock(String id, Map<String,String> parameters, String content, boolean isInline)
           
 
Method Summary
 String getContent()
           
 String getId()
           
 boolean isInline()
           
 void traverse(Listener listener)
          Let the block send Listener events corresponding to its content.
 
Methods inherited from class org.xwiki.rendering.block.AbstractBlock
addChild, addChildren, after, before, clone, clone, equals, getBlocks, getChildren, getChildrenByType, getFirstBlock, getNextSibling, getParameter, getParameters, getParent, getPreviousSibling, getRoot, hashCode, insertChildAfter, insertChildBefore, removeBlock, replaceChild, replaceChild, setChildren, setNextSiblingBlock, setParameter, setParameters, setParent, setPreviousSiblingBlock
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MacroBlock

public MacroBlock(String id,
                  Map<String,String> parameters,
                  boolean isInline)
Parameters:
id - the id of the macro
parameters - the parameters of the macro
isInline - indicate if the macro is located in a inline content (like paragraph, etc.)

MacroBlock

public MacroBlock(String id,
                  Map<String,String> parameters,
                  String content,
                  boolean isInline)
Parameters:
id - the id of the macro
parameters - the parameters of the macro
content - the content of the macro. Null if the macro does not have content
isInline - indicate if the macro is located in a inline content (like paragraph, etc.)
Method Detail

getId

public String getId()
Returns:
the macro id (eg "toc" for the TOC Macro).
Since:
2.0M3

getContent

public String getContent()
Returns:
the macro content.

isInline

public boolean isInline()
Returns:
if true the macro is located in a inline content (like paragraph, etc.).

traverse

public void traverse(Listener listener)
Description copied from interface: Block
Let the block send 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.

Specified by:
traverse in interface Block
Overrides:
traverse in class AbstractBlock
Parameters:
listener - the listener to which to send the events to.


Copyright © 2004-2012 XWiki. All Rights Reserved.