01: package com.sun.portal.search.autoclassify;
02:
03: import java.util.*;
04: import java.text.*;
05:
06: /** <p>Title: Autoclassify UI Context</p>
07: * <p>Description: This objec is used for UI specific resource, including locale
08: * and resource bundle</p>
09: * <p>Copyright: Copyright (c) 2002</p>
10: * <p>Company: Sun Microsystems</p>
11: * @author Allen Chiang
12: * @version 1.0
13: */
14: public class AutoclassifyContext extends HashMap {
15:
16: Locale UIlocale = Locale.getDefault();
17: DateFormat df = DateFormat.getDateTimeInstance(DateFormat.LONG,
18: DateFormat.LONG, UIlocale);
19: ResourceBundle rb = null;
20:
21: /** Creates a new instance of AutoclassifyContext */
22: public AutoclassifyContext() {
23: }
24:
25: /** Setting locale for UI output. Mainly for running Autoclassify from admin console
26: * with user perfer language.
27: * @param locale Locale of UI output.
28: */
29: public void setUILocale(Locale locale) {
30: UIlocale = locale;
31: df = DateFormat.getDateTimeInstance(DateFormat.LONG,
32: DateFormat.LONG, UIlocale);
33: }
34:
35: /** Retrieve current UI locale
36: * @return Locale was set for UI output
37: */
38: public Locale getUILocale() {
39: return UIlocale;
40: }
41:
42: /** Formats a Date to produce a string according to current locale
43: * @param date The Date to format
44: * @return the formatted time string.
45: */
46: public String dateTimeFormat(Date date) {
47: return df.format(date);
48: }
49:
50: /** Setting resource bundle
51: * @param rb Resource bundle for UI
52: */
53: public void setResourceBundle(ResourceBundle rb) {
54: this .rb = rb;
55: }
56:
57: /** Getting resource bundle from context
58: * @return The resource bundle in this context
59: */
60: public ResourceBundle getResourceBundle() {
61: return rb;
62: }
63:
64: }
|