|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.rendering.listener.chaining.ListenerChain
public class ListenerChain
Stores information about the listeners in the chain and the order in which they need to be called. Also sports a feature that allows pushing and popping listeners that are stackable. This feature is useful since listeners can hold stateful information and sometimes you may need to push new versions of them to start with new state information. For example this is used in the XWiki Syntax Renderer when group event is found to start the rendering for that group using reset state information.
| Constructor Summary | |
|---|---|
ListenerChain()
|
|
| Method Summary | |
|---|---|
void |
addListener(ChainingListener listener)
|
ChainingListener |
getListener(Class<? extends ChainingListener> listenerClass)
|
ChainingListener |
getNextListener(Class<? extends ChainingListener> listenerClass)
|
int |
indexOf(Class<? extends ChainingListener> listenerClass)
|
void |
popAllStackableListeners()
Remove all pushed stackable listeners to go back to the previous state (see pushAllStackableListeners(). |
void |
popListener(Class<? extends ChainingListener> listenerClass)
Remove the last instance corresponding to the passed listener class if it's stackable, in order to go back to the previous state. |
void |
pushAllStackableListeners()
Create new instances of all chaining listeners that are stackable (ie that implement the StackableChainingListener interface. |
void |
pushListener(Class<? extends ChainingListener> listenerClass)
Create a new instance of the passed chaining listener if it's stackable (ie it implements the StackableChainingListener interface. |
void |
removeListener(Class<? extends ChainingListener> listenerClass)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ListenerChain()
| Method Detail |
|---|
public void addListener(ChainingListener listener)
listener - the chaining listener to add to the chain. If an instance of that listener is already present
then we stack the new instance instead.public void removeListener(Class<? extends ChainingListener> listenerClass)
listenerClass - the listener to remove from the chainpublic ChainingListener getNextListener(Class<? extends ChainingListener> listenerClass)
listenerClass - the listener for which we need to find the next listener in the chain
public ChainingListener getListener(Class<? extends ChainingListener> listenerClass)
listenerClass - the listener class for which we want to find the listener instance
public int indexOf(Class<? extends ChainingListener> listenerClass)
listenerClass - the listener class for which to find the position in the chain
public void pushListener(Class<? extends ChainingListener> listenerClass)
StackableChainingListener interface. This allows creating a
clean state when some sub rendering has to be done with some new state.
listenerClass - the listener class for which to create a new instance (if stackable)public void pushAllStackableListeners()
StackableChainingListener interface. This allows creating a
clean state when some sub rendering has to be done with some new state.
public void popAllStackableListeners()
pushAllStackableListeners().
public void popListener(Class<? extends ChainingListener> listenerClass)
listenerClass - the class of the chaining listener to pop
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||