本文整理汇总了Java中org.waveprotocol.wave.client.scheduler.Scheduler类的典型用法代码示例。如果您正苦于以下问题:Java Scheduler类的具体用法?Java Scheduler怎么用?Java Scheduler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Scheduler类属于org.waveprotocol.wave.client.scheduler包,在下文中一共展示了Scheduler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cleanUp
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
private void cleanUp() {
RootPanel.get().remove(doubleLoadedImage);
final HandlerRegistration onLoadReg = onLoadHandlerRegistration;
final HandlerRegistration onErrorReg = onErrorHandlerRegistration;
// HACK(user): There is a bug in GWT which stops us from removing a listener in HOSTED
// mode inside the invoke context. Put the remove in a deferred command to avoid this
// error
ScheduleCommand.addCommand(new Scheduler.Task() {
@Override
public void execute() {
onLoadReg.removeHandler();
onErrorReg.removeHandler();
}
});
onLoadHandlerRegistration = null;
onErrorHandlerRegistration = null;
completed = true;
}
示例2: loadStageTwo
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
private void loadStageTwo(final StageOne one) {
final Timer timer = Timing.start("Stage Two");
SchedulerInstance.getHighPriorityTimer().schedule(new Scheduler.Task() {
@Override
public void execute() {
createStageTwoLoader(one).call(new Accessor<StageTwo>() {
@Override
public void use(StageTwo x) {
Timing.stop(timer);
if (x != null) {
loadStageThree(x);
} else {
finish();
}
}
});
}
});
}
示例3: loadStageThree
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
private void loadStageThree(final StageTwo two) {
final Timer timer = Timing.start("Stage Tree");
SchedulerInstance.getHighPriorityTimer().schedule(new Scheduler.Task() {
@Override
public void execute() {
createStageThreeLoader(two).call(new Accessor<StageThree>() {
@Override
public void use(StageThree x) {
Timing.stop(timer);
finish();
}
});
}
});
}
示例4: scheduleUpdateNotification
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
/**
* Schedule the editor's update notification
*/
void scheduleUpdateNotification(
boolean selectionCoordsChanged,
boolean selectionLocationChanged,
boolean contentChanged,
boolean userDirectlyChangedContent) {
// Internal editor throttling
// We want special behaviour, here where we do not reset the delay every
// time this method is called by rescheduling - so we first check if the
// notification task is scheduled.
notedSelectionCoordsChanged |= selectionCoordsChanged;
notedSelectionLocationChanged |= selectionLocationChanged;
notedContentChanged |= contentChanged;
notedUserDirectlyChangedContent |= userDirectlyChangedContent;
Scheduler scheduler = SchedulerInstance.get();
if (!scheduler.isScheduled(notificationTask)) {
int delay = (contentChanged || userDirectlyChangedContent) ? 0 : INITIAL_NOTIFY_SCHEDULE_DELAY_MS;
scheduler.scheduleRepeating(Priority.MEDIUM, notificationTask, delay, NOTIFY_SCHEDULE_DELAY_GAP_MS);
} else {
notifyAgain = true;
}
}
示例5: TypingExtractor
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
TypingExtractor(TypingSink sink, NodeManager manager, TimerService service,
HtmlView filteredHtmlView, ContentView renderedContentView, Repairer repairer,
SelectionSource selectionSource) {
this.sink = sink;
this.manager = manager;
this.selectionSource = selectionSource;
this.timerService = service;
this.filteredHtmlView = filteredHtmlView;
this.renderedContentView = renderedContentView;
this.repairer = repairer;
this.flushCmd = new Scheduler.Task() {
@Override
public void execute() {
flush();
}
};
}
示例6: setPopupPositionAndMakeVisible
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void setPopupPositionAndMakeVisible(final Element relative, final Element p) {
ScheduleCommand.addCommand(new Scheduler.Task() {
@Override
public void execute() {
p.getStyle().setLeft(relative.getAbsoluteLeft() + (relative.getOffsetWidth() - p.getOffsetWidth()) / 2, Unit.PX);
int height = PositionUtil.boundHeightToScreen(p.getOffsetHeight());
int top = relative.getAbsoluteTop() + (relative.getOffsetHeight() - height) / 2;
// Prevent negative top position.
p.getStyle().setTop(Math.max(top, MIN_OFFSET_HEIGHT_DEFAULT), Unit.PX);
p.getStyle().setHeight(height, Unit.PX);
p.getStyle().setVisibility(Visibility.VISIBLE);
}
});
}
示例7: cleanUp
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
private void cleanUp() {
RootPanel.get().remove(doubleLoadedImage);
final HandlerRegistration onLoadReg = onLoadHandlerRegistration;
final HandlerRegistration onErrorReg = onErrorHandlerRegistration;
// HACK(user): There is a bug in GWT which stops us from removing a listener in HOSTED
// mode inside the invoke context. Put the remove in a deferred command to avoid this
// error
ScheduleCommand.addCommand(new Scheduler.Task() {
public void execute() {
onLoadReg.removeHandler();
onErrorReg.removeHandler();
}
});
onLoadHandlerRegistration = null;
onErrorHandlerRegistration = null;
completed = true;
}
示例8: loadStageTwo
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
private void loadStageTwo(final StageOne one) {
final Timer timer = Timing.start("Stage Two");
SchedulerInstance.getHighPriorityTimer().schedule(new Scheduler.Task() {
@Override
public void execute() {
createStageTwoLoader(one).call(new Accessor<StageTwo>() {
@Override
public void use(StageTwo x) {
Timing.stop(timer);
loadStageThree(x);
}
});
}
});
}
示例9: scheduleUpdateNotification
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
/**
* Schedule the editor's update notification
*/
void scheduleUpdateNotification(
boolean selectionCoordsChanged,
boolean selectionLocationChanged,
boolean contentChanged,
boolean userDirectlyChangedContent) {
// Internal editor throttling
// We want special behaviour, here where we do not reset the delay every
// time this method is called by rescheduling - so we first check if the
// notification task is scheduled.
notedSelectionCoordsChanged |= selectionCoordsChanged;
notedSelectionLocationChanged |= selectionLocationChanged;
notedContentChanged |= contentChanged;
notedUserDirectlyChangedContent |= userDirectlyChangedContent;
Scheduler scheduler = SchedulerInstance.get();
if (!scheduler.isScheduled(notificationTask)) {
scheduler.scheduleRepeating(Priority.MEDIUM, notificationTask,
INITIAL_NOTIFY_SCHEDULE_DELAY_MS, NOTIFY_SCHEDULE_DELAY_GAP_MS);
} else {
notifyAgain = true;
}
}
示例10: setPopupPositionAndMakeVisible
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void setPopupPositionAndMakeVisible(Element relative, final Element p) {
ScheduleCommand.addCommand(new Scheduler.Task() {
@Override
public void execute() {
p.getStyle().setLeft((RootPanel.get().getOffsetWidth() - p.getOffsetWidth()) / 2, Unit.PX);
int height = PositionUtil.boundHeightToScreen(p.getOffsetHeight());
int top = (RootPanel.get().getOffsetHeight() - height) / 2;
// Prevent negative top position.
p.getStyle().setTop(Math.max(top, MIN_OFFSET_HEIGHT_DEFAULT), Unit.PX);
p.getStyle().setHeight(height, Unit.PX);
p.getStyle().setVisibility(Visibility.VISIBLE);
}
});
}
示例11: addItem
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
public void addItem(String text, final Scheduler.Task command) {
Element elem = Document.get().createAnchorElement();
elem.setInnerText(text);
DomHelper.registerEventHandler(elem, "click", new JavaScriptEventListener() {
@Override public void onJavaScriptEvent(String name, Event event) {
command.execute();
}
});
element.appendChild(elem);
}
示例12: fetchWaveView
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
@Override
public void fetchWaveView(final IdFilter waveletFilter, final boolean fromLastRead,
final int minBlipReplySize, final int maxBlipReplySize, final int maxBlipCount, final FetchWaveViewCallback callback) {
Preconditions.checkState(state == State.INITIAL || state == State.OPENING || state == State.OPENED,
"Invalid state: %s", state);
waveService.viewFetchWave(waveletFilter, fromLastRead, minBlipReplySize, maxBlipReplySize, maxBlipCount,
new FetchWaveCallback() {
@Override
public void onSuccess(WaveViewData waveView) {
if (state == State.INITIAL || state == State.OPENING || state == State.OPENED) {
if (indexingInProcess) {
indexingInProcess = false;
indexingCallback.onIndexingComplete();
}
callback.onWaveViewFetch(waveView);
}
}
@Override
public void onFailure(ReturnStatus status) {
if (state == State.INITIAL || state == State.OPENING || state == State.OPENED) {
if (status.getCode() == ReturnCode.INDEXING_IN_PROCESS) {
indexingInProcess = true;
String[] parts = status.getMessage().split(" ");
indexingCallback.onIndexing(Long.parseLong(parts[0]), Long.parseLong(parts[1]));
repeatRequestScheduler.scheduleDelayed(new Scheduler.Task() {
@Override
public void execute() {
fetchWaveView(waveletFilter, fromLastRead, minBlipReplySize, maxBlipReplySize, maxBlipCount, callback);
}
}, REPEAT_REQUEST_WHEN_INDEXING_MS);
} else {
callback.onFailure(status);
}
}
}
});
}
示例13: fetchFragments
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
@Override
public void fetchFragments(final WaveletId waveletId, Map<SegmentId, Long> segments,
final long endVersion, final int minReplySize, final int maxReplySize, final FetchFragmentsCallback callback) {
Preconditions.checkState(state == State.INITIAL || state == State.OPENING || state == State.OPENED,
"Invalid state: %s", state);
waveService.viewFetchFragments(waveletId, segments, endVersion, minReplySize, maxReplySize,
new WaveViewService.FetchFragmentsCallback() {
@Override
public void onSuccess(Map<SegmentId, RawFragment> rawFragments) {
if (state == State.INITIAL || state == State.OPENING || state == State.OPENED) {
if (indexingInProcess) {
indexingInProcess = false;
indexingCallback.onIndexingComplete();
}
callback.onWaveFragmentsFetch(rawFragments);
}
}
@Override
public void onFailure(ReturnStatus status) {
if (state == State.INITIAL || state == State.OPENING || state == State.OPENED) {
if (status.getCode() == ReturnCode.INDEXING_IN_PROCESS) {
indexingInProcess = true;
String[] parts = status.getMessage().split(" ");
indexingCallback.onIndexing(Long.parseLong(parts[0]), Long.parseLong(parts[1]));
repeatRequestScheduler.scheduleDelayed(new Scheduler.Task() {
@Override
public void execute() {
fetchFragments(waveletId, null, endVersion, minReplySize, maxReplySize, callback);
}
}, REPEAT_REQUEST_WHEN_INDEXING_MS);
} else {
callback.onFailure(status);
}
}
}
});
}
示例14: scheduleMutationNotification
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
private void scheduleMutationNotification(ContentElement element) {
MutationHandler handler = getMutationHandler(element);
if (handler != null) {
mutatedElements.add(element);
}
Scheduler scheduler = SchedulerInstance.get();
if (!scheduler.isScheduled(mutationNotificationTask)) {
scheduler.scheduleDelayed(Priority.MEDIUM, mutationNotificationTask,
NOTIFY_SCHEDULE_DELAY_MS);
}
}
示例15: EditorEventHandler
import org.waveprotocol.wave.client.scheduler.Scheduler; //导入依赖的package包/类
/**
* @param editorInteractor
* @param subHandler
*/
public EditorEventHandler(EditorInteractor editorInteractor, EditorEventsSubHandler subHandler,
NodeEventRouter router,
boolean useWhiteListFlag, boolean useWebkitCompositionFlag) {
this(new SchedulerTimerService(SchedulerInstance.get(), Scheduler.Priority.CRITICAL),
editorInteractor, subHandler, router,
useWhiteListFlag,
// We may want to turn off composition events for webkit if something goes wrong...
QuirksConstants.SUPPORTS_COMPOSITION_EVENTS &&
(UserAgent.isWebkit() ? useWebkitCompositionFlag : true));
}