当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurableNavigationHandler.getNavigationCase方法代码示例

本文整理汇总了Java中javax.faces.application.ConfigurableNavigationHandler.getNavigationCase方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableNavigationHandler.getNavigationCase方法的具体用法?Java ConfigurableNavigationHandler.getNavigationCase怎么用?Java ConfigurableNavigationHandler.getNavigationCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.faces.application.ConfigurableNavigationHandler的用法示例。


在下文中一共展示了ConfigurableNavigationHandler.getNavigationCase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: determineTargetURL

import javax.faces.application.ConfigurableNavigationHandler; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:stephanrauh,项目名称:JSFLibraryGenerator,代码行数:40,代码来源:ButtonRenderer.java

示例2: encodeHref

import javax.faces.application.ConfigurableNavigationHandler; //导入方法依赖的package包/类
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 "#";
		}
	}

}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:40,代码来源:NavLinkRenderer.java


注:本文中的javax.faces.application.ConfigurableNavigationHandler.getNavigationCase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。