public interface

IEventSource2

com.pnfsoftware.jeb.util.events.deprecated_v2.IEventSource2<E, T extends com.pnfsoftware.jeb.util.events.deprecated_v2.IEvent2<E>>
Known Indirect Subclasses

Class Overview

Interface for objects generating events, with optional relaying to a parent source.

Summary

Public Methods
abstract void addListener(IEventListener2<E> listener)
Register a listener.
abstract int countListeners()
Get the numbers of objects listening to this event source.
abstract IEventSource2<E, T> getParentSource()
Get the parent source.
abstract void notifyListeners(IEvent2<E> e)
Notify listeners that an event has occurred.
abstract boolean removeListener(IEventListener2<E> listener)
Unregister a listener.
abstract void setParentSource(IEventSource2<E, T> parentSource)
Set a parent source.

Public Methods

public abstract void addListener (IEventListener2<E> listener)

Register a listener. The implementor may allow duplicates.

Parameters
listener a listener of events generated by this source

public abstract int countListeners ()

Get the numbers of objects listening to this event source.

Returns
  • the number of listeners

public abstract IEventSource2<E, T> getParentSource ()

Get the parent source.

Returns
  • the parent source, or null if none

public abstract void notifyListeners (IEvent2<E> e)

Notify listeners that an event has occurred.

Parameters
e the event to be propagated

public abstract boolean removeListener (IEventListener2<E> listener)

Unregister a listener. If the implementor allows duplicates in addListener(), it should deal with those consistently.

Parameters
listener the listener to be removed
Returns
  • true if the listener was successfully removed, false

public abstract void setParentSource (IEventSource2<E, T> parentSource)

Set a parent source.

Parameters
parentSource the optional parent source