aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/protocol/event/CallParticipantEvent.java
blob: 736a6cd3d229e23ff0dabc67646f87b2e0dfbb27 (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
103
104
105
106
107
/*
 * SIP Communicator, 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 java.util.*;

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

/**
 *
 * @author Emil Ivov
 */
public class CallParticipantEvent
    extends EventObject
{
    /**
     * The call that the source call participant is associated with.
     */
    private final Call sourceCall;

    /**
     * An event id value indicating that this event is about the fact that
     * the source call participant has joined the source call.
     */
    public static final int CALL_PARTICIPANT_ADDED = 1;

    /**
     * An event id value indicating that this event is about the fact that
     * the source call participant has left the source call.
     */
    public static final int CALL_PARTICIPANT_REMVOVED = 2;

    /**
     * The id indicating the type of this event.
     */
    private final int eventID;

    /**
     * Creates a call participant event instance indicating that an event with
     * id <tt>eventID</tt> has happened to <tt>sourceCallParticipant</tt> in
     * <tt>sourceCall</tt>
     * @param sourceCallParticipant the call participant that this event is
     * about.
     * @param sourceCall the call that the source call participant is associated
     * with.
     * @param eventID one of the CALL_PARTICIPANT_XXX member ints indicating
     * the type of this event.
     */
    public CallParticipantEvent(CallParticipant sourceCallParticipant,
                                Call            sourceCall,
                                int             eventID)
    {
        super(sourceCallParticipant);
        this.sourceCall = sourceCall;
        this.eventID = eventID;
    }

    /**
     * Returnst one of the CALL_PARTICIPANT_XXX member ints indicating
     * the type of this event.
     * @return one of the CALL_PARTICIPANT_XXX member ints indicating
     * the type of this event.
     */
    public int getEventID()
    {
        return this.eventID;
    }

    /**
     * Returns the call that the source call participant is associated with.
     *
     * @return a reference to the <tt>Call</tt> that the source call participant
     * is associated with.
     */
    public Call getSourceCall()
    {
        return sourceCall;
    }

    /**
     * Returns the  source call participant (the one that this event is about).
     *
     * @return a reference to the source <tt>CallParticipant</tt> instance.
     */
    public CallParticipant getSourceCallParticipant()
    {
        return (CallParticipant)getSource();
    }

    /**
     * Returns a String representation of this <tt>CallParticipantEvent</tt>.
     *
     * @return  a String representation of this <tt>CallParticipantEvent</tt>.
     */
    public String toString()
    {

        return "CallParticipantEvent: ID=" + getEventID()
               + " source participant=" + getSourceCallParticipant()
               + " source call=" + getSourceCall();
    }

}