}
}
else
{
// Per the spec: build the view.
ViewDeclarationLanguage vdl = _vdlFactory.getViewDeclarationLanguage(viewId);
try {
ViewMetadata metadata = vdl.getViewMetadata (context, viewId);
Collection<UIViewParameter> viewParameters = null;
if (metadata != null)
{
view = metadata.createMetadataView(context);
if (view != null)
{
viewParameters = metadata.getViewParameters(view);
}
}
if (view == null)
{
view = context.getApplication().getViewHandler().createView(context, viewId);
}
context.setViewRoot (view);
// TODO: Why is necessary enable event processing?
// ANS: On RestoreViewExecutor, setProcessingEvents is called first to false
// and then to true when postback. Since we need listeners registered to PostAddToViewEvent
// event to be handled, we should enable it again. We are waiting a response from EG about
// the behavior of those listeners, because for partial state saving we need this listeners
// be called from here and relocate components properly, but for now we have to let this code as is.
try
{
context.setProcessingEvents (true);
vdl.buildView (context, view);
// In the latest code related to PostAddToView, it is
// triggered no matter if it is applied on postback. It seems that MYFACES-2389,
// TRINIDAD-1670 and TRINIDAD-1671 are related.
// This code is no longer necessary, but better let it here.
//_publishPostBuildComponentTreeOnRestoreViewEvent(context, view);