com.maryanovsky.gwtutils.client
Class GroupReadyListener

java.lang.Object
  extended by com.maryanovsky.gwtutils.client.GroupReadyListener
All Implemented Interfaces:
ReadyListener, EventListener

public class GroupReadyListener
extends Object
implements ReadyListener

Implements notifying a ReadyListener when a collection of items change between ready and unready states, as a group. A group of items are ready iff all of them are ready.

Author:
Maryanovsky Alexander

Constructor Summary
GroupReadyListener(ReadyListener readyListener, Object source)
          Creates a new GroupReadyListener with the specified ready listener to report to, and the specified object to report as the source of ready events.
 
Method Summary
 void becameReady(Object source)
          Invoked when an item becomes ready.
 void becameUnready(Object source)
          Invoked when the item becomes unready.
 void quietlyMarkReady(Object item)
          Marks the specified item as ready, without notifiying the listener.
 void quietlyMarkUnready(Object item)
          Marks the specified item as unready, without notifying the listener.
 void reset()
          Marks all items as ready, without notifying the listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupReadyListener

public GroupReadyListener(ReadyListener readyListener,
                          Object source)
Creates a new GroupReadyListener with the specified ready listener to report to, and the specified object to report as the source of ready events. All items are considered initially ready.

Parameters:
source - The object to report as the source of ready events. If you pass null, the newly created GroupReadyListener itself will be used.
readyListener - The listener to report ready events to.
Method Detail

becameReady

public void becameReady(Object source)
Invoked when an item becomes ready.

Specified by:
becameReady in interface ReadyListener

becameUnready

public void becameUnready(Object source)
Invoked when the item becomes unready.

Specified by:
becameUnready in interface ReadyListener

quietlyMarkReady

public void quietlyMarkReady(Object item)
Marks the specified item as ready, without notifiying the listener. This method is useful when a potentially unready item, is removed from the set of interest.


reset

public void reset()
Marks all items as ready, without notifying the listener. This method is useful when the set of interest changes drastically.


quietlyMarkUnready

public void quietlyMarkUnready(Object item)
Marks the specified item as unready, without notifying the listener. This method is useful if you wish all your items to be initially unready.