Example usage for com.google.gwt.user.client Timer scheduleRepeating

List of usage examples for com.google.gwt.user.client Timer scheduleRepeating

Introduction

In this page you can find the example usage for com.google.gwt.user.client Timer scheduleRepeating.

Prototype

public synchronized void scheduleRepeating(final int periodMs) 

Source Link

Document

Schedules a timer that elapses repeatedly.

Usage

From source file:com.objetdirect.tatami.client.Clock.java

License:Open Source License

/**
 * Shows the clock when the widget is attached
 * /*w  w w  .  jav  a  2 s  .  co  m*/
 */
public void onAttach() {
    super.onAttach();
    add(canvas);
    current_time = new Date();
    Timer timer = new Timer() {
        public void run() {
            reflectTime();
            current_time.setTime(current_time.getTime() + 1000);
            //current_time.setSeconds(current_time.getSeconds()+1);

        }
    };
    timer.scheduleRepeating(1000);
}

From source file:com.phys2d.demo.client.GwtDemo.java

License:BSD License

/**
 * Start the simulation running/*w  ww. j  a  v a 2  s  . c o  m*/
 */
public void start() {
    initGUI();
    initDemo();

    // float target = 1000 / 60.0f;
    // float frameAverage = target;
    // long lastFrame = System.currentTimeMillis();
    // float yield = 10000f;
    // float damping = 0.1f;

    // long renderTime = 0;
    // long logicTime = 0;

    Timer updateTimer = new Timer() {

        public void run() {
            update();
        }
    };
    updateTimer.scheduleRepeating(50);
    // update();
}

From source file:com.qualogy.qafe.gwt.client.vo.functions.execute.FunctionsExecutor.java

License:Apache License

public void execute(BuiltInFunctionGVO builtInFunction) {

    if (builtInFunction != null) {
        try {/*from w w w .j  av a 2s. co m*/
            ExecuteCommand command = (ExecuteCommand) EXECUTOR_MAP.get(builtInFunction.getClassName());
            if (command != null) {
                GWT.log("Function Execute:" + command, null);
                processedBuiltIn = false;
                command.execute(builtInFunction);
                if (!processedBuiltIn) {
                    Timer t = new Timer() {
                        public void run() {

                            if (processedBuiltIn) {
                                cancel();
                            }

                        }
                    };
                    t.run();
                    t.scheduleRepeating(100);
                }
            } else {
                ClientApplicationContext.getInstance()
                        .log("Unable to find executor for class " + builtInFunction.getClassName(), null);
            }
        } catch (UmbrellaException e) {
            ClientApplicationContext.getInstance().log(
                    "FunctionsExecutor:execute failed " + builtInFunction.getClassName(),
                    "Cause: " + e.getCauses(), true, false, e);
        } catch (Exception e) {
            ClientApplicationContext.getInstance().log(
                    "FunctionsExecutor:execute failed " + builtInFunction.getClassName(),
                    "The error that occured:  " + e.getMessage(), true, false, e);
        }
    }
}

From source file:com.qualogy.qafe.mgwt.client.vo.functions.execute.FunctionsExecutor.java

License:Apache License

public void execute(BuiltInFunctionGVO builtInFunctionGVO, AbstractActivity activity) {
    if (builtInFunctionGVO == null) {
        return;//from w  w  w  .  ja v  a  2s .  c om
    }
    if (activity == null) {
        return;
    }
    try {
        ExecuteCommand command = EXECUTOR_MAP.get(builtInFunctionGVO.getClassName());
        if (command != null) {
            GWT.log("Function Execute: " + command, null);
            processedBuiltIn = false;
            command.execute(builtInFunctionGVO, activity);
            if (!processedBuiltIn) {
                Timer timer = new Timer() {
                    public void run() {
                        if (processedBuiltIn) {
                            cancel();
                        }
                    }
                };
                timer.run();
                timer.scheduleRepeating(100);
            }
        } else {
            ClientApplicationContext.getInstance()
                    .log("Unable to find executor for class " + builtInFunctionGVO.getClassName(), null);
        }
    } catch (Exception e) {
        ClientApplicationContext.getInstance().log(
                "FunctionsExecutor:execute  failed " + builtInFunctionGVO.getClassName(),
                "The error that occured: " + e.getMessage(), true, false, e);
    }
}

From source file:com.scalagent.appli.client.RPCServiceCacheClient.java

License:Open Source License

public RPCServiceCacheClient(BaseRPCServiceAsync RPCService, SimpleEventBus eventBus, int updatePeriod) {

    Log.debug("RPCServiceCacheClient start.");

    this.RPCService = RPCService;
    this.eventBus = eventBus;

    // start the timer, to update periodically the cache
    if (updatePeriod != -1) {
        Timer timer = new RPCServiceCacheTimer(this);
        timer.scheduleRepeating(updatePeriod);
    }//from   w ww  .j av a2 s . com
}

From source file:com.scalagent.appli.client.RPCServiceCacheClient.java

License:Open Source License

public void setPeriod(int updatePeriod) {
    if (updatePeriod != -1) {
        Timer timer = new RPCServiceCacheTimer(this);
        timer.run();//from  w  w  w. jav  a  2s.  c om
        timer.scheduleRepeating(updatePeriod);
    }
}

From source file:com.webgocommerce.client.uiutil.Notification.java

public void showPopup() {
    //this.setGlassEnabled(true);
    this.setAnimationEnabled(true);
    //this.setSize("100%", "100%");
    this.center();
    this.setAutoHideEnabled(true);
    this.setModal(false);
    this.show();//w ww. j a  v a 2s  .  c o m
    Timer timer = new Timer() {
        @Override
        public void run() {
            // TODO Auto-generated method stub
            hidePopup();
        }
    };
    timer.scheduleRepeating(3000);
}

From source file:com.xyz.main.client.mvc.AppController.java

License:Open Source License

private void onInit(AppEvent event) {
    forwardToView(appView, event);/*w  ww .  j  a va2  s.  co m*/
    //?????
    Timer timer = new Timer() {
        public void run() {
            service.validateSession(new AsyncCallback<Boolean>() {
                public void onSuccess(Boolean isSucess) {
                    if (!isSucess) {
                        MessageBox.alert(msg.alert(), "???", null);
                        Window.Location.replace("/zhikebao/index");
                    }
                }

                public void onFailure(Throwable caught) {
                    Dispatcher.forwardEvent(AppEvents.Error, caught);
                }
            });
        }
    };
    timer.scheduleRepeating(1000 * 60 * 5);
}

From source file:com.ziroby.dmassist.gwt.client.MainPanel.java

License:GNU General Public License

private void registerCallbacks() {
    Timer timer = new Timer() {
        public void run() {
            getInitCountFromServer();// w  w  w  .ja v  a 2 s  . co  m
        }
    };
    timer.scheduleRepeating(SCHEDULE_REPEAT_MS);
    getInitCountFromServer();
}

From source file:cometedgwt.auction.client.StreamingServiceGWTClientImpl.java

License:Open Source License

/**
 * A Timer that every 20s check/*  w  ww  .jav  a2  s  .com*/
 * if everything is working.
 *
 */
private void createWatchDogTimer() {
    Timer t = new Timer() {

        public void run() {
            if (!keepAlive) {
                alert("the dog is angry !!! Awake streaming !!!");
                restartStreamingFromIFrame();
            }

            keepAlive = false;
        }
    };
    t.scheduleRepeating(watchDogTimerTime);
}