aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/protocol/event/ChatRoomMemberPropertyChangeEvent.java
blob: f42924d84747268e29454215d9d3fccfff834ceb (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
95
96
97
98
99
100
101
102
/*
 * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.sip.communicator.service.protocol.event;

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

/**
 * A <tt>ChatRoomMemberPropertyChangeEvent</tt> is issued whenever a chat room
 * member property has changed (such as the nickname for example). Event codes
 * defined in this class describe properties whose changes are being announced
 * through this event.
 *
 * @author Emil Ivov
 * @author Stephane Remy
 */
public class ChatRoomMemberPropertyChangeEvent
    extends java.beans.PropertyChangeEvent
{
    /**
     * Serial version UID.
     */
    private static final long serialVersionUID = 0L;

    /**
     * The nick name of the <tt>ChatRoomMember</tt> property.
     */
    public static final String MEMBER_NICKNAME = "MemberNickname";

    /**
     * The <tt>ChatRoom</tt>, to which the corresponding member belongs.
     */
    private ChatRoom memberChatRoom;

    /**
     * Creates a <tt>ChatRoomMemberPropertyChangeEvent</tt> indicating that a
     * change has occurred for property <tt>propertyName</tt> in the
     * <tt>source</tt> chat room member and that its value has changed from
     * <tt>oldValue</tt> to <tt>newValue</tt>.
     * <p>
     * @param source the <tt>ChatRoomMember</tt> whose property has changed.
     * @param memberChatRoom the <tt>ChatRoom</tt> of the member
     * @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.
     */
    public ChatRoomMemberPropertyChangeEvent(   ChatRoomMember source,
                                                ChatRoom memberChatRoom,
                                                String propertyName,
                                                Object oldValue,
                                                Object newValue)
    {
        super(  source,
                propertyName,
                oldValue,
                newValue);

        this.memberChatRoom = memberChatRoom;
    }

    /**
     * Returns the member of the chat room, for which this event is about.
     *
     * @return the <tt>ChatRoomMember</tt> for which this event is about
     */
    public ChatRoomMember getSourceChatRoomMember()
    {
        return (ChatRoomMember) getSource();
    }

    /**
     * Returns the chat room, to which the corresponding member belongs.
     *
     * @return the chat room, to which the corresponding member belongs
     */
    public ChatRoom getMemberChatRoom()
    {
        return memberChatRoom;
    }

    /**
     * Returns a String representation of this event.
     *
     * @return String representation of this event
     */
    @Override
    public String toString()
    {
        return "ChatRoomMemberPropertyChangeEvent[type="
            + this.getPropertyName()
            + " sourceRoomMember="
            + this.getSource().toString()
            + "oldValue="
            + this.getOldValue().toString()
            + "newValue="
            + this.getNewValue().toString()
            + "]";
    }
}