public class ListenerChain extends Object
Constructor and Description |
---|
ListenerChain() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(ChainingListener listener) |
void |
addListener(ChainingListener listener,
int index) |
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) |
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 chain. If more than one instance of that listener exist
in the chain then remove the one from the top of the stackpublic void addListener(ChainingListener listener, int index)
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.index
- the position in the chain where to insert the listenerpublic ChainingListener getNextListener(Class<? extends ChainingListener> listenerClass)
listenerClass
- the listener for which we need to find the next listener in the chainpublic ChainingListener getListener(Class<? extends ChainingListener> listenerClass)
listenerClass
- the listener class for which we want to find the listener instancepublic int indexOf(Class<? extends ChainingListener> listenerClass)
listenerClass
- the listener class for which to find the position in the chainpublic 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 popCopyright © 2004–2021 XWiki. All rights reserved.