javax.faces.application.ConfigurableNavigationHandler Java Examples
The following examples show how to use
javax.faces.application.ConfigurableNavigationHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DeltaSpikeNavigationHandler.java From deltaspike with Apache License 2.0 | 6 votes |
@Override public Map<String, Set<NavigationCase>> getNavigationCases() { Map<String, Set<NavigationCase>> result = null; if (this.wrapped instanceof ConfigurableNavigationHandler) { result = ((ConfigurableNavigationHandler) this.wrapped).getNavigationCases(); } if (result == null) { result = new HashMap<String, Set<NavigationCase>>(); } if (!this.activated) { return result; } return new NavigationCaseMapWrapper(result, this.wrapped); }
Example #2
Source File: NavigationHandlerAwareApplication.java From deltaspike with Apache License 2.0 | 6 votes |
private NavigationHandler wrapNavigationHandlerWithNewWrapper(NavigationHandler handler) { if (ConfigurableNavigationHandler.class.isAssignableFrom(handler.getClass())) { try { Constructor deltaSpikeNavigationHandlerWrapperConstructor = navigationHandlerWrapperClass.getConstructor(ConfigurableNavigationHandler.class); NavigationHandler navigationHandlerWrapper = (NavigationHandler)deltaSpikeNavigationHandlerWrapperConstructor.newInstance(handler); return navigationHandlerWrapper; } catch (Exception e) { throw ExceptionUtils.throwAsRuntimeException(e); } } return null; }
Example #3
Source File: RedirectNavigationHandler.java From development with Apache License 2.0 | 5 votes |
/** * @param context * @param fromAction * @param outcome * @return */ @Override public NavigationCase getNavigationCase(FacesContext context, String fromAction, String outcome) { if (parent instanceof ConfigurableNavigationHandler) { return ((ConfigurableNavigationHandler) parent).getNavigationCase( context, fromAction, outcome); } else { return null; } }
Example #4
Source File: RedirectNavigationHandler.java From development with Apache License 2.0 | 5 votes |
/** * @return */ @Override public Map<String, Set<NavigationCase>> getNavigationCases() { if (parent instanceof ConfigurableNavigationHandler) { return ((ConfigurableNavigationHandler) parent) .getNavigationCases(); } else { return null; } }
Example #5
Source File: BeyondViewScopeNavigationHandler.java From JSF-on-Spring-Boot with GNU General Public License v3.0 | 5 votes |
/** Calls the default implementation */ @Override public NavigationCase getNavigationCase(FacesContext context, String fromAction, String outcome) { if (wrappedNavigationHandler instanceof ConfigurableNavigationHandler) { return ((ConfigurableNavigationHandler) wrappedNavigationHandler) .getNavigationCase(context, fromAction, outcome); } else { return null; } }
Example #6
Source File: BeyondViewScopeNavigationHandler.java From JSF-on-Spring-Boot with GNU General Public License v3.0 | 5 votes |
/** Calls the default implementation */ @Override public Map<String, Set<NavigationCase>> getNavigationCases() { if (wrappedNavigationHandler instanceof ConfigurableNavigationHandler) { return ((ConfigurableNavigationHandler) wrappedNavigationHandler) .getNavigationCases(); } else { return null; } }
Example #7
Source File: NavLinkRenderer.java From BootsFaces-OSP with Apache License 2.0 | 5 votes |
private String encodeHref(FacesContext context, AbstractNavLink navlink) { String href = navlink.getHref(); String url; if (href != null) { url = getResourceURL(context, href); return url; } else { String outcome = navlink.getOutcome(); if (outcome == null) { return null; } ConfigurableNavigationHandler cnh = (ConfigurableNavigationHandler) context.getApplication() .getNavigationHandler(); NavigationCase navCase = cnh.getNavigationCase(context, null, outcome); if (navCase == null) { return null; } String vId = navCase.getToViewId(context); Map<String, List<String>> params = getParams(navCase, navlink); url = context.getApplication().getViewHandler().getBookmarkableURL(context, vId, params, navlink.isIncludeViewParams() || navCase.isIncludeViewParams()); if (url != null) { String frag = navlink.getFragment(); if (frag != null) { url += "#" + frag; } return url; } else { return "#"; } } }
Example #8
Source File: ButtonRenderer.java From BootsFaces-OSP with Apache License 2.0 | 5 votes |
/** * Translate the outcome attribute value to the target URL. * * @param context * the current FacesContext * @param outcome * the value of the outcome attribute * @return the target URL of the navigation rule (or the outcome if there's * not navigation rule) */ private String determineTargetURL(FacesContext context, Button button, String outcome) { ConfigurableNavigationHandler cnh = (ConfigurableNavigationHandler) context.getApplication() .getNavigationHandler(); NavigationCase navCase = cnh.getNavigationCase(context, null, outcome); /* * Param Name: javax.faces.PROJECT_STAGE Default Value: The default * value is ProjectStage#Production but IDE can set it differently in * web.xml Expected Values: Development, Production, SystemTest, * UnitTest Since: 2.0 * * If we cannot get an outcome we use an Alert to give a feedback to the * Developer if this build is in the Development Stage */ if (navCase == null) { if (FacesContext.getCurrentInstance().getApplication().getProjectStage().equals(ProjectStage.Development)) { return "alert('WARNING! " + C.W_NONAVCASE_BUTTON + "');"; } else { return ""; } } // throw new FacesException("The outcome '"+outcome+"' cannot be // resolved."); } String vId = navCase.getToViewId(context); Map<String, List<String>> params = getParams(navCase, button); String url; url = context.getApplication().getViewHandler().getBookmarkableURL(context, vId, params, button.isIncludeViewParams() || navCase.isIncludeViewParams()); return url; }
Example #9
Source File: PreRenderViewBean.java From ee7-sandbox with Apache License 2.0 | 5 votes |
public void init(ComponentSystemEvent e){ log.info("call init"); log.info("flag @"+ flag); if(!FacesContext.getCurrentInstance().isPostback()){ //initialized some data...but avoid loading in postback request } if("page2".equals(flag)){ ConfigurableNavigationHandler handler=(ConfigurableNavigationHandler) FacesContext.getCurrentInstance().getApplication().getNavigationHandler(); handler.performNavigation("page2"); } }
Example #10
Source File: NavigationCaseMapWrapper.java From deltaspike with Apache License 2.0 | 5 votes |
private DelegatingSet(Collection<? extends NavigationCase> c, ConfigurableNavigationHandler wrapped, String navigationCaseKey) { super(c); this.wrapped = wrapped; this.navigationCaseKey = navigationCaseKey; }
Example #11
Source File: DeltaSpikeNavigationHandlerWrapper.java From deltaspike with Apache License 2.0 | 4 votes |
public DeltaSpikeNavigationHandlerWrapper(ConfigurableNavigationHandler wrapped) { this.wrapped = wrapped; //only for delegating the methods implemented by DeltaSpikeNavigationHandler this.deltaSpikeNavigationHandler = new DeltaSpikeNavigationHandler(wrapped); }
Example #12
Source File: DeltaSpikeNavigationHandlerWrapper.java From deltaspike with Apache License 2.0 | 4 votes |
public ConfigurableNavigationHandler getWrapped() { return wrapped; }
Example #13
Source File: NavigationCaseMapWrapper.java From deltaspike with Apache License 2.0 | 4 votes |
private Map<String, Set<NavigationCase>> createViewConfigBasedNavigationCases(boolean allowParameters) { Map<String, Set<NavigationCase>> result; if (this.wrapped instanceof ConfigurableNavigationHandler) { result = new DelegatingMap((ConfigurableNavigationHandler)this.wrapped); } else { LOG.warning("the wrapped navigation-handler doesn't extend " + ConfigurableNavigationHandler.class.getName() + ". therefore std. navigation-rules might not work correctly with mojarra"); result = new HashMap<String, Set<NavigationCase>>(); } Collection<ViewConfigDescriptor> viewConfigDescriptors = BeanProvider.getContextualReference(ViewConfigResolver.class).getViewConfigDescriptors(); if (!viewConfigDescriptors.isEmpty()) { Set<NavigationCase> navigationCase = new HashSet<NavigationCase>(); Map<String, List<String>> parameters = null; if (allowParameters) { parameters = resolveParameters(); } boolean includeParameters; for (ViewConfigDescriptor entry : viewConfigDescriptors) { View viewMetaData = entry.getMetaData(View.class).iterator().next(); includeParameters = View.ViewParameterMode.INCLUDE .equals(viewMetaData.viewParams()); navigationCase.add(new NavigationCase("*", null, null, null, entry.getViewId(), includeParameters ? parameters : null, View.NavigationMode.REDIRECT.equals(viewMetaData.navigation()), includeParameters)); result.put(entry.getViewId(), navigationCase); } } return result; }
Example #14
Source File: NavigationCaseMapWrapper.java From deltaspike with Apache License 2.0 | 4 votes |
private DelegatingMap(ConfigurableNavigationHandler wrapped) { this.wrapped = wrapped; }