private void subscribeToPreRenderViewEventOncePerRequest(FacesContext facesContext, UIComponent component) {
Map<Object, Object> contextMap = facesContext.getAttributes();
if (contextMap.get(this.getClientId() + PRE_RENDER_VIEW_EVENT_REGISTERED) == null) {
contextMap.put(this.getClientId() + PRE_RENDER_VIEW_EVENT_REGISTERED, Boolean.TRUE);
UIViewRoot viewRoot = getUIViewRoot(component);
viewRoot.subscribeToViewEvent(PreRenderViewEvent.class, this);
}
}
private UIViewRoot getUIViewRoot(UIComponent component) {
UIComponent resolved = component;