Added methods for firing ContactPropertyChangeEvent-s

cusax-fix
Emil Ivov 20 years ago
parent a7c588bc72
commit b10bfef3d9

@ -1070,11 +1070,47 @@ else if (evt.getEventID() == SubscriptionEvent.SUBSCRIPTION_REMOVED)
listener.subscriptionRemoved(evt);
else if (evt.getEventID() == SubscriptionEvent.SUBSCRIPTION_FAILED)
listener.subscriptionFailed(evt);
}
}
}
/**
* Notify all subscription listeners of the corresponding contact property
* change event.
*
* @param eventID the String ID of the event to dispatch
* @param sourceContact the ContactIcqImpl instance that this event is
* pertaining to.
* @param oldValue the value that the changed property had before the change
* occurred.
* @param newValue the value that the changed property currently has (after
* the change has occurred).
*/
void fireContactPropertyChangeEvent( String eventID,
ContactIcqImpl sourceContact,
Object oldValue,
Object newValue)
{
ContactPropertyChangeEvent evt =
new ContactPropertyChangeEvent(sourceContact, eventID
, oldValue, newValue);
logger.debug("Dispatching a Contact Property Change Event to"
+subscriptionListeners.size() + " listeners. Evt="+evt);
synchronized(subscriptionListeners){
Iterator listeners = subscriptionListeners.iterator();
while (listeners.hasNext())
{
SubscriptionListener listener =
(SubscriptionListener) listeners.next();
listener.contactModified(evt);
}
}
}
/**
* Notify all subscription listeners of the corresponding event.
*

@ -29,10 +29,10 @@ public class ContactPropertyChangeEvent
* @param oldValue the value of the property before the change occurred.
* @param newValue the value of the property after the change occurred.
*/
public ContactPropertyChangeEvent( Contact source,
String propertyName,
Object oldValue,
Object newValue)
public ContactPropertyChangeEvent( Contact source,
String propertyName,
Object oldValue,
Object newValue)
{
super(source, propertyName, oldValue, newValue);
}
@ -46,4 +46,26 @@ public Contact getSourceContact()
{
return (Contact)getSource();
}
/**
* Returns a reference to the protocol provider where the event has
* originated.
* <p>
* @return a reference to the ProtocolProviderService instance where this
* event originated.
*/
public ProtocolProviderService getProtocolProvider()
{
return getSourceContact().getProtocolProvider();
}
/**
* Returns a reference to the source contact parent <tt>ContactGroup</tt>.
* @return a reference to the <tt>ContactGroup</tt> instance that contains
* the source <tt>Contact</tt>.
*/
public ContactGroup getParentContactGroup()
{
return getSourceContact().getParentContactGroup();
}
}

Loading…
Cancel
Save