• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package autotest.common;
2 
3 import com.google.gwt.json.client.JSONValue;
4 import com.google.gwt.user.client.Timer;
5 import com.google.gwt.user.client.ui.RootPanel;
6 
7 public class CommonClassFactory {
8 
globalInitialize()9     public static void globalInitialize() {
10         setupMOTD();
11 
12         Timer timer = new Timer() {
13             @Override
14             public void run() {
15                 refreshMOTD();
16             }
17         };
18 
19         // schedule every 10 minutes
20         timer.scheduleRepeating(10 * 60 * 1000);
21     }
22 
setupMOTD()23     public static void setupMOTD() {
24         String motd = StaticDataRepository.getRepository().getData(
25                 "motd").isString().stringValue();
26         RootPanel.get("motd").getElement().setInnerHTML(motd);
27     }
28 
refreshMOTD()29     public static void refreshMOTD() {
30         JsonRpcProxy.getProxy().rpcCall("get_motd", null, new JsonRpcCallback() {
31             @Override
32             public void onSuccess(JSONValue result) {
33                 String motd = result.isString().stringValue();
34                 RootPanel.get("motd").getElement().setInnerHTML(motd);
35             }
36         });
37     }
38 }
39