Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [GEF4] About events consumption and policy ordering
[GEF4] About events consumption and policy ordering [message #1705943] Thu, 20 August 2015 10:15 Go to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 951
Registered: February 2011
Senior Member
Hi,


I'm trying to implement several different actions on the same mouse action (Left click). The general idea is that, when I'm manipulating the Palette, the SelectionOnClick policy should not handle the click events.

So I have a PaletteModel that stores an active PaletteTool. If there is an active PaletteTool, then SelectionOnClick does nothing.

However, depending on the order in which the ClickPolicies are invoked, I can get one of the following sequences:

On click:
- PaletteOnClick: create something, consume the event, clear the palette model
- SelectionOnClick: PaletteModel is empty, select

On click:
- SelectionOnClick: PaletteModel is not empty, do nothing
- PaletteOnClick: create something, consume the event, clear the palette model

The second sequence is OK, but the first one is not.

First question: Is there a way to specify the order of the policies, or should we have a single ClickPolicy, which then delegates to a different mechanism for handling the ordering? (e.g. a single ClickPolicy, that will delegate to either SelectionTool or PaletteCreationTool, rather than a SelectionPolicy and a PaletteToolPolicy)

Second question: It seems that "consuming" an event is not really an option. GEF4 iterates on all policies even if the (JavaFX) event has been consumed. Additionally, if I check for e.isConsumed() in the SelectionOnClick policy, I get other side effects, because for example the Drag policy always consumes the "press" event (So the SelectionOnClick policy is always disabled in this case). Are there some recommandations to either properly use events consumption, or to avoid using this mechanism outside tools?


Thanks,
Camille


Camille Letavernier

[Updated on: Thu, 20 August 2015 10:15]

Report message to a moderator

Re: [GEF4] About events consumption and policy ordering [message #1705949 is a reply to message #1705943] Thu, 20 August 2015 11:26 Go to previous messageGo to next message
Alexander Nyssen is currently offline Alexander NyssenFriend
Messages: 244
Registered: July 2009
Location: Lünen
Senior Member
Camille Letavernier wrote on Thu, 20 August 2015 12:15

First question: Is there a way to specify the order of the policies, or should we have a single ClickPolicy, which then delegates to a different mechanism for handling the ordering? (e.g. a single ClickPolicy, that will delegate to either SelectionTool or PaletteCreationTool, rather than a SelectionPolicy and a PaletteToolPolicy)

The order in which policies are processed is not defined, so yes, this would be a valid scenario.

Camille Letavernier wrote on Thu, 20 August 2015 12:15

Second question: It seems that "consuming" an event is not really an option. GEF4 iterates on all policies even if the (JavaFX) event has been consumed. Additionally, if I check for e.isConsumed() in the SelectionOnClick policy, I get other side effects, because for example the Drag policy always consumes the "press" event (So the SelectionOnClick policy is always disabled in this case). Are there some recommandations to either properly use events consumption, or to avoid using this mechanism outside tools?

First, the fact that the press event is consumed within FXClickDragTool seems to be inconsistent to me (I think its there historically, because we first had distinct tools for click and drag). IMHO the tools should not consume any events themselves. Please open a bug to report this. Second, tools currently do not evaluate whether the event was consumed by a policy. IMHO it could make sense to evaluate that when iterating over the policies as you propose. Could you please open another bug to request this as an enhancement?
Re: [GEF4] About events consumption and policy ordering [message #1705966 is a reply to message #1705949] Thu, 20 August 2015 13:23 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 951
Registered: February 2011
Senior Member
Hi,

Thanks for the quick answer! I've reported the suggested entries to Bugzilla:

475486: FXClickDragTool always consumes the "press" events
https://bugs.eclipse.org/bugs/show_bug.cgi?id=475486

475488: Tools should stop iterating over related policies once the processed event has been consumed
https://bugs.eclipse.org/bugs/show_bug.cgi?id=475488

Regards,
Camille


Camille Letavernier
Previous Topic:[Zest] Adding attribute-list box to class nodes
Next Topic:Draw2D Add Figure at Location
Goto Forum:
  


Current Time: Tue Oct 03 12:33:32 GMT 2023

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

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

Back to the top