org.xwiki.rendering.macro.box
Class AbstractBoxMacro<P extends BoxMacroParameters>

java.lang.Object
  extended by org.xwiki.rendering.macro.AbstractMacro<P>
      extended by org.xwiki.rendering.macro.box.AbstractBoxMacro<P>
Type Parameters:
P - the type of macro parameters bean.
All Implemented Interfaces:
Comparable<Macro<?>>, org.xwiki.component.phase.Initializable, Macro<P>

public abstract class AbstractBoxMacro<P extends BoxMacroParameters>
extends AbstractMacro<P>

Draw a box around provided content.

Since:
1.7
Version:
$Id: a21d9f81699beba5a13fb04dfd7a7bfc4b26c066 $

Field Summary
 
Fields inherited from class org.xwiki.rendering.macro.AbstractMacro
beanManager, DEFAULT_CATEGORY_CONTENT, DEFAULT_CATEGORY_DEVELOPMENT, DEFAULT_CATEGORY_FORMATTING, DEFAULT_CATEGORY_NAVIGATION
 
Constructor Summary
protected AbstractBoxMacro(String name, String description, ContentDescriptor contentDescriptor, Class<?> parametersBeanClass)
          Creates a new box macro.
 
Method Summary
 List<Block> execute(P parameters, String content, MacroTransformationContext context)
           
protected  String getClassProperty()
           
protected  MacroContentParser getMacroContentParser()
           
protected abstract  List<Block> parseContent(P parameters, String content, MacroTransformationContext context)
          Execute macro content and return the result.
 boolean supportsInlineMode()
           
 
Methods inherited from class org.xwiki.rendering.macro.AbstractMacro
compareTo, getDescriptor, getPriority, initialize, setDefaultCategory, setDescriptor, setPriority
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBoxMacro

protected AbstractBoxMacro(String name,
                           String description,
                           ContentDescriptor contentDescriptor,
                           Class<?> parametersBeanClass)
Creates a new box macro.

Parameters:
name - the name of the macro
description - string describing this macro.
contentDescriptor - the ContentDescriptor describing the content of this macro.
parametersBeanClass - class of the parameters bean.
Method Detail

supportsInlineMode

public boolean supportsInlineMode()

execute

public List<Block> execute(P parameters,
                           String content,
                           MacroTransformationContext context)
                    throws MacroExecutionException
Throws:
MacroExecutionException

parseContent

protected abstract List<Block> parseContent(P parameters,
                                            String content,
                                            MacroTransformationContext context)
                                     throws MacroExecutionException
Execute macro content and return the result. This methods is separated form execute(BoxMacroParameters, String, MacroTransformationContext) to be able to overwrite it in macro which need boxes.

Parameters:
parameters - the parameters of the macro.
content - the content of the macro.
context - the context if the macros transformation.
Returns:
the result of the macro execution.
Throws:
MacroExecutionException - error when executing the macro.

getClassProperty

protected String getClassProperty()
Returns:
the name of the CSS class to use when rendering, in case no cssClass parameter is specified.

getMacroContentParser

protected MacroContentParser getMacroContentParser()
Returns:
the macro content parser to use to parse content in wiki syntax


Copyright © 2004-2011 XWiki. All Rights Reserved.