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:next.celebs.page.FrontTopMenu.java

License:Apache License

public void doShow() {
    if (!isHidden) {
        return;//ww w.  j av a 2  s  .co  m
    }

    Timer t = new Timer() {
        public void run() {
            NMorphStyle eff = FxUtil.moveHorizEffectAbs(690, 0, hMovies.getElement(), null, 30, 100, 0.3);
            eff.play();
        }
    };
    t.schedule(200);

    Timer t2 = new Timer() {
        public void run() {
            NMorphStyle eff2 = FxUtil.moveHorizEffectAbs(690, hMovies.getWidth() + 10, hModels.getElement(),
                    null, 30, 100, 0.3);
            eff2.play();
        }
    };
    t2.schedule(400);

    Timer t3 = new Timer() {
        public void run() {
            NMorphStyle eff3 = FxUtil.moveHorizEffectAbs(690, hMovies.getWidth() + 10 + hModels.getWidth() + 10,
                    hGirlDay.getElement(), null, 30, 100, 0.3);
            eff3.play();
        }
    };
    t3.schedule(600);

    isHidden = false;
}

From source file:next.celebs.page.LeftMenu.java

License:Apache License

private void clearLeftMenuRandom() {
    for (final YButton btn : buttons) {
        Timer t = new Timer() {
            public void run() {
                btn.setEnabled(false);/* w w  w . j a  v  a2  s .c  o  m*/
                NMorphStyle eff = FxUtil.moveHorizEffect(0, -btn.getOffsetWidth(), btn.getElement(), null, 100,
                        0);
                eff.play();
            }
        };
        t.schedule(MiscUtils.getTimeout());
    }
}

From source file:next.celebs.page.LeftMenu.java

License:Apache License

public void resetButtons(final YButton selectedBtn) {
    for (final YButton btn : buttons) {
        if (!btn.equals(selectedBtn) && !btn.isEnabled()) {

            Timer t = new Timer() {
                public void run() {
                    NMorphStyle eff = FxUtil.moveHorizEffect(-btn.getOffsetWidth(), 0, btn.getElement(),
                            new Command() {
                                @Override
                                public void execute() {
                                    btn.setEnabled(true);
                                }/* w w w  .jav  a2 s .  c o  m*/
                            }, 50, 100);
                    eff.play();
                }
            };
            t.schedule(MiscUtils.getTimeout());
        }
    }
}

From source file:next.i.controller.XController.java

License:Apache License

/**
 * private//from w ww  .j  a  v a  2 s  . com
 */
private void XController_() {

    this._id = ControllerID.get();

    _navigationBar = new XNavigationBar();
    _navigation = new XNavigationView();
    _navigation.setNavigationContent(getView());
    _navigation.setNavigationBar(_navigationBar);

    // defer invocation after sub-class constructors
    Timer t = new Timer() {
        @Override
        public void run() {
            onAfterLoad();

            if (XController.this.viewContent == null) {
                IsWidget w = getViewContent();
                if (w != null) {
                    XController.this.viewContent = w;
                    // TODO casting doesn't seem right
                    ((MPanelBase) getView()).add(w.asWidget());
                }
            }
            getNavigationBar().repaint();
        }
    };
    t.schedule(1);
}

From source file:next.tablet.client.black.GameTopMenu.java

License:Apache License

public void doHide(final Command afterCmd) {
    if (isHidden) {
        if (afterCmd != null) {
            afterCmd.execute();// ww w .jav  a  2 s .com
        }
        return;
    }

    Timer t = new Timer() {
        public void run() {
            NMorphStyle eff = CUtil.moveHorizEffectAbs(hSocial.getAbsoluteLeft(), 690, hSocial.getElement(),
                    afterCmd, 30, 100, 0.3);
            eff.play();
        }
    };
    t.schedule(250);

    Timer t2 = new Timer() {
        public void run() {
            NMorphStyle eff2 = CUtil.moveHorizEffectAbs(hSports.getAbsoluteLeft(), 690, hSports.getElement(),
                    null, 30, 100, 0.3);
            eff2.play();
        }
    };
    t2.schedule(150);

    Timer t3 = new Timer() {
        public void run() {
            NMorphStyle eff3 = CUtil.moveHorizEffectAbs(hInteractive.getAbsoluteLeft(), 690,
                    hInteractive.getElement(), null, 30, 100, 0.3);
            eff3.play();
        }
    };
    t3.schedule(50);

    // NMorphStyle eff3 = CUtil.moveHorizEffectAbs(hAll.getAbsoluteLeft(), 690, hAll.getElement(), null, 30, 100, 0.3);
    // eff3.play();

    isHidden = true;
}

From source file:next.tablet.client.black.GameTopMenu.java

License:Apache License

public void doShow() {
    // Window.alert("doShow 1");
    if (!isHidden) {
        return;/*from   w w w  . j a  v a2 s.com*/
    }

    Timer t = new Timer() {
        public void run() {
            NMorphStyle eff = CUtil.moveHorizEffectAbs(690, 0, hSocial.getElement(), null, 30, 100, 0.3);
            eff.play();
        }
    };
    t.schedule(200);

    Timer t2 = new Timer() {
        public void run() {
            NMorphStyle eff2 = CUtil.moveHorizEffectAbs(690, hSocial.getWidth() + 10, hSports.getElement(),
                    null, 30, 100, 0.3);
            eff2.play();
        }
    };
    t2.schedule(400);

    Timer t3 = new Timer() {
        public void run() {
            NMorphStyle eff3 = CUtil.moveHorizEffectAbs(690, hSocial.getWidth() + 10 + hSports.getWidth() + 10,
                    hInteractive.getElement(), null, 30, 100, 0.3);
            eff3.play();
        }
    };
    t3.schedule(600);

    isHidden = false;
}

