01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.admin;
05:
06: import org.dijon.DictionaryResource;
07:
08: import com.tc.util.ResourceBundleHelper;
09:
10: import java.util.prefs.Preferences;
11:
12: import javax.swing.UIDefaults;
13:
14: public class AdminClientContext {
15: public AdminClient client;
16: public AdminClientController controller;
17: public UIDefaults uiDefaults;
18: public ResourceBundleHelper bundleHelper;
19: public DictionaryResource topRes;
20: public Preferences prefs;
21:
22: /**
23: * Load a message string from Resources.java.
24: */
25: public String getMessage(String id) {
26: return getString(id);
27: }
28:
29: /**
30: * Load a string string from Resources.java.
31: */
32: public String getString(String id) {
33: return bundleHelper.getString(id);
34: }
35:
36: public String format(final String key, Object[] args) {
37: return bundleHelper.format(key, args);
38: }
39:
40: /**
41: * Load an array of messages from Resources.java.
42: */
43: public String[] getMessages(String[] ids) {
44: String[] result = null;
45:
46: if (ids != null && ids.length > 0) {
47: int count = ids.length;
48:
49: result = new String[count];
50:
51: for (int i = 0; i < count; i++) {
52: result[i] = getMessage(ids[i]);
53: }
54: }
55:
56: return result;
57: }
58:
59: /**
60: * Load an object from Resources.java.
61: */
62: public Object getObject(String id) {
63: return bundleHelper.getObject(id);
64: }
65:
66: /**
67: * Log a message to the AdminClientController
68: */
69: public void log(String msg) {
70: controller.log(msg);
71: }
72:
73: /*
74: * Log an exception to the AdminClientController
75: */
76: public void log(Exception e) {
77: controller.log(e);
78: }
79:
80: /**
81: * Set a message on the AdminClientController
82: */
83: public void setStatus(String msg) {
84: controller.setStatus(msg);
85: }
86: }
|