Package com.google.gwt.core.client

Examples of com.google.gwt.core.client.Duration


    }

    private void doDeleteBundleDeployment() {
        String deleteSubmittedMessage = MSG.view_bundle_deploy_deleteSubmitted(deployment.getName());
        getMessageCenter().notify(new Message(deleteSubmittedMessage, Message.Severity.Info));
        final Duration duration = new Duration();
        BundleGWTServiceAsync bundleService = GWTServiceLookup.getBundleService();
        bundleService.deleteBundleDeployment(deployment.getId(), new AsyncCallback<Void>() {
            @Override
            public void onFailure(final Throwable caught) {
                Timer timer = new Timer() {
                    @Override
                    public void run() {
                        String message = MSG.view_bundle_deploy_deleteFailure(deployment.getName());
                        getErrorHandler().handleError(message, caught);
                    }
                };
                // Delay the showing of the result to give the user some time to see the deleteSubmitted notif
                timer.schedule(Math.max(0, 3 * 1000 - duration.elapsedMillis()));
            }

            @Override
            public void onSuccess(Void result) {
                Timer timer = new Timer() {
                    @Override
                    public void run() {
                        String message = MSG.view_bundle_deploy_deleteSuccessful(deployment.getName());
                        getMessageCenter().notify(new Message(message, Message.Severity.Info));
                        // Bundle deployment is deleted, go back to main bundle destinations view
                        goToView(
                            LinkManager.getBundleDestinationLink(bundle.getId(), deployment.getDestination().getId()),
                            true);
                    }
                };
                // Delay the showing of the result to give the user some time to see the deleteSubmitted notif
                timer.schedule(Math.max(0, 3 * 1000 - duration.elapsedMillis()));
            }
        });
    }
View Full Code Here


                doomedNames.add(object.getBundleName());
                doomedIds[i++] = object.getBundleId();
            }

            BundleGWTServiceAsync bundleManager = GWTServiceLookup.getBundleService();
            final Duration duration = new Duration();
            bundleManager.deleteBundles(doomedIds, new AsyncCallback<Void>() {
                @Override
                public void onFailure(final Throwable caught) {
                    Timer timer = new Timer() {
                        @Override
                        public void run() {
                            String conciseMessage = MSG.view_bundle_list_deletesFailure();
                            String detailedMessage = doomedNames.toString() + "<br/>\n"
                                + ErrorHandler.getAllMessages(caught);
                            getMessageCenter().notify(new Message(conciseMessage, detailedMessage, Severity.Error));
                        }
                    };
                    // Delay the showing of the result to give the user some time to see the deleteSubmitted notif
                    timer.schedule(Math.max(0, 3 * 1000 - duration.elapsedMillis()));
                }

                @Override
                public void onSuccess(Void result) {
                    Timer timer = new Timer() {
                        @Override
                        public void run() {
                            String conciseMessage = MSG.view_bundle_list_deletesSuccessful();
                            String detailedMessage = doomedNames.toString();
                            getMessageCenter().notify(new Message(conciseMessage, detailedMessage, Severity.Info));
                            CoreGUI.refresh();
                        }
                    };
                    // Delay the showing of the result to give the user some time to see the deleteSubmitted notif
                    timer.schedule(Math.max(0, 3 * 1000 - duration.elapsedMillis()));
                }
            });
        }
View Full Code Here

    if (PagingScrollTableDemo.get() != null) {
      PagingScrollTable<Student> pagingScrollTable = PagingScrollTableDemo.get().getPagingScrollTable();
      if (pagingScrollTable != null) {
        pagingScrollTable.addPageChangeHandler(new PageChangeHandler() {
          public void onPageChange(PageChangeEvent event) {
            pageLoadDuration = new Duration();
          }
        });

        pagingScrollTable.addPageLoadHandler(new PageLoadHandler() {
          public void onPageLoad(PageLoadEvent event) {
View Full Code Here

      return myRow++;
    }

    String repeat() {
      if (repeat == 0) {
        duration = new Duration();
        if (usePretend) {
          savedEvent = DOM.eventGetCurrentEvent();
          ++repeat;
          while (savedEvent != null && savedEvent.getType() != null
              && savedEvent.getType().equals("click")) {
View Full Code Here

      return myRow++;
    }

    String repeat() {
      if (repeat == 0) {
        duration = new Duration();
      } else if (repeat == maxRepeat) {
        double milli = duration.elapsedMillis();
        runningAverage = (runningAverage + milli) / 2;
        repeat = -5;
        return "Took " + milli + " to repeat " + maxRepeat + " times";
View Full Code Here

    // Copy the animation requests to avoid concurrent modifications.
    AnimationHandleImpl[] curAnimations = new AnimationHandleImpl[animationRequests.size()];
    curAnimations = animationRequests.toArray(curAnimations);

    // Iterate over the animation requests.
    Duration duration = new Duration();
    for (AnimationHandleImpl requestId : curAnimations) {
      // Remove the current request.
      animationRequests.remove(requestId);

      // Execute the callback.
      requestId.getCallback().execute(duration.getStartMillis());
    }

    // Reschedule the timer if there are more animation requests.
    if (animationRequests.size() > 0) {
      /*
       * In order to achieve as close to 60fps as possible, we calculate the new
       * delay based on the execution time of this method. The delay will be
       * less than 16ms, assuming this method takes more than 1ms to complete.
       */
      timer.schedule(Math.max(MIN_FRAME_DELAY, DEFAULT_FRAME_DELAY - duration.elapsedMillis()));
    }
  }
View Full Code Here

    Button createClippedImages = new Button("time the creation",
        new ClickHandler() {
          boolean firstTime = true;

          public void onClick(ClickEvent event) {
            final Duration d = new Duration();

            final int numImages = size.getValue();
            final TreeImages test = GWT.<TreeImages> create(TreeImages.class);

            for (int i = 0; i < numImages; i++) {
              Image current = test.treeClosed().createImage();

              if (i == numImages - 1) {
                current.addLoadHandler(new LoadHandler() {
                  public void onLoad(LoadEvent event) {
                    if (firstTime) {
                      log.report("Took " + d.elapsedMillis()
                          + " milliseconds to create the images");
                    }
                    firstTime = false;
                  }
                });
View Full Code Here

      }
    });

    Button distroy = new Button("time the removal", new ClickHandler() {
      public void onClick(ClickEvent event) {
        Duration d = new Duration();
        target.clear();

        log.report("Took " + d.elapsedMillis() + " milliseconds to clear "
            + size.getValue() + " widgets from a flow panel");
        for (Widget child : children) {
          if (child.getElement().getPropertyString("__listener") != null) {
            throw new IllegalStateException(
                "each child should no longer have a listener");
View Full Code Here

   */
  public void testEarlyBreakIfAllTaskAreFinished() {
    final SchedulerImpl impl = new SchedulerImpl() {
      @Override
      Duration createDuration() {
        return new Duration() {
          @Override
          public int elapsedMillis() {
            // never expire
            return 0;
          }
View Full Code Here

  /**
   * there for testing
   */
  Duration createDuration() {
    return new Duration();
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.core.client.Duration

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.