Package com.google.gwt.core.client

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


      return null;
    }

    boolean canceledSomeTasks = false;

    Duration duration = createDuration();
    while (duration.elapsedMillis() < TIME_SLICE) {
      boolean executedSomeTask = false;
      for (int i = 0; i < length; i++) {
        assert tasks.length() == length : "Working array length changed " + tasks.length() + " != "
            + length;
        Task t = tasks.get(i);
View Full Code Here


  private void reset(GqEvent nativeEvent) {
    this.startEvent = nativeEvent;
    this.startX = getClientX(nativeEvent);
    this.startY = getClientY(nativeEvent);
    this.mouseUpDuration = new Duration();
  }
View Full Code Here

        alreadyContainedResources.addAll(resourceSet.toList());
        alreadyContainedResources.retainAll(resourceModel.getResources()
                .toList());

        if (Benchmark.isBenchmarkEnabled()) {
            Duration duration = new Duration();
            resourceModel.addResourceSet(resourceSet);
            Window.alert("ResourceModel.addResourceSet execution time: "
                    + duration.elapsedMillis() + " ms");
        } else {
            resourceModel.addResourceSet(resourceSet);
        }

        assert resourceModel.containsResourceSet(resourceSet);
View Full Code Here

        alreadyContainedResources.addAll(resourceSet.toList());
        alreadyContainedResources.retainAll(resourceModel.getResources()
                .toList());

        if (DevelopmentSettings.isBenchmarkEnabled()) {
            Duration duration = new Duration();
            resourceModel.addResourceSet(resourceSet);
            Window.alert("ResourceModel.addResourceSet execution time: "
                    + duration.elapsedMillis() + " ms");
        } else {
            resourceModel.addResourceSet(resourceSet);
        }

        assert resourceModel.containsResourceSet(resourceSet);
View Full Code Here

   Duration duration;

   @Before
   public void beforeDurationTest() {
      duration = new Duration();
   }
View Full Code Here

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

      return null;
    }

    boolean canceledSomeTasks = false;

    Duration duration = createDuration();
    while (duration.elapsedMillis() < TIME_SLICE) {
      boolean executedSomeTask = false;
      for (int i = 0; i < length; i++) {
        assert tasks.length() == length : "Working array length changed " + tasks.length() + " != "
            + length;
        Task t = tasks.get(i);
View Full Code Here

  @Override
  public void moveTo(double location) {
    startLocation = getViewport().getStart();
    endLocation = location;
    counter = new Duration();
    execute();
    scheduler.scheduleDelayed(this, 0);
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void onJavaScriptEvent(String name, Event rawEvent) {
    double processTiming = 0;
    Duration instrumentedDuration = null;
    // These events should never be stopped by the editor since other handlers
    // rely on getting to handle them.
    // TODO(danilatos): clean this mess up.
    boolean hackEditorNeverConsumes = name.equals("contextmenu") || name.equals("click")
        || name.equals("mousedown");

    try {
      EditorEvent event = SignalEventImpl.create(EditorEventImpl.FACTORY,
          rawEvent, !hackEditorNeverConsumes);

      try {
        if (UserAgent.isMac() &&
            rawEvent.getCtrlKey() && rawEvent.getAltKey()
            && rawEvent.getTypeInt() == Event.ONKEYPRESS) {
          // In mac safari, Ctrl+Alt+something often inserts weird invisible
          // characters in the dom!!! Always cancel the event, no matter what
          // (We can still handle it programmatically if we wish)

          // Cancel for FF as well just in case - but if this causes an issue
          // it should be OK to enable for FF. We get keypress events, but
          // no dom munge.

          // Don't cancel it on Windows, because that prevents AltGr combos
          // from working in european languages

          EditorStaticDeps.logger.trace().log("Cancelling dangerous: " + rawEvent.getType());

          rawEvent.preventDefault();
        }
      } catch (JavaScriptException e) {
        // If this fails, swallow it. Seems to cause issues with dom mutation
        // events when setting contentEditable with JUnit tests.
      }

      if (event == null) {
        if (!hackEditorNeverConsumes) {
          try {
            rawEvent.stopPropagation();
          } catch (JavaScriptException e) {
            // If this fails, swallow it. Seems to cause issues with dom mutation
            // events when setting contentEditable with JUnit tests.
          }
        }
        return;
      }

      boolean cancel = false;

      if (!hackEditorNeverConsumes) {
        if (editorRelevantEvent(event)) {
          try {
            event.stopPropagation();
          } catch (JavaScriptException e) {
            // If this fails, swallow it. Seems to cause issues with dom mutation
            // events when setting contentEditable with JUnit tests.
          }
        } else {
          return;
        }
      }

      boolean isMutationEvent = event.isMutationEvent();

      if (!isMutationEvent || !EditorStaticDeps.shouldIgnoreMutations()) {
        EditorStaticDeps.startIgnoreMutations();
        try {
          if (debugDisabled) {
            cancel = false;
          } else if (!canHandleBrowserEvents()) {
            // If we're too busy for it to be safe to do anything at all,
            // we cancel the event altogether
            EditorStaticDeps.logger.trace().log("Too busy to handle: ", event);
            cancel = true;
          } else {
            // Cache the selection across multiple calls to Selection.get(), for the
            // duration of this event handler. We turn caching off again in the finally
            // block below.
            NativeSelectionUtil.cacheOn();

            // Normal event handling
            responsibility.startDirectSequence();
            try {
              if (settings.getInstrumentor().shouldInstrument(event)) {
                Duration timer = new Duration();
                cancel = eventHandler.handleEvent(event);
                processTiming = timer.elapsedMillis();
                instrumentedDuration = new Duration();
              } else {
                cancel = eventHandler.handleEvent(event);
              }
            } finally {
              responsibility.endDirectSequence();
View Full Code Here

        cellInfo.testIndex = (int) group.get("test_idx").isNumber().doubleValue();
        lastCellInfo = cellInfo;
    }

    public void refresh(JSONObject condition, Command onFinished) {
        timer = new Duration();
        this.onFinished = onFinished;
        dataSource.query(condition, this);
    }
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.