org.xwiki.rendering.listener
Class CompositeListener

java.lang.Object
  extended by org.xwiki.rendering.listener.CompositeListener
All Implemented Interfaces:
ImageListener, LinkListener, Listener

public class CompositeListener
extends Object
implements Listener

Send events to a list of Listeners.

Since:
2.1M1
Version:
$Id: 36ee6c12063a299938d80cd134506af846f1f3cd $

Field Summary
 
Fields inherited from interface org.xwiki.rendering.listener.Listener
EMPTY_PARAMETERS
 
Constructor Summary
CompositeListener()
           
 
Method Summary
 void addListener(Listener listener)
          Add a nex listener to the list.
 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.
 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 beginLink(ResourceReference reference, boolean isFreeStandingURI, Map<String,String> parameters)
          Start of a link.
 void beginList(ListType listType, Map<String,String> parameters)
          Start of a list.
 void beginListItem()
          Start of a list item.
 void beginMacroMarker(String name, Map<String,String> macroParameters, String content, boolean isInline)
          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.
 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 endLink(ResourceReference reference, boolean isFreeStandingURI, Map<String,String> parameters)
          End of a link.
 void endList(ListType listType, Map<String,String> parameters)
          End of a list.
 void endListItem()
          End of a list item.
 void endMacroMarker(String name, Map<String,String> macroParameters, String content, boolean isInline)
          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.
 Listener getListener(int i)
          Get listener at the provided position in the list.
 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 onImage(ResourceReference reference, boolean isFreeStandingURI, Map<String,String> parameters)
          An image.
 void onMacro(String id, Map<String,String> macroParameters, String content, boolean isInline)
          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 text, 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 protectedString, boolean isInline, Map<String,String> parameters)
          A portion of text.
 void onWord(String word)
          A word.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeListener

public CompositeListener()
Method Detail

addListener

public void addListener(Listener listener)
Add a nex listener to the list.

Parameters:
listener - a listener

getListener

public Listener getListener(int i)
Get listener at the provided position in the list.

Parameters:
i - the index of the listener in the list
Returns:
the listener

beginDefinitionDescription

public void beginDefinitionDescription()
Start of a definition list description. For example in HTML this is the equivalent of <dd>.

Specified by:
beginDefinitionDescription in interface Listener
See Also:
Listener.beginDefinitionDescription()

beginDefinitionList

public void beginDefinitionList(Map<String,String> parameters)
Start of a definition list. For example in HTML this is the equivalent of <dl>.

Specified by:
beginDefinitionList in interface Listener
Parameters:
parameters - a generic list of parameters for the list. Example: "style"/"background-color: blue"
See Also:
Listener.beginDefinitionList(java.util.Map)

beginDefinitionTerm

public void beginDefinitionTerm()
Start of a definition list term. For example in HTML this is the equivalent of <dt>.

Specified by:
beginDefinitionTerm in interface Listener
See Also:
Listener.beginDefinitionTerm()

beginDocument

public void beginDocument(MetaData metaData)
Start of the document.

Specified by:
beginDocument in interface Listener
Parameters:
metaData - the meta data to associate to the following events, see MetaData
Since:
3.0M2
See Also:
Listener.beginDocument(MetaData)

beginFormat

public void beginFormat(Format format,
                        Map<String,String> parameters)
End of a text formatting block.

Specified by:
beginFormat in interface Listener
Parameters:
format - the formatting type (bold, italic, etc)
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
Listener.beginFormat(org.xwiki.rendering.listener.Format, java.util.Map)

beginGroup

public void beginGroup(Map<String,String> parameters)
Start a group of elements. Groups are used to allow using standalone elements in list items, table cells, etc. They can also be used to set parameters on a group of standalone elements.

Specified by:
beginGroup in interface Listener
Parameters:
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
Listener.beginGroup(java.util.Map)

beginHeader

public void beginHeader(HeaderLevel level,
                        String id,
                        Map<String,String> parameters)
Start of a header.

Specified by:
beginHeader in interface Listener
Parameters:
level - the header level (1, 2, 3, etc)
id - the header unique identifier
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
Listener.beginHeader(org.xwiki.rendering.listener.HeaderLevel, java.lang.String, java.util.Map)

beginList

public void beginList(ListType listType,
                      Map<String,String> parameters)
Start of a list.

