org.xwiki.rendering.wikimodel.xwiki.xwiki20
Class XWikiSerializer2

java.lang.Object
  extended by org.xwiki.rendering.wikimodel.PrintTextListener
      extended by org.xwiki.rendering.wikimodel.xwiki.xwiki20.XWikiSerializer2
All Implemented Interfaces:
IWemListener, IWemListenerDocument, IWemListenerInline, IWemListenerList, IWemListenerProgramming, IWemListenerSemantic, IWemListenerSimpleBlocks, IWemListenerTable

public class XWikiSerializer2
extends PrintTextListener

Serializing XWiki 2.0 syntax ...

Implementation hints:

Since:
4.0M1
Version:
$Id: a1e22e9a7561b1f293efd12c73340063c6ab0b67 $
See Also:
org.xwiki.rendering.wikimodel.xwiki.xwiki10.XWikiSerializer}

Field Summary
 
Fields inherited from class org.xwiki.rendering.wikimodel.PrintTextListener
fRefHandler
 
Constructor Summary
XWikiSerializer2(IWikiPrinter printer)
           
 
Method Summary
 void beginDefinitionDescription()
          This method is used to notify about a definition description.
 void beginDefinitionTerm()
          A definition term.
 void beginFormat(WikiFormat format)
          This method is called at the beginning of a sequence of in-line elements having the specified formatting parameters.
 void beginHeader(int headerLevel, WikiParameters params)
          This method is called to notify about a new section header found in the document.
 void beginList(WikiParameters params, boolean ordered)
          This method is used to notify about a new list.
 void beginListItem()
          This method is used to notify about the beginning of a new item of a simple list (see IWemListenerList.beginList(WikiParameters, boolean)/ IWemListenerList.endList(WikiParameters, boolean) methods).
 void beginTable(WikiParameters params)
          This method notifies about the beginning of a new table in the document.
 void beginTableCell(boolean tableHead, WikiParameters params)
          This method is used to notify about the beginning of a new table cell.
 void beginTableRow(WikiParameters params)
          This method is used to notify about the beginning of a new table row.
static String clearName(String name)
          Clears the name of files; used while uploading attachments within XWiki RECOMMENDED FOR NAMES OF UPLOADED FILES.
static String clearName(String name, boolean stripDots, boolean ascii)
           
protected  void endBlock()
          This method is called at the end of each block element.
 void endDefinitionDescription()
          This method is used to notify about the end of a definition description.
 void endDefinitionTerm()
          The end of a definition term.
 void endFormat(WikiFormat format)
          This method is called to notify about the end of a sequence of in-line elements having common formatting parameters.
 void endHeader(int headerLevel, WikiParameters params)
          This method is called to notify about the end of a section-level header.
 void endList(WikiParameters params, boolean ordered)
          This method is used to notify about the end of a list.
 void endListItem()
          This method is used to notify about the end of an item of a simple list (see IWemListenerList.beginList(WikiParameters, boolean)/ IWemListenerList.endList(WikiParameters, boolean) methods).
 void endParagraph(WikiParameters params)
          End of a simple paragraph.
 void endTable(WikiParameters params)
          This method notifies about the end of a table in the document.
 void endTableCell(boolean tableHead, WikiParameters params)
          This method is used to notify about the end of a table cell.
 void endTableRow(WikiParameters params)
          This method is used to notify about the end of a table row.
protected  String getEol()
           
protected  String getImageThumbwidth()
           
 Logger getLogger()
           
protected  ReferenceHandler newReferenceHandler()
           
 void onImage(String ref)
          This method is called to notify that an free standing image was found in the parsed wiki document.
 void onImage(WikiReference ref)
          This method is called to notify that a structured reference was found in the text
protected  void onImageThumbnail(WikiReference ref)
          Special case when detected, that there are image thumbnail.
 void onLineBreak()
          This method is called to notify about a forced line break found in the text.
 void onNewLine()
          This method is called to notify that the parsed block contains a new line sequence ("\r\n" or "\r" or "\n" character sequence).
 void onSpecialSymbol(String str)
          This method is called to notify about a sequence of special characters.
 void onTableCaption(String str)
          Notifies the table caption.
 void onVerbatimBlock(String str, WikiParameters params)
          This method notifies about a verbatim (pre-formatted) block defined in the text
 void onVerbatimInline(String str, WikiParameters params)
          This method is called to notify about not-interpreted in-line sequence of characters which should be represented in the final text "as is".
protected  void print(String str)
           
protected  void println()
           
protected  void println(String str)
           
 void setLogger(Logger logger)
           
 
