KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > admin > AdminClientContext


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.admin;
5
6 import org.dijon.DictionaryResource;
7
8 import com.tc.util.ResourceBundleHelper;
9
10 import java.util.prefs.Preferences JavaDoc;
11
12 import javax.swing.UIDefaults JavaDoc;
13
14 public class AdminClientContext {
15   public AdminClient client;
16   public AdminClientController controller;
17   public UIDefaults JavaDoc uiDefaults;
18   public ResourceBundleHelper bundleHelper;
19   public DictionaryResource topRes;
20   public Preferences JavaDoc prefs;
21
22   /**
23    * Load a message string from Resources.java.
24    */

25   public String JavaDoc getMessage(String JavaDoc id) {
26     return getString(id);
27   }
28
29   /**
30    * Load a string string from Resources.java.
31    */

32   public String JavaDoc getString(String JavaDoc id) {
33     return bundleHelper.getString(id);
34   }
35   
36   public String JavaDoc format(final String JavaDoc key, Object JavaDoc[] args) {
37     return bundleHelper.format(key, args);
38   }
39
40   /**
41    * Load an array of messages from Resources.java.
42    */

43   public String JavaDoc[] getMessages(String JavaDoc[] ids) {
44     String JavaDoc[] result = null;
45
46     if(ids != null && ids.length > 0) {
47       int count = ids.length;
48
49       result = new String JavaDoc[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   /**
61    * Load an object from Resources.java.
62    */

63   public Object JavaDoc getObject(String JavaDoc id) {
64     return bundleHelper.getObject(id);
65   }
66
67   /**
68    * Log a message to the AdminClientController
69    */

70   public void log(String JavaDoc msg) {
71     controller.log(msg);
72   }
73
74   /*
75    * Log an exception to the AdminClientController
76    */

77   public void log(Exception JavaDoc e) {
78     controller.log(e);
79   }
80
81   /**
82    * Set a message on the AdminClientController
83    */

84   public void setStatus(String JavaDoc msg) {
85     controller.setStatus(msg);
86   }
87 }
88
Popular Tags