Specified by:
beginList in interface Listener
Parameters:
listType - the type of list (bulleted, numbered, etc)
parameters - a generic list of parameters for the list. Example: "style"/"background-color: blue"
See Also:
Listener.beginList(org.xwiki.rendering.listener.ListType, java.util.Map)

beginListItem

public void beginListItem()
Start of a list item.

Specified by:
beginListItem in interface Listener
See Also:
Listener.beginListItem()

beginMacroMarker

public void beginMacroMarker(String name,
                             Map<String,String> macroParameters,
                             String content,
                             boolean isInline)
Start of marker containing a macro definition. This is a special that Macro Blocks emits when they are executed so that it's possible to reconstruct the initial macro syntax even after Macros have been executed. This is used for exemple by the WYSIWYG editor to let use see the result of executing a macro and still let them modify the macro definition.

Specified by:
beginMacroMarker in interface Listener
Parameters:
name - the macro name
macroParameters - the macro parameters
content - the macro content
isInline - if true the macro is located in a inline content (like paragraph, etc.)
See Also:
Listener.beginMacroMarker(java.lang.String, java.util.Map, java.lang.String, boolean)

beginParagraph

public void beginParagraph(Map<String,String> parameters)
Start of a paragraph.

Specified by:
beginParagraph in interface Listener
Parameters:
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
Listener.beginParagraph(java.util.Map)

beginQuotation

public void beginQuotation(Map<String,String> parameters)
Start of a quotation. There are one or several quotation lines inside a quotation block.

Specified by:
beginQuotation in interface Listener
Parameters:
parameters - a generic list of parameters for the quotation. Example: "style"/"background-color: blue"
See Also:
Listener.beginQuotation(java.util.Map)

beginQuotationLine

public void beginQuotationLine()
Start of a quotation line. There can be several quotation lines in a quotation block.

Specified by:
beginQuotationLine in interface Listener
See Also:
Listener.beginQuotationLine()

beginSection

public void beginSection(Map<String,String> parameters)
Start of a section.

Specified by:
beginSection in interface Listener
Parameters:
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
Listener.beginSection(java.util.Map)

beginTable

public void beginTable(Map<String,String> parameters)
Start of a table.

Specified by:
beginTable in interface Listener
Parameters:
parameters - a generic list of parameters for the table.
See Also:
Listener.beginTable(java.util.Map)

beginTableCell

public void beginTableCell(Map<String,String> parameters)
Start of a table cell.

Specified by:
beginTableCell in interface Listener
Parameters:
parameters - a generic list of parameters for the table cell.
See Also:
Listener.beginTableCell(java.util.Map)

beginTableHeadCell

public void beginTableHeadCell(Map<String,String> parameters)
Start of a table head cell.

Specified by:
beginTableHeadCell in interface Listener
Parameters:
parameters - a generic list of parameters for the table head cell.
See Also:
Listener.beginTableHeadCell(java.util.Map)

beginTableRow

public void beginTableRow(Map<String,String> parameters)
Start of a table row.

Specified by:
beginTableRow in interface Listener
Parameters:
parameters - a generic list of parameters for the table row.
See Also:
Listener.beginTableRow(java.util.Map)

endDefinitionDescription

public void endDefinitionDescription()
End of a definition list description. For example in HTML this is the equivalent of </dd>.

Specified by:
endDefinitionDescription in interface Listener
See Also:
Listener.endDefinitionDescription()

endDefinitionList

public void endDefinitionList(Map<String,String> parameters)
End of a definition list. For example in HTML this is the equivalent of </dl>.

Specified by:
endDefinitionList in interface Listener
Parameters:
parameters - a generic list of parameters for the list. Example: "style"/"background-color: blue"
See Also:
Listener.endDefinitionList(java.util.Map)

endDefinitionTerm

public void endDefinitionTerm()
End of a definition list term. For example in HTML this is the equivalent of </dt>.

Specified by:
endDefinitionTerm in interface Listener
See Also:
Listener.endDefinitionTerm()

endDocument

public void endDocument(MetaData metaData)
End of the document.

Specified by:
endDocument in interface Listener
Parameters:
metaData - the meta data associated with the previous events, see MetaData
Since:
3.0M2
See Also:
Listener.endDocument(MetaData)

endFormat

public void endFormat(Format format,
                      Map<String,String> parameters)
End of a text formatting block.