Methods inherited from class org.xwiki.rendering.wikimodel.PrintTextListener
beginDefinitionList, beginDocument, beginInfoBlock, beginParagraph, beginPropertyBlock, beginPropertyInline, beginQuotation, beginQuotationLine, beginSection, beginSectionContent, endDefinitionList, endDocument, endInfoBlock, endPropertyBlock, endPropertyInline, endQuotation, endQuotationLine, endSection, endSectionContent, isSupportDownload, isSupportImage, onEmptyLines, onEscape, onExtensionBlock, onExtensionInline, onHorizontalLine, onMacroBlock, onMacroInline, onReference, onReference, onSpace, onWord
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XWikiSerializer2

public XWikiSerializer2(IWikiPrinter printer)
Method Detail

beginHeader

public void beginHeader(int headerLevel,
                        WikiParameters params)
Description copied from interface: IWemListenerDocument
This method is called to notify about a new section header found in the document.

Specified by:
beginHeader in interface IWemListenerDocument
Overrides:
beginHeader in class PrintTextListener
Parameters:
headerLevel - the level of the found header; valid values: 1-6
params - wiki parameters associated with the
See Also:
IWemListenerDocument.beginHeader(int, WikiParameters)

endHeader

public void endHeader(int headerLevel,
                      WikiParameters params)
Description copied from interface: IWemListenerDocument
This method is called to notify about the end of a section-level header.

Specified by:
endHeader in interface IWemListenerDocument
Overrides:
endHeader in class PrintTextListener
Parameters:
headerLevel - the level of the header
params - wiki parameters of the header
See Also:
IWemListenerDocument.endHeader(int, WikiParameters)

beginList

public void beginList(WikiParameters params,
                      boolean ordered)
Description copied from interface: IWemListenerList
This method is used to notify about a new list. Each list contain at least one list item. All list items are notified using the IWemListenerList.beginListItem()/IWemListenerList.endListItem() method pair. Items of lists of this type can contain the following sequence of elements:
  1. formatted text - the text can be empty; in this case it is not notified
  2. Just after the text the list item can have:
    • an embedded list - in this way it is possible to build hierarchical structures
    • an embedded document - it should be defined explicitly and it can have all valid elements of the top-level document

Specified by:
beginList in interface IWemListenerList
Overrides:
beginList in class PrintTextListener
Parameters:
params - parameters of the list
ordered - if this flag is true then this method corresponds to a new ordered list ("ol"); otherwise this method notifies a beginning of an unordered list ("ul")
See Also:
IWemListenerList.beginList(WikiParameters, boolean)

endList

public void endList(WikiParameters params,
                    boolean ordered)
Description copied from interface: IWemListenerList
This method is used to notify about the end of a list.

Specified by:
endList in interface IWemListenerList
Overrides:
endList in class PrintTextListener
Parameters:
params - parameters of the list
ordered - if this flag is true then this method corresponds to a new ordered list ("ol"); otherwise this method notifies a beginning of an unordered list ("ul")
See Also:
IWemListenerList.endList(WikiParameters, boolean)

beginListItem

public void beginListItem()
Description copied from interface: IWemListenerList
This method is used to notify about the beginning of a new item of a simple list (see IWemListenerList.beginList(WikiParameters, boolean)/ IWemListenerList.endList(WikiParameters, boolean) methods).

Specified by:
beginListItem in interface IWemListenerList
Overrides:
beginListItem in class PrintTextListener
See Also:
IWemListenerList.beginListItem()

endListItem

public void endListItem()
Description copied from interface: IWemListenerList
This method is used to notify about the end of an item of a simple list (see IWemListenerList.beginList(WikiParameters, boolean)/ IWemListenerList.endList(WikiParameters, boolean) methods).

Specified by:
endListItem in interface IWemListenerList
Overrides:
endListItem in class PrintTextListener
See Also:
IWemListenerList.endListItem()

onImage

public void onImage(String ref)
Description copied from interface: IWemListenerInline
This method is called to notify that an free standing image was found in the parsed wiki document.

Specified by:
onImage in interface IWemListenerInline
Overrides:
onImage in class PrintTextListener
Parameters:
ref - the reference the reference

onImage

public void onImage(WikiReference ref)
Description copied from interface: IWemListenerInline
This method is called to notify that a structured reference was found in the text

Specified by:
onImage in interface IWemListenerInline
Overrides:
onImage in class PrintTextListener
Parameters:
ref - the reference the reference

onImageThumbnail

protected void onImageThumbnail(WikiReference ref)
Special case when detected, that there are image thumbnail. Thus it's possible to insert something like XWiki "LightBox" macro. (Default implementation will set "width:200px")


onVerbatimBlock

public void onVerbatimBlock(String str,
                            WikiParameters params)
Description copied from interface: IWemListenerSimpleBlocks
This method notifies about a verbatim (pre-formatted) block defined in the text

