public abstract class ICUNotifier extends Object
Abstract implementation of a notification facility. Clients add EventListeners with addListener and remove them with removeListener. Notifiers call notifyChanged when they wish to notify listeners. This queues the listener list on the notification thread, which eventually dequeues the list and calls notifyListener on each listener in the list.
Subclasses override acceptsListener and notifyListener to add type-safe notification. AcceptsListener should return true if the listener is of the appropriate type; ICUNotifier itself will ensure the listener is non-null and that the identical listener is not already registered with the Notifier. NotifyListener should cast the listener to the appropriate type and call the appropriate method on the listener.
| Constructor and Description |
|---|
ICUNotifier() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract boolean |
acceptsListener(EventListener l)
Subclasses implement this to return true if the listener is
of the appropriate type.
|
void |
addListener(EventListener l)
Add a listener to be notified when notifyChanged is called.
|
void |
notifyChanged()
Queue a notification on the notification thread for the current
listeners.
|
protected abstract void |
notifyListener(EventListener l)
Subclasses implement this to notify the listener.
|
void |
removeListener(EventListener l)
Stop notifying this listener.
|
public void addListener(EventListener l)
public void removeListener(EventListener l)
public void notifyChanged()
protected abstract boolean acceptsListener(EventListener l)
protected abstract void notifyListener(EventListener l)