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

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

Introduction

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

Prototype

public synchronized void schedule(int delayMs) 

Source Link

Document

Schedules a timer to elapse in the future.

Usage

From source file:de.eckhartarnold.client.GalleryPresentation.java

License:Apache License

public void onStop() {
    if (layout.slideshow.getCurrentSlide() == layout.slideshow.size() - 1) {
        Timer timer = new Timer() {
            public void run() {
                if (slideshowInitiated) {
                    returnToGallery();/*from   w  w w  .j a  va2 s . co m*/
                }
            }
        };
        timer.schedule(layout.slideshow.getDuration() * 120 / 100); // let the last image stay a little longer... 
    } else {
        slideshowInitiated = false;
    }
}

From source file:de.fhrt.codenvy.bpmn.editor.widget.diagram.BpmnEditorDiagramWidget.java

License:Open Source License

private TabLayoutPanel initRootLayout() {
    TabLayoutPanel root = new TabLayoutPanel(0, Unit.PX);
    root.setSize("100%", "100%");
    root.add(diagramHtmlPanel, "Design");
    root.add(cmWidget, "Source");
    root.addStyleName("bpmnDigramWidget-tabLayoutPanel");
    root.addSelectionHandler(new SelectionHandler<Integer>() {

        @Override//from  w  ww .  ja v  a2 s .c o  m
        public void onSelection(SelectionEvent<Integer> event) {
            if (event.getSelectedItem() == 1) {
                Timer t = new Timer() {
                    @Override
                    public void run() {
                        cmWidget.refresh();
                    }
                };
                t.schedule(10);
            }
        }
    });
    return root;
}

From source file:de.mg.ttjs.client.page.MessagePopup.java

License:Apache License

public void show(final JQMPage page, String text) {
    label.setText(text);// w ww  .java2s  .com
    JQMContext.changePage(dialog);

    Timer t = new Timer() {
        @Override
        public void run() {
            JQMContext.changePage(page);
        }
    };
    t.schedule(2500);
}

From source file:de.novanic.eventservice.client.event.command.schedule.GWTCommandScheduler.java

License:Open Source License

/**
 * Creates a new thread for the execution of the {@link de.novanic.eventservice.client.event.command.ClientCommand}.
 * The execution is started after the specified delay.
 * @param aCommand {@link de.novanic.eventservice.client.event.command.ClientCommand} to schedule
 * @param aDelay delay in milliseconds/*  w ww  .  j  a  v a  2s  . c  om*/
 */
public void schedule(final ClientCommand<?> aCommand, int aDelay) {
    Timer theTimer = new GWTCommandTimer(aCommand);
    theTimer.schedule(aDelay);
}

From source file:de.swm.commons.mobile.client.page.Transition.java

License:Apache License

/**
 * Will perform a transition./*from   ww w.  ja v  a2  s .  com*/
 * 
 * @param from
 *            .
 * @param to
 *            .
 * @param parent
 *            the parent widget containing form sand to widgets.
 */
public static void start(final SWMMobileWidgetBase from, final SWMMobileWidgetBase to,
        final HasWidgets parent) {
    final Timer timer = new Timer() {
        @Override
        public void run() {
            parent.remove(from);
            parent.add(to);
            to.onTransitionEnd();
        }

    };
    timer.schedule(1);
}

From source file:de.swm.commons.mobile.client.page.Transition.java

License:Apache License

/**
 * Will start the next transition.//ww  w  . j a  v a 2  s.c o m
 */
protected void start() {
    registerTransitionEndEvent();
    final Timer timer = new Timer() {
        @Override
        public void run() {
            myFrom.addStyleName(SWMMobile.getTheme().getMGWTCssBundle().getTransitionsCss().start());
            myTo.addStyleName(SWMMobile.getTheme().getMGWTCssBundle().getTransitionsCss().start());
        }
    };
    timer.schedule(DEFAULT_TRANSITION_DELAY); // xxms instead of 1ms, to give iOS/Android enough time to set the
    // starting state.

}

From source file:de.swm.commons.mobile.client.presenter.AbstractMobilePresenter.java

License:Apache License

/**
 * Starts a propgress bar./*from  w ww .  ja va  2s  .  com*/
 *
 * @param spinnerStarted spinner is started
 * @return the loading indicator.
 */
private LoadingIndicatorPopup startPopup(final ISpinnerStarted spinnerStarted) {
    spinner.showCentered(true);
    final Timer timer = new Timer() {

        @Override
        public void run() {
            isSpinnerStarted = true;
            spinnerStarted.spinnerStarted();
        }
    };
    timer.schedule(50);
    return spinner;
}

From source file:de.swm.commons.mobile.client.utils.GhostClickPreventer.java

License:Apache License

public void rememberGhostClick(Point point) {
    clickedPoints.add(point);//from  w  ww . j av a2 s. c  o m

    Timer timer = new Timer() {

        @Override
        public void run() {
            Point removedP = clickedPoints.remove(0);
        }

    };
    timer.schedule(GHOST_CLICK_DELAY_MILLIS);
}

From source file:de.swm.commons.mobile.client.widgets.ListPanel.java

License:Apache License

@Override
public void onDragStart(DragEvent e) {
    if (mySelectable) {
        mySelected = Utils.getTargetItemIndex(getElement(), e.getNativeEvent().getEventTarget());
        if (mySelected >= 0) {
            final Timer timer = new Timer() {
                @Override//  ww  w.  j  av  a  2 s .  c  o m
                public void run() {
                    if (mySelected >= 0 && getWidgetCount() > 0 && mySelected < getWidgetCount()) {
                        ListItem item = (ListItem) getWidget(mySelected);
                        if (!item.getDisabled()) {
                            getWidget(mySelected).addStyleName(
                                    SWMMobile.getTheme().getMGWTCssBundle().getListPanelCss().pressed());
                        }
                    }
                }
            };
            timer.schedule(DRAG_DELAY);
        }
    }
}

From source file:de.swm.commons.mobile.client.widgets.ListPanel.java

License:Apache License

@Override
public void onDragMove(DragEvent e) {
    if (mySelected >= 0) {
        getWidget(mySelected)/* w ww .  j  a  va  2 s. c o  m*/
                .removeStyleName(SWMMobile.getTheme().getMGWTCssBundle().getListPanelCss().pressed());
        final Timer timer = new Timer() {
            @Override
            public void run() {
                mySelected = -1;
            }
        };
        timer.schedule(DRAG_MOVE_DELAY);
    }
}