public interface Listener extends LinkListener, ImageListener
XDOM
object. That object has
a AbstractBlock.traverse(Listener)
method that accepts a Listener
object. For each
Block
element found in the document its
Block.traverse(org.xwiki.rendering.listener.Listener)
method is called leading to the generation of events from this
interface.
Here's an example of usage:
<code> XDOM dom = parser.parse(source); MyListener listener = new MyListener(...); dom.traverse(listener); // At this stage all events have been sent to MyListener. </code>
Modifier and Type | Field and Description |
---|---|
static Map<String,String> |
EMPTY_PARAMETERS
To use when there is no parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
beginDefinitionDescription()
Start of a definition list description.
|
void |
beginDefinitionList(Map<String,String> parameters)
Start of a definition list.
|
void |
beginDefinitionTerm()
Start of a definition list term.
|
void |
beginDocument(MetaData metadata)
Start of the document.
|
default void |
beginFigure(Map<String,String> parameters)
Start of a figure.
|
default void |
beginFigureCaption(Map<String,String> parameters)
Start of a figure caption.
|
void |
beginFormat(Format format,
Map<String,String> parameters)
End of a text formatting block.
|
void |
beginGroup(Map<String,String> parameters)
Start a group of elements.
|
void |
beginHeader(HeaderLevel level,
String id,
Map<String,String> parameters)
Start of a header.
|
void |
beginList(ListType type,
Map<String,String> parameters)
Start of a list.
|
void |
beginListItem()
Start of a list item.
|
default void |
beginListItem(Map<String,String> parameters)
Start of a list item.
|
void |
beginMacroMarker(String name,
Map<String,String> parameters,
String content,
boolean inline)
Start of marker containing a macro definition.
|
void |
beginMetaData(MetaData metadata)
Start of MetaData (eg saving source from where the content is coming from).
|
void |
beginParagraph(Map<String,String> parameters)
Start of a paragraph.
|
void |
beginQuotation(Map<String,String> parameters)
Start of a quotation.
|
void |
beginQuotationLine()
Start of a quotation line.
|
void |
beginSection(Map<String,String> parameters)
Start of a section.
|
void |
beginTable(Map<String,String> parameters)
Start of a table.
|
void |
beginTableCell(Map<String,String> parameters)
Start of a table cell.
|
void |
beginTableHeadCell(Map<String,String> parameters)
Start of a table head cell.
|
void |
beginTableRow(Map<String,String> parameters)
Start of a table row.
|
void |
endDefinitionDescription()
End of a definition list description.
|
void |
endDefinitionList(Map<String,String> parameters)
End of a definition list.
|
void |
endDefinitionTerm()
End of a definition list term.
|
void |
endDocument(MetaData metadata)
End of the document.
|
default void |
endFigure(Map<String,String> parameters)
End of a figure.
|
default void |
endFigureCaption(Map<String,String> parameters)
End of a figure caption.
|
void |
endFormat(Format format,
Map<String,String> parameters)
End of a text formatting block.
|
void |
endGroup(Map<String,String> parameters)
End of the group.
|
void |
endHeader(HeaderLevel level,
String id,
Map<String,String> parameters)
End of a header.
|
void |
endList(ListType type,
Map<String,String> parameters)
End of a list.
|
void |
endListItem()
End of a list item.
|
default void |
endListItem(Map<String,String> parameters)
End of a list item.
|
void |
endMacroMarker(String name,
Map<String,String> parameters,
String content,
boolean inline)
End of marker containing a macro definition.
|
void |
endMetaData(MetaData metadata)
End of MetaData.
|
void |
endParagraph(Map<String,String> parameters)
End of a paragraph.
|
void |
endQuotation(Map<String,String> parameters)
End of a quotation.
|
void |
endQuotationLine()
End of a quotation line.
|
void |
endSection(Map<String,String> parameters)
End of a section.
|
void |
endTable(Map<String,String> parameters)
End of a table.
|
void |
endTableCell(Map<String,String> parameters)
End of a table cell.
|
void |
endTableHeadCell(Map<String,String> parameters)
End of a table head cell.
|
void |
endTableRow(Map<String,String> parameters)
End of a table row.
|
void |
onEmptyLines(int count)
Represents an empty line between 2 standalone Blocks.
|
void |
onHorizontalLine(Map<String,String> parameters)
Represents an horizontal line.
|
void |
onId(String name)
A reference/location in a page.
|
void |
onMacro(String id,
Map<String,String> parameters,
String content,
boolean inline)
A Macro.
|
void |
onNewLine()
A new line or line break (it's up to the renderers to decide if it should be outputted as a new line or as a line
break in the given syntax).
|
void |
onRawText(String content,
Syntax syntax)
Some text to inject directly into the listener output without parsing it.
|
void |
onSpace()
A space.
|
void |
onSpecialSymbol(char symbol)
A special symbol (
* , < , > , = , quote, etc). |
void |
onVerbatim(String content,
boolean inline,
Map<String,String> parameters)
A portion of text.
|
void |
onWord(String word)
A word.
|
beginLink, endLink
onImage
void beginDocument(MetaData metadata)
metadata
- the meta data to associate to the following events, see MetaData
void endDocument(MetaData metadata)
metadata
- the meta data associated with the previous events, see MetaData
void beginMetaData(MetaData metadata)
metadata
- the metadatavoid endMetaData(MetaData metadata)
metadata
- the metadatavoid beginGroup(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters. Example: style="background-color: blue"void endGroup(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters. Example: style="background-color: blue"void beginFormat(@Default(value="NONE") Format format, @Default(value="") Map<String,String> parameters)
format
- the formatting type (bold, italic, etc)parameters
- a generic list of parameters. Example: style="background-color: blue"Format
void endFormat(@Default(value="NONE") Format format, @Default(value="") Map<String,String> parameters)
format
- the formatting type (bold, italic, etc)parameters
- a generic list of parameters. Example: style="background-color: blue"Format
void beginParagraph(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters. Example: style="background-color: blue"void endParagraph(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters. Example: style="background-color: blue"void beginList(@Default(value="BULLETED") ListType type, @Default(value="") Map<String,String> parameters)
type
- the type of list (bulleted, numbered, etc)parameters
- a generic list of parameters for the list. Example: "style"/"background-color: blue"ListType
void beginDefinitionList(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the list. Example: "style"/"background-color: blue"void endList(@Default(value="BULLETED") ListType type, @Default(value="") Map<String,String> parameters)
type
- the type of list (bulleted, numbered, etc)parameters
- a generic list of parameters for the list. Example: "style"/"background-color: blue"ListType
void endDefinitionList(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the list. Example: "style"/"background-color: blue"void beginListItem()
default void beginListItem(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the list item. Example: "style"/"background-color: blue"void beginDefinitionTerm()
void beginDefinitionDescription()
void endListItem()
default void endListItem(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the list item. Example: "style"/"background-color: blue"void endDefinitionTerm()
void endDefinitionDescription()
void beginTable(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the table.void beginTableRow(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the table row.void beginTableCell(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the table cell.void beginTableHeadCell(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the table head cell.void endTable(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the table.void endTableRow(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the table row.void endTableCell(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the table cell.void endTableHeadCell(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the table head cell.void beginSection(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters. Example: style="background-color: blue"HeaderLevel
void endSection(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters. Example: style="background-color: blue"HeaderLevel
void beginHeader(@Default(value="1") HeaderLevel level, String id, @Default(value="") Map<String,String> parameters)
level
- the header level (1, 2, 3, etc)id
- the header unique identifierparameters
- a generic list of parameters. Example: style="background-color: blue"HeaderLevel
void endHeader(@Default(value="1") HeaderLevel level, String id, @Default(value="") Map<String,String> parameters)
level
- the header level (1, 2, 3, etc)id
- the header unique identifierparameters
- a generic list of parameters. Example: style="background-color: blue"HeaderLevel
void beginMacroMarker(String name, @Default(value="") Map<String,String> parameters, String content, boolean inline)
name
- the macro nameparameters
- the macro parameterscontent
- the macro contentinline
- if true the macro is located in a inline content (like paragraph, etc.)onMacro(String, java.util.Map, String, boolean)
void endMacroMarker(String name, @Default(value="") Map<String,String> parameters, String content, boolean inline)
name
- the macro nameparameters
- the macro parameterscontent
- the macro contentinline
- if true the macro is located in a inline content (like paragraph, etc.)beginMacroMarker(String, java.util.Map, String, boolean)
void beginQuotation(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the quotation. Example: "style"/"background-color: blue"void endQuotation(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters for the quotation. Example: "style"/"background-color: blue"void beginQuotationLine()
void endQuotationLine()
default void beginFigure(Map<String,String> parameters)
parameters
- a generic list of parameters for the figuredefault void endFigure(Map<String,String> parameters)
parameters
- a generic list of parameters for the figuredefault void beginFigureCaption(Map<String,String> parameters)
parameters
- a generic list of parameters for the figuredefault void endFigureCaption(Map<String,String> parameters)
parameters
- a generic list of parameters for the figurevoid onNewLine()
void onMacro(String id, @Default(value="") Map<String,String> parameters, String content, @Name(value="inline") boolean inline)
id
- the macro id (eg "toc" for the TOC macro)parameters
- the macro parameterscontent
- the macro contentinline
- if true the macro is located in a inline content (like paragraph, etc.)void onWord(String word)
word
- the word encounteredvoid onSpace()
void onSpecialSymbol(char symbol)
*
, <
, >
, =
, quote, etc). Any non alpha numeric character is a
special symbol.symbol
- the symbol encounteredvoid onId(String name)
name
- the location name.void onHorizontalLine(@Default(value="") Map<String,String> parameters)
parameters
- a generic list of parameters. Example: style="background-color: blue"void onEmptyLines(@Default(value="1") int count)
count
- the number of empty lines between 2 standalone Blocksvoid onVerbatim(@Name(value="content") String content, boolean inline, @Default(value="") Map<String,String> parameters)
content
- the string to protected from renderinginline
- if true the text content is located in a inline content (like paragraph, etc.)parameters
- a generic list of parameters. Example: style="background-color: blue"void onRawText(@Name(value="content") String content, Syntax syntax)
content
- the text to injectsyntax
- the syntax in which the text is written. This is useful so that listener implementations can decide
whether they can handle direct inject for that syntaxCopyright © 2004–2021 XWiki. All rights reserved.