agent.interaction.samples
Class SimpleOpenMediaInteraction

java.lang.Object
  extended by agent.interaction.samples.SimplePlace
      extended by agent.interaction.samples.SimpleOpenMediaInteraction
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 SimpleOpenMediaInteraction
extends SimplePlace

This example uses a GUI application to show how to receive an Open Media interaction.

To process the interaction, this example displays a few information about the example and provides you with a button to mark it done. One PlaceListener is registered, which receives InteractionEvents.


Nested Class Summary
 class SimpleOpenMediaInteraction.OpenMediaInteractionEventThread
           
 
Field Summary
 
Fields inherited from class agent.interaction.samples.SimplePlace
sampleAgent, sampleChat, sampleDn, sampleEmail, sampleOpenMedia, samplePlace
 
Constructor Summary
SimpleOpenMediaInteraction(java.lang.String windowTitle)
          Creates an instance of SimpleOpenMediaInteraction.
 
Method Summary
 void handleInteractionEvent(com.genesyslab.ail.event.InteractionEvent event)
          Receives InteractionEvents, which report changes to the status or data of an interaction.
 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

SimpleOpenMediaInteraction

public SimpleOpenMediaInteraction(java.lang.String windowTitle)
Creates an instance of SimpleOpenMediaInteraction.
The super constructor connects to the Agent Interaction Layer. After connecting, it sets up an agent, place, media, 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

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 Open Media are two buttons ( one for accepting to process the interaction, one for marking done the interaction), and a text area which displays interaction information (this corresponds here to processing the interaction).

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

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 use 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 of an interaction. If you implement the PlaceListener interface, you must implement this method.

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

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