Specified by:
onVerbatimBlock in interface IWemListenerSimpleBlocks
Overrides:
onVerbatimBlock in class PrintTextListener
Parameters:
str - the content of the verbatim (pre-formatted) block
params - parameters of the verbatim block
See Also:
IWemListenerSimpleBlocks.onVerbatimBlock(String, WikiParameters)

onVerbatimInline

public void onVerbatimInline(String str,
                             WikiParameters params)
Description copied from interface: IWemListenerInline
This method is called to notify about not-interpreted in-line sequence of characters which should be represented in the final text "as is".

Specified by:
onVerbatimInline in interface IWemListenerInline
Overrides:
onVerbatimInline in class PrintTextListener
Parameters:
str - the sequence of non-interpreted characters
params - TODO
See Also:
IWemListenerInline.onVerbatimInline(java.lang.String, WikiParameters)

onTableCaption

public void onTableCaption(String str)
Description copied from interface: IWemListenerTable
Notifies the table caption.

Specified by:
onTableCaption in interface IWemListenerTable
Overrides:
onTableCaption in class PrintTextListener
Parameters:
str - the content of the table caption
See Also:
IWemListenerTable.onTableCaption(java.lang.String)

beginTable

public void beginTable(WikiParameters params)
Description copied from interface: IWemListenerTable
This method notifies about the beginning of a new table in the document.

Specified by:
beginTable in interface IWemListenerTable
Overrides:
beginTable in class PrintTextListener
Parameters:
params - table parameters
See Also:
IWemListenerTable.beginTable(WikiParameters)

endTable

public void endTable(WikiParameters params)
Description copied from interface: IWemListenerTable
This method notifies about the end of a table in the document.

Specified by:
endTable in interface IWemListenerTable
Overrides:
endTable in class PrintTextListener
Parameters:
params - table parameters
See Also:
IWemListenerTable.endTable(WikiParameters)

beginTableCell

public void beginTableCell(boolean tableHead,
                           WikiParameters params)
Description copied from interface: IWemListenerTable
This method is used to notify about the beginning of a new table cell.

Specified by:
beginTableCell in interface IWemListenerTable
Overrides:
beginTableCell in class PrintTextListener
Parameters:
tableHead - if this flag is true then the reported cell corresponds to the table head ("th" element); otherwise it should be considered as a normal table cell ("td" element).
params - parameters of this cell
See Also:
IWemListenerTable.beginTableCell(boolean, WikiParameters)

endTableCell

public void endTableCell(boolean tableHead,
                         WikiParameters params)
Description copied from interface: IWemListenerTable
This method is used to notify about the end of a table cell.

Specified by:
endTableCell in interface IWemListenerTable
Overrides:
endTableCell in class PrintTextListener
Parameters:
tableHead - if this flag is true then the reported cell corresponds to the table head ("th" element); otherwise it should be considered as a normal table cell ("td" element).
params - parameters of this cell
See Also:
IWemListenerTable.endTableCell(boolean, WikiParameters)

beginTableRow

public void beginTableRow(WikiParameters params)
Description copied from interface: IWemListenerTable
This method is used to notify about the beginning of a new table row.

Specified by:
beginTableRow in interface IWemListenerTable
Overrides:
beginTableRow in class PrintTextListener
Parameters:
params - parameters of the row.
See Also:
IWemListenerTable.beginTableRow(WikiParameters)

endTableRow

public void endTableRow(WikiParameters params)
Description copied from interface: IWemListenerTable
This method is used to notify about the end of a table row.

Specified by:
endTableRow in interface IWemListenerTable
Overrides:
endTableRow in class PrintTextListener
Parameters:
params - parameters of the row.
See Also:
IWemListenerTable.endTableRow(WikiParameters)

beginFormat

public void beginFormat(WikiFormat format)
Description copied from interface: IWemListenerInline
This method is called at the beginning of a sequence of in-line elements having the specified formatting parameters.

Specified by:
beginFormat in interface IWemListenerInline
Overrides:
beginFormat in class PrintTextListener
Parameters:
format - the object defining formatting parameters of in-line elements.
See Also:
IWemListenerInline.beginFormat(WikiFormat)

endFormat

public void endFormat(WikiFormat format)
Description copied from interface: IWemListenerInline
This method is called to notify about the end of a sequence of in-line elements having common formatting parameters.

Specified by:
endFormat in interface IWemListenerInline
Overrides:
endFormat in class PrintTextListener
Parameters:
format - the formatting object defining how contained in-line elements should be formatted
See Also:
IWemListenerInline.endFormat(WikiFormat)

endParagraph

public void endParagraph(WikiParameters params)
Description copied from interface: IWemListenerSimpleBlocks
End of a simple paragraph.

Specified by:
endParagraph in interface IWemListenerSimpleBlocks
Overrides:
endParagraph in class PrintTextListener
Parameters:
params - paragraph parameters
See Also:
IWemListenerSimpleBlocks.endParagraph(WikiParameters)

