com.maryanovsky.gwtutils.client.event
Class GroupReadyListener<IT,ST>

java.lang.Object
  extended by com.maryanovsky.gwtutils.client.event.GroupReadyListener<IT,ST>
All Implemented Interfaces:
ReadyListener<IT>, EventListener

public class GroupReadyListener<IT,ST>
extends Object
implements ReadyListener<IT>

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. Note that the class implements ReadyListener itself, so it can be simply used as a ready listener for some set of items. IT is the type of the items. ST is the type of the object report as the source of ready events.

Author:
Maryanovsky Alexander

Constructor Summary
GroupReadyListener(ReadyListener<ST> readyListener, ST 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(IT source)
          Invoked when an item becomes ready.
 void becameUnready(IT source)
          Invoked when the item becomes unready.
 void quietlyMarkReady(IT item)
          Marks the specified item as ready, without notifiying the listener.
 void quietlyMarkUnready(IT 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<ST> readyListener,
                          ST 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:
readyListener - The listener to report ready events to.
source - The object to report as the source of ready events.
Method Detail

becameReady

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

Specified by:
becameReady in interface ReadyListener<IT>

becameUnready

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

Specified by:
becameUnready in interface ReadyListener<IT>

quietlyMarkReady

public void quietlyMarkReady(IT 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(IT 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.