List of usage examples for com.google.gwt.user.client Timer scheduleRepeating
public synchronized void scheduleRepeating(final int periodMs)
From source file:com.bramosystems.oss.player.core.client.impl.QTStateManagerIE.java
License:Apache License
@Override public void initOnLoad(final String playerId, final QTStateManager.OnLoadHandler onLoadHandler) { Timer tt = new Timer() { @Override/*w w w. j a va 2 s . c om*/ public void run() { QuickTimePlayerImpl impl = QuickTimePlayerImpl.getPlayer(playerId); try { String v = impl.getPluginVersion(); if (v != null) { cancel(); onLoadHandler.onDebug("Plugin Version : " + v); onLoadHandler.initImpl(impl); } } catch (Exception e) { } } }; tt.scheduleRepeating(200); // IE workarround ... }
From source file:com.dimdim.conference.ui.publisher.client.WaitAndContinueWaiter.java
License:Open Source License
public void waitForScreenShareCompletion(final ApplicationShareInterface listener, final Element elem, final WaitAndContinueData listenerData, final PublisherInterfaceManager pim)//, final ApplicationWindowsListPanel appPanel) { //Window.alert("inside .... wait for screen share completion listenerData ="+listenerData); //tfd.setCaption("Wait for Share to Start...", false); //tfd.show(); Timer t = new Timer() { private PublisherInterfaceManager pim2 = pim; private WaitAndContinueData listenerData2 = new WaitAndContinueData(listenerData); boolean appPanelRefreshed = false; int countZero = 0; public void run() { int pubState = 0; try { pubState = PublisherInterfaceManager.getManager().isSharingActive(); //Window.alert("screen share result = "+pubState); } catch (Exception e) { //Window.alert(e.getMessage()); pubState = 2;/*from w w w . j a va 2 s . c om*/ } if (pubState == 0) { //tfd.show(); countZero += 1; if (countZero > 20) { pubState = 22; } } if (pubState == 1 && listenerData.getInt1() >= 0 && !appPanelRefreshed) { //Window.alert("got 1 as pub state"); //tfd1.hide(); if (listener != null) { DebugPanel.getDebugPanel() .addDebugMessage("application share result from pub = " + pubState); // UIResourceObject res = ClientModel.getClientModel(). // getResourceModel().findResourceObjectByMediaID(String.valueOf(listenerData.getInt1()) ); // if(null != res) // { // listenerData2.setStr7(res.getResourceId()); // } listenerData2.setBool1(true); listenerData2.setAppHandle(listenerData.getAppHandle()); listenerData2.setInt1(listenerData.getInt1()); //listener.continueWork(listenerData2); //ConferenceGlobals.setCurrentSharedResource(null); //ResourceModel rm = ClientModel.getClientModel().getResourceModel(); //rm.setCurrentResourceUnselected(); //Window.alert("app share started....handle = "+listenerData.getInt1()); listener.start(listenerData2); appPanelRefreshed = true; } // appPanel.closePopup(); } if (pubState != 0 && pubState != 1) { //Window.alert("Exited the screen share wait with return code:"+pubState); //Window.alert("delete resource in wait and continue waiter sshare.."); //Window.alert("inside .... app handle = "+appPanel.getSharedAppHandle()); this.cancel(); //tfd1.hide(); pim2.setDesktopSharingActive(false); // if(pubState != 2){ // DefaultCommonDialog.showMessage( // ConferenceGlobals.getDisplayString("publisher_error.header","Application Share Error"), // ConferenceGlobals.getDisplayString("publisher_error."+pubState,"Unknown Error")); // } if (listener != null) { UIResourceObject res = null;//ClientModel.getClientModel(). // getResourceModel().findResourceObjectByMediaID(String.valueOf(appPanel.getSharedAppHandle() ) ); // //try to get resource from resource model if (null == res) { //Window.alert("resource from app panel = null"); res = ClientModel.getClientModel().getResourceModel() .findResourceObject(listenerData.getResourceId()); } if (null != res) { listenerData2.setCode("SHARE_APPLICATION"); listenerData2.setInt1(listenerData.getInt1()); if (null != res) { listenerData2.setResourceId(res.getResourceId()); } // listener.stop(listenerData2); } if (pubState != 2) { listenerData2.setInt1(pubState); listener.error(listenerData2); } else { listener.stop(listenerData2); } // ResourceModel rm = ClientModel.getClientModel().getResourceModel(); // rm.setCurrentResourceUnselected(); } // closePopup(); // appPanel.closePopup(); } } }; t.scheduleRepeating(1000); }
From source file:com.ephesoft.gxt.rv.client.view.batch.DLFView.java
License:Open Source License
@Override public void focus() { if (widget instanceof Widget) { final Widget inputWidget = (Widget) (widget); if (inputWidget.isAttached()) { setFocus();/*from w w w . j av a 2 s. co m*/ } else { Timer timer = new Timer() { @Override public void run() { if (inputWidget.isAttached()) { cancel(); setFocus(); } } }; timer.scheduleRepeating(20); } } }
From source file:com.extjs.gxt.samples.client.examples.windows.MessageBoxExample.java
License:Open Source License
@Override protected void onRender(Element parent, int pos) { super.onRender(parent, pos); final Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() { public void handleEvent(MessageBoxEvent ce) { Button btn = ce.getButtonClicked(); Info.display("MessageBox", "The '{0}' button was pressed", btn.getText()); }/*from w ww.j a v a 2 s. co m*/ }; final ButtonBar buttonBar = new ButtonBar(); buttonBar.setMinButtonWidth(75); buttonBar.add(new Button("Confirm", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { MessageBox.confirm("Confirm", "Are you sure you want to do that?", l); } })); buttonBar.add(new Button("Prompt", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { final MessageBox box = MessageBox.prompt("Name", "Please enter your name:"); box.addCallback(new Listener<MessageBoxEvent>() { public void handleEvent(MessageBoxEvent be) { Info.display("MessageBox", "You entered '{0}'", new Params(be.getValue())); } }); } })); buttonBar.add(new Button("Multiline Prompt", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { MessageBox box = MessageBox.prompt("Address", "Please enter your address:", true); box.addCallback(new Listener<MessageBoxEvent>() { public void handleEvent(MessageBoxEvent be) { String v = Format.ellipse(be.getValue(), 80); Info.display("MessageBox", "You entered '{0}'", new Params(v)); } }); } })); buttonBar.add(new Button("Yes/No/Cancel", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { MessageBox box = new MessageBox(); box.setButtons(MessageBox.YESNOCANCEL); box.setIcon(MessageBox.QUESTION); box.setTitle("Save Changes?"); box.addCallback(l); box.setMessage( "You are closing a tab that has unsaved changes. Would you like to save your changes?"); box.show(); } })); buttonBar.add(new Button("Progress", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { final MessageBox box = MessageBox.progress("Please wait", "Loading items...", "Initializing..."); final ProgressBar bar = box.getProgressBar(); final Timer t = new Timer() { float i; @Override public void run() { bar.updateProgress(i / 100, (int) i + "% Complete"); i += 5; if (i > 105) { cancel(); box.close(); Info.display("Message", "Items were loaded", ""); } } }; t.scheduleRepeating(500); } })); buttonBar.add(new Button("Wait", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { final MessageBox box = MessageBox.wait("Progress", "Saving your data, please wait...", "Saving..."); Timer t = new Timer() { @Override public void run() { Info.display("Message", "Your fake data was saved", ""); box.close(); } }; t.schedule(5000); } })); buttonBar.add(new Button("Alert", new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { MessageBox.alert("Alert", "Access Denied", l); } })); add(buttonBar, new FlowData(10)); }
From source file:com.ezee.web.common.ui.main.EzeeWebMain.java
private void applyDateTimer() { Timer dateTimer = new Timer() { @Override// w w w .j a v a 2s. c om public void run() { setDate(); } }; dateTimer.scheduleRepeating(60 * 1000); }
From source file:com.garmin.gwt.communicator.testing.client.Showcase.java
License:Apache License
private void testReadFromDeviceXml() { // unlock plugin if (!plugin.unlock(keys)) { displayToConsole("failed to unlock plugin!"); }/*from w ww. ja v a 2 s .c om*/ // get list of devices plugin.startFindDevices(); final Timer poller = new Timer() { @Override public void run() { if (plugin.finishFindDevices()) { this.cancel(); String deviceXml = plugin.getDevicesXml(); displayToConsole(deviceXml); } } }; poller.scheduleRepeating(200); }
From source file:com.google.api.explorer.client.history.PrettyDate.java
License:Apache License
/** * Schedules a repeating timer to continually update the text with the * pretty-date, every minute until the text is more than an hour old, at which * point it stops. The assumption is that nobody will wait for 60+ minutes for * "one hour ago" to turn into "2 hours ago" *///ww w.j av a 2 s . c o m public static void keepMakingPretty(final Date date, final String prefix, final Element element) { makePretty(date, prefix, element); if (!TIMERS.containsKey(element)) { Timer timer = new Timer() { @Override public void run() { makePretty(date, prefix, element); if (element.getInnerText().contains("hour")) { stopMakingPretty(element); } } }; timer.scheduleRepeating(60000); TIMERS.put(element, timer); } }
From source file:com.google.appinventor.client.Ode.java
License:Open Source License
public void blocksTruncatedDialog(final long projectId, final String fileId, final String content, final OdeAsyncCallback callback) { final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.blocksTruncatedDialogText()); dialogBox.setHeight("150px"); dialogBox.setWidth("600px"); dialogBox.setGlassEnabled(true);/*from w ww. j a va 2s . c om*/ dialogBox.setAnimationEnabled(true); dialogBox.center(); String[] fileParts = fileId.split("/"); String screenNameParts = fileParts[fileParts.length - 1]; final String screenName = screenNameParts.split("\\.")[0]; // Get rid of the .bky part final String userEmail = user.getUserEmail(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML(MESSAGES.blocksTruncatedDialogMessage().replace("%1", screenName)); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); final Button continueSession = new Button(MESSAGES.blocksTruncatedDialogButtonSave()); continueSession.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); // call save2 again, this time with force = true so the empty workspace will be written getProjectService().save2(getSessionId(), projectId, fileId, true, content, callback); } }); holder.add(continueSession); final Button cancelSession = new Button(MESSAGES.blocksTruncatedDialogButtonNoSave()); final OdeAsyncCallback<Void> logReturn = new OdeAsyncCallback<Void>() { @Override public void onSuccess(Void result) { reloadWindow(false); } }; cancelSession.addClickListener(new ClickListener() { public void onClick(Widget sender) { // Note: We do *not* remove the dialog, this locks the UI up (our intent) // Wait for a few seconds for other I/O to complete cancelSession.setEnabled(false); // Disable button to prevent further clicking continueSession.setEnabled(false); // This one as well Timer t = new Timer() { int count = 5; @Override public void run() { if (count > 0) { HTML html = (HTML) ((VerticalPanel) dialogBox.getWidget()).getWidget(0); html.setHTML(MESSAGES.blocksTruncatedDialogButtonHTML().replace("%1", "" + count)); count -= 1; } else { this.cancel(); getProjectService().log("Disappearing Blocks: ProjectId = " + projectId + " fileId = " + fileId + " User = " + userEmail, logReturn); } } }; t.scheduleRepeating(1000); // Run every second } }); holder.add(cancelSession); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
From source file:com.google.code.p.gwtcsample.client.GWTCSample.java
License:Apache License
public void testProgressBar(GWTCBox box) { box.setTitle("GWTCProgress"); class pTimer extends Timer { int done = 0; int total = 400; GWTCProgress prgBar;//w ww .j a va2 s . c o m boolean doLoop; public pTimer(GWTCProgress p, boolean l) { prgBar = p; doLoop = l; } public void run() { if (done == 0 && doLoop == false) { prgBar.show(); } if (done >= total) { done = 0; if (doLoop == false) { cancel(); prgBar.hide(); } } prgBar.setProgress(done, total); done += 15; } } final GWTCProgress prgBar1 = new GWTCProgress(20, GWTCProgress.SHOW_TIME_REMAINING | GWTCProgress.SHOW_LEFT_TEXT | GWTCProgress.SHOW_NUMBERS); prgBar1.setText("gwt-file.jar"); prgBar1.addStyleName("gwtcu-thinBar"); final Timer timer1 = new pTimer(prgBar1, true); timer1.scheduleRepeating(500); box.add(createPanelWithDescription(prgBar1, i18n.descr_progress_1())); final GWTCProgress prgBar2 = new GWTCProgress(40, GWTCProgress.SHOW_TIME_REMAINING | GWTCProgress.SHOW_TEXT | GWTCProgress.SHOW_NUMBERS | GWTCProgress.SHOW_AS_DIALOG); prgBar2.setText(i18n.progress_title()); prgBar2.setTotalMessage(i18n.progress_total()); prgBar2.setPercentMessage(i18n.progress_percent()); prgBar2.setHoursMessage(i18n.progress_hours()); prgBar2.setMinutesMessage(i18n.progress_minutes()); prgBar2.setSecondsMessage(i18n.progress_seconds()); final Timer timer2 = new pTimer(prgBar2, false); final GWTCButton button = new GWTCButton(i18n.click_button(), new ClickHandler() { public void onClick(ClickEvent event) { prgBar2.show(); timer2.scheduleRepeating(200); } }); box.add(createPanelWithDescription(button, i18n.descr_progress_2())); }
From source file:com.google.developers.gdgfirenze.admin.client.SensormixAdminUi.java
License:Apache License
/** * Instantiates a new sensormix admin ui. * /* w w w.java2 s. c o m*/ * @param eventBus * the event bus * @param sensormixService */ public SensormixAdminUi(EventBus eventBus, GwtSensormixServiceAsync sensormixService) { this.sensormixService = sensormixService; this.eventBus = eventBus; final TreeViewModel model = new SensorTreeModel(eventBus, sensormixService); navigator = new CellBrowser.Builder<Object>(model, null).build(); navigator.setDefaultColumnWidth(600); initWidget(uiBinder.createAndBindUi(this)); final Timer timer = new Timer() { @Override public void run() { refreshHeaderCounters(); } }; timer.scheduleRepeating(PERIODREFRESHING); }