org.jwalk.tool
Class QuestionMaster

java.lang.Object
  extended by org.jwalk.tool.QuestionMaster
All Implemented Interfaces:
java.util.EventListener, QuestionListener

public class QuestionMaster
extends java.lang.Object
implements QuestionListener

QuestionMaster implements the question-response interaction with the tester. QuestionMaster is an implementation of the QuestionListener interface that is designed to work with the JWalkTester GUI. It handles Confirmation and Notification questions that require some kind of dialog with the tester.

Version:
1.1
Author:
Mihai-Gabriel Glont, Anthony Simons

Constructor Summary
QuestionMaster(JWalkTester tester)
          Creates a QuestionMaster owned by a JWalkTester.
 
Method Summary
protected  Answer handle(Confirmation question)
          Responds to a Confirmation question asked by a JWalker.
protected  Answer handle(Notification notice)
          Responds to a Notification question asked by a JWalker.
 Answer respond(QuestionEvent event)
          Responds to a question asked by a JWalker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuestionMaster

public QuestionMaster(JWalkTester tester)
Creates a QuestionMaster owned by a JWalkTester. When this QuestionMaster pops up JOptionPane dialogs, these depend on the JWalkTester as their master frame.

Method Detail

respond

public Answer respond(QuestionEvent event)
Responds to a question asked by a JWalker. Analyses the type of the Question in the event, calling a suitable handler to answer it, using a JOptionPane dialog. This method fulfils the contract of QuestionListener.

Specified by:
respond in interface QuestionListener
Parameters:
event - the QuestionEvent dispatched by a JWalker.
Returns:
an Answer from {YES, NO, QUIT}.

handle

protected Answer handle(Confirmation question)
Responds to a Confirmation question asked by a JWalker. Creates a JOptionPane dialog that displays the test result and asks the tester to confirm, reject or cancel.

Parameters:
question - the Confirmation question.
Returns:
an Answer from {YES, NO, QUIT}.

handle

protected Answer handle(Notification notice)
Responds to a Notification question asked by a JWalker. Creates a JOptionPane dialog that displays the message and asks the tester to confirm that is was read.

Parameters:
notice - the Notification question.
Returns:
an Answer, which is always OK.