/** * Gets the id attribute of the given widget, recursing into child widgets if necessary. */ private String getWidgetId( StaticXmlWidget widget ) { String id = widget.getAttribute( "id" ); if ( id != null ) { return id; } for( StaticWidget child : widget.getChildren() ) { id = getWidgetId( (StaticXmlWidget) child ); if ( id != null ) { return id; } } return null; } }
String id = getWidgetId( widget );