aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/protocol/event/ContactPropertyChangeEvent.java
blob: f69caeb79744dc732e89acd410fdce242e6a8c31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package net.java.sip.communicator.service.protocol.event;

import net.java.sip.communicator.service.protocol.*;

/**
 * A Contact property change event is issued whenever a contact property has
 * changed. Event codes defined in this class describe properties whose changes
 * are being announced through this event.
 *
 * @author Emil Ivov
 */
public class ContactPropertyChangeEvent
    extends java.beans.PropertyChangeEvent
{
    /**
     * Serial version UID.
     */
    private static final long serialVersionUID = 0L;

    /**
     * Indicates that a change has occurred in the display name of the source
     * contact.
     */
    public static final String PROPERTY_DISPLAY_NAME = "DisplayName";

     /**
     * Indicates that a change has occurred in the image of the source
     * contact.
     */
    public static final String PROPERTY_IMAGE = "Image";

    /**
     * Indicates that a change has occurred in the data that the contact is
     * storing in external sources.
     */
    public static final String PROPERTY_PERSISTENT_DATA = "PersistentData";

    /**
     * Indicates that a change has occurred in the display details of the source
     * contact.
     */
    public static final String PROPERTY_DISPLAY_DETAILS = "DisplayDetails";

    /**
     * Creates a ContactPropertyChangeEvent indicating that a change has
     * occurred for property <tt>propertyName</tt> in the <tt>source</tt>
     * contact and that its value has changed from <tt>oldValue</tt> to
     * <tt>newValue</tt>.
     * <p>
     * @param source the Contact whose property has changed.
     * @param propertyName the name of the property that has changed.
     * @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)
    {
        super(source, propertyName, oldValue, newValue);
    }

    /**
     * Returns a reference to the <tt>Contact</tt> whose property has changed.
     * <p>
     * @return a reference to the <tt>Contact</tt> whose reference has changed.
     */
    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();
    }
}