|
GWT 2.7.0 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.google.gwt.core.client.Scheduler
com.google.gwt.core.client.testing.StubScheduler
public class StubScheduler
A fake scheduler that records scheduled commands and can execute them when asked to.
Typical usage:
scheduleCommands(scheduler); assertFalse(scheduler.executeCommands());
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.google.gwt.core.client.Scheduler |
|---|
Scheduler.RepeatingCommand, Scheduler.ScheduledCommand |
| Constructor Summary | |
|---|---|
StubScheduler()
|
|
| Method Summary | |
|---|---|
boolean |
executeCommands()
Executes all scheduled commands once. |
boolean |
executeRepeatingCommands()
Executes all scheduled RepeatingCommands once. |
boolean |
executeScheduledCommands()
Executes all scheduled ScheduledCommands that have been passed to this scheduler,
then removes all commands. |
java.util.List<Scheduler.RepeatingCommand> |
getRepeatingCommands()
Returns the currently scheduled RepeatingCommands that would be executed
by executeRepeatingCommands(). |
java.util.List<Scheduler.ScheduledCommand> |
getScheduledCommands()
Returns the currently scheduled ScheduledCommands that would be executed
by executeScheduledCommands(). |
void |
scheduleDeferred(Scheduler.ScheduledCommand cmd)
A deferred command is executed after the browser event loop returns. |
void |
scheduleEntry(Scheduler.RepeatingCommand cmd)
An "entry" command will be executed before GWT-generated code is invoked by the browser's event loop. |
void |
scheduleEntry(Scheduler.ScheduledCommand cmd)
An "entry" command will be executed before GWT-generated code is invoked by the browser's event loop. |
void |
scheduleFinally(Scheduler.RepeatingCommand cmd)
A "finally" command will be executed before GWT-generated code returns control to the browser's event loop. |
void |
scheduleFinally(Scheduler.ScheduledCommand cmd)
A "finally" command will be executed before GWT-generated code returns control to the browser's event loop. |
void |
scheduleFixedDelay(Scheduler.RepeatingCommand cmd,
int delayMs)
Schedules a repeating command that is scheduled with a constant delay. |
void |
scheduleFixedPeriod(Scheduler.RepeatingCommand cmd,
int delayMs)
Schedules a repeating command that is scheduled with a constant periodicity. |
void |
scheduleIncremental(Scheduler.RepeatingCommand cmd)
Schedules a repeating command that performs incremental work. |
| Methods inherited from class com.google.gwt.core.client.Scheduler |
|---|
get |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StubScheduler()
| Method Detail |
|---|
public java.util.List<Scheduler.RepeatingCommand> getRepeatingCommands()
RepeatingCommands that would be executed
by executeRepeatingCommands().
public boolean executeCommands()
executeRepeatingCommands()
then executeScheduledCommands().
Caveat: executes once any scheduled command created when executing the repeating commands.
true) or
new commands have been scheduled after the executionpublic boolean executeRepeatingCommands()
RepeatingCommands once. Does not execute the commands
newly scheduled by the initial commands. Removes the commands that returned false.
After this method completes, getRepeatingCommands() returns only the commands
that are still scheduled.
true) or
new commands have been scheduled after the executionpublic java.util.List<Scheduler.ScheduledCommand> getScheduledCommands()
ScheduledCommands that would be executed
by executeScheduledCommands().
public boolean executeScheduledCommands()
ScheduledCommands that have been passed to this scheduler,
then removes all commands.
After this method completes, getScheduledCommands() returns only the commands
that have been scheduled by the initial commands.
public void scheduleDeferred(Scheduler.ScheduledCommand cmd)
Scheduler
scheduleDeferred in class Schedulerpublic void scheduleEntry(Scheduler.RepeatingCommand cmd)
SchedulerScheduler.RepeatingCommand will be called once
per entry from the event loop until false is returned. This
type of command is appropriate for instrumentation or code that needs to
know when "something happens."
If an entry command schedules another entry command, the second command will be executed before control flow continues to the GWT-generated code.
scheduleEntry in class Schedulerpublic void scheduleEntry(Scheduler.ScheduledCommand cmd)
SchedulerIf an entry command schedules another entry command, the second command will be executed before control flow continues to the GWT-generated code.
scheduleEntry in class Schedulerpublic void scheduleFinally(Scheduler.RepeatingCommand cmd)
SchedulerScheduler.RepeatingCommand.execute()
method will be called once per exit to the event loop until
false is returned. This type of command is appropriate for
instrumentation or cleanup code.
If a finally command schedules another finally command, the second command will be executed before control flow returns to the browser.
scheduleFinally in class Schedulerpublic void scheduleFinally(Scheduler.ScheduledCommand cmd)
SchedulerIf a finally command schedules another finally command, the second command will be executed before control flow returns to the browser.
Consider the following:
try {
nativeEventCallback(); // Calls scheduleFinally one or more times
} finally {
executeFinallyCommands();
}
scheduleFinally in class SchedulerStyleInjector
public void scheduleFixedDelay(Scheduler.RepeatingCommand cmd,
int delayMs)
SchedulerdelayMs milliseconds after the last invocation completes.
For example, assume that a command takes 30ms to run and a 100ms delay is provided. The second invocation of the command will occur at 130ms after the first invocation starts.
scheduleFixedDelay in class Schedulercmd - the command to executedelayMs - the amount of time to wait after one invocation ends before
the next invocation
public void scheduleFixedPeriod(Scheduler.RepeatingCommand cmd,
int delayMs)
SchedulerdelayMs milliseconds, regardless of how long the previous
invocation took to complete.
scheduleFixedPeriod in class Schedulercmd - the command to executedelayMs - the period with which the command is executedpublic void scheduleIncremental(Scheduler.RepeatingCommand cmd)
Scheduler
scheduleIncremental in class Schedulercmd - the command to execute
|
GWT 2.7.0 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||