r355 - in trunk: chorem-entities/src/main/java/org/chorem chorem-entities/src/main/xmi chorem-webmotion/src/main/java/org/chorem/webmotion/actions
Author: bpoussin Date: 2013-06-30 01:56:49 +0200 (Sun, 30 Jun 2013) New Revision: 355 Url: http://chorem.org/projects/chorem/repository/revisions/355 Log: Ajout de methode pour connaitre la Locale a utiliser pour l'utilisateur courant Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java trunk/chorem-entities/src/main/xmi/chorem-model.properties trunk/chorem-entities/src/main/xmi/chorem-model.zargo trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java =================================================================== --- trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-06-29 22:55:21 UTC (rev 354) +++ trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2013-06-29 23:56:49 UTC (rev 355) @@ -48,7 +48,9 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; +import org.parboiled.common.StringUtils; /** * Proxy pour l'application. Certaines methodes specifiques pour l'application @@ -343,4 +345,21 @@ WikittyQueryResult<Company> result = findAllByQuery(Company.class, q); return result.getAll(); } + + /** + * Retourne la locale preferee de l'utilisateur, si l'utilisateur n'a pas + * defini de locale, alors on prend celle du systeme. + * + * @return Ret + */ + public Locale getUserLocale() { + Locale result = Locale.getDefault(); + ChoremUser user = getUser(ChoremUser.class); + if (user != null && StringUtils.isNotEmpty(user.getDefaultLocale())) { + String l = user.getDefaultLocale(); + result = Locale.forLanguageTag(l); + } + + return result; + } } Modified: trunk/chorem-entities/src/main/xmi/chorem-model.properties =================================================================== --- trunk/chorem-entities/src/main/xmi/chorem-model.properties 2013-06-29 22:55:21 UTC (rev 354) +++ trunk/chorem-entities/src/main/xmi/chorem-model.properties 2013-06-29 23:56:49 UTC (rev 355) @@ -54,7 +54,7 @@ # # ChoremUser # -org.chorem.entities.ChoremUser.class.tagvalue.version=1.0 +org.chorem.entities.ChoremUser.class.tagvalue.version=2.0 org.chorem.entities.ChoremUser.class.tagvalue.toString=%WikittyUser.login|nologin$s org.chorem.entities.ChoremUser.class.tagvalue.sortOrder=WikittyUser.login # Modified: trunk/chorem-entities/src/main/xmi/chorem-model.zargo =================================================================== (Binary files differ) Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-06-29 22:55:21 UTC (rev 354) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2013-06-29 23:56:49 UTC (rev 355) @@ -1013,7 +1013,7 @@ } if ("ascii".equalsIgnoreCase(type)) { - InputStream out = computeAsciiTable(data); + InputStream out = computeAsciiTable(client, data); return renderDownload(out, "budget.txt", "text/plain"); } else { return renderView("dashboardBudget.jsp", "companyId", companyId, @@ -1021,8 +1021,8 @@ } } - protected InputStream computeAsciiTable(BudgetData data) { - NumberFormat currency = new DecimalFormat("#0.00"); + protected InputStream computeAsciiTable(ChoremClient client, BudgetData data) { + NumberFormat currency = NumberFormat.getCurrencyInstance(client.getUserLocale()); TableFormatter tf = new SimpleTableFormatter(true);
participants (1)
-
bpoussin@users.chorem.org