From source file:next.tablet.client.black.ImagePage.java

License:Apache License

public ImagePage(final TabletEventBus eventBus) {
    setStyleName("bCommunityPage");
    // setSize("1024px", "600px");
    // setPopupPosition(0, 0);
    setWidth("700px");

    this.getElement().getStyle().setOpacity(0);
    setPopupPosition(2000, 2000);//from   w w w  . j av  a 2 s  . com
    show();

    content = new Image();

    setWidget(content);

    eventBus.addHandler(ShowFacebookOptionEvent.TYPE, new ShowFacebookOptionHandler() {
        @Override
        public void onExecute(final ShowFacebookOptionEvent e) {
            Timer t = new Timer() {
                public void run() {
                    if (e.getType() == ShowFacebookOptionEvent.Type.PROFILE) {
                        setResource(RES.iProfile());

                    } else if (e.getType() == ShowFacebookOptionEvent.Type.FRIENDS) {
                        setResource(RES.iFriends());

                    } else if (e.getType() == ShowFacebookOptionEvent.Type.NEWS_FEED) {
                        setResource(RES.iNewsFeed());

                    } else if (e.getType() == ShowFacebookOptionEvent.Type.GAMES) {
                        setResource(RES.iGames());
                    }
                    doShow();
                }
            };
            t.schedule(500);
        }
    });

    eventBus.addHandler(ShowLocationOptionEvent.TYPE, new ShowLocationOptionHandler() {
        @Override
        public void onExecute(final ShowLocationOptionEvent e) {
            Timer t = new Timer() {
                public void run() {
                    if (e.getType() == ShowLocationOptionEvent.Type.PROMOTIONS) {
                        setResource(RES.iPromotions());

                    } else if (e.getType() == ShowLocationOptionEvent.Type.TOUR) {
                        setResource(RES.iTour());

                    } else if (e.getType() == ShowLocationOptionEvent.Type.RESPONSIVE) {
                        setResource(RES.iResponsive());

                    } else if (e.getType() == ShowLocationOptionEvent.Type.CONTACT) {
                        setResource(RES.iContact());

                    } else if (e.getType() == ShowLocationOptionEvent.Type.FAQ) {
                        setResource(RES.iFaq());
                    }
                    doShow();
                }
            };
            t.schedule(500);
        }
    });

    eventBus.addHandler(ShowAccountEditEvent.TYPE, new ShowAccountEditHandler() {
        @Override
        public void onExecute(final ShowAccountEditEvent e) {
            Timer t = new Timer() {
                public void run() {
                    setResource(RES._accountEdit());
                    doShow();
                }
            };
            t.schedule(500);
        }
    });

    eventBus.addHandler(ShowTwitterEvent.TYPE, new ShowTwitterHandler() {
        @Override
        public void onExecute(final ShowTwitterEvent e) {
            Timer t = new Timer() {
                public void run() {
                    setResource(RES._favoritesTwitter());
                    doShow();
                }
            };
            t.schedule(500);
        }
    });

    eventBus.addHandler(ShowWalletTopupEvent.TYPE, new ShowWalletTopupHandler() {
        @Override
        public void onExecute(final ShowWalletTopupEvent e) {
            Timer t = new Timer() {
                public void run() {
                    setResource(RES.iWalletTopup());
                    doShow();
                }
            };
            t.schedule(500);
        }
    });
}

From source file:next.tablet.client.black.LeftMenu.java

License:Apache License

private void clearLeftMenuRandom() {
    for (final ImageButton btn : buttons) {
        int timeout = Random.nextInt(1000);
        Timer t = new Timer() {
            public void run() {
                btn.setEnabled(false);//w  ww. j  a v a  2 s  . c  o m
                NMorphStyle eff = CUtil.moveHorizEffect(0, -btn.getOffsetWidth(), btn.getElement(), null, 100,
                        0);
                eff.play();
            }
        };
        t.schedule(timeout);
    }
}

From source file:next.tablet.client.black.LeftMenu.java

License:Apache License

public void resetButtons(final ImageButton selectedBtn) {
    for (final ImageButton btn : buttons) {
        if (!btn.equals(selectedBtn) && !btn.isEnabled()) {

            int timeout = Random.nextInt(1000);
            Timer t = new Timer() {
                public void run() {
                    NMorphStyle eff = CUtil.moveHorizEffect(-btn.getOffsetWidth(), 0, btn.getElement(),
                            new Command() {
                                @Override
                                public void execute() {
                                    btn.setEnabled(true);
                                }/*w w w . j ava2 s .c  o  m*/
                            }, 50, 100);
                    eff.play();
                }
            };
            t.schedule(timeout);

        }
    }
}

From source file:next.tablet.client.black.NotificationPage.java

License:Apache License

public void doHide() {
    if (isHidden) {
        return;//from   w w w .  j a va 2 s.  co m
    }

    Timer t1 = new Timer() {
        public void run() {
            notifIcon1.doHide(null);
            Timer t2 = new Timer() {
                public void run() {
                    notifIcon2.doHide(null);
                    Timer t3 = new Timer() {
                        public void run() {
                            notifIcon3.doHide(null);
                            Timer t4 = new Timer() {
                                public void run() {

                                    NMorphStyle eff = CUtil.moveVerticalEffect(POSITION, 601,
                                            NotificationPage.this.getElement(), null);
                                    eff.play();

                                    Timer t5 = new Timer() {
                                        public void run() {
                                            doShow();
                                        }
                                    };
                                    t5.schedule(10000);
                                }
                            };
                            t4.schedule(400);
                        }
                    };
                    t3.schedule(400);
                }
            };
            t2.schedule(400);
        }
    };
    t1.schedule(400);

    isHidden = true;
}