[GEF5] Click policies chain [message #1760757] |
Tue, 02 May 2017 16:33  |
Maxim Martynov Messages: 22 Registered: February 2017 |
Junior Member |
|
|
I have Pane with another Pane children. I want to add OnClickHandler which will add another componentns as childrens on TOP Pane. When i click on TOP pane which has parent Pane several OnClick events invoked by ClickDragGesture. How i can skip all events on parent Pane and handle only last event in chain to add children only to TOP Panel?
[Updated on: Tue, 02 May 2017 16:34] Report message to a moderator
|
|
|
Re: [GEF5] Click policies chain [message #1760789 is a reply to message #1760757] |
Wed, 03 May 2017 03:31   |
|
What you mean is that the ClickDragGesture invokes multiple IOnClickHandlers (for all panes in the hierarchy), right? What you have to do in this case is to bind a different IHandlerResolver, which adjusts the default behavior by only forwarding it to a single pane (instead of all in the chain).
|
|
|
Re: [GEF5] Click policies chain [message #1760817 is a reply to message #1760789] |
Wed, 03 May 2017 09:46  |
|
Alternatively, you can simply use the AbstractHandler#isRegistered(EventTarget) and #isRegisteredForHost(EventTarget) methods to guard the IOnClickHandler implementations from running when the received event is not designated for their host. For a usage example, you can take a look at the FocusAndSelectOnClickPolicy:
// check if the host is the explicit event target
if (isRegistered(e.getTarget())
&& !isRegisteredForHost(e.getTarget())) {
// do not process events for other parts
return;
}
Best regards,
Matthias
[Updated on: Wed, 03 May 2017 09:49] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02193 seconds