org.xwiki.gwt.user.client
Class DeferredUpdater

java.lang.Object
  extended by org.xwiki.gwt.user.client.DeferredUpdater
All Implemented Interfaces:
TimerListener

public class DeferredUpdater
extends Object
implements TimerListener

Schedules updates for an Updatable object and ensures that only the most recent update is actually executed.

Version:
$Id: bb847a43a279797f5d5bb3e7cd5eed689acba8b7 $

Field Summary
static int DEFAULT_DELAY
          The default number of milliseconds to wait before executing an update.
 
Constructor Summary
DeferredUpdater(Updatable updatable)
          Creates a new deferred updater for the specified Updatable object.
DeferredUpdater(Updatable updatable, int delay)
          Creates a new deferred updater for the specified Updatable object.
 
Method Summary
 void deferUpdate()
          Cancels any pending updates and schedule a new update for the underlying object.
 void onElapsed(Timer sender)
          Called whenever the delay period of the timer elapses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DELAY

public static final int DEFAULT_DELAY
The default number of milliseconds to wait before executing an update.

See Also:
Constant Field Values
Constructor Detail

DeferredUpdater

public DeferredUpdater(Updatable updatable)
Creates a new deferred updater for the specified Updatable object. The updates are delayed with the default number of milliseconds, 500. Only the most recent update is executed.

Parameters:
updatable - the object whose updates are going to be deferred

DeferredUpdater

public DeferredUpdater(Updatable updatable,
                       int delay)
Creates a new deferred updater for the specified Updatable object. The updates are delayed with the specified number of milliseconds. Only the most recent update is executed.

Parameters:
updatable - the object whose updates are going to be deferred
delay - the number of milliseconds to wait before executing an update
Method Detail

deferUpdate

public void deferUpdate()
Cancels any pending updates and schedule a new update for the underlying object.


onElapsed

public void onElapsed(Timer sender)
Description copied from interface: TimerListener
Called whenever the delay period of the timer elapses.

Specified by:
onElapsed in interface TimerListener
Parameters:
sender - The timer whose delay period elapsed. The listener should be registered to this timer.


Copyright © 2004-2012 XWiki. All Rights Reserved.