01: /*
02: * Created on 26 Oct 2006
03: */
04: package uk.org.ponder.localeutil;
05:
06: import java.util.Locale;
07:
08: /** A utility base class that allows some form of I18N converter to accept
09: * a Locale in any number of ways.
10: * @author Antranig Basman (antranig@caret.cam.ac.uk)
11: *
12: */
13:
14: public class LocaleReceiver implements LocaleSetter {
15: private Locale locale = Locale.getDefault();
16: private LocaleGetter localegetter;
17:
18: public void setLocaleName(String localename) {
19: this .locale = LocaleUtil.parseLocale(localename);
20: }
21:
22: public void setLocale(Locale locale) {
23: this .locale = locale;
24: }
25:
26: public void setLocaleGetter(LocaleGetter localegetter) {
27: this .localegetter = localegetter;
28: }
29:
30: public Locale getLocale() {
31: return localegetter == null ? locale : localegetter.get();
32: }
33:
34: }
|