Package org.jivesoftware.openfire.roster
Class RosterEventDispatcher
java.lang.Object
org.jivesoftware.openfire.roster.RosterEventDispatcher
Dispatches roster events. The following events are supported:
- rosterLoaded --> A roster has just been loaded.
- contactAdded --> A contact has been added to a roster.
- contactUpdated --> A contact has been updated of a roster.
- contactDeleted --> A contact has been deleted from a roster.
addListener(RosterEventListener)
and removeListener(RosterEventListener)
to add or remove RosterEventListener
.- Author:
- Gaston Dombiak
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
addingContact
(Roster roster, RosterItem item, boolean persistent) Notifies listeners that a contact is about to be added to a roster.static void
addListener
(RosterEventListener listener) Registers a listener to receive events.static void
contactAdded
(Roster roster, RosterItem item) Notifies the listeners that a contact has been added to a roster.static void
contactDeleted
(Roster roster, RosterItem item) Notifies the listeners that a contact has been deleted from a roster.static void
contactUpdated
(Roster roster, RosterItem item) Notifies the listeners that a contact has been updated.static void
removeListener
(RosterEventListener listener) Unregisters a listener to receive events.static void
rosterLoaded
(Roster roster) Notifies the listeners that a roster has just been loaded.
-
Constructor Details
-
RosterEventDispatcher
public RosterEventDispatcher()
-
-
Method Details
-
addListener
Registers a listener to receive events.- Parameters:
listener
- the listener.
-
removeListener
Unregisters a listener to receive events.- Parameters:
listener
- the listener.
-
rosterLoaded
Notifies the listeners that a roster has just been loaded.- Parameters:
roster
- the loaded roster.
-
addingContact
Notifies listeners that a contact is about to be added to a roster. New contacts may be persisted to the database or not. Listeners may indicate that contact about to be persisted should not be persisted. Only one listener is needed to returnfalse
so that the contact is not persisted.- Parameters:
roster
- the roster that was updated.item
- the new roster item.persistent
- true if the new contact is going to be saved to the database.- Returns:
- false if the contact should not be persisted to the database.
-
contactAdded
Notifies the listeners that a contact has been added to a roster.- Parameters:
roster
- the roster that was updated.item
- the new roster item.
-
contactUpdated
Notifies the listeners that a contact has been updated.- Parameters:
roster
- the roster that was updated.item
- the updated roster item.
-
contactDeleted
Notifies the listeners that a contact has been deleted from a roster.- Parameters:
roster
- the roster that was updated.item
- the roster item that was deleted.
-