Class BlockStateChainingListener
java.lang.Object
org.xwiki.rendering.listener.chaining.AbstractChainingListener
org.xwiki.rendering.listener.chaining.BlockStateChainingListener
- All Implemented Interfaces:
ChainingListener,StackableChainingListener,ImageListener,LinkListener,Listener
public class BlockStateChainingListener
extends AbstractChainingListener
implements StackableChainingListener
Indicates block element for which we are inside and previous blocks.
- Since:
- 1.8RC1
- Version:
- $Id: 8b1d41d20cc33a3cf73c0348fbd009b5ba46e8c5 $
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.xwiki.rendering.listener.Listener
EMPTY_PARAMETERS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidStart of a definition list description.voidbeginDefinitionList(Map<String, String> parameters) Start of a definition list.voidStart of a definition list term.voidbeginDocument(MetaData metadata) Start of the document.voidbeginFigure(Map<String, String> parameters) Start of a figure.voidbeginFigureCaption(Map<String, String> parameters) Start of a figure caption.voidbeginFormat(Format format, Map<String, String> parameters) End of a text formatting block.voidbeginGroup(Map<String, String> parameters) Start a group of elements.voidbeginHeader(HeaderLevel level, String id, Map<String, String> parameters) Start of a header.voidbeginLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters) Start of a link.voidStart of a list.voidStart of a list item.voidbeginListItem(Map<String, String> parameters) Start of a list item.voidStart of marker containing a macro definition.voidbeginMetaData(MetaData metadata) Start of MetaData (eg saving source from where the content is coming from).voidbeginParagraph(Map<String, String> parameters) Start of a paragraph.voidbeginQuotation(Map<String, String> parameters) Start of a quotation.voidStart of a quotation line.voidbeginSection(Map<String, String> parameters) Start of a section.voidbeginTable(Map<String, String> parameters) Start of a table.voidbeginTableCell(Map<String, String> parameters) Start of a table cell.voidbeginTableHeadCell(Map<String, String> parameters) Start of a table head cell.voidbeginTableRow(Map<String, String> parameters) Start of a table row.voidEnd of a definition list description.voidendDefinitionList(Map<String, String> parameters) End of a definition list.voidEnd of a definition list term.voidendDocument(MetaData metadata) End of the document.voidEnd of a figure.voidendFigureCaption(Map<String, String> parameters) End of a figure caption.voidEnd of a text formatting block.voidEnd of the group.voidEnd of a header.voidendLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters) End of a link.voidEnd of a list.voidEnd of a list item.voidendListItem(Map<String, String> parameters) End of a list item.voidEnd of marker containing a macro definition.voidendMetaData(MetaData metadata) End of MetaData.voidendParagraph(Map<String, String> parameters) End of a paragraph.voidendQuotation(Map<String, String> parameters) End of a quotation.voidEnd of a quotation line.voidendSection(Map<String, String> parameters) End of a section.voidEnd of a table.voidendTableCell(Map<String, String> parameters) End of a table cell.voidendTableHeadCell(Map<String, String> parameters) End of a table head cell.voidendTableRow(Map<String, String> parameters) End of a table row.intintintintintintintintintintintintbooleanbooleanbooleanisInLine()booleanisInLink()booleanisInList()booleanbooleanbooleanbooleanbooleanbooleanvoidonEmptyLines(int count) Represents an empty line between 2 standalone Blocks.voidonHorizontalLine(Map<String, String> parameters) Represents an horizontal line.voidA reference/location in a page.voidonImage(ResourceReference reference, boolean freestanding, String id, Map<String, String> parameters) An image.voidonImage(ResourceReference reference, boolean freestanding, Map<String, String> parameters) An image.voidA Macro.voidA 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).voidSome text to inject directly into the listener output without parsing it.voidonSpace()A space.voidonSpecialSymbol(char symbol) A special symbol (*,<,>,=, quote, etc).voidonVerbatim(String content, boolean inline, Map<String, String> parameters) A portion of text.voidA word.voidvoidMethods inherited from class org.xwiki.rendering.listener.chaining.AbstractChainingListener
getListenerChain, setListenerChainMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xwiki.rendering.listener.chaining.ChainingListener
getListenerChain
-
Constructor Details
-
BlockStateChainingListener
-
-
Method Details
-
createChainingListenerInstance
- Specified by:
createChainingListenerInstancein interfaceStackableChainingListener- Returns:
- the new instance of the listener
-
getPreviousEvent
-
getInlineDepth
public int getInlineDepth() -
isInLine
public boolean isInLine() -
isInParagraph
public boolean isInParagraph() -
isInHeader
public boolean isInHeader() -
isInTable
public boolean isInTable() -
isInTableCell
public boolean isInTableCell() -
getCellCol
public int getCellCol() -
getCellRow
public int getCellRow() -
getDefinitionListDepth
public int getDefinitionListDepth() -
isInDefinitionList
public boolean isInDefinitionList() -
getDefinitionListItemIndex
public int getDefinitionListItemIndex() -
getListDepth
public int getListDepth() -
isInList
public boolean isInList() -
getListItemIndex
public int getListItemIndex() -
pushLinkDepth
public void pushLinkDepth() -
popLinkDepth
public void popLinkDepth() -
getLinkDepth
public int getLinkDepth() -
isInLink
public boolean isInLink() -
getQuotationDepth
public int getQuotationDepth() -
isInQuotation
public boolean isInQuotation() -
getQuotationLineDepth
public int getQuotationLineDepth() -
isInQuotationLine
public boolean isInQuotationLine() -
getQuotationLineIndex
public int getQuotationLineIndex() -
getMacroDepth
public int getMacroDepth() -
isInMacro
public boolean isInMacro() -
getParentEvent
- Returns:
- The event that encloses the current event.
- Since:
- 14.0RC1
-
beginDocument
Start of the document.- Specified by:
beginDocumentin interfaceListener- Overrides:
beginDocumentin classAbstractChainingListener- Parameters:
metadata- the meta data to associate to the following events, seeMetaData- Since:
- 14.0RC1
-
beginDefinitionDescription
public void beginDefinitionDescription()Description copied from interface:ListenerStart of a definition list description. For example in HTML this is the equivalent of <dd>.- Specified by:
beginDefinitionDescriptionin interfaceListener- Overrides:
beginDefinitionDescriptionin classAbstractChainingListener
-
beginDefinitionList
Start of a definition list. For example in HTML this is the equivalent of <dl>.- Specified by:
beginDefinitionListin interfaceListener- Overrides:
beginDefinitionListin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the list. Example: "style"/"background-color: blue"- Since:
- 2.0RC1
-
beginDefinitionTerm
public void beginDefinitionTerm()Description copied from interface:ListenerStart of a definition list term. For example in HTML this is the equivalent of <dt>.- Specified by:
beginDefinitionTermin interfaceListener- Overrides:
beginDefinitionTermin classAbstractChainingListener
-
beginLink
public void beginLink(ResourceReference reference, boolean freestanding, Map<String, String> parameters) Start of a link.- Specified by:
beginLinkin interfaceLinkListener- Overrides:
beginLinkin classAbstractChainingListener- Parameters:
reference- the link referencefreestanding- if true then the link is a free standing URI directly in the textparameters- a generic list of parameters. Example: style="background-color: blue"- Since:
- 2.5RC1
- See Also:
-
beginList
Description copied from interface:ListenerStart of a list.- Specified by:
beginListin interfaceListener- Overrides:
beginListin classAbstractChainingListener- 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:ListenerStart of a list item.- Specified by:
beginListItemin interfaceListener- Overrides:
beginListItemin classAbstractChainingListener
-
beginListItem
Description copied from interface:ListenerStart of a list item.- Specified by:
beginListItemin interfaceListener- Overrides:
beginListItemin classAbstractChainingListener- 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:ListenerStart 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:
beginMacroMarkerin interfaceListener- Overrides:
beginMacroMarkerin classAbstractChainingListener- Parameters:
name- the macro nameparameters- the macro parameterscontent- the macro contentisInline- if true the macro is located in a inline content (like paragraph, etc.)- See Also:
-
beginMetaData
Start of MetaData (eg saving source from where the content is coming from).- Specified by:
beginMetaDatain interfaceListener- Overrides:
beginMetaDatain classAbstractChainingListener- Parameters:
metadata- the metadata- Since:
- 14.0RC1
-
beginGroup
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:
beginGroupin interfaceListener- Overrides:
beginGroupin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters. Example: style="background-color: blue"- Since:
- 14.0RC1
-
beginParagraph
Description copied from interface:ListenerStart of a paragraph.- Specified by:
beginParagraphin interfaceListener- Overrides:
beginParagraphin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters. Example: style="background-color: blue"
-
beginQuotation
Description copied from interface:ListenerStart of a quotation. There are one or several quotation lines inside a quotation block.- Specified by:
beginQuotationin interfaceListener- Overrides:
beginQuotationin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the quotation. Example: "style"/"background-color: blue"
-
beginQuotationLine
public void beginQuotationLine()Description copied from interface:ListenerStart of a quotation line. There can be several quotation lines in a quotation block.- Specified by:
beginQuotationLinein interfaceListener- Overrides:
beginQuotationLinein classAbstractChainingListener
-
beginHeader
Description copied from interface:ListenerStart of a header.- Specified by:
beginHeaderin interfaceListener- Overrides:
beginHeaderin classAbstractChainingListener- Parameters:
level- the header level (1, 2, 3, etc)id- the header unique identifierparameters- a generic list of parameters. Example: style="background-color: blue"- See Also:
-
beginTable
Description copied from interface:ListenerStart of a table.- Specified by:
beginTablein interfaceListener- Overrides:
beginTablein classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the table.
-
beginTableRow
Description copied from interface:ListenerStart of a table row.- Specified by:
beginTableRowin interfaceListener- Overrides:
beginTableRowin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the table row.
-
beginTableCell
Description copied from interface:ListenerStart of a table cell.- Specified by:
beginTableCellin interfaceListener- Overrides:
beginTableCellin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the table cell.
-
beginTableHeadCell
Description copied from interface:ListenerStart of a table head cell.- Specified by:
beginTableHeadCellin interfaceListener- Overrides:
beginTableHeadCellin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the table head cell.
-
endDefinitionDescription
public void endDefinitionDescription()Description copied from interface:ListenerEnd of a definition list description. For example in HTML this is the equivalent of </dd>.- Specified by:
endDefinitionDescriptionin interfaceListener- Overrides:
endDefinitionDescriptionin classAbstractChainingListener
-
endDefinitionList
End of a definition list. For example in HTML this is the equivalent of </dl>.- Specified by:
endDefinitionListin interfaceListener- Overrides:
endDefinitionListin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the list. Example: "style"/"background-color: blue"- Since:
- 2.0RC1
-
endDefinitionTerm
public void endDefinitionTerm()Description copied from interface:ListenerEnd of a definition list term. For example in HTML this is the equivalent of </dt>.- Specified by:
endDefinitionTermin interfaceListener- Overrides:
endDefinitionTermin classAbstractChainingListener
-
endDocument
End of the document.- Specified by:
endDocumentin interfaceListener- Overrides:
endDocumentin classAbstractChainingListener- Parameters:
metadata- the meta data associated with the previous events, seeMetaData- Since:
- 3.0M2
-
beginFormat
End of a text formatting block.- Specified by:
beginFormatin interfaceListener- Overrides:
beginFormatin classAbstractChainingListener- Parameters:
format- the formatting type (bold, italic, etc)parameters- a generic list of parameters. Example: style="background-color: blue"- Since:
- 14.0RC1
- See Also:
-
endFormat
Description copied from interface:ListenerEnd of a text formatting block.- Specified by:
endFormatin interfaceListener- Overrides:
endFormatin classAbstractChainingListener- Parameters:
format- the formatting type (bold, italic, etc)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) End of a link.- Specified by:
endLinkin interfaceLinkListener- Overrides:
endLinkin classAbstractChainingListener- Parameters:
reference- the link referencefreestanding- if true then the link is a free standing URI directly in the textparameters- a generic list of parameters. Example: style="background-color: blue"- Since:
- 2.5RC1
- See Also:
-
endList
Description copied from interface:ListenerEnd of a list.- Specified by:
endListin interfaceListener- Overrides:
endListin classAbstractChainingListener- 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:ListenerEnd of a list item.- Specified by:
endListItemin interfaceListener- Overrides:
endListItemin classAbstractChainingListener
-
endListItem
Description copied from interface:ListenerEnd of a list item.- Specified by:
endListItemin interfaceListener- Overrides:
endListItemin classAbstractChainingListener- 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:ListenerEnd of marker containing a macro definition.- Specified by:
endMacroMarkerin interfaceListener- Overrides:
endMacroMarkerin classAbstractChainingListener- Parameters:
name- the macro nameparameters- the macro parameterscontent- the macro contentisInline- if true the macro is located in a inline content (like paragraph, etc.)- See Also:
-
endMetaData
End of MetaData.- Specified by:
endMetaDatain interfaceListener- Overrides:
endMetaDatain classAbstractChainingListener- Parameters:
metadata- the metadata- Since:
- 14.0RC1
-
endGroup
End of the group.- Specified by:
endGroupin interfaceListener- Overrides:
endGroupin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters. Example: style="background-color: blue"- Since:
- 14.0RC1
-
endParagraph
Description copied from interface:ListenerEnd of a paragraph.- Specified by:
endParagraphin interfaceListener- Overrides:
endParagraphin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters. Example: style="background-color: blue"
-
endQuotation
Description copied from interface:ListenerEnd of a quotation.- Specified by:
endQuotationin interfaceListener- Overrides:
endQuotationin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the quotation. Example: "style"/"background-color: blue"
-
endQuotationLine
public void endQuotationLine()Description copied from interface:ListenerEnd of a quotation line.- Specified by:
endQuotationLinein interfaceListener- Overrides:
endQuotationLinein classAbstractChainingListener
-
beginSection
Start of a section.- Specified by:
beginSectionin interfaceListener- Overrides:
beginSectionin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters. Example: style="background-color: blue"- Since:
- 14.0RC1
- See Also:
-
endSection
Description copied from interface:ListenerEnd of a section.- Specified by:
endSectionin interfaceListener- Overrides:
endSectionin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters. Example: style="background-color: blue"- See Also:
-
endHeader
Description copied from interface:ListenerEnd of a header.- Specified by:
endHeaderin interfaceListener- Overrides:
endHeaderin classAbstractChainingListener- Parameters:
level- the header level (1, 2, 3, etc)id- the header unique identifierparameters- a generic list of parameters. Example: style="background-color: blue"- See Also:
-
endTable
Description copied from interface:ListenerEnd of a table.- Specified by:
endTablein interfaceListener- Overrides:
endTablein classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the table.
-
endTableCell
Description copied from interface:ListenerEnd of a table cell.- Specified by:
endTableCellin interfaceListener- Overrides:
endTableCellin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the table cell.
-
endTableHeadCell
Description copied from interface:ListenerEnd of a table head cell.- Specified by:
endTableHeadCellin interfaceListener- Overrides:
endTableHeadCellin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the table head cell.
-
endTableRow
Description copied from interface:ListenerEnd of a table row.- Specified by:
endTableRowin interfaceListener- Overrides:
endTableRowin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the table row.
-
beginFigure
Start of a figure.- Specified by:
beginFigurein interfaceListener- Overrides:
beginFigurein classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the figure- Since:
- 14.0RC1
-
endFigure
Description copied from interface:ListenerEnd of a figure.- Specified by:
endFigurein interfaceListener- Overrides:
endFigurein classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the figure
-
beginFigureCaption
Description copied from interface:ListenerStart of a figure caption.- Specified by:
beginFigureCaptionin interfaceListener- Overrides:
beginFigureCaptionin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the figure
-
endFigureCaption
Description copied from interface:ListenerEnd of a figure caption.- Specified by:
endFigureCaptionin interfaceListener- Overrides:
endFigureCaptionin classAbstractChainingListener- Parameters:
parameters- a generic list of parameters for the figure
-
onRawText
Description copied from interface:ListenerSome 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:
onRawTextin interfaceListener- Overrides:
onRawTextin classAbstractChainingListener- Parameters:
text- the text to injectsyntax- 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
-
onEmptyLines
public void onEmptyLines(int count) Description copied from interface:ListenerRepresents 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:
onEmptyLinesin interfaceListener- Overrides:
onEmptyLinesin classAbstractChainingListener- Parameters:
count- the number of empty lines between 2 standalone Blocks
-
onHorizontalLine
Description copied from interface:ListenerRepresents an horizontal line.- Specified by:
onHorizontalLinein interfaceListener- Overrides:
onHorizontalLinein classAbstractChainingListener- Parameters:
parameters- a generic list of parameters. Example: style="background-color: blue"
-
onId
Description copied from interface:ListenerA 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:
onIdin interfaceListener- Overrides:
onIdin classAbstractChainingListener- Parameters:
name- the location name.
-
onImage
public void onImage(ResourceReference reference, boolean freestanding, Map<String, String> parameters) An image.- Specified by:
onImagein interfaceImageListener- Overrides:
onImagein classAbstractChainingListener- Parameters:
reference- the image referencefreestanding- if true then the image is defined directly as a URI in the textparameters- a generic list of parameters. Example: style="background-color: blue"- Since:
- 2.5RC1
-
onImage
public void onImage(ResourceReference reference, boolean freestanding, String id, Map<String, String> parameters) Description copied from interface:ImageListenerAn image.- Specified by:
onImagein interfaceImageListener- Overrides:
onImagein classAbstractChainingListener- Parameters:
reference- the image referencefreestanding- if true then the image is defined directly as a URI in the textid- the (generated) id of the imageparameters- a generic list of parameters. Example: style="background-color: blue"
-
onNewLine
public void onNewLine()Description copied from interface:ListenerA 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:
onNewLinein interfaceListener- Overrides:
onNewLinein classAbstractChainingListener
-
onSpace
public void onSpace()Description copied from interface:ListenerA space.- Specified by:
onSpacein interfaceListener- Overrides:
onSpacein classAbstractChainingListener
-
onSpecialSymbol
public void onSpecialSymbol(char symbol) Description copied from interface:ListenerA special symbol (*,<,>,=, quote, etc). Any non alpha numeric character is a special symbol.- Specified by:
onSpecialSymbolin interfaceListener- Overrides:
onSpecialSymbolin classAbstractChainingListener- Parameters:
symbol- the symbol encountered
-
onVerbatim
Description copied from interface:ListenerA portion of text.- Specified by:
onVerbatimin interfaceListener- Overrides:
onVerbatimin classAbstractChainingListener- Parameters:
content- the string to protected from renderinginline- 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
Description copied from interface:ListenerA 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:
onWordin interfaceListener- Overrides:
onWordin classAbstractChainingListener- Parameters:
word- the word encountered
-
onMacro
Description copied from interface:ListenerA Macro.- Specified by:
onMacroin interfaceListener- Overrides:
onMacroin classAbstractChainingListener- Parameters:
id- the macro id (eg "toc" for the TOC macro)parameters- the macro parameterscontent- the macro contentinline- if true the macro is located in a inline content (like paragraph, etc.)
-