public class

JebEventSource

extends Object
implements IEventSource
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.events.JebEventSource
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

The standard engines implementation of an IEventSource. Designed to emit JebEvent s.

Summary

Public Constructors
JebEventSource()
Create an event with a null parent source.
JebEventSource(IEventSource parentSource)
Create an event source and hook it to a parent source.
Public Methods
synchronized void addListener(IEventListener listener)
Register a listener.
synchronized int countListeners()
Get the numbers of objects listening to this event source.
synchronized List<IEventListener> getListeners()
Get a copy of the list of listeners.
synchronized IEventSource getParentSource()
Get the parent source.
synchronized void insertListener(int index, IEventListener listener)
Insert a listner at the given position.
synchronized void notifyListeners(IEvent e)
Notify listeners that an event has occurred.
synchronized boolean removeListener(IEventListener listener)
Unregister a listener.
synchronized void setParentSource(IEventSource parentSource)
Set a parent source.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.util.events.IEventSource

Public Constructors

public JebEventSource ()

Create an event with a null parent source.

public JebEventSource (IEventSource parentSource)

Create an event source and hook it to a parent source. When this source notifies its observers of an event, the "parent source" will also be notified (regardless of the "parent source" being a listener of that observable).

Parameters
parentSource source that generated the event

Public Methods

public synchronized void addListener (IEventListener listener)

Register a listener. The implementor may allow duplicates.

Parameters
listener a listener of events generated by this source

public synchronized int countListeners ()

Get the numbers of objects listening to this event source.

Returns
  • the number of listeners

public synchronized List<IEventListener> getListeners ()

Get a copy of the list of listeners.

public synchronized IEventSource getParentSource ()

Get the parent source.

Returns
  • the parent source, or null if none

public synchronized void insertListener (int index, IEventListener listener)

Insert a listner at the given position.

public synchronized void notifyListeners (IEvent e)

Notify listeners that an event has occurred.

Parameters
e the event to be propagated

public synchronized boolean removeListener (IEventListener 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 synchronized void setParentSource (IEventSource parentSource)

Set a parent source.

Parameters
parentSource the optional parent source