Specified by:
endFormat in interface Listener
Parameters:
format - the formatting type (bold, italic, etc)
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
Listener.endFormat(org.xwiki.rendering.listener.Format, java.util.Map)

endGroup

public void endGroup(Map<String,String> parameters)
End of the group.

Specified by:
endGroup in interface Listener
Parameters:
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
Listener.endGroup(java.util.Map)

endHeader

public void endHeader(HeaderLevel level,
                      String id,
                      Map<String,String> parameters)
End of a header.

Specified by:
endHeader in interface Listener
Parameters:
level - the header level (1, 2, 3, etc)
id - the header unique identifier
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
Listener.endHeader(org.xwiki.rendering.listener.HeaderLevel, java.lang.String, java.util.Map)

endList

public void endList(ListType listType,
                    Map<String,String> parameters)
End of a list.

Specified by:
endList in interface Listener
Parameters:
listType - the type of list (bulleted, numbered, etc)
parameters - a generic list of parameters for the list. Example: "style"/"background-color: blue"
See Also:
Listener.endList(org.xwiki.rendering.listener.ListType, java.util.Map)

endListItem

public void endListItem()
End of a list item.

Specified by:
endListItem in interface Listener
See Also:
Listener.endListItem()

endMacroMarker

public void endMacroMarker(String name,
                           Map<String,String> macroParameters,
                           String content,
                           boolean isInline)
End of marker containing a macro definition.

Specified by:
endMacroMarker in interface Listener
Parameters:
name - the macro name
macroParameters - the macro parameters
content - the macro content
isInline - if true the macro is located in a inline content (like paragraph, etc.)
See Also:
Listener.endMacroMarker(java.lang.String, java.util.Map, java.lang.String, boolean)

endParagraph

public void endParagraph(Map<String,String> parameters)
End of a paragraph.

Specified by:
endParagraph in interface Listener
Parameters:
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
Listener.endParagraph(java.util.Map)

endQuotation

public void endQuotation(Map<String,String> parameters)
End of a quotation.

Specified by:
endQuotation in interface Listener
Parameters:
parameters - a generic list of parameters for the quotation. Example: "style"/"background-color: blue"
See Also:
Listener.endQuotation(java.util.Map)

endQuotationLine

public void endQuotationLine()
End of a quotation line.

Specified by:
endQuotationLine in interface Listener
See Also:
Listener.endQuotationLine()

endSection

public void endSection(Map<String,String> parameters)
End of a section.

Specified by:
endSection in interface Listener
Parameters:
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
Listener.endSection(java.util.Map)

endTable

public void endTable(Map<String,String> parameters)
End of a table.

Specified by:
endTable in interface Listener
Parameters:
parameters - a generic list of parameters for the table.
See Also:
Listener.endTable(java.util.Map)

endTableCell

public void endTableCell(Map<String,String> parameters)
End of a table cell.

Specified by:
endTableCell in interface Listener
Parameters:
parameters - a generic list of parameters for the table cell.
See Also:
Listener.endTableCell(java.util.Map)

endTableHeadCell

public void endTableHeadCell(Map<String,String> parameters)
End of a table head cell.

Specified by:
endTableHeadCell in interface Listener
Parameters:
parameters - a generic list of parameters for the table head cell.
See Also:
Listener.endTableHeadCell(java.util.Map)

endTableRow

public void endTableRow(Map<String,String> parameters)
End of a table row.

Specified by:
endTableRow in interface Listener
Parameters:
parameters - a generic list of parameters for the table row.
See Also:
Listener.endTableRow(java.util.Map)

onEmptyLines

public void onEmptyLines(int count)
Represents an empty line between 2 standalone Blocks. A standalone block is block that is not included in another block. Standalone blocks are Paragraph, Standalone Macro, Lists, Table, etc.

Specified by:
onEmptyLines in interface Listener
Parameters:
count - the number of empty lines between 2 standalone Blocks
See Also:
Listener.onEmptyLines(int)

onHorizontalLine

public void onHorizontalLine(Map<String,String> parameters)
Represents an horizontal line.

Specified by:
onHorizontalLine in interface Listener
Parameters:
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
Listener.onHorizontalLine(java.util.Map)

onId

public void onId(String name)
A reference/location in a page. In HTML for example this is called an Anchor. It allows pointing to that location, for example in links. Note that there is no wiki syntax for this in general and it's often generated by Macros (such as the TOC Macro).

