com.smartgwt.client.event

## Class SmartGwtTimer

- java.lang.Object
- - com.smartgwt.client.event.SmartGwtTimer

-     public abstract class SmartGwtTimer
      extends java.lang.Object

  `SmartGwtTimer` is an alternative to GWT's built-in `Timer` class that may allow code to be executed more efficiently. The SmartClient Framework is aware of threads run using a `SmartGwtTimer`, so extra work (e.g. reflowing `Layout` members, refreshing `DrawItem`s, etc.) queued by a timer's `run()` method gets processed before it returns control to its caller, instead of being scheduled to run in a future (second) timer call.

  Note that if you are replacing or updating components in a `Timer` and notice a visible flash, switching to a `SmartGwtTimer`, which offers identical public APIs to `Timer`, may solve the issue.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SmartGwtTimer()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancel()` Cancels this timer.
    `boolean` | `isRunning()` Returns true if the timer is running.
    `abstract void` | `run()` This method will be called when a timer fires.
    `void` | `schedule(int delayMillis)` Schedules a timer to elapse in the future.
    `void` | `scheduleRepeating(int periodMillis)` Schedules a timer that elapses repeatedly.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SmartGwtTimer

          public SmartGwtTimer()

  - ### Method Detail

    - #### cancel

          public void cancel()

      Cancels this timer. If the timer is not running, this is a no-op.

    - #### isRunning

          public boolean isRunning()

      Returns true if the timer is running. Timer is running if and only if it is scheduled but it is not expired or cancelled.
      Returns:
        whether timer is running

    - #### schedule

          public void schedule(int delayMillis)

      Schedules a timer to elapse in the future. If the timer is already running then it will be first canceled before re-scheduling.
      Parameters:
        `delayMillis` - delay in milliseconds before timer fires

    - #### scheduleRepeating

          public void scheduleRepeating(int periodMillis)

      Schedules a timer that elapses repeatedly. If the timer is already running then it will be first canceled before re-scheduling.
      Parameters:
        `periodMillis` - delay in milliseconds between timer fires

    - #### run

          public abstract void run()

      This method will be called when a timer fires. Override it to implement the timer's logic.