eu.semaine.components.dialogue.test
Class TestGui

java.lang.Object
  extended by java.lang.Thread
      extended by eu.semaine.components.Component
          extended by eu.semaine.components.dialogue.test.TestGui
All Implemented Interfaces:
SEMAINEMessageAvailableListener, java.lang.Runnable

public class TestGui
extends Component

This class creates a GUI to test the Dialogue Management. It provides a method to send input to the DM and to receive the output.

Version:
0.1 - dummy class
Author:
Mark tM

Nested Class Summary
 
Nested classes/interfaces inherited from class eu.semaine.components.Component
Component.State
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 long lastTickTime
           
 boolean typing
           
 
Fields inherited from class eu.semaine.components.Component
inputWaiting, isInput, isOutput, log, meta, receivers, senders, state, waitingTime
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TestGui()
          Creates a new GUI + Creates the Senders and Receivers + Creates and starts a timer class + Initializes the interface
 
Method Summary
 void act()
          Proactive actions.
 javax.swing.JPanel createInputSide()
          Creates the inputside of the gui, puts this in a JPanel and returns this.
 java.lang.String getSentence(SEMAINEMessage m)
          Returns the detected sentence in the SEMAINEMessage m
 long getTime()
           
 void initGui()
          Initializes the GUI
 boolean isSentence(SEMAINEMessage m)
          Checks if the Message is ASR output and if it contains a sentence.
 void keyPressed()
          Called when the user presses a key.
 void newInput()
          This method is called when input is entered with the input textfield
 void printLine(java.lang.String line)
          This method prints the given line in the output textarea
 void react(SEMAINEMessage m)
          Called when a message is received Checks if the message contains FML.
 void sendSilent()
           
 void sendSpeaking()
           
 void sendUtterance(java.lang.String line)
          Sends the given utterance to the userstate using an EmmaMessage
 
Methods inherited from class eu.semaine.components.Component
customStartIO, exitRequested, messageAvailableFrom, requestExit, run
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lastTickTime

public long lastTickTime

typing

public boolean typing
Constructor Detail

TestGui

public TestGui()
        throws javax.jms.JMSException
Creates a new GUI + Creates the Senders and Receivers + Creates and starts a timer class + Initializes the interface

Throws:
javax.jms.JMSException
Method Detail

act

public void act()
Description copied from class: Component
Proactive actions. This method is called every Component.waitingTime milliseconds if no messages arrive, and after every message processing. This base implementation does nothing; subclasses should implement suitable behaviour here.

Overrides:
act in class Component

react

public void react(SEMAINEMessage m)
           throws javax.jms.JMSException
Called when a message is received Checks if the message contains FML. If so, it displays the message it contains in the GUI

Overrides:
react in class Component
Throws:
javax.jms.JMSException - if communication with the JMS server goes wrong.

isSentence

public boolean isSentence(SEMAINEMessage m)
                   throws javax.jms.JMSException
Checks if the Message is ASR output and if it contains a sentence.

Parameters:
m - the message to check
Returns:
true if the message says that the user is currently silent
Throws:
javax.jms.JMSException

getSentence

public java.lang.String getSentence(SEMAINEMessage m)
                             throws javax.jms.JMSException
Returns the detected sentence in the SEMAINEMessage m

Parameters:
m - the message to detect the sentence in
Returns:
the detected sentence
Throws:
javax.jms.JMSException

initGui

public void initGui()
Initializes the GUI


createInputSide

public javax.swing.JPanel createInputSide()
Creates the inputside of the gui, puts this in a JPanel and returns this. This version creates a JTextField and a Send-button.

Returns:
the JPanel with the inputside GUI

newInput

public void newInput()
This method is called when input is entered with the input textfield


printLine

public void printLine(java.lang.String line)
This method prints the given line in the output textarea

Parameters:
line - - the line to print

keyPressed

public void keyPressed()
Called when the user presses a key. Used for turn taking behaviour


sendUtterance

public void sendUtterance(java.lang.String line)
Sends the given utterance to the userstate using an EmmaMessage

Parameters:
line -

sendSpeaking

public void sendSpeaking()

sendSilent

public void sendSilent()

getTime

public long getTime()