Package org.xwiki.rendering.macro.box
Class AbstractBoxMacro<P extends BoxMacroParameters>
- java.lang.Object
-
- org.xwiki.rendering.macro.AbstractMacro<P>
-
- 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: ce57b5d4b86600e9a26d3fe8d616defe46f076a2 $
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTENT_MISSING_ERRORPredefined error message.-
Fields inherited from class org.xwiki.rendering.macro.AbstractMacro
beanManager, DEFAULT_CATEGORY_CONTENT, DEFAULT_CATEGORY_DEPRECATED, DEFAULT_CATEGORY_DEVELOPMENT, DEFAULT_CATEGORY_FORMATTING, DEFAULT_CATEGORY_INTERNAL, DEFAULT_CATEGORY_LAYOUT, DEFAULT_CATEGORY_NAVIGATION
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractBoxMacro(String name, String description, ContentDescriptor contentDescriptor, Class<?> parametersBeanClass)Creates a new box macro.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description List<Block>execute(P parameters, String content, MacroTransformationContext context)protected List<? extends Block>getBlockTitle(P parameters, String content, MacroTransformationContext context)protected Map<String,String>getBoxParameters(P parameters, String content, MacroTransformationContext context)protected StringgetClassProperty()protected ResourceReferencegetImageReference(P parameters, String content, MacroTransformationContext context)protected MacroContentParsergetMacroContentParser()protected StringgetTitle(P parameters, String content, MacroTransformationContext context)protected booleanisContentChecked()protected abstract List<Block>parseContent(P parameters, String content, MacroTransformationContext context)Execute macro content and return the result.booleansupportsInlineMode()-
Methods inherited from class org.xwiki.rendering.macro.AbstractMacro
compareTo, getDescriptor, getNonGeneratedContentMetaData, getNonGeneratedContentMetaData, getNonGeneratedContentMetaData, getNonGeneratedContentMetaData, getPriority, initialize, setDefaultCategories, setDescriptor, setPriority
-
-
-
-
Field Detail
-
CONTENT_MISSING_ERROR
public static final String CONTENT_MISSING_ERROR
Predefined error message.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractBoxMacro
protected AbstractBoxMacro(String name, String description, ContentDescriptor contentDescriptor, Class<?> parametersBeanClass)
Creates a new box macro.- Parameters:
name- the name of the macrodescription- string describing this macro.contentDescriptor- theContentDescriptordescribing the content of this macro.parametersBeanClass- class of the parameters bean.
-
-
Method Detail
-
supportsInlineMode
public boolean supportsInlineMode()
-
getBlockTitle
protected List<? extends Block> getBlockTitle(P parameters, String content, MacroTransformationContext context)
- Parameters:
parameters- the macro parameters in the form of a bean defined by theMacroimplementationcontent- the content of the macrocontext- the context of the macros transformation process- Returns:
- the title represented as a list of Blocks
- Since:
- 10.10
-
getImageReference
protected ResourceReference getImageReference(P parameters, String content, MacroTransformationContext context)
- Parameters:
parameters- the macro parameters in the form of a bean defined by theMacroimplementationcontent- the content of the macrocontext- the context of the macros transformation process- Returns:
- the image reference to be displayed in the box
- Since:
- 10.10
-
getTitle
protected String getTitle(P parameters, String content, MacroTransformationContext context)
- Parameters:
parameters- the macro parameters in the form of a bean defined by theMacroimplementationcontent- the content of the macrocontext- the context of the macros transformation process- Returns:
- the title of the box
- Since:
- 10.10
-
getBoxParameters
protected Map<String,String> getBoxParameters(P parameters, String content, MacroTransformationContext context)
- Parameters:
parameters- the macro parameters in the form of a bean defined by theMacroimplementationcontent- the content of the macrocontext- the context of the macros transformation process- Returns:
- the map of parameters to build the box, in the same order as we create them when they are retrieved by renderers.
- Since:
- 10.10
-
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 formexecute(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.
-
isContentChecked
@Unstable protected boolean isContentChecked()
- Returns:
- true if
execute(BoxMacroParameters, String, MacroTransformationContext)should make sure the content is not null - Since:
- 15.0RC1, 14.10.2
-
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
-
-