use of org.apache.deltaspike.jsf.impl.scope.window.ClientWindowAdapter in project deltaspike by apache.
the class JsfClientWindowAwareLifecycleWrapper method attachWindow.
@Override
public void attachWindow(FacesContext facesContext) {
lazyInit();
boolean delegateWindowHandling = ClientWindowConfig.ClientWindowRenderMode.DELEGATED.equals(clientWindowConfig.getClientWindowRenderMode(facesContext));
if (delegateWindowHandling) {
try {
//the first wrapper is always DeltaSpikeLifecycleWrapper which can't extend from LifecycleWrapper
Lifecycle externalWrapper = ((DeltaSpikeLifecycleWrapper) this.wrapped).getWrapped();
delegateAttachWindow(facesContext, externalWrapper);
} catch (Exception e) {
try {
attachWindowOnUnwrappedInstance(facesContext, this.wrapped);
} catch (Exception e1) {
throw ExceptionUtils.throwAsRuntimeException(e);
}
}
} else {
ClientWindow clientWindow = BeanProvider.getContextualReference(ClientWindow.class);
//trigger init - might lead to a redirect -> response-complete
String windowId = clientWindow.getWindowId(facesContext);
if (!facesContext.getResponseComplete() && !"default".equals(windowId)) {
facesContext.getExternalContext().setClientWindow(new ClientWindowAdapter(clientWindow));
}
}
}
Aggregations