List of usage examples for com.google.gwt.user.client Timer schedule
public synchronized void schedule(int delayMs)
From source file:edu.caltech.ipac.firefly.ui.PopupPane.java
public void show(int autoCloseSecs) { show();/* w ww. ja v a 2s .co m*/ if (autoCloseSecs > 0) { Timer t = new Timer() { public void run() { hide(); } }; t.schedule(autoCloseSecs * 1200); } }
From source file:edu.caltech.ipac.firefly.visualize.MiniPlotWidget.java
public void setActive(boolean active) { _active = active;// w w w. ja v a 2s . co m AllPlots.getInstance().setStatus(this, active ? AllPlots.PopoutStatus.Enabled : AllPlots.PopoutStatus.Disabled); if (active) { Vis.init(this, new Vis.InitComplete() { public void done() { Timer t = new Timer() { @Override public void run() { _plotView.refreshDisplay(); } }; t.schedule(1000); } }); } }
From source file:edu.nrao.dss.client.forms.fields.GeneralCombo.java
License:Open Source License
public void setComboStore(ArrayList<String> options) { String value = getRawValue(); reset();/*w w w. j av a 2 s. co m*/ this.getStore().removeAll(); for (String key : options) { key = key.replace("\"", ""); ComboModel option = new ComboModel(key); this.getStore().add(option); } ComboModel newSelection = this.getStore().findModel("name", value); // if the currently selected is in new store select it else select first if (newSelection == null) { this.setValue(this.getStore().getAt(0)); } else { this.setValue(newSelection); } // if there is only one option available disable it if (this.getStore().getCount() == 1) { // this.setVisible(false); this.disable(); } else { this.enable(); // this.setVisible(true); } if (newSelection == null) { getInputEl().setStyleAttribute("background-color", "#C11000"); Timer timer = new Timer() { public void run() { getInputEl().setStyleAttribute("background-color", "white"); } }; timer.schedule(2000); } }
From source file:edu.nrao.dss.client.Scheduler.java
License:Open Source License
public void onModuleLoad() { final MessageBox box = MessageBox.wait("Loading Scheduler Page", "Pre-loading all information for all tabs", "About a quarter of a minute ..."); initLayout();/*from w w w . java 2 s . c o m*/ Timer t = new Timer() { @Override public void run() { box.close(); } }; t.schedule(10000); }
From source file:eolus.client.UI_Elements.MyHandlers.java
License:EUPL
public static void autoHide(final Label l) /* hide label after 2 seconds --caroline */ { Timer once = new Timer() { @Override/*from w ww. j av a 2s.c o m*/ public void run() { l.setVisible(false); this.cancel(); } }; once.schedule(2000); }
From source file:es.deusto.weblab.client.experiments.logic.ui.LogicExperiment.java
License:Open Source License
private void processCommandSent(ResponseCommand responseCommand) { if (this.lastCommand instanceof GetCircuitCommand) { this.messages.stop(); this.messages.setText(""); final CircuitParser circuitParser = new CircuitParser(); try {//from w ww. ja v a 2s . c o m this.circuit = circuitParser.parseCircuit(responseCommand.getCommandString()); } catch (final InvalidCircuitException e) { this.messages.setText("Invalid Circuit received: " + e.getMessage()); return; } this.sendSolutionButton.setEnabled(false); this.updateCircuitGrid(); } else if (this.lastCommand instanceof SolveCircuitCommand) { this.messages.stop(); if (responseCommand.getCommandString().startsWith("FAIL")) { this.solving = false; if (Audio.isSupported()) { @SuppressWarnings("unused") final Audio audio = Audio.createIfSupported(); } AudioManager.getInstance().playBest("snd/wrong"); this.messages.setText(i18n.wrongOneGameOver(this.points)); this.sendSolutionButton.setEnabled(false); } else if (responseCommand.getCommandString().startsWith("OK")) { this.points++; turnOnLight(); this.messages.setText(i18n.wellDone1point()); AudioManager.getInstance().playBest("snd/applause"); final Timer sleepTimer = new Timer() { @Override public void run() { LogicExperiment.this.sendCommand(new GetCircuitCommand()); turnOffLight(); } }; sleepTimer.schedule(2000); } } else { // TODO: Unknown command! } }
From source file:es.deusto.weblab.client.experiments.logic.ui.MobileLogicExperiment.java
License:Open Source License
private void processCommandSent(ResponseCommand responseCommand) { if (this.lastCommand instanceof GetCircuitCommand) { this.messages.stop(); this.messages.setText(""); final CircuitParser circuitParser = new CircuitParser(); try {/* w w w.j a v a 2s . c o m*/ this.circuit = circuitParser.parseCircuit(responseCommand.getCommandString()); } catch (final InvalidCircuitException e) { this.messages.setText("Invalid Circuit received: " + e.getMessage()); return; } this.sendSolutionButton.setEnabled(false); this.updateCircuitGrid(); } else if (this.lastCommand instanceof SolveCircuitCommand) { this.messages.stop(); if (responseCommand.getCommandString().startsWith("FAIL")) { this.solving = false; this.messages.setText(i18n.wrongOneGameOver(this.points)); this.sendSolutionButton.setEnabled(false); } else if (responseCommand.getCommandString().startsWith("OK")) { this.points++; this.messages.setText(i18n.wellDone1point()); turnOnLight(); final Timer sleepTimer = new Timer() { @Override public void run() { MobileLogicExperiment.this.sendCommand(new GetCircuitCommand()); turnOffLight(); } }; sleepTimer.schedule(2000); } } else { // TODO: Unknown command! } }
From source file:es.deusto.weblab.client.experiments.submarine.ui.SubmarineExperiment.java
License:Open Source License
/** * Setup certain widgets that require it after the experiment has been * started./* w w w. jav a 2s. c o m*/ */ private void setupWidgets() { this.lightSwitch.addActionListener(new IWlActionListener() { @Override public void onAction(IWlWidget widget) { boolean state = SubmarineExperiment.this.lightSwitch.isSwitched(); SubmarineExperiment.this.boardController.sendCommand("LIGHT " + (state ? "ON" : "OFF")); SubmarineExperiment.this.lightImage .setUrl(GWT.getModuleBaseURL() + "img/bulb_" + (state ? "on" : "off") + ".png"); } }); this.foodButton.addActionListener(new IWlActionListener() { @Override public void onAction(IWlWidget widget) { SubmarineExperiment.this.boardController.sendCommand("FOOD", new IResponseCommandCallback() { @Override public void onFailure(CommException e) { setMessage("Error feeding: " + e.getMessage()); } @Override public void onSuccess(ResponseCommand responseCommand) { if (responseCommand.getCommandString().startsWith("fed")) { SubmarineExperiment.this.lookHereImage.setVisible(true); final Timer t = new Timer() { @Override public void run() { SubmarineExperiment.this.lookHereImage.setVisible(false); } }; t.schedule(5000); setMessage(i18n.fishFed()); } else if (responseCommand.getCommandString().startsWith("notfed:")) { final String time = responseCommand.getCommandString().substring("notfed:".length()); setMessage(i18n.fishAlreadyFed(time)); } else { setMessage(i18n.fishNotFed(responseCommand.getCommandString())); } } }); } }); this.timer.setTimerFinishedCallback(new IWlTimerFinishedCallback() { @Override public void onFinished() { SubmarineExperiment.this.boardController.clean(); } }); this.timer.start(); }
From source file:es.deusto.weblab.client.lab.controller.LabController.java
License:Open Source License
protected void createTimer(int millis, IControllerRunnable runnable) { final Timer timer = new ExtendedTimer(runnable); timer.schedule(millis); }
From source file:es.deusto.weblab.client.mocks.MockController.java
License:Open Source License
private void nextWaitingReservationStatus() { final WaitingReservationStatus waitingReservation = new WaitingReservationStatus("foo"); waitingReservation.setPosition(this.n); this.uimanager.onWaitingReservation(waitingReservation); if (--this.n >= 0) { final Timer t = new Timer() { @Override/* w w w . j a v a2s. c om*/ public void run() { MockController.this.nextWaitingReservationStatus(); } }; t.schedule(500); } else { final WaitingConfirmationReservationStatus confirmationReservation = new WaitingConfirmationReservationStatus( "foo"); this.uimanager.onWaitingReservationConfirmation(confirmationReservation); final Timer t = new Timer() { @Override public void run() { MockController.this.afterShowingWaitingConfirmation(); } }; t.schedule(500); } }