endBlock

protected void endBlock()
Description copied from class: PrintTextListener
This method is called at the end of each block element. It can be overloaded in subclasses.

Overrides:
endBlock in class PrintTextListener

getEol

protected String getEol()

onLineBreak

public void onLineBreak()
Description copied from interface: IWemListenerInline
This method is called to notify about a forced line break found in the text. Note that the line break symbol can be found in the middle of a "physical" line so this event is not equals to the IWemListenerInline.onNewLine() notification.

Specified by:
onLineBreak in interface IWemListenerInline
Overrides:
onLineBreak in class PrintTextListener
See Also:
IWemListenerInline.onLineBreak()

onNewLine

public void onNewLine()
Description copied from interface: IWemListenerInline
This method is called to notify that the parsed block contains a new line sequence ("\r\n" or "\r" or "\n" character sequence). Note that the new line symbols are not the same as a forced line break sequence notified by the IWemListenerInline.onLineBreak() event.

Specified by:
onNewLine in interface IWemListenerInline
Overrides:
onNewLine in class PrintTextListener
See Also:
IWemListenerInline.onNewLine()

onSpecialSymbol

public void onSpecialSymbol(String str)
Description copied from interface: IWemListenerInline
This method is called to notify about a sequence of special characters. Special symbols are characters which are not interpreted as a part of a word (letters or digits) or as a space. Note that the handling of these symbols requires special attention because these symbols most frequently used to define text formatting. Various wiki syntaxes use combinations of these sequences to define structural elements in wiki documents.
 The full list of possible special symbols:
  "!",     "\"",     "#",     "$",     "%",     "&",     "'",     "(",
  ")",     "*",      "+",     ",",     "-",     ".",     "/",     ":",
  ";",     "<",      "=",     ">",     "?",     "@",     "[",     "\\",
  "]",     "^",      "_",     "`",     "{",     "|",     "}",     "~"
 

Specified by:
onSpecialSymbol in interface IWemListenerInline
Overrides:
onSpecialSymbol in class PrintTextListener
Parameters:
str - the sequence of special symbols
See Also:
IWemListenerInline.onSpecialSymbol(java.lang.String)

beginDefinitionTerm

public void beginDefinitionTerm()
Description copied from interface: IWemListenerList
A definition term. Definition terms can contain only formatted texts. Note that it is impossible to have an embedded list or a document inside of definition terms.

Specified by:
beginDefinitionTerm in interface IWemListenerList
Overrides:
beginDefinitionTerm in class PrintTextListener
See Also:
IWemListenerList.beginDefinitionTerm()

endDefinitionTerm

public void endDefinitionTerm()
Description copied from interface: IWemListenerList
The end of a definition term.

Specified by:
endDefinitionTerm in interface IWemListenerList
Overrides:
endDefinitionTerm in class PrintTextListener
See Also:
IWemListenerList.endDefinitionTerm()

beginDefinitionDescription

public void beginDefinitionDescription()
Description copied from interface: IWemListenerList
This method is used to notify about a definition description. All definition descriptions are contained in definition lists and can contain text, embedded lists or an embedded document.

Specified by:
beginDefinitionDescription in interface IWemListenerList
Overrides:
beginDefinitionDescription in class PrintTextListener
See Also:
IWemListenerList.beginDefinitionDescription()

endDefinitionDescription

public void endDefinitionDescription()
Description copied from interface: IWemListenerList
This method is used to notify about the end of a definition description.

Specified by:
endDefinitionDescription in interface IWemListenerList
Overrides:
endDefinitionDescription in class PrintTextListener
See Also:
IWemListenerList.endDefinitionDescription()

getImageThumbwidth

protected String getImageThumbwidth()
Returns:
The wisth information for a thumbnail image

print

protected void print(String str)
Overrides:
print in class PrintTextListener

println

protected void println()
Overrides:
println in class PrintTextListener

println

protected void println(String str)
Overrides:
println in class PrintTextListener

newReferenceHandler

protected ReferenceHandler newReferenceHandler()
Overrides:
newReferenceHandler in class PrintTextListener

getLogger

public Logger getLogger()
Returns:
the logger

setLogger

public void setLogger(Logger logger)
Parameters:
logger - the logger to set

clearName

public static final String clearName(String name,
                                     boolean stripDots,
                                     boolean ascii)
See Also:
#clearName(String)}

clearName

public static final String clearName(String name)
Clears the name of files; used while uploading attachments within XWiki RECOMMENDED FOR NAMES OF UPLOADED FILES. (boolean stripDots = false; boolean ascii = true;)

See Also:
com.xpn.xwiki.XWiki#clearName(String, boolean, boolean, com.xpn.xwiki.XWikiContext)}


Copyright © 2004-2012 XWiki. All Rights Reserved.