Package autotest.common

Source Code of autotest.common.CommonClassFactory

package autotest.common;

import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.RootPanel;

public class CommonClassFactory {

    public static void globalInitialize() {
        setupMOTD();

        Timer timer = new Timer() {
            @Override
            public void run() {
                refreshMOTD();
            }
        };

        // schedule every 10 minutes
        timer.scheduleRepeating(10 * 60 * 1000);
    }

    public static void setupMOTD() {
        String motd = StaticDataRepository.getRepository().getData(
                "motd").isString().stringValue();
        RootPanel.get("motd").getElement().setInnerHTML(motd);
    }

    public static void refreshMOTD() {
        JsonRpcProxy.getProxy().rpcCall("get_motd", null, new JsonRpcCallback() {
            @Override
            public void onSuccess(JSONValue result) {
                String motd = result.isString().stringValue();
                RootPanel.get("motd").getElement().setInnerHTML(motd);
            }
        });
    }
}
TOP

Related Classes of autotest.common.CommonClassFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.