protected void findRichMessages(FacesContext context, UIComponent component, String id, Set<UIComponent> messages) {
Iterator<UIComponent> facetsAndChildren = component.getFacetsAndChildren();
while (facetsAndChildren.hasNext()) {
UIComponent child = (UIComponent) facetsAndChildren.next();
if (child instanceof ClientSideMessage) {
ClientSideMessage richMessage = (ClientSideMessage) child;
if (null == richMessage.getFor()) {
richMessage.updateMessages(context, id);
messages.add(child);
}
} else {
findRichMessages(context, child, id, messages);
}