agent.interaction.samples
Class SimpleEmailInteraction

java.lang.Object
  extended by agent.interaction.samples.SimplePlace
      extended by agent.interaction.samples.SimpleEmailInteraction
All Implemented Interfaces:
com.genesyslab.ail.event.ConfigObjectListener, com.genesyslab.ail.event.DnListener, com.genesyslab.ail.event.InteractionListener, com.genesyslab.ail.event.PlaceListener, java.util.EventListener

public class SimpleEmailInteraction
extends SimplePlace

This example uses a GUI application to show how to answer and reply an e-mail.

One PlaceListener is registered, which receives InteractionEvents.


Field Summary
 
Fields inherited from class agent.interaction.samples.SimplePlace
sampleAgent, sampleChat, sampleDn, sampleEmail, sampleOpenMedia, samplePlace
 
Constructor Summary
SimpleEmailInteraction(java.lang.String windowTitle)
          Creates an instance of SimpleEmailInteraction.
 
Method Summary
 void createReply()
          Creates a reply interaction (sampleEmailReply) and the associated panel, so that the user can fill in the email text then send it.
 void displaySampleEmailIn()
          Displays the 'From', 'Subject', and 'Text' fields of an inbound e-mail.
 java.lang.String getOutboundQueues()
          Return an outbound queue to create and/or send a reply e-mail interaction.
 void handleInteractionEvent(com.genesyslab.ail.event.InteractionEvent event)
          Receives InteractionEvents, which report changes to the status or data for all interactions of this place.
 void linkWidgetsToGui()
          Links widgets (user interface components) to API functionality and registers a listener for events on the Place the agent has logged in to.
static void main(java.lang.String[] args)
           
 void setInteractionWidgetState()
          This class receives InteractionEvents, which are handled by the handleInteractionEvent() method.
 void setPlaceWidgetState()
          Any time the place associated with this example changes its state, the example's widgets must be updated to reflect that state.
 void setSampleType()
          Tells the AgentInteractionGui class which example has called the GUI, so that it can determine which widgets will be enabled when the GUI is created.
 
Methods inherited from class agent.interaction.samples.SimplePlace
contactChanged, deleted, dnAdded, dnRemoved, handleDnEvent, handlePlaceEvent, idModified
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleEmailInteraction

public SimpleEmailInteraction(java.lang.String windowTitle)
Creates an instance of SimpleEmailInteraction.
The super constructor connects to the Agent Interaction Layer. After connecting, it sets up an agent, place, media, and DN for use by the samples. Then it creates the GUI, links the GUI components (widgets) to API functionality, and starts the application.

Parameters:
windowTitle - The title of the GUI window for this example.
Method Detail

main

public static void main(java.lang.String[] args)

setSampleType

public void setSampleType()
Tells the AgentInteractionGui class which example has called the GUI, so that it can determine which widgets will be enabled when the GUI is created.


linkWidgetsToGui

public void linkWidgetsToGui()
Links widgets (user interface components) to API functionality and registers a listener for events on the Place the agent has logged in to.

The linked widgets for Simple Email are buttons for processing an inbound email and the reply to this email. These buttons correspond to the following actions:

Overrides:
linkWidgetsToGui in class SimplePlace
See Also:
SimplePlace.linkWidgetsToGui()

setPlaceWidgetState

public void setPlaceWidgetState()
Description copied from class: SimplePlace
Any time the place associated with this example changes its state, the example's widgets must be updated to reflect that state. For example, if the "Log In" button has been clicked and the login was successful, the "Log In" button must now be disabled and the "Log Out" button must be enabled.

This method enables or disables the specified widgets, which are normally just buttons and radio buttons, but may include other widgets. To do this, it uses the isPossible method of the Possible interface.

The isPossible method returns either true or false, depending on whether a particular action is possible. This boolean value is used to determine whether the widget will be enabled.

Overrides:
setPlaceWidgetState in class SimplePlace

createReply

public void createReply()
Creates a reply interaction (sampleEmailReply) and the associated panel, so that the user can fill in the email text then send it.


setInteractionWidgetState

public void setInteractionWidgetState()
This class receives InteractionEvents, which are handled by the handleInteractionEvent() method. This class also has widgets whose state must be set when it receives these events. This method enables or disables the specified widgets, which are normally just buttons and radio buttons, but may include other widgets. To do this, it uses the isPossible() method of the Possible interface. The isPossible() method returns either true or false, depending on whether a particular action is possible. This boolean value is used to determine whether the widget will be enabled.

Overrides:
setInteractionWidgetState in class SimplePlace

handleInteractionEvent

public void handleInteractionEvent(com.genesyslab.ail.event.InteractionEvent event)
Receives InteractionEvents, which report changes to the status or data for all interactions of this place. If you implement the PlaceListener interface, you must implement this method.

The SimpleEmailInteraction code example uses this method to log these InteractionEvents as they occur and to set the state of the widgets used by the SimpleEmailInteraction example. All processing is performed in a separated threadthe EmailInteractionEventThread class.

Specified by:
handleInteractionEvent in interface com.genesyslab.ail.event.InteractionListener
Overrides:
handleInteractionEvent in class SimplePlace

displaySampleEmailIn

public void displaySampleEmailIn()
Displays the 'From', 'Subject', and 'Text' fields of an inbound e-mail.


getOutboundQueues

public java.lang.String getOutboundQueues()
Return an outbound queue to create and/or send a reply e-mail interaction.

Returns: