Adding resume() to JsfView
This commit is contained in:
@@ -177,8 +177,8 @@ public class AjaxViewRoot extends DelegatingViewRoot {
|
||||
try {
|
||||
String formId = findContainingFormId(context);
|
||||
if (StringUtils.hasLength(formId)) {
|
||||
String script = "dojo.byId('" + formId + "').action = "
|
||||
+ context.getApplication().getViewHandler().getActionURL(context, getViewId());
|
||||
String script = "dojo.byId('" + formId + "').action = '"
|
||||
+ context.getApplication().getViewHandler().getActionURL(context, getViewId()) + "'";
|
||||
writer.startElement("script", null);
|
||||
writer.writeText(script, null);
|
||||
writer.endElement("script");
|
||||
|
||||
@@ -51,6 +51,8 @@ public class JsfView implements View {
|
||||
|
||||
private String viewId;
|
||||
|
||||
private boolean restored = false;
|
||||
|
||||
public JsfView(UIViewRoot viewRoot, Lifecycle facesLifecycle, RequestContext context) {
|
||||
this.viewRoot = viewRoot;
|
||||
this.viewId = viewRoot.getViewId();
|
||||
@@ -79,8 +81,17 @@ public class JsfView implements View {
|
||||
}
|
||||
}
|
||||
|
||||
public void postback() {
|
||||
// TODO - implement Postback JSF lifecycle
|
||||
public void resume() {
|
||||
FacesContext facesContext = FlowFacesContext.newInstance(context, facesLifecycle);
|
||||
try {
|
||||
if (restored && !facesContext.getResponseComplete() && !facesContext.getRenderResponse()) {
|
||||
facesLifecycle.execute(facesContext);
|
||||
facesContext.renderResponse();
|
||||
}
|
||||
} finally {
|
||||
facesContext.release();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean eventSignaled() {
|
||||
@@ -99,4 +110,8 @@ public class JsfView implements View {
|
||||
public String toString() {
|
||||
return "[JSFView = '" + viewId + "']";
|
||||
}
|
||||
|
||||
public void setRestored(boolean restored) {
|
||||
this.restored = restored;
|
||||
}
|
||||
}
|
||||
@@ -70,8 +70,6 @@ public class JsfViewFactory implements ViewFactory {
|
||||
|
||||
FacesContext facesContext = FlowFacesContext.newInstance(context, lifecycle);
|
||||
try {
|
||||
boolean restored = false;
|
||||
|
||||
if (!facesContext.getRenderResponse()) {
|
||||
JsfUtils.notifyBeforeListeners(PhaseId.RESTORE_VIEW, lifecycle, facesContext);
|
||||
}
|
||||
@@ -85,7 +83,7 @@ public class JsfViewFactory implements ViewFactory {
|
||||
logger.debug("Existing view root found for '" + viewName + "'");
|
||||
}
|
||||
view = createJsfView(facesContext.getViewRoot(), lifecycle, context);
|
||||
restored = true;
|
||||
view.setRestored(true);
|
||||
} else {
|
||||
UIViewRoot viewRoot = viewHandler.restoreView(facesContext, viewName);
|
||||
if (viewRoot != null) {
|
||||
@@ -95,14 +93,14 @@ public class JsfViewFactory implements ViewFactory {
|
||||
view = createJsfView(viewRoot, lifecycle, context);
|
||||
facesContext.setViewRoot(view.getViewRoot());
|
||||
processComponentBinding(facesContext, view.getViewRoot());
|
||||
restored = true;
|
||||
view.setRestored(true);
|
||||
} else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating view root for '" + viewName + "'");
|
||||
}
|
||||
view = createJsfView(viewHandler.createView(facesContext, viewName), lifecycle, context);
|
||||
facesContext.setViewRoot(view.getViewRoot());
|
||||
restored = false;
|
||||
view.setRestored(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,11 +108,6 @@ public class JsfViewFactory implements ViewFactory {
|
||||
JsfUtils.notifyAfterListeners(PhaseId.RESTORE_VIEW, lifecycle, facesContext);
|
||||
}
|
||||
|
||||
if (restored && !facesContext.getResponseComplete() && !facesContext.getRenderResponse()) {
|
||||
lifecycle.execute(facesContext);
|
||||
facesContext.renderResponse();
|
||||
}
|
||||
|
||||
return view;
|
||||
} finally {
|
||||
facesContext.release();
|
||||
|
||||
Reference in New Issue
Block a user