1. Writing the recursive method.
2. Invoking the recursive method
Done!!
private void loopComponentsRecursively(List<UIComponent> childrenList) {
for(UIComponent component : childrenList) {
if(component.getChildCount() > 0) {
loopComponentsRecursively(component.getChildren());
} else {
// no more children for this component
System.out.println("child: " + component.getId() + " " + component.getClientId());
}
}
}
2. Invoking the recursive method
// some code
loopComponentsRecursively(viewRoot.getChildren());
//some other code
Done!!