org.xwiki.rendering.listener.chaining
Class ConsecutiveNewLineStateChainingListener

java.lang.Object
  extended by org.xwiki.rendering.listener.chaining.AbstractChainingListener
      extended by org.xwiki.rendering.listener.chaining.ConsecutiveNewLineStateChainingListener
All Implemented Interfaces:
ChainingListener, StackableChainingListener, ImageListener, LinkListener, Listener

public class ConsecutiveNewLineStateChainingListener
extends AbstractChainingListener
implements StackableChainingListener

Counts consecutive new lines.

Since:
1.8RC1
Version:
$Id; $

Field Summary
 
Fields inherited from interface org.xwiki.rendering.listener.Listener
EMPTY_PARAMETERS
 
Constructor Summary
ConsecutiveNewLineStateChainingListener(ListenerChain listenerChain)
           
 
Method Summary
 StackableChainingListener createChainingListenerInstance()
          
 void endDefinitionDescription()
          End of a definition list description. For example in HTML this is the equivalent of </dd>.
 void endDefinitionList(java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a definition list. For example in HTML this is the equivalent of </dl>.
 void endDefinitionTerm()
          End of a definition list term. For example in HTML this is the equivalent of </dt>.
 void endDocument(MetaData metaData)
          End of the document.
 void endFormat(Format format, java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a text formatting block.
 void endGroup(java.util.Map<java.lang.String,java.lang.String> parameters)
          End of the group.
 void endHeader(HeaderLevel level, java.lang.String id, java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a header.
 void endLink(ResourceReference reference, boolean isFreeStandingURI, java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a link.
 void endList(ListType listType, java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a list.
 void endListItem()
          End of a list item.
 void endMacroMarker(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> parameters, java.lang.String content, boolean isInline)
          End of marker containing a macro definition.
 void endParagraph(java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a paragraph.
 void endQuotation(java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a quotation.
 void endQuotationLine()
          End of a quotation line.
 void endTable(java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a table.
 void endTableCell(java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a table cell.
 void endTableHeadCell(java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a table head cell.
 void endTableRow(java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a table row.
 int getNewLineCount()
           
 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.
 void onHorizontalLine(java.util.Map<java.lang.String,java.lang.String> parameters)
          Represents an horizontal line.
 void onId(java.lang.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).
 void onImage(ResourceReference reference, boolean isFreeStandingURI, java.util.Map<java.lang.String,java.lang.String> parameters)
          An image.
 void onMacro(java.lang.String id, java.util.Map<java.lang.String,java.lang.String> parameters, java.lang.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(java.lang.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.
 void onSpace()
          A space.
 void onSpecialSymbol(char symbol)
          A special symbol ("*", "<", ">", "=", quote, etc). Any non alpha numeric character is a special symbol.
 void onVerbatim(java.lang.String protectedString, boolean isInline, java.util.Map<java.lang.String,java.lang.String> parameters)
          A portion of text.
 void onWord(java.lang.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.
 
Methods inherited from class org.xwiki.rendering.listener.chaining.AbstractChainingListener
beginDefinitionDescription, beginDefinitionList, beginDefinitionTerm, beginDocument, beginFormat, beginGroup, beginHeader, beginLink, beginList, beginListItem, beginMacroMarker, beginMetaData, beginParagraph, beginQuotation, beginQuotationLine, beginSection, beginTable, beginTableCell, beginTableHeadCell, beginTableRow, endMetaData, endSection, getListenerChain, setListenerChain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xwiki.rendering.listener.chaining.ChainingListener
getListenerChain
 
Methods inherited from interface org.xwiki.rendering.listener.Listener
beginDefinitionDescription, beginDefinitionList, beginDefinitionTerm, beginDocument, beginFormat, beginGroup, beginHeader, beginList, beginListItem, beginMacroMarker, beginMetaData, beginParagraph, beginQuotation, beginQuotationLine, beginSection, beginTable, beginTableCell, beginTableHeadCell, beginTableRow, endMetaData, endSection
 
Methods inherited from interface org.xwiki.rendering.listener.LinkListener
beginLink
 

Constructor Detail

ConsecutiveNewLineStateChainingListener

public ConsecutiveNewLineStateChainingListener(ListenerChain listenerChain)
Parameters:
listenerChain - see AbstractChainingListener.getListenerChain()
Method Detail

createChainingListenerInstance

public StackableChainingListener createChainingListenerInstance()

Specified by:
createChainingListenerInstance in interface StackableChainingListener
Returns:
the new instance of the listener
See Also:
StackableChainingListener.createChainingListenerInstance()

getNewLineCount

public int getNewLineCount()
Returns:
the number of found new lines.

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
Overrides:
endDefinitionDescription in class AbstractChainingListener
See Also:
AbstractChainingListener.endDefinitionDescription()

endDefinitionList

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

Specified by:
endDefinitionList in interface Listener
Overrides:
endDefinitionList in class AbstractChainingListener
Parameters:
parameters - a generic list of parameters for the list. Example: "style"/"background-color: blue"
Since:
2.0RC1
See Also:
AbstractChainingListener.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
Overrides:
endDefinitionTerm in class AbstractChainingListener
See Also:
AbstractChainingListener.endDefinitionTerm()

endDocument

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

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

endGroup

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

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

endFormat

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

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

endLink

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

Specified by:
endLink in interface LinkListener
Overrides:
endLink in class AbstractChainingListener
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:
AbstractChainingListener.endLink( org.xwiki.rendering.listener.reference.ResourceReference , boolean, java.util.Map)

endList

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

Specified by:
endList in interface Listener
Overrides:
endList in class AbstractChainingListener
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:
AbstractChainingListener.endList(org.xwiki.rendering.listener.ListType, java.util.Map)

endListItem

public void endListItem()
End of a list item.

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

endMacroMarker

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

Specified by:
endMacroMarker in interface Listener
Overrides:
endMacroMarker in class AbstractChainingListener
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:
AbstractChainingListener.endMacroMarker(java.lang.String, java.util.Map, java.lang.String, boolean)

endParagraph

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

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

endQuotation

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

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

endQuotationLine

public void endQuotationLine()
End of a quotation line.

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

endHeader

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

Specified by:
endHeader in interface Listener
Overrides:
endHeader in class AbstractChainingListener
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:
AbstractChainingListener.endHeader(org.xwiki.rendering.listener.HeaderLevel, java.lang.String, java.util.Map)

endTable

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

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

endTableCell

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

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

endTableHeadCell

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

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

endTableRow

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

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

onRawText

public void onRawText(java.lang.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
Overrides:
onRawText in class AbstractChainingListener
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:
AbstractChainingListener.onRawText(String, Syntax)

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
Overrides:
onEmptyLines in class AbstractChainingListener
Parameters:
count - the number of empty lines between 2 standalone Blocks
See Also:
AbstractChainingListener.onEmptyLines(int)

onHorizontalLine

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

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

onId

public void onId(java.lang.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
Overrides:
onId in class AbstractChainingListener
Parameters:
name - the location name.
See Also:
AbstractChainingListener.onId(java.lang.String)

onImage

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

Specified by:
onImage in interface ImageListener
Overrides:
onImage in class AbstractChainingListener
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:
AbstractChainingListener.onImage( org.xwiki.rendering.listener.reference.ResourceReference , boolean, java.util.Map)

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
Overrides:
onNewLine in class AbstractChainingListener
See Also:
AbstractChainingListener.onNewLine()

onSpace

public void onSpace()
A space.

Specified by:
onSpace in interface Listener
Overrides:
onSpace in class AbstractChainingListener
See Also:
AbstractChainingListener.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
Overrides:
onSpecialSymbol in class AbstractChainingListener
Parameters:
symbol - the symbol encountered
See Also:
AbstractChainingListener.onSpecialSymbol(char)

onMacro

public void onMacro(java.lang.String id,
                    java.util.Map<java.lang.String,java.lang.String> parameters,
                    java.lang.String content,
                    boolean isInline)
A Macro.

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

onVerbatim

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

Specified by:
onVerbatim in interface Listener
Overrides:
onVerbatim in class AbstractChainingListener
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:
AbstractChainingListener.onVerbatim(String, boolean, Map)

onWord

public void onWord(java.lang.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
Overrides:
onWord in class AbstractChainingListener
Parameters:
word - the word encountered
See Also:
AbstractChainingListener.onWord(java.lang.String)


Copyright © 2004-2011 XWiki. All Rights Reserved.