1 /***
2 Copyright (C) 2005 The Java Community
3
4 This program is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free Software
6 Foundation; either version 2 of the License, or (at your option) any later
7 version.
8
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 Place, Suite 330, Boston, MA 02111-1307 USA.
16
17 */
18
19 package org.bejug.javacareers.jobs.view.jsf.action;
20
21 import java.util.Locale;
22
23 import javax.faces.context.FacesContext;
24 import javax.faces.event.ValueChangeEvent;
25
26 import org.apache.commons.logging.Log;
27 import org.apache.commons.logging.LogFactory;
28
29 /***
30 *
31 * @author Peter Symoens (Last modified by $Author: bavo_jcs $)
32 * @version $Revision: 1.8 $ - $Date: 2005/09/30 14:38:07 $
33 */
34 public class ChangeLocaleAction extends BaseAction {
35
36 /***
37 * the logger.
38 */
39 private static final Log LOG = LogFactory.getLog(ChangeLocaleAction.class);
40
41 /***
42 *
43 * @param event
44 * The ActionEvent
45 */
46 public void processLocaleChange(ValueChangeEvent event) {
47
48 String locale = (String) event.getNewValue();
49 LOG.info("Debug: new value = " + locale);
50 if (locale.equals("nl_BE")) {
51 LOG.info("Debug: locale is set to nl");
52 FacesContext.getCurrentInstance().getViewRoot().setLocale(
53 new Locale("BE", "nl"));
54 }
55 else if (locale.equals("fr_BE")){
56 LOG.info("Debug: locale is set to fr");
57 FacesContext.getCurrentInstance().getViewRoot().setLocale(
58 Locale.FRENCH);
59 }
60 else if (locale.equals("en_GB")){
61 LOG.info("Debug: locale is set to en");
62 FacesContext.getCurrentInstance().getViewRoot().setLocale(
63 Locale.ENGLISH);
64 }
65 else{
66 LOG.info("Debug: unknown locale = " + locale);
67 }
68
69 }
70
71 }
72
73 /***
74 * $Log: ChangeLocaleAction.java,v $
75 * Revision 1.8 2005/09/30 14:38:07 bavo_jcs
76 * Fixed URL
77 *
78 * Revision 1.7 2005/09/13 08:11:06 schauwvliege
79 * organize imports
80 *
81 * Revision 1.6 2005/08/30 13:07:47 psong09
82 * renamed author: psong09
83 *
84 * Revision 1.5 2005/08/10 09:04:49 bavo_jcs
85 * Optimized imports according to checkstyle
86 *
87 * Revision 1.4 2005/08/09 12:59:56 bavo_jcs
88 * Optimized imports
89 *
90 * Revision 1.3 2005/06/14 13:03:16 psong09
91 * update log statements
92 *
93 * Revision 1.2 2005/06/09 08:18:52 bejug_cc
94 * Fix initial import
95 *
96 * Revision 1.2 2005/05/17 15:39:05 PSONG09
97 * update jobsearch functionality
98 *
99 * Revision 1.1 2005/05/17 06:59:43 PSONG09
100 * added ChangeLocaleAction
101 *
102 */