From 1fceebfa0fd6a08cde8ceef1af784cf57bdf0b9d Mon Sep 17 00:00:00 2001 From: Emil Ivov Date: Wed, 8 Mar 2006 04:08:05 +0000 Subject: [PATCH] added additional event types --- .../contactlist/event/MetaContactEvent.java | 26 ++++++++--- .../event/MetaContactGroupEvent.java | 44 ++++++++++++++----- 2 files changed, 54 insertions(+), 16 deletions(-) diff --git a/src/net/java/sip/communicator/service/contactlist/event/MetaContactEvent.java b/src/net/java/sip/communicator/service/contactlist/event/MetaContactEvent.java index 0b45d1173..007c3d2c0 100644 --- a/src/net/java/sip/communicator/service/contactlist/event/MetaContactEvent.java +++ b/src/net/java/sip/communicator/service/contactlist/event/MetaContactEvent.java @@ -22,17 +22,31 @@ public class MetaContactEvent private int eventID = -1; /** - * Indicates that the MetaContactEvent instance was triggered by + * Indicates that the MetaContactEvent instance was triggered by * adding a MetaContact. */ - public static final int METACONTACT_ADDED = 1; + public static final int META_CONTACT_ADDED = 1; /** * Indicates that the MetaContactEvent instance was triggered by the * removal of an existing MetaContact. */ - public static final int METACONTACT_REMOVED = 2; - + public static final int META_CONTACT_REMOVED = 2; + + /** + * Indicates that the MetaContactEvent instance was triggered by the + * removal of a protocol specific contact from an existing MetaContact. + */ + public static final int PROTO_CONTACT_REMOVED = 3; + + /** + * Indicates that the MetaContactEvent instance was triggered by the + * addition of a protocol specific contact to an existing MetaContact. + */ + public static final int PROTO_CONTACT_ADDED = 4; + + + private ProtocolProviderService sourceProvider = null; private MetaContactGroup parentGroup = null; @@ -41,7 +55,7 @@ public class MetaContactEvent * @param source the MetaContact instance that is added to the MetaContactList * @param provider the ProtocolProviderService instance where this event * occurred - * @param parentGroup the MetaContactGroup underwhich the corresponding + * @param parentGroup the MetaContactGroup underwhich the corresponding * MetaContact is located * @param eventID one of the METACONTACT_XXX static fields indicating the * nature of the event. @@ -76,7 +90,7 @@ public MetaContact getSourceContact() } /** - * Returns the MetaContactGroup that the MetaContact belongs to. + * Returns the MetaContactGroup that the MetaContact belongs to. * @return the MetaContactGroup that the MetaContact belongs to. */ public MetaContactGroup getParentGroup() diff --git a/src/net/java/sip/communicator/service/contactlist/event/MetaContactGroupEvent.java b/src/net/java/sip/communicator/service/contactlist/event/MetaContactGroupEvent.java index 3b034fd79..214d2ac5c 100644 --- a/src/net/java/sip/communicator/service/contactlist/event/MetaContactGroupEvent.java +++ b/src/net/java/sip/communicator/service/contactlist/event/MetaContactGroupEvent.java @@ -21,19 +21,43 @@ public class MetaContactGroupEvent private int eventID = -1; /** - * Indicates that the MetaContactGroupEvent instance was triggered by + * Indicates that the MetaContactGroupEvent instance was triggered by * adding a MetaContactGroup. */ - public static final int METACONTACT_GROUP_ADDED = 1; + public static final int META_CONTACT_GROUP_ADDED = 1; /** * Indicates that the MetaContactGroupEvent instance was triggered by the * removal of an existing MetaContactGroup. */ - public static final int METACONTACT_GROUP_REMOVED = 2; - + public static final int META_CONTACT_GROUP_REMOVED = 2; + + /** + * Indicates that the MetaContactGroupEvent instance was triggered by the + * removal of a protocol specific ContactGroup in the source + * MetaContactGroup. + */ + public static final int CONTACT_GROUP_REMOVED_FROM_META_GROUP = 3; + + /** + * Indicates that the MetaContactGroupEvent instance was triggered by the + * renaming of a protocol specific ContactGroup in the source + * MetaContactGroup. Note that this does not in any way mean that the + * name of the MetaContactGroup itslef has changed. MetaContactGroups + * contain multiple protocol groups and their name cannot change each time + * one of them is renamed. + */ + public static final int CONTACT_GROUP_RENAMED_IN_META_GROUP = 3; + + + /** + * Indicates that the MetaContactGroupEvent instance was triggered by the + * renaming of an existing MetaContactGroup. + */ + public static final int META_CONTACT_GROUP_RENAMED = 4; + private ProtocolProviderService sourceProvider = null; - + /** * Creates a new MetaContactGroup event according to the specified parameters. * @param source the MetaContactGroup instance that is added to the MetaContactList @@ -47,7 +71,7 @@ public MetaContactGroupEvent( MetaContactGroup source, int eventID) { super(source); - this.sourceProvider = provider; + this.sourceProvider = provider; this.eventID = eventID; } @@ -64,11 +88,11 @@ public ProtocolProviderService getSourceProvider() * Returns the source MetaContactGroup. * @return the source MetaContactGroup. */ - public MetaContactGroup getSourceContactGroup() + public MetaContactGroup getSourceMetaContactGroup() { return (MetaContactGroup)getSource(); } - + /** * Returns a String representation of this MetaContactGroupEvent * @@ -79,9 +103,9 @@ public String toString() { StringBuffer buff = new StringBuffer("MetaContactGroupEvent-[ GroupName="); - buff.append(getSourceContactGroup().getGroupName()); + buff.append(getSourceMetaContactGroup().getGroupName()); buff.append(", eventID=").append(getEventID()); - + return buff.toString(); }