Package com.google.gwt.user.client

Examples of com.google.gwt.user.client.Timer


  private Timer              followerNotifierTimer;

  public SharedConnectionManager(IUpdateManager updateManager) {
    this.updateManager = updateManager;

    followerTakeOverTimer = new Timer() {
      @Override
      public void run() {
        // Checks if the leader keepalive cookie was updated not long ago
        if ((Long.parseLong(Cookies.getCookie(LEADER_KEEPALIVE)) + sharedConnectionKeepaliveIntervalInMs * 3) < getTime()) {
          // If it isn't updated for a while, then getting the leadership
          FreenetJs.log("Getting leadership lastKeepalive:" + Cookies.getCookie(LEADER_KEEPALIVE));
          // Cancells the follower timers
          followerTakeOverTimer.cancel();
          followerNotifierTimer.cancel();
          // The old leader's name
          String originalLeader = Cookies.getCookie(LEADER_NAME);
          if (originalLeader != null) {
            // If there was an old leader, then notifies the server about the takeover
            FreenetRequest.sendRequest(UpdaterConstants.failoverPath, new QueryParameter[] { new QueryParameter("requestId", FreenetJs.requestId),
                new QueryParameter("originalRequestId", originalLeader) });
          }
          // Starts leading
          startLeading();
        }
      }
    };
    followerNotifierTimer = new Timer() {

      @Override
      public void run() {
        // Process cookie messages every now and then
        processMessages();
View Full Code Here


    // Process messages, so there are no messages unprocessed
    processMessages();
    // Opens a connection to the server
    longPollingManager.openConnection();
    // Starts a timer to update the leader keepalive periodically
    new Timer() {
      public void run() {
        Cookies.setCookie(LEADER_KEEPALIVE, "" + getTime(), null, null, "/", false);
        FreenetJs.log("Setting leader keepalive:" + Cookies.getCookie(LEADER_KEEPALIVE));
      };
    }.scheduleRepeating(sharedConnectionKeepaliveIntervalInMs);
View Full Code Here

    sendRequest();
  }

  /** Schedules the next request. It waits more and more as more requests fails, but will try forever. */
  private void scheduleNextRequest() {
    new Timer() {
      @Override
      public void run() {
        // When run, send a request
        sendRequest();
      }
View Full Code Here

                        touchStartX = touch.getClientX();
                        touchStartY = touch.getClientY();

                        if (dragmode != 0) {
                            if (dragTouchTimeout == null) {
                                dragTouchTimeout = new Timer() {

                                    @Override
                                    public void run() {
                                        if (touchStart != null) {
                                            // Start a drag if a finger is held
                                            // in place long enough, then moved
                                            isDragging = true;
                                        }
                                    }
                                };
                            }
                            dragTouchTimeout.schedule(TOUCHSCROLL_TIMEOUT);
                        }

                        if (actionKeys != null) {
                            if (contextTouchTimeout == null) {
                                contextTouchTimeout = new Timer() {

                                    @Override
                                    public void run() {
                                        if (touchStart != null) {
                                            // Open the context menu if finger
View Full Code Here

                        /*
                         * Prevent simulated mouse events.
                         */
                        touchStart.preventDefault();
                        if (dragmode != 0 || actionKeys != null) {
                            new Timer() {

                                @Override
                                public void run() {
                                    TouchScrollDelegate activeScrollDelegate = TouchScrollDelegate
                                            .getActiveScrollDelegate();
                                    /*
                                     * If there's a scroll delegate, check if
                                     * we're actually scrolling and handle it.
                                     * If no delegate, do nothing here and let
                                     * the row handle potential drag'n'drop or
                                     * context menu.
                                     */
                                    if (activeScrollDelegate != null) {
                                        if (activeScrollDelegate.isMoved()) {
                                            /*
                                             * Prevent the row from handling
                                             * touch move/end events (the
                                             * delegate handles those) and from
                                             * doing drag'n'drop or opening a
                                             * context menu.
                                             */
                                            touchStart = null;
                                        } else {
                                            /*
                                             * Scrolling hasn't started, so
                                             * cancel delegate and let the row
                                             * handle potential drag'n'drop or
                                             * context menu.
                                             */
                                            activeScrollDelegate
                                                    .stopScrolling();
                                        }
                                    }
                                }
                            }.schedule(TOUCHSCROLL_TIMEOUT);

                            if (contextTouchTimeout == null
                                    && actionKeys != null) {
                                contextTouchTimeout = new Timer() {

                                    @Override
                                    public void run() {
                                        if (touchStart != null) {
                                            showContextMenu(touchStart);
View Full Code Here

        // timers are cancelled on mouseup or mouseout.
        if (event.getNativeButton() == NativeEvent.BUTTON_LEFT
                && event.getSource() instanceof VEventButton) {
            final VEventButton sender = (VEventButton) event.getSource();
            processClickEvent(sender);
            mouseTimer = new Timer() {
                @Override
                public void run() {
                    mouseTimer = new Timer() {
                        @Override
                        public void run() {
                            processClickEvent(sender);
                        }
                    };
View Full Code Here

    queryModule.setVisible(false);
    exportModule.setVisible(false);
   
    // set up the timer, but don't fire it yet
    timerInterval = 4000; // check for busy app every 4 seconds
    checkApplicationBusyTimer = new Timer() {
      @Override
      public void run() {
        if( !thisClientMatchingPointsBusy  )
        {
          checkApplicationBusy();
View Full Code Here

          , 0
      );
    }
   
    popup.setPopupPosition(left, top + 20);
    new Timer() { @Override
      public void run() {
        textBox.setFocus(true);
      }
    }.schedule(180);
   
View Full Code Here

    final String text = box.getText().trim();
   
    Orr.log("searching: " +text);
    searchResultsForm.searching();
   
    new Timer() {
      public void run() {
        executeSearch(text);
      }
    }.schedule(300);
View Full Code Here

//    });

   
   
    // use a timer to request for focus in the suggest-box:
    new Timer() {
      public void run() {
//        box.setFocus(true);
        textBox.setFocus(true);
      }
    }.schedule(500);
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.Timer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.