com.genesyslab.ail.event
Interface AgentListener

All Superinterfaces:
ConfigObjectListener, DnListener, java.util.EventListener, InteractionListener, PlaceListener

public interface AgentListener
extends PlaceListener

Listener for events on an Agent.
Use AgentListener to monitor:

You do not need to process InteractionEvent, PlaceEvent, DnEvent events if you register directly another InteractionListener, PlaceListener, or DnListener on the corresponding object.

Note: When the monitored agent is logged out of the place, the listener no longer receives events regarding this place or interactions on this place.

The following code snippet shows how to implement AgentListener:

public class SimpleAgentExample implements AgentListener
{
    public SimpleAgentExample (Agent exampleAgent)
    {
        //Adding the listener
        exampleAgent.addAgentListener(this);
    }
    public void handleAgentEvent(AgentEvent evt)
    {
        //Implement this method to refresh your application
        //with the new agent information.
    }
    public void placeChanged(Place newPlace)
    {
        //Implement this method to refresh your application
        //with the new place associated with the Agent.
    }
    //Inherited PlaceListener methods.
    //See PlaceListener for details.
    public void dnAdded(String id){}
    public void dnRemoved(String id){}
    public void handlePlaceEvent(PlaceEvent event){}
    public void idModified(String id){}

    //Inherited DnListener methods. See DnListener for details.
    public void handleDnEvent(DnEvent event){}

    //Handlers for managing the interactions of the agent.
    //See InteractionListener for details.
    public void handleInteractionEvent(InteractionEvent event){}
    public void contactChanged(InteractionEvent event){}
    public void deleted(){}
}

Warning: If you want to perform a lengthy operation or an operation making calls to AIL methods, be sure that your application implements such code in a separate thread, not in the listener methods.

See Also:
AgentEvent, PlaceEvent, DnEvent, InteractionEvent

Method Summary
 void handleAgentEvent(AgentEvent event)
          This method gets called when an event occurs on an agent.
 void placeChanged(Place newPlace)
          This method gets called when the place of the agent has changed.
 
Methods inherited from interface com.genesyslab.ail.event.PlaceListener
dnAdded, dnRemoved, handlePlaceEvent, idModified
 
Methods inherited from interface com.genesyslab.ail.event.DnListener
handleDnEvent
 
Methods inherited from interface com.genesyslab.ail.event.InteractionListener
contactChanged, handleInteractionEvent
 

Method Detail

handleAgentEvent

void handleAgentEvent(AgentEvent event)
This method gets called when an event occurs on an agent.

Parameters:
event - the event that occurred.

placeChanged

void placeChanged(Place newPlace)
This method gets called when the place of the agent has changed.

Parameters:
newPlace - the new current place of the agent.