/**
* @deprecated overload/use {@link #executeInitView(javax.faces.context.FacesContext)} instead
*/
protected void postRestoreView(FacesContext facesContext)
{
ViewControllerManager manager = ViewControllerManagerFactory.getInstance();
if (manager == null)
{
return;
}
UIViewRoot viewRoot = facesContext.getViewRoot();
if (viewRoot == null)
{
return;
}
String viewId = viewRoot.getViewId();
if (viewId == null)
{
return;
}
// Here we keep track of the ViewRoot instances that we have already called initView for,
// and if it changes then we call initView again.
//
// An alternative would be to keep track of the ViewController instance, and call initView
// if that instance changes. But this is tricky as this object is often a proxy for the
// real object, and may not change even when the target is invalidated and recreated.
String viewKey = String.valueOf(System.identityHashCode(viewRoot));
ViewControllerPhaseListenerState state = getState(facesContext);
if (state.initedViews.contains(viewKey))
{
// this view instance is already initialized
if (log.isDebugEnabled())
{
log.debug("Skipping already-initialized viewcontroller bean " + viewKey + " for view " + viewId);
}
return;
}
if (log.isDebugEnabled())
{
log.debug("Initializing viewcontroller bean " + viewKey + " for view " + viewId);
}
state.initedViews.add(viewKey);
manager.executeInitView(viewId);
}