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


Java LocaleEditor.setAsText方法代码示例

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


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

示例1: preHandle

import org.springframework.beans.propertyeditors.LocaleEditor; //导入方法依赖的package包/类
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException {
	if (request.getUserPrincipal() != null) {
		String codiIdioma = request.getParameter(this.paramName);
		
		if (codiIdioma != null) {
			personaService.savePrefIdioma(codiIdioma);
			LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
			if (localeResolver == null)
				throw new IllegalStateException  ("No LocaleResolver found: not in a DispatcherServlet request?");
			LocaleEditor localeEditor = new LocaleEditor();
			localeEditor.setAsText(codiIdioma);
			localeResolver.setLocale(request, response, (Locale)localeEditor.getValue());
		}
	}
	return true;
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:17,代码来源:IdiomaInterceptor.java

示例2: resolveLocale

import org.springframework.beans.propertyeditors.LocaleEditor; //导入方法依赖的package包/类
public Locale resolveLocale(HttpServletRequest request) {
	Locale locale = null;
	LocaleEditor localeEditor = new LocaleEditor();
	
	ParellaCodiNom parella = (ParellaCodiNom)WebUtils.getSessionAttribute(request, SESSION_IDIOMA_ACTUAL);
	if (parella != null) {
		localeEditor.setAsText(parella.getCodi());
		locale = (Locale)localeEditor.getValue();
	} else {
		if (request.getUserPrincipal() != null) {
			UsuariPreferencies preferencies = personaService.getUsuariPreferencies();
			if (preferencies != null && preferencies.getIdioma() != null) {
				String idioma = preferencies.getIdioma();
				localeEditor.setAsText(idioma);
				locale = (Locale)localeEditor.getValue();
			}
			if (locale == null || !esIdiomaDisponible(locale)) {
				locale = determinarIdiomaDefecte(request);
			}
		} else {
			locale = determinarIdiomaDefecte(request);
		}
		setLocale(request, locale);
	}
	return locale;
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:27,代码来源:IdiomaResolver.java

示例3: preHandle

import org.springframework.beans.propertyeditors.LocaleEditor; //导入方法依赖的package包/类
@Override
public boolean preHandle(HttpServletRequest request,
		HttpServletResponse response, Object handler)
		throws ServletException {
	LocaleResolver localeResolver = RequestContextUtils
			.getLocaleResolver(request);
	if (localeResolver == null) {
		throw new IllegalStateException(
				"No LocaleResolver found: not in a DispatcherServlet request?");
	}
//	CmsSite site = CmsUtils.getSite(request);
	CmsSite site=CmsThreadVariable.getSite();
	String newLocale = site.getLocaleAdmin();
	LocaleEditor localeEditor = new LocaleEditor();
	localeEditor.setAsText(newLocale);
	localeResolver.setLocale(request, response, (Locale) localeEditor
			.getValue());
	// Proceed in any case.
	return true;
}
 
开发者ID:huanzhou,项目名称:jeecms6,代码行数:21,代码来源:AdminLocaleInterceptor.java

示例4: preHandle

import org.springframework.beans.propertyeditors.LocaleEditor; //导入方法依赖的package包/类
@Override
public boolean preHandle(HttpServletRequest request,
		HttpServletResponse response, Object handler)
		throws ServletException {
	LocaleResolver localeResolver = RequestContextUtils
			.getLocaleResolver(request);
	if (localeResolver == null) {
		throw new IllegalStateException(
				"No LocaleResolver found: not in a DispatcherServlet request?");
	}
	CmsSite site = CmsUtils.getSite(request);
	String newLocale = site.getLocaleFront();
	LocaleEditor localeEditor = new LocaleEditor();
	localeEditor.setAsText(newLocale);
	localeResolver.setLocale(request, response, (Locale) localeEditor
			.getValue());
	// Proceed in any case.
	return true;
}
 
开发者ID:huanzhou,项目名称:jeecms6,代码行数:20,代码来源:FrontLocaleInterceptor.java

示例5: preHandle

import org.springframework.beans.propertyeditors.LocaleEditor; //导入方法依赖的package包/类
@Override
public boolean preHandle(HttpServletRequest request,
		HttpServletResponse response, Object handler)
		throws ServletException {
	LocaleResolver localeResolver = RequestContextUtils
			.getLocaleResolver(request);
	if (localeResolver == null) {
		throw new IllegalStateException(
				"No LocaleResolver found: not in a DispatcherServlet request?");
	}
	CmsSite site = CmsUtils.getSite(request);
	String newLocale = site.getLocaleAdmin();
	LocaleEditor localeEditor = new LocaleEditor();
	localeEditor.setAsText(newLocale);
	localeResolver.setLocale(request, response, (Locale) localeEditor
			.getValue());
	// Proceed in any case.
	return true;
}
 
开发者ID:caipiao,项目名称:Lottery,代码行数:20,代码来源:AdminLocaleInterceptor.java

示例6: setIdiomaDefecte

import org.springframework.beans.propertyeditors.LocaleEditor; //导入方法依赖的package包/类
public void setIdiomaDefecte(String idiomaDefecte) {
	if ( idiomaDefecte!=null ) {
		LocaleEditor localeEditor = new LocaleEditor();
		localeEditor.setAsText(idiomaDefecte);
		this.idiomaDefecte = (Locale)localeEditor.getValue();
		
		if ( ! esIdiomaDisponible(this.idiomaDefecte) )
			this.idiomesDisponibles.add(0, this.idiomaDefecte);
	}
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:11,代码来源:IdiomaResolver.java

示例7: setIdiomesDisponibles

import org.springframework.beans.propertyeditors.LocaleEditor; //导入方法依赖的package包/类
public void setIdiomesDisponibles(String idiomesDisponibles) {
	if ( idiomesDisponibles!=null && idiomesDisponibles!="" ) {
		this.idiomesDisponibles = new ArrayList<Locale>();
		LocaleEditor localeEditor = new LocaleEditor();

		String idiomes[] = idiomesDisponibles.split(",");
		for ( String idioma: idiomes ) {
			localeEditor.setAsText(idioma);
			this.idiomesDisponibles.add( (Locale)localeEditor.getValue() );
		}
		
		if ( this.idiomaDefecte==null )
			this.idiomaDefecte = this.idiomesDisponibles.get(0);
	}
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:16,代码来源:IdiomaResolver.java

示例8: setLocale

import org.springframework.beans.propertyeditors.LocaleEditor; //导入方法依赖的package包/类
protected void setLocale(HttpServletRequest request, HttpServletResponse response, String newLocale) {
	if (newLocale != null) {
		LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
		if (localeResolver == null) {
			logger.debug("No LocaleResolver found: not in a DispatcherServlet request?");
			return;
		}
		LocaleEditor localeEditor = new LocaleEditor();
		localeEditor.setAsText(newLocale);
		localeResolver.setLocale(request, response, (Locale) localeEditor.getValue());
	}
}
 
开发者ID:mobilipia,项目名称:Deskera-HRMS,代码行数:13,代码来源:authHandlerController.java

示例9: getTplPath

import org.springframework.beans.propertyeditors.LocaleEditor; //导入方法依赖的package包/类
/**
 * 获得模板路径。将对模板文件名称进行本地化处理。
 * 
 * @param messageSource
 * @param lang
 *            本地化语言
 * @param solution
 *            方案路径
 * @param dir
 *            模板目录。不本地化处理。
 * @param name
 *            模板名称。本地化处理。
 * @return
 */
public static String getTplPath(MessageSource messageSource, String lang,
		String solution, String dir, String name) {
	LocaleEditor localeEditor = new LocaleEditor();
	localeEditor.setAsText(lang);
	Locale locale = (Locale) localeEditor.getValue();
	return solution + "/" + dir + "/"
			+ messageSource.getMessage(name, null, locale) + TPL_SUFFIX;
}
 
开发者ID:huanzhou,项目名称:jeecms6,代码行数:23,代码来源:FrontUtils.java


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