Class RosterEventDispatcher


  • public class RosterEventDispatcher
    extends Object
    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.
    Use addListener(RosterEventListener) and removeListener(RosterEventListener) to add or remove RosterEventListener.
    Author:
    Gaston Dombiak
    • Constructor Detail

      • RosterEventDispatcher

        public RosterEventDispatcher()
    • Method Detail

      • addListener

        public static void addListener​(RosterEventListener listener)
        Registers a listener to receive events.
        Parameters:
        listener - the listener.
      • removeListener

        public static void removeListener​(RosterEventListener listener)
        Unregisters a listener to receive events.
        Parameters:
        listener - the listener.
      • rosterLoaded

        public static void rosterLoaded​(Roster roster)
        Notifies the listeners that a roster has just been loaded.
        Parameters:
        roster - the loaded roster.
      • addingContact

        public static boolean addingContact​(Roster roster,
                                            RosterItem item,
                                            boolean persistent)
        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 return false 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

        public static void contactAdded​(Roster roster,
                                        RosterItem item)
        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

        public static void contactUpdated​(Roster roster,
                                          RosterItem item)
        Notifies the listeners that a contact has been updated.
        Parameters:
        roster - the roster that was updated.
        item - the updated roster item.
      • contactDeleted

        public static void contactDeleted​(Roster roster,
                                          RosterItem item)
        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.