Specified by:
onId in interface Listener
Parameters:
name - the location name.
See Also:
Listener.onId(java.lang.String)

onMacro

public void onMacro(String id,
                    Map<String,String> macroParameters,
                    String content,
                    boolean isInline)
A Macro.

Specified by:
onMacro in interface Listener
Parameters:
id - the macro id (eg "toc" for the TOC macro)
macroParameters - the macro parameters
content - the macro content
isInline - if true the macro is located in a inline content (like paragraph, etc.)
See Also:
Listener.onMacro(java.lang.String, java.util.Map, java.lang.String, boolean)

onNewLine

public 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).

Specified by:
onNewLine in interface Listener
See Also:
Listener.onNewLine()

onRawText

public void onRawText(String text,
                      Syntax syntax)
Some text to inject directly into the listener output without parsing it. For example a HTML macro could inject directly some HTML entered by the user into the rendered HTML output. Note that it's not recommended to use this event in most cases since it can lead to invalid content being generated and in addition most listener implementations will not understand the injected text and will just ignore it.

Specified by:
onRawText in interface Listener
Parameters:
text - the text to inject
syntax - 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 syntax
See Also:
Listener.onRawText(java.lang.String, org.xwiki.rendering.syntax.Syntax)

onSpace

public void onSpace()
A space.

Specified by:
onSpace in interface Listener
See Also:
Listener.onSpace()

onSpecialSymbol

public void onSpecialSymbol(char symbol)
A special symbol ("*", "<", ">", "=", quote, etc). Any non alpha numeric character is a special symbol.

Specified by:
onSpecialSymbol in interface Listener
Parameters:
symbol - the symbol encountered
See Also:
Listener.onSpecialSymbol(char)

onVerbatim

public void onVerbatim(String protectedString,
                       boolean isInline,
                       Map<String,String> parameters)
A portion of text.

Specified by:
onVerbatim in interface Listener
Parameters:
protectedString - the string to protected from rendering
isInline - 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"
See Also:
Listener.onVerbatim(java.lang.String, boolean, java.util.Map)

onWord

public void onWord(String word)
A word. Note that sentences ar broken into different events: word events, special symbols events, space events, etc. This allows fine-grained actions for listeners.

Specified by:
onWord in interface Listener
Parameters:
word - the word encountered
See Also:
Listener.onWord(java.lang.String)

beginLink

public void beginLink(ResourceReference reference,
                      boolean isFreeStandingURI,
                      Map<String,String> parameters)
Start of a link.

Specified by:
beginLink in interface LinkListener
Parameters:
reference - the link reference
isFreeStandingURI - if true then the link is a free standing URI directly in the text
parameters - a generic list of parameters. Example: style="background-color: blue"
Since:
2.5RC1
See Also:
LinkListener.beginLink(org.xwiki.rendering.listener.reference.ResourceReference , boolean, java.util.Map)

endLink

public void endLink(ResourceReference reference,
                    boolean isFreeStandingURI,
                    Map<String,String> parameters)
End of a link.

Specified by:
endLink in interface LinkListener
Parameters:
reference - the link reference
isFreeStandingURI - if true then the link is a free standing URI directly in the text
parameters - a generic list of parameters. Example: style="background-color: blue"
Since:
2.5RC1
See Also:
LinkListener.endLink(ResourceReference , boolean, java.util.Map)

onImage

public void onImage(ResourceReference reference,
                    boolean isFreeStandingURI,
                    Map<String,String> parameters)
An image.

Specified by:
onImage in interface ImageListener
Parameters:
reference - the image reference
isFreeStandingURI - if true then the image is defined directly as a URI in the text
parameters - a generic list of parameters. Example: style="background-color: blue"
Since:
2.5RC1
See Also:
ImageListener.onImage(ResourceReference, boolean, java.util.Map)

beginMetaData

public void beginMetaData(MetaData metadata)
Start of MetaData (eg saving source from where the content is coming from).

Specified by:
beginMetaData in interface Listener
Parameters:
metadata - the metadata
Since:
3.0M2
See Also:
Listener.beginMetaData(MetaData)

endMetaData

public void endMetaData(MetaData metadata)
End of MetaData.

Specified by:
endMetaData in interface Listener
Parameters:
metadata - the metadata
Since:
3.0M2
See Also:
Listener.endMetaData(MetaData)


Copyright © 2004-2011 XWiki. All Rights Reserved.