Class AbstractChainingListener

java.lang.Object
org.xwiki.rendering.listener.chaining.AbstractChainingListener
All Implemented Interfaces:
ChainingListener, ImageListener, LinkListener, Listener
Direct Known Subclasses:
AbstractChainingPrintRenderer, BlockStateChainingListener, ConsecutiveNewLineStateChainingListener, EmptyBlockChainingListener, GroupStateChainingListener, LookaheadChainingListener, MetaDataStateChainingListener

public abstract class AbstractChainingListener extends Object implements ChainingListener
Default and basic implementation of a chaining listener that knows how to delegate event calls to the next listener in the chain.
Since:
1.8RC1
Version:
$Id: 9f550477655079ca29014a39050f5a5a2fd372e1 $
  • Constructor Details

    • AbstractChainingListener

      public AbstractChainingListener()
      The default constructor.

      Initialize listItemRetroCompatibility field.

  • Method Details

    • setListenerChain

      public void setListenerChain(ListenerChain listenerChain)
      Parameters:
      listenerChain - see getListenerChain()
      Since:
      2.0M3
    • getListenerChain

      public ListenerChain getListenerChain()
      Specified by:
      getListenerChain in interface ChainingListener
      Returns:
      the chain this listener is part of
    • beginDefinitionDescription

      public void beginDefinitionDescription()
      Description copied from interface: Listener
      Start of a definition list description. For example in HTML this is the equivalent of <dd>.
      Specified by:
      beginDefinitionDescription in interface Listener
    • beginDefinitionList

      public void beginDefinitionList(Map<String,String> parameters)
      Description copied from interface: Listener
      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"
    • beginDefinitionTerm

      public void beginDefinitionTerm()
      Description copied from interface: Listener
      Start of a definition list term. For example in HTML this is the equivalent of <dt>.
      Specified by:
      beginDefinitionTerm in interface Listener
    • beginDocument

      public void beginDocument(MetaData metadata)
      Description copied from interface: Listener
      Start of the document.
      Specified by:
      beginDocument in interface Listener
      Parameters:
      metadata - the meta data to associate to the following events, see MetaData
    • beginGroup

      public void beginGroup(Map<String,String> parameters)
      Description copied from interface: Listener
      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"
    • beginFormat

      public void beginFormat(Format format, Map<String,String> parameters)
      Description copied from interface: Listener
      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:
    • beginHeader

      public void beginHeader(HeaderLevel level, String id, Map<String,String> parameters)
      Description copied from interface: Listener
      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:
    • beginLink

      public void beginLink(ResourceReference reference, boolean freestanding, Map<String,String> parameters)
      Description copied from interface: LinkListener
      Start of a link.
      Specified by:
      beginLink in interface LinkListener
      Parameters:
      reference - the link reference
      freestanding - 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"
      See Also:
    • beginList

      public void beginList(ListType type, Map<String,String> parameters)
      Description copied from interface: Listener
      Start of a list.
      Specified by:
      beginList in interface Listener
      Parameters:
      type - the type of list (bulleted, numbered, etc)
      parameters - a generic list of parameters for the list. Example: "style"/"background-color: blue"
      See Also:
    • beginListItem

      public void beginListItem()
      Description copied from interface: Listener
      Start of a list item.
      Specified by:
      beginListItem in interface Listener
    • beginListItem

      public void beginListItem(Map<String,String> parameters)
      Description copied from interface: Listener
      Start of a list item.
      Specified by:
      beginListItem in interface Listener
      Parameters:
      parameters - a generic list of parameters for the list item. Example: "style"/"background-color: blue"
    • beginMacroMarker

      public void beginMacroMarker(String name, Map<String,String> parameters, String content, boolean isInline)
      Description copied from interface: Listener
      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
      parameters - the macro parameters
      content - the macro content
      isInline - if true the macro is located in a inline content (like paragraph, etc.)
      See Also:
    • beginParagraph

      public void beginParagraph(Map<String,String> parameters)
      Description copied from interface: Listener
      Start of a paragraph.
      Specified by:
      beginParagraph in interface Listener
      Parameters:
      parameters - a generic list of parameters. Example: style="background-color: blue"
    • beginQuotation

      public void beginQuotation(Map<String,String> parameters)
      Description copied from interface: Listener
      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"
    • beginQuotationLine

      public void beginQuotationLine()
      Description copied from interface: Listener
      Start of a quotation line. There can be several quotation lines in a quotation block.
      Specified by:
      beginQuotationLine in interface Listener
    • beginSection

      public void beginSection(Map<String,String> parameters)
      Description copied from interface: Listener
      Start of a section.
      Specified by:
      beginSection in interface Listener
      Parameters:
      parameters - a generic list of parameters. Example: style="background-color: blue"
      See Also:
    • beginTable

      public void beginTable(Map<String,String> parameters)
      Description copied from interface: Listener
      Start of a table.
      Specified by:
      beginTable in interface Listener
      Parameters:
      parameters - a generic list of parameters for the table.
    • beginTableCell

      public void beginTableCell(Map<String,String> parameters)
      Description copied from interface: Listener
      Start of a table cell.
      Specified by:
      beginTableCell in interface Listener
      Parameters:
      parameters - a generic list of parameters for the table cell.
    • beginTableHeadCell

      public void beginTableHeadCell(Map<String,String> parameters)
      Description copied from interface: Listener
      Start of a table head cell.
      Specified by:
      beginTableHeadCell in interface Listener
      Parameters:
      parameters - a generic list of parameters for the table head cell.
    • beginTableRow

      public void beginTableRow(Map<String,String> parameters)
      Description copied from interface: Listener
      Start of a table row.
      Specified by:
      beginTableRow in interface Listener
      Parameters:
      parameters - a generic list of parameters for the table row.
    • beginMetaData

      public void beginMetaData(MetaData metadata)
      Description copied from interface: Listener
      Start of MetaData (eg saving source from where the content is coming from).
      Specified by:
      beginMetaData in interface Listener
      Parameters:
      metadata - the metadata
    • beginFigure

      public void beginFigure(Map<String,String> parameters)
      Description copied from interface: Listener
      Start of a figure.
      Specified by:
      beginFigure in interface Listener
      Parameters:
      parameters - a generic list of parameters for the figure
    • beginFigureCaption

      public void beginFigureCaption(Map<String,String> parameters)
      Description copied from interface: Listener
      Start of a figure caption.
      Specified by:
      beginFigureCaption in interface Listener
      Parameters:
      parameters - a generic list of parameters for the figure
    • endDefinitionDescription

      public void endDefinitionDescription()
      Description copied from interface: Listener
      End of a definition list description. For example in HTML this is the equivalent of </dd>.
      Specified by:
      endDefinitionDescription in interface Listener
    • endDefinitionList

      public void endDefinitionList(Map<String,String> parameters)
      Description copied from interface: Listener
      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"
    • endDefinitionTerm

      public void endDefinitionTerm()
      Description copied from interface: Listener
      End of a definition list term. For example in HTML this is the equivalent of </dt>.
      Specified by:
      endDefinitionTerm in interface Listener
    • endDocument

      public void endDocument(MetaData metadata)
      Description copied from interface: Listener
      End of the document.
      Specified by:
      endDocument in interface Listener
      Parameters:
      metadata - the meta data associated with the previous events, see MetaData
    • endGroup

      public void endGroup(Map<String,String> parameters)
      Description copied from interface: Listener
      End of the group.
      Specified by:
      endGroup in interface Listener
      Parameters:
      parameters - a generic list of parameters. Example: style="background-color: blue"
    • endFormat

      public void endFormat(Format format, Map<String,String> parameters)
      Description copied from interface: Listener
      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:
    • endHeader

      public void endHeader(HeaderLevel level, String id, Map<String,String> parameters)
      Description copied from interface: Listener
      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:
    • endLink

      public void endLink(ResourceReference reference, boolean freestanding, Map<String,String> parameters)
      Description copied from interface: LinkListener
      End of a link.
      Specified by:
      endLink in interface LinkListener
      Parameters:
      reference - the link reference
      freestanding - 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"
      See Also:
    • endList

      public void endList(ListType type, Map<String,String> parameters)
      Description copied from interface: Listener
      End of a list.
      Specified by:
      endList in interface Listener
      Parameters:
      type - the type of list (bulleted, numbered, etc)
      parameters - a generic list of parameters for the list. Example: "style"/"background-color: blue"
      See Also:
    • endListItem

      public void endListItem()
      Description copied from interface: Listener
      End of a list item.
      Specified by:
      endListItem in interface Listener
    • endListItem

      public void endListItem(Map<String,String> parameters)
      Description copied from interface: Listener
      End of a list item.
      Specified by:
      endListItem in interface Listener
      Parameters:
      parameters - a generic list of parameters for the list item. Example: "style"/"background-color: blue"
    • endMacroMarker

      public void endMacroMarker(String name, Map<String,String> parameters, String content, boolean isInline)
      Description copied from interface: Listener
      End of marker containing a macro definition.
      Specified by:
      endMacroMarker in interface Listener
      Parameters:
      name - the macro name
      parameters - the macro parameters
      content - the macro content
      isInline - if true the macro is located in a inline content (like paragraph, etc.)
      See Also:
    • endParagraph

      public void endParagraph(Map<String,String> parameters)
      Description copied from interface: Listener
      End of a paragraph.
      Specified by:
      endParagraph in interface Listener
      Parameters:
      parameters - a generic list of parameters. Example: style="background-color: blue"
    • endQuotation

      public void endQuotation(Map<String,String> parameters)
      Description copied from interface: Listener
      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"
    • endQuotationLine

      public void endQuotationLine()
      Description copied from interface: Listener
      End of a quotation line.
      Specified by:
      endQuotationLine in interface Listener
    • endSection

      public void endSection(Map<String,String> parameters)
      Description copied from interface: Listener
      End of a section.
      Specified by:
      endSection in interface Listener
      Parameters:
      parameters - a generic list of parameters. Example: style="background-color: blue"
      See Also:
    • endTable

      public void endTable(Map<String,String> parameters)
      Description copied from interface: Listener
      End of a table.
      Specified by:
      endTable in interface Listener
      Parameters:
      parameters - a generic list of parameters for the table.
    • endTableCell

      public void endTableCell(Map<String,String> parameters)
      Description copied from interface: Listener
      End of a table cell.
      Specified by:
      endTableCell in interface Listener
      Parameters:
      parameters - a generic list of parameters for the table cell.
    • endTableHeadCell

      public void endTableHeadCell(Map<String,String> parameters)
      Description copied from interface: Listener
      End of a table head cell.
      Specified by:
      endTableHeadCell in interface Listener
      Parameters:
      parameters - a generic list of parameters for the table head cell.
    • endTableRow

      public void endTableRow(Map<String,String> parameters)
      Description copied from interface: Listener
      End of a table row.
      Specified by:
      endTableRow in interface Listener
      Parameters:
      parameters - a generic list of parameters for the table row.
    • endMetaData

      public void endMetaData(MetaData metadata)
      Description copied from interface: Listener
      End of MetaData.
      Specified by:
      endMetaData in interface Listener
      Parameters:
      metadata - the metadata
    • endFigure

      public void endFigure(Map<String,String> parameters)
      Description copied from interface: Listener
      End of a figure.
      Specified by:
      endFigure in interface Listener
      Parameters:
      parameters - a generic list of parameters for the figure
    • endFigureCaption

      public void endFigureCaption(Map<String,String> parameters)
      Description copied from interface: Listener
      End of a figure caption.
      Specified by:
      endFigureCaption in interface Listener
      Parameters:
      parameters - a generic list of parameters for the figure
    • onEmptyLines

      public void onEmptyLines(int count)
      Description copied from interface: Listener
      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
    • onHorizontalLine

      public void onHorizontalLine(Map<String,String> parameters)
      Description copied from interface: Listener
      Represents an horizontal line.
      Specified by:
      onHorizontalLine in interface Listener
      Parameters:
      parameters - a generic list of parameters. Example: style="background-color: blue"
    • onId

      public void onId(String name)
      Description copied from interface: Listener
      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.
    • onImage

      public void onImage(ResourceReference reference, boolean freestanding, Map<String,String> parameters)
      Description copied from interface: ImageListener
      An image.
      Specified by:
      onImage in interface ImageListener
      Parameters:
      reference - the image reference
      freestanding - 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"
    • onImage

      public void onImage(ResourceReference reference, boolean freestanding, String id, Map<String,String> parameters)
      Description copied from interface: ImageListener
      An image.
      Specified by:
      onImage in interface ImageListener
      Parameters:
      reference - the image reference
      freestanding - if true then the image is defined directly as a URI in the text
      id - the (generated) id of the image
      parameters - a generic list of parameters. Example: style="background-color: blue"
    • onMacro

      public void onMacro(String id, Map<String,String> parameters, String content, boolean inline)
      Description copied from interface: Listener
      A Macro.
      Specified by:
      onMacro in interface Listener
      Parameters:
      id - the macro id (eg "toc" for the TOC macro)
      parameters - the macro parameters
      content - the macro content
      inline - if true the macro is located in a inline content (like paragraph, etc.)
    • onNewLine

      public void onNewLine()
      Description copied from interface: Listener
      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
    • onSpace

      public void onSpace()
      Description copied from interface: Listener
      A space.
      Specified by:
      onSpace in interface Listener
    • onSpecialSymbol

      public void onSpecialSymbol(char symbol)
      Description copied from interface: Listener
      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
    • onVerbatim

      public void onVerbatim(String content, boolean inline, Map<String,String> parameters)
      Description copied from interface: Listener
      A portion of text.
      Specified by:
      onVerbatim in interface Listener
      Parameters:
      content - the string to protected from rendering
      inline - 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"
    • onWord

      public void onWord(String word)
      Description copied from interface: Listener
      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
    • onRawText

      public void onRawText(String text, Syntax syntax)
      Description copied from interface: Listener
      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