[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/service/protocol/event/GeolocationEvent.java

emcho at dev.java.net emcho at dev.java.net
Mon May 14 16:10:49 CEST 2007


User: emcho   
Date: 2007-05-14 14:10:49+0000
Log:
 Committing geolocation for Jabber from Guillaume Schreiner - Louis Pasteur University, France
 
 indicates a change in the geographic position of one of the contacts in our contact list

File Changes:

Directory: /sip-communicator/src/net/java/sip/communicator/service/protocol/event/
==================================================================================

File [added]: GeolocationEvent.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/service/protocol/event/GeolocationEvent.java?rev=1.1&content-type=text/vnd.viewcvs-markup
Added lines: 116
----------------
/*
 * 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 geographic location of a contact.
 *
 * @author Guillaume Schreiner
 */
public class GeolocationEvent
    extends EventObject
{

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

    /**
     * The contact that this event is pertaining to.
     */
    private Contact sourceContact = null;

    /**
     * The new location of the contact that has caused this event.
     */
    private Map newLocation = null;

    /**
     * Creates an event instance indicating that the specified source contact
     * has changed its geographic location to <tt>newLocation</tt>.
     *
     * @param sourceContact the contact associated with this event.
     * @param sourceProvider the protocol provider that the contact belongs to.
     * @param newLocation the geolocation where the sourceCountact currently is.
     * @param geolocationOpSet the operation set that generated this event
     */
    public GeolocationEvent(Contact                 sourceContact,
                            ProtocolProviderService sourceProvider,
                            Map                     newLocation,
                            OperationSetGeolocation geolocationOpSet)
    {
        super(geolocationOpSet);
        this.sourceContact = sourceContact;
        this.sourceProvider = sourceProvider;
        this.newLocation = newLocation;
    }

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

    /**
     * Returns the source contact associated with the event.
     *
     * @return the source contact associated with the event.
     */
    public Contact getSourceContact()
    {
        return this.sourceContact;
    }

    /**
     * Returns the Geolocation of the contact after this event took place.
     * (i.e. at the time the event is being dispatched).
     *
     * @return geolocation stored into a Map indicating the current location
     * of the source Contact at the moment the event was dispatched.
     */
    public Map getNewLocation()
    {
        return newLocation;
    }

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

    /**
     * Returns a String representation of this GeolocationContactChangeEvent
     *
     * @return A a <tt>java.lang.String</tt> representation of this
     * ContactPresenceStatusChangeEvent.
     */
    public String toString()
    {
        StringBuffer buff = new StringBuffer
            ("ContactGeolocationPresenceChangeEvent-[ ContactID=");
        buff.append(getSourceContact().getAddress());
        return buff.append(", NewLocation=").append(getNewLocation())
            .append("]").toString();
    }

}




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: cvs-help at sip-communicator.dev.java.net





More information about the commits mailing list