All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.gwt.test.internal.patchers.SchedulerImplPatcher Maven / Gradle / Ivy

There is a newer version: 0.63
Show newest version
package com.googlecode.gwt.test.internal.patchers;

import com.google.gwt.core.client.Scheduler.RepeatingCommand;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.client.impl.SchedulerImpl;
import com.googlecode.gwt.test.internal.BrowserSimulatorImpl;
import com.googlecode.gwt.test.patchers.PatchClass;
import com.googlecode.gwt.test.patchers.PatchMethod;

@PatchClass(SchedulerImpl.class)
class SchedulerImplPatcher {

    @PatchMethod
    static void scheduleDeferred(SchedulerImpl impl, ScheduledCommand cmd) {
        BrowserSimulatorImpl.get().scheduleDeferred(cmd);
    }

    @PatchMethod
    static void scheduleEntry(SchedulerImpl impl, RepeatingCommand cmd) {
        BrowserSimulatorImpl.get().scheduleEntry(cmd);
    }

    @PatchMethod
    static void scheduleEntry(SchedulerImpl impl, ScheduledCommand cmd) {
        BrowserSimulatorImpl.get().scheduleEntry(cmd);
    }

    @PatchMethod
    static void scheduleFinally(SchedulerImpl impl, RepeatingCommand cmd) {
        BrowserSimulatorImpl.get().scheduleFinally(cmd);
    }

    @PatchMethod
    static void scheduleFinally(SchedulerImpl impl, ScheduledCommand cmd) {
        BrowserSimulatorImpl.get().scheduleFinally(cmd);
    }

    @PatchMethod
    static void scheduleFixedDelay(SchedulerImpl impl, RepeatingCommand cmd, int delayMs) {
        executeRepeatingCommand(cmd);
    }

    @PatchMethod
    static void scheduleFixedPeriod(SchedulerImpl impl, RepeatingCommand cmd, int delayMs) {
        executeRepeatingCommand(cmd);
    }

    @PatchMethod
    static void scheduleIncremental(SchedulerImpl impl, RepeatingCommand cmd) {
        executeRepeatingCommand(cmd);
    }

    private static void executeRepeatingCommand(RepeatingCommand cmd) {
        boolean repeat = true;
        while (repeat) {
            repeat = cmd.execute();
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy