Hi Bobby, >From a design perspective, is there any reason why WidgetB can't be a part of the composite WidgetA? A composite is essentially made up of a set of other widgets. It seems like if WidgetB belongs or is added to the WidgetA composite, it is actually part of the WidgetA composite.
Redesigning it as such should make it much easier to determine the containing parent for WidgetB. Hope that helps, -Sumit Chandel On Sat, May 9, 2009 at 12:13 PM, Bobby Frank <[email protected]> wrote: > > I have the following situation: > class WidgetA extends Composite { > public WidgetA() { > initWidget(new VerticalPanel()); > } > > public void add(Widget w) { > ((VerticalPanel) getWidget()).add(w); > } > } > > And somewhere else I make a call like: > WidgetA a = new WidgetA(); > WidgetB b = new WidgetB(); > a.add(b); > > Later on I need to get the WidgetA object that WidgetB belongs to (was > added to), so naturally I think to call b.getParent(). However, this > will return a VerticalPanel. > I can't come up with a good generic way of being able to return the > corresponding WidgetA object for any Widget that may be added to it > (not just type WidgetB). Any suggestions? > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
