Re: How to get internal widget to notify its parent widget when clicked (and have the parent execute something)

2009-04-29 Thread Micky
Hey matttai, did you find a good solution for your issue? I'm trying to do something similar and have not had much luck. Observer pattern would seem to be the way to go - In theory there is no difference between theory and practice. In practice there is.;) On Apr 6, 10:12 pm, matttai

Re: How to get internal widget to notify its parent widget when clicked (and have the parent execute something)

2009-04-06 Thread Jason Essington
the easiest way is to create a click handler that holds a reference to the parent the simplest form would look something like: myWidget.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event){ parent.doSomething(); } }); no need to do any sink/unsink mucking

Re: How to get internal widget to notify its parent widget when clicked (and have the parent execute something)

2009-04-06 Thread matttai
Ah that works only if the widget is nested in 1 object (eg. direct parent). The widget is dynamically added to various objects and can be nested at different levels. Currently i am using a VERY dodge way of this.getParent().getParent ().getParent().getParent().doSomething(); :) And in that

Re: How to get internal widget to notify its parent widget when clicked (and have the parent execute something)

2009-04-06 Thread Vitali Lovich
Still don't see the problem. public class MyParentClass extends Composite implements ClickHandler { public void add(Widget w) { super.add(w); if (w instanceof MyChildClass) { MyChildClass child = (MyChildClass) w;

Re: How to get internal widget to notify its parent widget when clicked (and have the parent execute something)

2009-04-05 Thread gregor
Hi matttai, unless you have a big reason to do so, I would avoid sinking/unsinking events etc. I would go for one of two options: 1. if the inner widget is *only* ever used by the parent (owned by parent only), then you can make it an inner class of the parent widget. This is convenient since

How to get internal widget to notify its parent widget when clicked (and have the parent execute something)

2009-04-04 Thread matttai
As per the title :) How to get internal widget to notify its parent widget when clicked (and have the parent execute something)? I think it has something to do with sinking and unsinking events but I haven't been able to find a very good example of doing this. Any help would be appreciated!