GWT: How to get the com.google.gwt.user.client.ui.Widget child widget?

I am using GWT 2.4. Given com.google.gwt.user.client.ui.Widget, how to get the first child widget? For example, if a Widget represents a <div> , I would like to know the first thing that is in the <div> . There is no guarantee that there will be a child widget, but if there is, I would like to know how to get it.

All I know is a general class of objects. I can’t guarantee that it will be a widget like FlowPanel or something else, even if it’s possible.

+4
source share
1 answer

GWT widgets, which may have children, implement the HasWidgets interface:

 Widget getFirstChild(Widget parent) { if (parent instanceof HasWidgets) { Iterator<Widget> iter = ((HasWidgets) parent).iterator(); return (iter != null && iter.hasNext()) ? iter.next() : null; } return null; } 
+5
source

Source: https://habr.com/ru/post/1385563/


All Articles