ca.odell.glazedlists.event
Class GraphDependenciesListEventPublisher

java.lang.Object
  extended by ca.odell.glazedlists.event.GraphDependenciesListEventPublisher
All Implemented Interfaces:
ListEventPublisher

public final class GraphDependenciesListEventPublisher
extends Object
implements ListEventPublisher

Manager for distributing ListEvents to ListEventListeners. Because ListEvents must be forwarded in a safe order, the GraphDependenciesListEventPublisher manages dependencies between ListEventListeners and EventLists. Therefore any ListEventListener that fires ListEvents from within the ListEventListener.listChanged(ca.odell.glazedlists.event.ListEvent) method shall share the GraphDependenciesListEventPublisher with its source EventList.

Author:
Jesse Wilson

Constructor Summary
GraphDependenciesListEventPublisher()
          Creates a GraphDependenciesListEventPublisher.
 
Method Summary
 void addDependency(EventList dependency, ListEventListener listener)
          Requires that the specified EventList be updated before the specified ListEventListener which depends on it.
 void clearRelatedListener(Object subject, Object relatedListener)
          Detach the subject from its related listener.
 void clearRelatedSubject(Object listener)
          Detach the listener from its related subject.
 boolean dependenciesSatisfied(ca.odell.glazedlists.event.GraphDependenciesListEventPublisher.DependentListener dependentListener)
           
 boolean dependenciesSatisfied(ListEventListener listener)
          Returns true if the specified ListEventListener's required dependencies have been satisfied.
 void removeDependency(EventList dependency, ListEventListener listener)
          Removes the specified EventList as a dependency for the specified ListEventListener.
 void setRelatedListener(Object subject, Object relatedListener)
          Attach the specified subject to the specified listener, so that the listener's dependencies are satisfied before the subject is notified.
 void setRelatedSubject(Object listener, Object relatedSubject)
          Attach the specified listener to the specified subject, so that when dependencies are being prepared, notifying the listener will be considered equivalent to notifying the subject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphDependenciesListEventPublisher

public GraphDependenciesListEventPublisher()
Creates a GraphDependenciesListEventPublisher.

Method Detail

addDependency

public void addDependency(EventList dependency,
                          ListEventListener listener)
Requires that the specified EventList be updated before the specified ListEventListener which depends on it. Dependencies are automatically managed by most EventLists, so this method shall only be used for EventLists that have indirect dependencies.

Specified by:
addDependency in interface ListEventPublisher

removeDependency

public void removeDependency(EventList dependency,
                             ListEventListener listener)
Removes the specified EventList as a dependency for the specified ListEventListener. This ListEventListener will continue to receive ListEvents, but there will be no dependency tracking when such events are fired.

Specified by:
removeDependency in interface ListEventPublisher

setRelatedSubject

public void setRelatedSubject(Object listener,
                              Object relatedSubject)
Attach the specified listener to the specified subject, so that when dependencies are being prepared, notifying the listener will be considered equivalent to notifying the subject. This makes it possible to support multiple listeners in a single subject, typically using inner classes.

For example, the CompositeList class uses multiple listeners for a single subject, and uses this method to define that relationship.

Specified by:
setRelatedSubject in interface ListEventPublisher

clearRelatedSubject

public void clearRelatedSubject(Object listener)
Detach the listener from its related subject.

Specified by:
clearRelatedSubject in interface ListEventPublisher

setRelatedListener

public void setRelatedListener(Object subject,
                               Object relatedListener)
Attach the specified subject to the specified listener, so that the listener's dependencies are satisfied before the subject is notified. This makes it possible for a single listener to have multiple subjects, typically using inner classes.

For example, the ListSelection class uses a single listener for multiple subjects (selected and unselected), and uses this method to define that relationship.

Specified by:
setRelatedListener in interface ListEventPublisher

clearRelatedListener

public void clearRelatedListener(Object subject,
                                 Object relatedListener)
Detach the subject from its related listener.

Specified by:
clearRelatedListener in interface ListEventPublisher

dependenciesSatisfied

public boolean dependenciesSatisfied(ListEventListener listener)
Returns true if the specified ListEventListener's required dependencies have been satisfied.

A dependency has been satisfied if it has been notified of the current event, either directly or indirectly.

A dependency is required if it is dependent on the event's cause, either directly or indirectly.

This method is currently broken. If an EventList fails to forward any events, it may cause a source EventList to be unsatisfied.


dependenciesSatisfied

public boolean dependenciesSatisfied(ca.odell.glazedlists.event.GraphDependenciesListEventPublisher.DependentListener dependentListener)


Glazed Lists, Copyright © 2003-2006 publicobject.com, O'Dell Engineering.
Documentation build by jessewilson at 2006-08-09 23:05