Skip to main content



      Home
Home » Eclipse Projects » NatTable » Sending Events bottom up, over all layers?
Sending Events bottom up, over all layers? [message #1039993] Fri, 12 April 2013 18:46 Go to next message
Eclipse UserFriend
I would like to pass an Event to all the Layers, on top of my Layer.

Passing infos top-down is possible by doing AbstractLayer.doCommand

Is there an analogue for doing it bottom-up?



Greets
Re: Sending Events bottom up, over all layers? [message #1040225 is a reply to message #1039993] Sat, 13 April 2013 03:43 Go to previous messageGo to next message
Eclipse UserFriend
Commands are passed the layer stack top-down, events bottom-up

http://www.eclipse.org/nattable/documentation.php?page=basics
Re: Sending Events bottom up, over all layers? [message #1040260 is a reply to message #1040225] Sat, 13 April 2013 05:01 Go to previous messageGo to next message
Eclipse UserFriend
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 05:12] by Moderator

Re: Sending Events bottom up, over all layers? [message #1040314 is a reply to message #1040260] Sat, 13 April 2013 06:57 Go to previous message
Eclipse UserFriend
Yes passing events up is done by calling the listeners. The layers need to register as listener to the underlying layer. This is how it is implemented by the NatTable layers. IMHO this should be implemented in the abstract implementations. Possibly by setUnderlyingLayer(). I think there is also a comment saying that you need to ensure this on implementing a custom layer. So if this does not word for you, you should ensure that you implemented your layer correctly
Previous Topic:Selected columns indexes in collapsed groups
Next Topic:Bug PaddingDecorator?
Goto Forum:
  


Current Time: Tue Jul 08 14:15:30 EDT 2025

Powered by FUDForum. Page generated in 0.07456 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top