com.google.gwt.core.client.Duration.currentTimeMillis()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中com.google.gwt.core.client.Duration.currentTimeMillis()方法的一些代码示例,展示了Duration.currentTimeMillis()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Duration.currentTimeMillis()方法的具体详情如下:
包路径:com.google.gwt.core.client.Duration
类名称:Duration
方法名:currentTimeMillis

Duration.currentTimeMillis介绍

[英]Returns the same result as System#currentTimeMillis(), but as a double. Because emulated long math is significantly slower than doubles in Production Mode, this method is to be preferred.
[中]返回与System#currentTimeMillis()相同的结果,但为双精度。由于在生产模式下,模拟的长数学运算速度明显慢于双倍运算,因此此方法是首选方法。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Returns the number of milliseconds that have elapsed since this object was
 * created.
 */
public int elapsedMillis() {
 return uncheckedConversion(currentTimeMillis() - start);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
 public void run() {
  assert (!isExecuting());
  setExecutionTimerPending(false);
  doExecuteCommands(Duration.currentTimeMillis());
 }
};

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
 public boolean execute() {
  double currentTime = Duration.currentTimeMillis();
  Iterator<TemporalPoint> iter = touchPositionsDuringMomentum.iterator();
  while (iter.hasNext()) {
   TemporalPoint point = iter.next();
   if (currentTime - point.getTime() >= TIME_THRESHOLD) {
    iter.remove();
   }
  }
  return !touchPositionsDuringMomentum.isEmpty();
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Immediately run this animation. If the animation is already running, it
 * will be canceled first.
 * <p>
 * If the element is not <code>null</code>, the {@link #onUpdate(double)}
 * method might be called only if the element may be visible (generally left
 * at the appreciation of the browser). Otherwise, it will be called
 * unconditionally.
 * 
 * @param duration the duration of the animation in milliseconds
 * @param element the element that visually bounds the entire animation
 */
public void run(int duration, Element element) {
 run(duration, Duration.currentTimeMillis(), element);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public void onBrowserEvent(Event event) {
 // Align the scrollbars with the content.
 if (Event.ONSCROLL == event.getTypeInt()) {
  double curTime = Duration.currentTimeMillis();
  if (curTime > ignoreContentUntil) {
   ignoreScrollbarsUntil = curTime + IGNORE_SCROLL_TIMEOUT;
   maybeUpdateScrollbarPositions();
  }
 }
 super.onBrowserEvent(event);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
 public void onScroll(ScrollEvent event) {
  double curTime = Duration.currentTimeMillis();
  if (curTime > ignoreScrollbarsUntil) {
   ignoreContentUntil = curTime + IGNORE_SCROLL_TIMEOUT;
   int hPos = scrollbar.getHorizontalScrollPosition();
   if (getHorizontalScrollPosition() != hPos) {
    setHorizontalScrollPosition(hPos);
   }
  }
 }
});

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Run this animation at the given startTime. If the startTime has already
 * passed, the animation will run synchronously as if it started at the
 * specified start time. If the animation is already running, it will be
 * canceled first.
 * <p>
 * If the element is not <code>null</code>, the {@link #onUpdate(double)}
 * method might be called only if the element may be visible (generally left
 * at the appreciation of the browser). Otherwise, it will be called
 * unconditionally.
 * 
 * @param duration the duration of the animation in milliseconds
 * @param startTime the synchronized start time in milliseconds
 * @param element the element that visually bounds the entire animation
 */
public void run(int duration, double startTime, Element element) {
 // Cancel the animation if it is running
 cancel();
 // Save the duration and startTime
 isRunning = true;
 isStarted = false;
 this.duration = duration;
 this.startTime = startTime;
 this.element = element;
 ++runId;
 // Execute the first callback.
 callback.execute(Duration.currentTimeMillis());
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Called by ModuleSpace in Development Mode when running onModuleLoads.
 */
private static boolean enter() {
 assert entryDepth >= 0 : "Negative entryDepth value at entry " + entryDepth;
 if (GWT.isScript() && entryDepth != 0) {
  double now = Duration.currentTimeMillis();
  if (now - watchdogEntryDepthLastScheduled > WATCHDOG_ENTRY_DEPTH_CHECK_INTERVAL_MS) {
   watchdogEntryDepthLastScheduled = now;
   watchdogEntryDepthTimerId = watchdogEntryDepthSchedule();
  }
 }
 // We want to disable some actions in the reentrant case
 if (entryDepth++ == 0) {
  SchedulerImpl.INSTANCE.flushEntryCommands();
  return true;
 }
 return false;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Checks if the click event point is related to the touch positions
 * during the recent momentum scrolling.
 *
 * @param clickPoint point of the click event
 * @return true if clickPoint is the same as one of the touch positions during
 *     the recent momentum scrolling
 */
private boolean isClickTouchPositionDuringMomentum(Point clickPoint) {
 double currentTime = Duration.currentTimeMillis();
 boolean same = false;
 for (TemporalPoint point : touchPositionsDuringMomentum) {
  if (currentTime - point.getTime() <= TIME_THRESHOLD &&
    hitTest(clickPoint, point.getPoint())) {
   same = true;
   break;
  }
 }
 return same;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
 public void onScroll(ScrollEvent event) {
  double curTime = Duration.currentTimeMillis();
  if (curTime > ignoreScrollbarsUntil) {
   ignoreContentUntil = curTime + IGNORE_SCROLL_TIMEOUT;
   int vPos = scrollbar.getVerticalScrollPosition();
   int v = getVerticalScrollPosition();
   if (getVerticalScrollPosition() != vPos) {
    setVerticalScrollPosition(vPos);
   }
  }
 }
});

代码示例来源:origin: org.atmosphere/atmosphere-gwt-client

@Override
public void onMessage(List<?> messages) {
  lastReceivedTime = Duration.currentTimeMillis();
  doOnMessage(messages, this);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

double startTouchTime = Duration.currentTimeMillis();
recentTouchPosition.setTemporalPoint(startTouchPosition, startTouchTime);
lastTouchPosition.setTemporalPoint(startTouchPosition, startTouchTime);

代码示例来源:origin: com.google.gwt/gwt-servlet

if (hasTimeSliceExpired(Duration.currentTimeMillis(), startTimeMillis)) {

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * Returns the number of milliseconds that have elapsed since this object was
 * created.
 */
public int elapsedMillis() {
 return uncheckedConversion(currentTimeMillis() - start);
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
 public void run() {
  assert (!isExecuting());
  setExecutionTimerPending(false);
  doExecuteCommands(Duration.currentTimeMillis());
 }
};

代码示例来源:origin: com.google.web.bindery/requestfactory-server

/**
 * Returns the number of milliseconds that have elapsed since this object was
 * created.
 */
public int elapsedMillis() {
 return uncheckedConversion(currentTimeMillis() - start);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

double now = Duration.currentTimeMillis();
if (now - this.lastClick < DOUBLE_CLICK_TIMEOUT) {
 now = 0;

代码示例来源:origin: com.google.gwt/gwt-servlet

double touchTime = Duration.currentTimeMillis();
lastTouchPosition.setTemporalPoint(touchPoint, touchTime);
if (!dragging) {

代码示例来源:origin: net.wetheinter/gwt-user

@Override
public void onBrowserEvent(Event event) {
 // Align the scrollbars with the content.
 if (Event.ONSCROLL == event.getTypeInt()) {
  double curTime = Duration.currentTimeMillis();
  if (curTime > ignoreContentUntil) {
   ignoreScrollbarsUntil = curTime + IGNORE_SCROLL_TIMEOUT;
   maybeUpdateScrollbarPositions();
  }
 }
 super.onBrowserEvent(event);
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
 public void onScroll(ScrollEvent event) {
  double curTime = Duration.currentTimeMillis();
  if (curTime > ignoreScrollbarsUntil) {
   ignoreContentUntil = curTime + IGNORE_SCROLL_TIMEOUT;
   int hPos = scrollbar.getHorizontalScrollPosition();
   if (getHorizontalScrollPosition() != hPos) {
    setHorizontalScrollPosition(hPos);
   }
  }
 }
});

相关文章