Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [Zest] attach Listener to GraphNode
[Zest] attach Listener to GraphNode [message #243427] Fri, 06 June 2008 18:15 Go to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
Hy.
I recognized, that it is not possible to get events from a GraphNode.
The below EventListener is never executed, when I move my mouse pointer
over the node (for Graph it works as assumed):

graphNode.addListener(SWT.MouseEnter, new Listener() {
@Override
public void handleEvent(Event event) {
System.out.println("foo");
}
});

Is this a known problem in Zest? This would be really handy to build a
simple editor.
The indirect way over a Graph listener is not very practical and also has
some pitfalls (especially when there is more than one node selected).

And another thing ... is there a way to allow only one selection in a
graph?
I thought about something like "new Graph(graphComposite, SWT.SINGLE);",
but this doesn't work (Crashs with Exception).

Other than that, I really love Zest. Not necessary anymore to learn the
GEF framework for my very simple editor problem.

Best regards,
Kai
Re: [Zest] attach Listener to GraphNode [message #243432 is a reply to message #243427] Fri, 06 June 2008 19:34 Go to previous messageGo to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
I just thought, that I found a good workaround ... but I was wrong :-(
I used GraphNode.getNodeFigure().addMouseListener() to add a mouse
listener.
The event works, but the node isn't anymore selectable, nor moveable.

Kai
Re: [Zest] attach Listener to GraphNode [message #243457 is a reply to message #243427] Mon, 09 June 2008 04:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: irbull.cs.uvic.ca

This seems like a reasonable request. Can you open a bug under Gef/Zest
for this.

Cheers,
ian

Kai Schlamp wrote:
> Hy.
> I recognized, that it is not possible to get events from a GraphNode.
> The below EventListener is never executed, when I move my mouse pointer
> over the node (for Graph it works as assumed):
>
> graphNode.addListener(SWT.MouseEnter, new Listener() {
> @Override
> public void handleEvent(Event event) {
> System.out.println("foo");
> }
> });
>
> Is this a known problem in Zest? This would be really handy to build a
> simple editor.
> The indirect way over a Graph listener is not very practical and also
> has some pitfalls (especially when there is more than one node selected).
>
> And another thing ... is there a way to allow only one selection in a
> graph?
> I thought about something like "new Graph(graphComposite, SWT.SINGLE);",
> but this doesn't work (Crashs with Exception).
>
> Other than that, I really love Zest. Not necessary anymore to learn the
> GEF framework for my very simple editor problem.
>
> Best regards,
> Kai
>
Re: [Zest] attach Listener to GraphNode [message #243504 is a reply to message #243457] Tue, 10 June 2008 22:19 Go to previous messageGo to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
Just for info: Bug 236528

Best regards,
Kai
Re: [Zest] attach Listener to GraphNode [message #243515 is a reply to message #243504] Wed, 11 June 2008 09:02 Go to previous messageGo to next message
kent gibson is currently offline kent gibsonFriend
Messages: 114
Registered: July 2009
Senior Member
please provide a link to the bug, so I can vote for it (if possible).

I am having the same exact problem, if I add a MouseMotionListner or
MouseListener to the the root layer (or its parent), then I can no longer
select elements in the graph control (the selection listener on the graph
control will never fire).

Why is this so, and is there any way I prevent this?

While on the subject of selection, is there public way to allow multiple
nodes to be selected without having to use the ctrl key?

thanks
Re: [Zest] attach Listener to GraphNode [message #243530 is a reply to message #243515] Wed, 11 June 2008 11:36 Go to previous messageGo to next message
kent gibson is currently offline kent gibsonFriend
Messages: 114
Registered: July 2009
Senior Member
I think I understand the problem we are having a bit more and have perhaps
have an idea.

The Graph has inside of it an SWTEventDispatcher, which is effectively
catching all events on all figures.

The method getLightweightSystem() is public is one could set a new event
dispatcher and handle all the events.
Re: [Zest] attach Listener to GraphNode [message #243563 is a reply to message #243515] Thu, 12 June 2008 19:11 Go to previous messageGo to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
kentusha wrote:

> please provide a link to the bug, so I can vote for it (if possible).

https://bugs.eclipse.org/236528
Re: [Zest] attach Listener to GraphNode [message #243650 is a reply to message #243530] Sat, 14 June 2008 16:58 Go to previous message
Eclipse UserFriend
Originally posted by: irbull.cs.uvic.ca

Exactly,

Zest is built on Draw2D, and Draw2D catches all these events. The goal
of Zest is to mimic the SWT API, so in a lot of cases we have to create
new events and put them back on the queue.

cheers,
ian

kentusha wrote:
> I think I understand the problem we are having a bit more and have
> perhaps have an idea.
>
> The Graph has inside of it an SWTEventDispatcher, which is effectively
> catching all events on all figures.
>
> The method getLightweightSystem() is public is one could set a new event
> dispatcher and handle all the events.
>
Previous Topic:Zest 3.4.0RC4: org.eclipse.ui.services.IDisposable not found
Next Topic:[Zest] Setting border on graph node not working.
Goto Forum:
  


Current Time: Tue Mar 19 11:34:28 GMT 2024

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

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

Back to the top