List of usage examples for com.google.gwt.user.client Timer schedule
public synchronized void schedule(int delayMs)
From source file:fr.mncc.gwttoolbox.ui.client.Indicator.java
License:Open Source License
public static void showError(String msg, int durationInSeconds) { final Indicator indicator = new Indicator(); indicator.setErrorMessage(msg);//www. j a v a 2s . c om indicator.show(); Timer timer = new Timer() { @Override public void run() { indicator.hide(); } }; timer.schedule(durationInSeconds * 1000); }
From source file:fr.mncc.gwttoolbox.ui.client.Indicator.java
License:Open Source License
public static void showSuccess(String msg, int durationInSeconds) { final Indicator indicator = new Indicator(); indicator.setSuccessMessage(msg);/*from w ww. j av a 2 s. com*/ indicator.show(); Timer timer = new Timer() { @Override public void run() { indicator.hide(); } }; timer.schedule(durationInSeconds * 1000); }
From source file:fr.mncc.gwttoolbox.ui.client.popups.Indicator.java
License:Open Source License
public static void showInfo(String msg) { final Indicator indicator = new Indicator(); indicator.setInfoMessage(msg);/*from w w w . jav a2 s.c o m*/ indicator.show(); Timer timer = new Timer() { @Override public void run() { indicator.hide(); } }; timer.schedule(4 * 1000); }
From source file:fr.mncc.gwttoolbox.ui.client.popups.Indicator.java
License:Open Source License
public static void showError(String msg) { final Indicator indicator = new Indicator(); indicator.setErrorMessage(msg);//from www . j a va 2 s . co m indicator.show(); Timer timer = new Timer() { @Override public void run() { indicator.hide(); } }; timer.schedule(4 * 1000); }
From source file:fr.mncc.gwttoolbox.ui.client.popups.Indicator.java
License:Open Source License
public static void showSuccess(String msg) { final Indicator indicator = new Indicator(); indicator.setSuccessMessage(msg);/*from w w w . java 2 s. c om*/ indicator.show(); Timer timer = new Timer() { @Override public void run() { indicator.hide(); } }; timer.schedule(4 * 1000); }
From source file:geogebra.web.gui.view.algebra.RadioButtonTreeItem.java
License:Open Source License
/** * Stop new formula creation Much of this code is copied from * AlgebraInputW.onKeyUp/*w w w . jav a 2 s . c o m*/ * * @param newValue0 * @return boolean whether it was successful */ public boolean stopNewFormulaCreation(String newValue0, final String latexx, final AsyncOperation cb) { // TODO: move to NewRadioButtonTreeItem? Wouldn't help much... String newValue = newValue0; if (newValue0 != null) { newValue = stopCommon(newValue); } app.getKernel().clearJustCreatedGeosInViews(); final String input = newValue; if (input == null || input.length() == 0) { app.getActiveEuclidianView().requestFocusInWindow(); // Michael // Borcherds // 2008-05-12 scrollIntoView(); return false; } app.setScrollToShow(true); try { AsyncOperation callback = new AsyncOperation() { @Override public void callback(Object obj) { if (!(obj instanceof GeoElement[])) { // inputField.getTextBox().setFocus(true); setFocus(true); return; } GeoElement[] geos = (GeoElement[]) obj; // need label if we type just eg // lnx if (geos.length == 1 && !geos[0].labelSet) { geos[0].setLabel(geos[0].getDefaultLabel()); } // create texts in the middle of the visible view // we must check that size of geos is not 0 (ZoomIn, // ZoomOut, ...) if (geos.length > 0 && geos[0] != null && geos[0].isGeoText()) { GeoText text = (GeoText) geos[0]; if (!text.isTextCommand() && text.getStartPoint() == null) { Construction cons = text.getConstruction(); EuclidianViewInterfaceCommon ev = app.getActiveEuclidianView(); boolean oldSuppressLabelsStatus = cons.isSuppressLabelsActive(); cons.setSuppressLabelCreation(true); GeoPoint p = new GeoPoint(text.getConstruction(), null, (ev.getXmin() + ev.getXmax()) / 2, (ev.getYmin() + ev.getYmax()) / 2, 1.0); cons.setSuppressLabelCreation(oldSuppressLabelsStatus); try { text.setStartPoint(p); text.update(); } catch (CircularDefinitionException e1) { e1.printStackTrace(); } } } app.setScrollToShow(false); addToHistory(input, latexx); Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { public void execute() { scrollIntoView(); if (newCreationMode) { setFocus(true); } } }); // actually this (and only this) means return true! cb.callback(null); // inputField.setText(null); // that comes after boolean // return true // inputField.setIsSuggestionJustHappened(false); // that is // not relevant here } }; GeoElement[] newGeo = app.getKernel().getAlgebraProcessor() .processAlgebraCommandNoExceptionHandling(input, true, false, true, true, callback); if (newGeo != null && newGeo.length == 1 && newGeo[0] instanceof GeoText) { // texts created via the input field should be displayed in the // AV newGeo[0].setAuxiliaryObject(false); } } catch (Exception ee) { // TODO: better exception handling // GOptionPaneW.setCaller(inputField.getTextBox());// we have no // good FocusWidget // app.showError(ee, inputField); app.showError(ee.getMessage());// we use what we have return false; } catch (MyError ee) { // TODO: better error handling // GOptionPaneW.setCaller(inputField.getTextBox());// we have no // good FocusWidget // inputField.showError(ee); app.showError(ee);// we use what we have return false; } // there is also a timer to make sure it scrolls into view Timer tim = new Timer() { @Override public void run() { scrollIntoView(); if (newCreationMode) { setFocus(true); } } }; tim.schedule(500); return true; }
From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.results.ModeController.java
protected void hookupCopyToFilterListener(final ResultsPanelCanCopyToFilter resultsPanel) { resultsPanel.addCopyToFilterClickListener(new ClickListener() { public void onClick(Widget sender) { String list = resultsPanel.getResultsTable().makeListFromCheckedRows(); if (list != null && list.length() > 0) { if (resultsPanel.getListBy() == FilterSpecifier.ListBy.Genes) { filterPanel.addToGeneList(list); } else if (resultsPanel.getListBy() == FilterSpecifier.ListBy.Patients) { filterPanel.addToPatientList(list); }//from w w w .ja v a 2 s . c o m addToFilterPopup.setPopupPosition(sender.getAbsoluteLeft(), sender.getAbsoluteTop() - 15); addToFilterPopup.show(); Timer hideTimer = new Timer() { public void run() { addToFilterPopup.hide(); } }; hideTimer.schedule(2000); } } }); }
From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.results.ModeControllerPathway.java
private void createTabForPathway(SinglePathwayResults pathwayResult) { final PathwayDiagramPanel panel = new PathwayDiagramPanel(pathwayResult, this); panel.addCopyToFilterClickListener(new ClickListener() { public void onClick(Widget sender) { String list = panel.makeListFromCheckedRows(); addToElementList(list);//from w ww .ja v a 2 s . c o m addToFilterPopup.setPopupPosition(sender.getAbsoluteLeft(), sender.getAbsoluteTop() - 15); addToFilterPopup.show(); Timer hideTimer = new Timer() { public void run() { addToFilterPopup.hide(); } }; hideTimer.schedule(2000); } }); tabPanel.addOrReplaceTab(panel, getModeColorSchemeClass()); }
From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.util.TooltipListener.java
License:Open Source License
public void onMouseEnter(final Widget sender) { //if instance already visible, do nothing if (tooltip != null && tooltip.isVisible()) { return;//from w w w.ja v a2 s. co m } mouseIsOnLink = true; int delay = (DELAYBEFORESHOW < 0 ? 0 : DELAYBEFORESHOW); Timer t = new Timer() { public void run() { if (mouseIsOnLink && (tooltip == null || !tooltip.isVisible())) { //in case onMouseEnter is called twice, will only create tooltip once tooltip = new Tooltip(sender.getAbsoluteLeft() + DEFAULT_OFFSET_X, sender.getAbsoluteTop() + DEFAULT_OFFSET_Y, text, styleName); tooltip.show(); } } }; t.schedule(delay); }
From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.util.TooltipListener.java
License:Open Source License
public void onMouseLeave(Widget sender) { mouseIsOnLink = false;// w ww .j a v a 2 s .com Timer t = new Timer() { public void run() { if (tooltip != null && !tooltip.mouseOnThisTooltip) { tooltip.hide(); } } }; t.schedule(250); }