本文整理了Java中com.google.gwt.core.client.Scheduler.scheduleFixedPeriod()
方法的一些代码示例,展示了Scheduler.scheduleFixedPeriod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.scheduleFixedPeriod()
方法的具体详情如下:
包路径:com.google.gwt.core.client.Scheduler
类名称:Scheduler
方法名:scheduleFixedPeriod
[英]Schedules a repeating command that is scheduled with a constant periodicity. That is, the command will be invoked every delayMs
milliseconds, regardless of how long the previous invocation took to complete.
[中]计划以恒定周期计划的重复命令。也就是说,无论上一次调用需要多长时间才能完成,该命令都将每delayMs
毫秒调用一次。
代码示例来源:origin: jbossas/console
public void put(final String key, DMRResponse response)
{
values.put(key, response);
Scheduler.get().scheduleFixedPeriod(
new Scheduler.RepeatingCommand() {
@Override
public boolean execute() {
values.remove(key);
return false;
}
}, expiryTimeMs
);
}
代码示例来源:origin: org.jboss.as/jboss-as-console-dmr
public void put(final String key, DMRResponse response)
{
values.put(key, response);
Scheduler.get().scheduleFixedPeriod(
new Scheduler.RepeatingCommand() {
@Override
public boolean execute() {
values.remove(key);
return false;
}
}, expiryTimeMs
);
}
代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl
/**
* Check for updates to the application cache every 30 minutes
*/
private void scheduleUpdateChecker() {
Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() {
@Override
public boolean execute() {
if (!updating) {
updateCache();
}
return true;
}
}, updateCheckInterval);
}
代码示例来源:origin: bedatadriven/activityinfo
private void recalculateTabCount() {
final int[] counter = new int[]{0};
Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() {
@Override
public boolean execute() {
counter[0]++;
NodeList<Element> buttons = getElement().getElementsByTagName("li");
if (buttons.getLength() > 0) {
Element firstButton = buttons.getItem(0);
Element lastButton = buttons.getItem(buttons.getLength() - 1);
if (firstButton.getAbsoluteTop() != lastButton.getAbsoluteTop()) {
tabCount--;
render();
}
return false;
}
if (counter[0] > 10) { // safe exit
return false;
}
return true;
}
}, 500);
}
代码示例来源:origin: bedatadriven/activityinfo
public ObservableCache() {
if(GWT.isClient()) {
Scheduler.get().scheduleFixedPeriod(this::sweepCache, CLEANUP_DELAY_MS);
}
}
代码示例来源:origin: com.goodow.realtime/realtime-channel
@Override
public int setPeriodic(int delayMs, final Handler<Void> handler) {
final int id = timerId++;
RepeatingCommand cmd = new RepeatingCommand() {
@Override
public boolean execute() {
if (timers.has("" + id)) {
handler.handle(null);
return true;
}
return false;
}
};
timers.set("" + id, cmd);
Scheduler.get().scheduleFixedPeriod(cmd, delayMs);
return id;
}
代码示例来源:origin: bedatadriven/activityinfo
private void retry(final CommandRequest request, final RetryCountDown retryCountDown) {
try {
long waitPeriod = retryCountDown.countDownAndGetWaitPeriod();
Log.debug("Retry will run in " + waitPeriod + "ms.");
scheduler.scheduleFixedPeriod(new RepeatingCommand() {
@Override
public boolean execute() {
executeCommand(request, retryCountDown);
return false;
}
}, (int) waitPeriod);
} catch (Exception e) {
Log.error(e.getMessage(), e);
executingCommands.remove(request);
request.onFailure(e);
}
}
}
代码示例来源:origin: bedatadriven/activityinfo
@Inject
public LastSyncStatus(EventBus eventBus) {
this.eventBus = eventBus;
setStyleAttribute("cursor", "pointer");
eventBus.addListener(SyncCompleteEvent.TYPE, new Listener<SyncCompleteEvent>() {
@Override
public void handleEvent(SyncCompleteEvent event) {
lastSyncTime = event.getTime();
setBox(true);
updateLastSyncLabel();
}
});
Scheduler.get().scheduleFixedPeriod(new RepeatingCommand() {
@Override
public boolean execute() {
updateLastSyncLabel();
return true;
}
}, UPDATE_DELAY);
sinkEvents(Event.ONCLICK);
}
代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl
private void pollForStatusOnAndroid() {
if (BrowserInfo.get().isAndroid()) {
Scheduler.get().scheduleFixedPeriod(
new Scheduler.RepeatingCommand() {
@Override
public boolean execute() {
if (updating) {
// The normal listeners are working correctly
return false;
}
switch (getStatus()) {
case IDLE:
hideProgress();
return false;
case UPDATEREADY:
requestUpdate(false);
return false;
default:
return true;
}
}
}, 500);
}
}
代码示例来源:origin: bedatadriven/activityinfo
private void refreshWithNewlyParsedRows() {
eventBus.fireEvent(new PageChangedEvent(false, I18N.CONSTANTS.parsingRows()));
Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() {
@Override
public boolean execute() {
SourceTable sourceTable = model.getSource();
if (!sourceTable.parsedAllRows()) {
sourceTable.parseNextRows(50);
ColumnMappingGrid.this.setRowData(model.getSource().getRows());
ColumnMappingGrid.this.getRowElement(ColumnMappingGrid.this.getRowCount() - 1).scrollIntoView();
} else {
ColumnMappingGrid.this.scrollColumnIntoView(0);
eventBus.fireEvent(new PageChangedEvent(true, ""));
return false;
}
return true;
}
}, 1);
}
}
代码示例来源:origin: org.eclipse.che.core/che-core-ide-app
/**
* Create message stack.
*
* @param resources core resources
*/
@Inject
public NotificationPopupStack(final Resources resources) {
notificationContainer.ensureDebugId(NOTIFICATION_CONTAINER_DBG_ID);
notificationContainer.setStyleName(resources.notificationCss().notificationPopupPlaceholder());
RootPanel.get().add(notificationContainer);
Scheduler.get()
.scheduleFixedPeriod(
new Scheduler.RepeatingCommand() {
/** {@inheritDoc} */
@Override
public boolean execute() {
while (notificationContainer.getWidgetCount() < POPUP_COUNT && !stack.isEmpty()) {
notificationContainer.add(
new NotificationPopup(stack.pop(), resources, NotificationPopupStack.this));
}
return true;
}
},
1000);
}
代码示例来源:origin: org.eclipse.che.core/che-core-ide-app
.scheduleFixedPeriod(
new Scheduler.RepeatingCommand() {
@Override
代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl
public void goOffline(ActivationEvent event) {
online = false;
getConnection().setApplicationRunning(false);
if (!getOfflineApp().isActive()) {
getOfflineApp().activate(event);
if (!isNetworkOnline()) {
Scheduler.get()
.scheduleFixedPeriod(new CheckForNetwork(), 1000);
}
}
}
代码示例来源:origin: org.eclipse.che.core/che-core-ide-app
/** {@inheritDoc} */
@Override
public void scrollBottom() {
/** scroll bottom immediately if view is visible */
if (scrollPanel.getElement().getOffsetParent() != null) {
scrollPanel.getElement().setScrollTop(scrollPanel.getElement().getScrollHeight());
return;
}
/** otherwise, check the visibility periodically and scroll the view when it's visible */
if (!scrollBottomRequired) {
scrollBottomRequired = true;
Scheduler.get()
.scheduleFixedPeriod(
new Scheduler.RepeatingCommand() {
@Override
public boolean execute() {
if (scrollPanel.getElement().getOffsetParent() != null) {
scrollPanel
.getElement()
.setScrollTop(scrollPanel.getElement().getScrollHeight());
scrollBottomRequired = false;
return false;
}
return true;
}
},
1000);
}
}
内容来源于网络,如有侵权,请联系作者删除!