agent.interaction.samples
Class SimplePlace

java.lang.Object
  extended by agent.interaction.samples.SimplePlace
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
Direct Known Subclasses:
SimpleChatInteraction, SimpleEmailInteraction, SimpleOpenMediaInteraction, SimpleVoiceInteraction

public class SimplePlace
extends java.lang.Object
implements com.genesyslab.ail.event.PlaceListener

This example uses a GUI application to show how to log an agent into a place and queue. Once you have done this, the example enables you to set the agent status to Ready, Not Ready, and After Call Work. It also lets you log the agent out.

This example is also the base class for the other Agent Interaction (Java) code examples, including SimpleVoiceInteraction and MultipartyVoiceInteraction.

PLEASE NOTE: This code example will not work unless you edit the configuration data in AgentInteractionData.java so that it matches objects that already exist in your local configuration layer.

There are several steps needed to prepare an application to use the services of Agent Interaction (Java). This example uses the services of other classes to carry out these functions.

Version:
7.5.001.02

Field Summary
 com.genesyslab.ail.Agent sampleAgent
          Agent object used in this example.
 com.genesyslab.ail.Media sampleChat
          Media object used for managing open media in this example.
 com.genesyslab.ail.Dn sampleDn
          Dn object used in this example.
 com.genesyslab.ail.Media sampleEmail
          Media object used for managing e-mail in this example.
 com.genesyslab.ail.Media sampleOpenMedia
          Media object used for managing open media in this example.
 com.genesyslab.ail.Place samplePlace
          Place object used in this example.
 
Constructor Summary
SimplePlace(java.lang.String windowTitle)
          Creates an instance of SimplePlace.
 
Method Summary
 void contactChanged(com.genesyslab.ail.event.InteractionEvent event)
          This method is required by the PlaceListener interface, but is not used by the Agent Interaction (Java) code examples.
 void deleted()
          This method is required by the PlaceListener interface, but is not used by the Agent Interaction (Java) code examples.
 void dnAdded(java.lang.String dn)
          This method is required by the PlaceListener interface, but is not used by the Agent Interaction (Java) code examples.
 void dnRemoved(java.lang.String dn)
          This method is required by the PlaceListener interface, but is not used by the Agent Interaction (Java) code examples.
 void handleDnEvent(com.genesyslab.ail.event.DnEvent event)
          Receives DnEvents, which report changes to the status or data of a DN.
 void handleInteractionEvent(com.genesyslab.ail.event.InteractionEvent event)
          This method is required by the PlaceListener interface, but is not used by the SimplePlace example because this example doesn't generate any interactions.
 void handlePlaceEvent(com.genesyslab.ail.event.PlaceEvent event)
          Receives PlaceEvents, which report changes to the status or data of a DN.
 void idModified(java.lang.String id)
          This method is required by the PlaceListener interface, but is not used by the Agent Interaction (Java) code examples.
 void linkWidgetsToGui()
          This method does two important things: first, it links widgets (user interface components) to API functionality, and second, it registers a listener for events on the Place the agent has logged in to.
static void main(java.lang.String[] args)
          This method is used to run the SimplePlace example.
 void setInteractionWidgetState()
          The setInteractionWidgetState() method is used by subclasses of the SimplePlace class.
 void setPlaceWidgetState()
          Any time the place associated with this example changes its state, the example's widgets must be updated to reflect that state.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sampleAgent

public com.genesyslab.ail.Agent sampleAgent
Agent object used in this example.


samplePlace

public com.genesyslab.ail.Place samplePlace
Place object used in this example.


sampleDn

public com.genesyslab.ail.Dn sampleDn
Dn object used in this example.


sampleEmail

public com.genesyslab.ail.Media sampleEmail
Media object used for managing e-mail in this example.


sampleOpenMedia

public com.genesyslab.ail.Media sampleOpenMedia
Media object used for managing open media in this example.


sampleChat

public com.genesyslab.ail.Media sampleChat
Media object used for managing open media in this example.

Constructor Detail

SimplePlace

