use of javax.faces.lifecycle.ClientWindow in project liferay-faces-bridge-impl by liferay.
the class BridgeRequestScopeCompat_2_2_Impl method saveClientWindow.
protected void saveClientWindow(ExternalContext externalContext) {
ClientWindow clientWindow = externalContext.getClientWindow();
Map<String, Object> requestMap = externalContext.getRequestMap();
requestMap.put(BRIDGE_REQ_SCOPE_ATTR_CLIENT_WINDOW, clientWindow);
}
use of javax.faces.lifecycle.ClientWindow in project liferay-faces-bridge-impl by liferay.
the class BridgeRequestScopeCompat_2_2_Impl method restoreClientWindow.
protected void restoreClientWindow(ExternalContext externalContext) {
Map<String, Object> requestMap = externalContext.getRequestMap();
ClientWindow clientWindow = (ClientWindow) requestMap.remove(BRIDGE_REQ_SCOPE_ATTR_CLIENT_WINDOW);
externalContext.setClientWindow(clientWindow);
}
use of javax.faces.lifecycle.ClientWindow in project liferay-faces-bridge-impl by liferay.
the class Tests method clientWindowTest.
// Test 6.162
@BridgeTest(test = "clientWindowTest")
public String clientWindowTest(TestBean testBean) {
testBean.setTestComplete(true);
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
ClientWindow origClientWindow = externalContext.getClientWindow();
ClientWindow clientWindow = new ClientWindowTCKImpl(origClientWindow);
externalContext.setClientWindow(clientWindow);
if (clientWindow.equals(externalContext.getClientWindow())) {
testBean.setTestResult(true, "externalContext.getClientWindow() correctly returned the same value that was passed to ExternalContext.setClientWindow(ClientWindow).");
} else {
testBean.setTestResult(false, "externalContext.getClientWindow() incorrectly returned a different value than was passed to ExternalContext.setClientWindow(ClientWindow).");
}
externalContext.setClientWindow(origClientWindow);
if (testBean.getTestStatus()) {
return Constants.TEST_SUCCESS;
} else {
return Constants.TEST_FAILED;
}
}
use of javax.faces.lifecycle.ClientWindow in project primefaces by primefaces.
the class OutcomeTargetRenderer method getTargetURL.
protected String getTargetURL(FacesContext context, UIOutcomeTarget outcomeTarget) {
String url;
boolean clientWindowRenderingModeEnabled = false;
Object clientWindow = null;
try {
if (PrimeApplicationContext.getCurrentInstance(context).getEnvironment().isAtLeastJsf22() && outcomeTarget.isDisableClientWindow()) {
clientWindow = context.getExternalContext().getClientWindow();
if (clientWindow != null) {
clientWindowRenderingModeEnabled = ((ClientWindow) clientWindow).isClientWindowRenderModeEnabled(context);
if (clientWindowRenderingModeEnabled) {
((ClientWindow) clientWindow).disableClientWindowRenderMode(context);
}
}
}
String href = outcomeTarget.getHref();
if (href != null) {
url = "#".equals(href) ? "#" : context.getExternalContext().encodeRedirectURL(href, outcomeTarget.getParams());
} else {
NavigationCase navCase = findNavigationCase(context, outcomeTarget);
if (navCase == null) {
throw new FacesException("Could not resolve NavigationCase for outcome: " + outcomeTarget.getOutcome());
}
String toViewId = navCase.getToViewId(context);
boolean isIncludeViewParams = isIncludeViewParams(outcomeTarget, navCase);
Map<String, List<String>> params = getParams(context, navCase, outcomeTarget);
if (params == null) {
params = Collections.emptyMap();
}
url = context.getApplication().getViewHandler().getBookmarkableURL(context, toViewId, params, isIncludeViewParams);
if (outcomeTarget.getFragment() != null) {
url += "#" + outcomeTarget.getFragment();
}
}
} finally {
if (clientWindowRenderingModeEnabled && clientWindow != null) {
((ClientWindow) clientWindow).enableClientWindowRenderMode(context);
}
}
return url;
}
use of javax.faces.lifecycle.ClientWindow in project primefaces by primefaces.
the class ClientWindow001 method submit.
public void submit() {
ClientWindow clientWindow = FacesContext.getCurrentInstance().getExternalContext().getClientWindow();
FacesMessage msg = new FacesMessage("jfwid", clientWindow.getId());
FacesContext.getCurrentInstance().addMessage(null, msg);
}
Aggregations