org.xwiki.rendering.listener.chaining
Class TextOnNewLineStateChainingListener

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

public class TextOnNewLineStateChainingListener
extends AbstractChainingListener
implements StackableChainingListener

Indicate if the text being written starts a new line. By text we mean Space, Special Symbol and Words. This is useful for some Renderers which need to have this information. For example the XWiki Syntax renderer uses it to decide whether to escape "*" characters starting new lines since otherwise they would be confused for list items.

Since:
1.8RC1
Version:
$Id$

Field Summary
 
Fields inherited from interface org.xwiki.rendering.listener.Listener
EMPTY_PARAMETERS
 
Constructor Summary
TextOnNewLineStateChainingListener(ListenerChain listenerChain)
           
 
Method Summary
 void beginDefinitionDescription()
          Start of a definition list description.
 void beginDefinitionList(java.util.Map<java.lang.String,java.lang.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, java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a text formatting block.
 void beginGroup(java.util.Map<java.lang.String,java.lang.String> parameters)
          Start a group of elements.
 void beginHeader(HeaderLevel level, java.lang.String id, java.util.Map<java.lang.String,java.lang.String> parameters)
          Start of a header.
 void beginLink(ResourceReference reference, boolean isFreeStandingURI, java.util.Map<java.lang.String,java.lang.String> parameters)
          Start of a link.
 void beginList(ListType listType, java.util.Map<java.lang.String,java.lang.String> parameters)
          Start of a list.
 void beginListItem()
          Start of a list item.
 void beginMacroMarker(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> parameters, java.lang.String content, boolean isInline)
          Start of marker containing a macro definition.
 void beginParagraph(java.util.Map<java.lang.String,java.lang.String> parameters)
          Start of a paragraph.
 void beginQuotation(java.util.Map<java.lang.String,java.lang.String> parameters)
          Start of a quotation.
 void beginQuotationLine()
          Start of a quotation line.
 void beginTable(java.util.Map<java.lang.String,java.lang.String> parameters)
          Start of a table.
 void beginTableCell(java.util.Map<java.lang.String,java.lang.String> parameters)
          Start of a table cell.
 void beginTableHeadCell(java.util.Map<java.lang.String,java.lang.String> parameters)
          Start of a table head cell.
 void beginTableRow(java.util.Map<java.lang.String,java.lang.String> parameters)
          Start of a table row.
 StackableChainingListener createChainingListenerInstance()
          
 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 endParagraph(java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a paragraph.
 void endTable(java.util.Map<java.lang.String,java.lang.String> parameters)
          End of a table.
 boolean isTextOnNewLine()
           
 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.
 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.
 void onVerbatim(java.lang.String protectedString, boolean isInline, java.util.Map<java.lang.String,java.lang.String> parameters)
          A portion of text.
 
Methods inherited from class org.xwiki.rendering.listener.chaining.AbstractChainingListener
beginMetaData, beginSection, endDefinitionDescription, endDefinitionList, endDefinitionTerm, endDocument, endFormat, endGroup, endList, endListItem, endMacroMarker, endMetaData, endQuotation, endQuotationLine, endSection, endTableCell, endTableHeadCell, endTableRow, getListenerChain, onEmptyLines, onSpace, onSpecialSymbol, onWord, 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
beginMetaData, beginSection, endDefinitionDescription, endDefinitionList, endDefinitionTerm, endDocument, endFormat, endGroup, endList, endListItem, endMacroMarker, endMetaData, endQuotation, endQuotationLine, endSection, endTableCell, endTableHeadCell, endTableRow, onEmptyLines, onSpace, onSpecialSymbol, onWord
 

Constructor Detail

TextOnNewLineStateChainingListener

public TextOnNewLineStateChainingListener(ListenerChain listenerChain)
Method Detail

createChainingListenerInstance

public StackableChainingListener createChainingListenerInstance()

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

isTextOnNewLine

public boolean isTextOnNewLine()

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

beginDefinitionList

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

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

beginDocument

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

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

beginGroup

public void beginGroup(java.util.Map<java.lang.String,java.lang.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
Overrides:
beginGroup in class AbstractChainingListener
Parameters:
parameters - a generic list of parameters. Example: style="background-color: blue"
See Also:
AbstractChainingListener.beginGroup(Map)

beginFormat

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

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

beginLink

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

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

beginList

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

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

beginListItem

public void beginListItem()
Start of a list item.

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

beginMacroMarker

public void beginMacroMarker(java.lang.String name,
                             java.util.Map<java.lang.String,java.lang.String> parameters,
                             java.lang.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
Overrides:
beginMacroMarker 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.beginMacroMarker(java.lang.String, java.util.Map, java.lang.String, boolean)

beginParagraph

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

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

beginQuotation

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

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

beginHeader

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

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

beginTable

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

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

beginTableCell

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

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

beginTableHeadCell

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

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

beginTableRow

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

Specified by:
beginTableRow in interface Listener
Overrides:
beginTableRow in class AbstractChainingListener
Parameters:
parameters - a generic list of parameters for the table row.
See Also:
AbstractChainingListener.beginTableRow(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, org.xwiki.rendering.syntax.Syntax)

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)

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)

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)

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()

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(java.lang.String, java.util.Map, java.lang.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)


Copyright © 2004-2011 XWiki. All Rights Reserved.