|
|
Re: Sending Events bottom up, over all layers? [message #1040260 is a reply to message #1040225] |
Sat, 13 April 2013 09:01 |
Alex Kipling Messages: 260 Registered: July 2012 |
Senior Member |
|
|
Yeah, it is written in the Docu that the events are passed bottom-up,
but as far as I can see the method AbstractLayer.fireLayerEvent(event) just triggers the listeners - it does not pass events to the layer one level higher.
And I would like to pass an Event bottom-up to ALL LAYERS above my actual layer.
First I thought, that there is a listener, which will pass the event up, but when I tried out on my AbstractLayer implementation - there were no listeners at all.
What do I miss? Is it a wrong method for sending events?
/**
* Pass the event to all the {@link ILayerListener} registered on this layer.
* A cloned copy is passed to each listener.
*/
public void fireLayerEvent(ILayerEvent event) {
if (listeners.size() > 0) {
Iterator<ILayerListener> it = listeners.iterator();
boolean isLastListener = false;
do {
ILayerListener l = it.next();
isLastListener = !it.hasNext(); // Lookahead
// Fire cloned event to first n-1 listeners; fire original event to last listener
ILayerEvent eventToFire = isLastListener ? event : event.cloneEvent();
l.handleLayerEvent(eventToFire);
} while (!isLastListener);
}
}
[Updated on: Sat, 13 April 2013 09:12] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.05777 seconds