public static <T> T firstChildRendered(Class<T> childType, UIComponent base) {
        if (base == null || !base.isRendered()) {
            return null;
        }

        for (int i = 0; i < base.getChildCount(); i++) {
            UIComponent child = base.getChildren().get(i);
            if (childType.isInstance(child) && child.isRendered() ) {
                return (T) child;
            }
        }

        return null;
    }
Finds the first component by the given id expression or client id.

@param id The id.
@param base The base component to start the traversal.
@param separatorChar The separatorChar (e.g. :).
@param context The FacesContext.
@param callback the callback for the found component
primefaces/src/main/java/org/primefaces/util/ComponentTraversalUtils.java