aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/protocol/event/AvatarEvent.java
blob: 0428e3744aec9f4b0e080f019aaa2cc65d605e81 (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
/*
 * 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.*;

/**
 * Instances of this class represent a change avatar of a protocol
 *
 * @author Damien Roth
 */
public class AvatarEvent
    extends EventObject
{
    /**
     * Serial version UID.
     */
    private static final long serialVersionUID = 0L;

    /**
     * The new avatar
     */
    private byte[] newAvatar;

    /**
     * The provider that has generated the event.
     */
    private ProtocolProviderService sourceProvider;

    /**
     * Creates an event instance indicating that the specified protocol
     * has changed its avatar to <tt>newAvatar</tt>.
     *
     * @param sourceOp the operation set that generated this event
     * @param sourceProvider the protocol provider that the contact belongs to
     * @param newAvatar the new avatar
     */
    public AvatarEvent(OperationSetAvatar sourceOp,
            ProtocolProviderService sourceProvider, byte[] newAvatar)
    {
        super(sourceOp);
        this.sourceProvider = sourceProvider;
        this.newAvatar = newAvatar;
    }

    /**
     * Returns the provider that the source belongs to.
     *
     * @return the provider that the source belongs to.
     */
    public ProtocolProviderService getSourceProvider()
    {
        return this.sourceProvider;
    }

    /**
     * Returns the new avatar
     * @return the new avatar
     */
    public byte[] getNewAvatar()
    {
        return this.newAvatar;
    }

    /**
     * Returns the <tt>OperationSetAvatar</tt> instance that is the source
     * of this event.
     *
     * @return the <tt>OperationSetAvatar</tt> instance that is the source
     * of this event.
     */
    public OperationSetAvatar getSourceAvatarOperationSet()
    {
        return (OperationSetAvatar) getSource();
    }

    /**
     * Returns a String representation of this AvatarEvent
     *
     * @return a <tt>String</tt> representation of this <tt>AvatarEvent</tt>.
     */
    public String toString()
    {
        return "AvatarEvent-[ Provider=" + getSourceProvider() + "]";
    }
}