public SimplePlace(java.lang.String windowTitle)
Creates an instance of SimplePlace. The Connector class connects to the Agent Interaction Layer using the AilLoader and AilFactory classes. The AgentInteractionData class supplies data from the Configuration Layer for things like host, port, place, DN and agent attributes. After connecting, this method sets up an agent, place and DN for use by the examples. 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

linkWidgetsToGui

public void linkWidgetsToGui()
This method does two important things: first, it links widgets (user interface components) to API functionality, and second, it registers a listener for events on the Place the agent has logged in to.

The AgentInteractionGui class creates a single graphical user interface that is used by each of the Agent Interaction (Java) code examples. This GUI contains all of the widgets used by the examples, but they are only placeholders. That is, they don't have any functionality when they are created in the GUI class.

When a example is run, the linkWidgetsToGui() method is used to associate these widgets with the appropriate fields in the example class, as shown here:

loginButton = agentInteractionGui.loginButton;

In many cases, particularly for buttons and radio buttons, these fields are then linked to actions that correspond to the functions they are designed to carry out. For example:

loginButton.setAction(new AbstractAction("Log In") {
 public void actionPerformed(ActionEvent actionEvent) {
  try {
   sampleAgent.login(samplePlace, agentInteractionData
    .getLoginId1(), agentInteractionData.getPassword1(),
    agentInteractionData.getQueue(), null, null, null);
...


As mentioned above, this method also contains the statement that registers a listener for events on the Place the agent is logged in to:

samplePlace.addPlaceListener(this);


setPlaceWidgetState

public void setPlaceWidgetState()
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.


setInteractionWidgetState

public void setInteractionWidgetState()
The setInteractionWidgetState() method is used by subclasses of the SimplePlace class. These classes have widgets whose state must be set when they receive InteractionEvents.

Since SimplePlace itself does not receive InteractionEvents, the method body has been left empty here.


handleDnEvent

public void handleDnEvent(com.genesyslab.ail.event.DnEvent event)
Receives DnEvents, which report changes to the status or data of a DN. If you implement the PlaceListener interface, you must implement this method.

The SimplePlace example uses this method to log these DnEvents as they occur and to set the state of the widgets used by the SimplePlace example.

Specified by:
handleDnEvent in interface com.genesyslab.ail.event.DnListener

handlePlaceEvent

public void handlePlaceEvent(com.genesyslab.ail.event.PlaceEvent event)
Receives PlaceEvents, which report changes to the status or data of a DN. If you implement the PlaceListener interface, you must implement this method.

The SimplePlace example uses this method to log these PlaceEvents as they occur.

Specified by:
handlePlaceEvent in interface com.genesyslab.ail.event.PlaceListener

handleInteractionEvent

public void handleInteractionEvent(com.genesyslab.ail.event.InteractionEvent event)
This method is required by the PlaceListener interface, but is not used by the SimplePlace example because this example doesn't generate any interactions. However, this method is implemented by the examples that use interactions, such as SimpleVoiceInteraction and SimpleEmailInteraction.

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

contactChanged

public void contactChanged(com.genesyslab.ail.event.InteractionEvent event)
This method is required by the PlaceListener interface, but is not used by the Agent Interaction (Java) code examples.

Specified by:
contactChanged in interface com.genesyslab.ail.event.InteractionListener

deleted

public void deleted()
This method is required by the PlaceListener interface, but is not used by the Agent Interaction (Java) code examples.

Specified by:
deleted in interface com.genesyslab.ail.event.ConfigObjectListener

dnAdded

public void dnAdded(java.lang.String dn)
This method is required by the PlaceListener interface, but is not used by the Agent Interaction (Java) code examples.

Specified by:
dnAdded in interface com.genesyslab.ail.event.PlaceListener

dnRemoved

public void dnRemoved(java.lang.String dn)
This method is required by the PlaceListener interface, but is not used by the Agent Interaction (Java) code examples.

Specified by:
dnRemoved in interface com.genesyslab.ail.event.PlaceListener

idModified

public void idModified(java.lang.String id)
This method is required by the PlaceListener interface, but is not used by the Agent Interaction (Java) code examples.

Specified by:
idModified in interface com.genesyslab.ail.event.PlaceListener

main

public static void main(java.lang.String[] args)
This method is used to run the SimplePlace example.

Parameters:
args - There are no arguments for this class.