audiojury.action
Class ProjectRunner

java.lang.Object
  |
  +--audiojury.action.ProjectRunner

public class ProjectRunner
extends java.lang.Object

Coordinates the actions when a Project is run by a test subject. It shows and hides interaction panels, starts and stops playback and collects results before passing them on.


Field Summary
static int MODE_PREVIEW
          By default preview mode is off which means the tests will run as programmed (like in the client).
static int MODE_REAL
          By default real mode is on, which means the judgements will be performed as programmed.
static int NEXT_JUDGEMENT
          Command for gotoRunTest: Goto next judgement.
static int PREV_JUDGEMENT
          Command for gotoRunTest: Goto previous judgement.
static int SHOW_INSTRUCTIONS
          Command for gotoRunTest: Goto show instructions.
static int SKIP_PRACTICE
          Command for gotoRunTest: Skip practice.
static int START_PRACTICE
          Command for gotoRunTest: Start practice screen.
static int START_REAL
          Command for gotoRunTest: Start real test (no practice).
 
Constructor Summary
ProjectRunner(int mode)
          Constructor.
 
Method Summary
 int getJudgementCount()
          Gets the number of Judgement in the current Test.
 javax.swing.JPanel getPanel()
          Returns the correct panel to show, depending on at which stage the run has come to.
 java.lang.String getProjectBase()
          Determines the base directory where to look for Projects.
protected  ProjectManager getProjectManager()
          Gets the ProjectManager currently being used.
protected  ResultManager getResultManager()
          Gets the ResultManager currently being used.
 int getRunmode()
          The ProjectRunner may be in either MODE_PREVIEW or MODE_REAL.
 int getRunningJudgementEnd()
          Gets the index of the last Judgement to run.
 java.util.List getRunningJudgements()
          Gets a list of the Judgement that will be run in the current Test.
 int getRunningJudgementStart()
          Gets the index of the first Judgement to run.
 Project getRunningProject()
          Gets the Project currently being run.
 Test getRunningTest()
          Gets the Test currently being run.
 int getRunningTestIndex()
          Gets the index of the currently running Test.
 int getTestCount()
          Gets the number of Tests in the current Project.
 void gotoProjectInstructions()
          Jump to showing the project instructions.
 void gotoRegistration()
          Jump to the step where personal information is collected.
 void gotoRunTest(int command)
          Jump to the step where tests are run.
 boolean hasMoreLeftTests()
          Determine wether there are more Tests in the Project to run.
 boolean isTestFinished()
          Determine wether the current set of Judgement is finished and thus the current Test is finished.
 void previewTest(Project project, Test test, FullScreenDialog parent)
          Starts preview of a Test.
 void runProject(java.lang.String projname, FullScreenDialog parent)
          Starts running a Project.
 void saveRegistrationInfo(java.lang.String[] info)
          Makes the collected personal information part of the results.
 void saveResults()
          Saves the project results to disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHOW_INSTRUCTIONS

public static final int SHOW_INSTRUCTIONS
Command for gotoRunTest: Goto show instructions.

See Also:
Constant Field Values

START_PRACTICE

public static final int START_PRACTICE
Command for gotoRunTest: Start practice screen.

See Also:
Constant Field Values

SKIP_PRACTICE

public static final int SKIP_PRACTICE
Command for gotoRunTest: Skip practice.

See Also:
Constant Field Values

START_REAL

public static final int START_REAL
Command for gotoRunTest: Start real test (no practice).

See Also:
Constant Field Values

NEXT_JUDGEMENT

public static final int NEXT_JUDGEMENT
Command for gotoRunTest: Goto next judgement.

See Also:
Constant Field Values

PREV_JUDGEMENT

public static final int PREV_JUDGEMENT
Command for gotoRunTest: Goto previous judgement.

See Also:
Constant Field Values

MODE_PREVIEW

public static int MODE_PREVIEW
By default preview mode is off which means the tests will run as programmed (like in the client). When a project is run from the administrator program preview mode is on allowing the administrator to navigate back and forth between judgements.


MODE_REAL

public static int MODE_REAL
By default real mode is on, which means the judgements will be performed as programmed.

Constructor Detail

ProjectRunner

public ProjectRunner(int mode)
Constructor.

Parameters:
mode - Which mode to run in, MODE_PREVIEW or MODE_REAL.
Method Detail

getProjectBase

public java.lang.String getProjectBase()
Determines the base directory where to look for Projects.

Returns:
The path to where runnable (active) Projects can be found.

runProject

public void runProject(java.lang.String projname,
                       FullScreenDialog parent)
                throws ProjectOperationException,
                       NoProjectFoundException,
                       ProjectEmptyException
Starts running a Project.

Parameters:
projname - The name of the Projectto run.
parent - The parent window.
Throws:
ProjectOperationException - if an unhandled error occurs.
NoProjectFoundException - if no project could be found with the specified name.
ProjectEmptyException - if the project specified was empty when it shouldn't be.

previewTest

public void previewTest(Project project,
                        Test test,
                        FullScreenDialog parent)
                 throws TestEmptyException
Starts preview of a Test. Used by the administrator part of AudioJury.

Parameters:
project - The project to run.
test - The test withing this project to run.
parent - The parent window.
Throws:
TestEmptyException - if the test specified was empty when it shouldn't be.

saveRegistrationInfo

public void saveRegistrationInfo(java.lang.String[] info)
Makes the collected personal information part of the results. The results are not saved to disk.

Parameters:
info - An array of values corresponding to the personal attribute labels.

saveResults

public void saveResults()
                 throws ResultOperationException
Saves the project results to disk.

Throws:
ResultOperationException - if an unhandled error occurs.

getRunningTestIndex

public int getRunningTestIndex()
Gets the index of the currently running Test.

Returns:
The index of the currently running Test.

getTestCount

public int getTestCount()
Gets the number of Tests in the current Project.

Returns:
the number of Tests in the current Project.

getRunningJudgementStart

public int getRunningJudgementStart()
Gets the index of the first Judgement to run.

Returns:
The index of the first Judgement to run.

getRunningJudgementEnd

public int getRunningJudgementEnd()
Gets the index of the last Judgement to run.

Returns:
The index of the last Judgement to run.

getJudgementCount

public int getJudgementCount()
Gets the number of Judgement in the current Test.

Returns:
The number of Judgement in the current Test.

getRunningProject

public Project getRunningProject()
Gets the Project currently being run.

Returns:
The Project object currently being run.

getRunmode

public int getRunmode()
The ProjectRunner may be in either MODE_PREVIEW or MODE_REAL.

Returns:
The current run mode.

getRunningTest

public Test getRunningTest()
Gets the Test currently being run.

Returns:
The Test currently being run.

getRunningJudgements

public java.util.List getRunningJudgements()
Gets a list of the Judgement that will be run in the current Test.

Returns:
A list of the Judgement that will be run in the current Test.

gotoProjectInstructions

public void gotoProjectInstructions()
Jump to showing the project instructions.


gotoRegistration

public void gotoRegistration()
Jump to the step where personal information is collected.


gotoRunTest

public void gotoRunTest(int command)
Jump to the step where tests are run.

Parameters:
command - The command (or rather step) to execute in test.

isTestFinished

public boolean isTestFinished()
Determine wether the current set of Judgement is finished and thus the current Test is finished.

Returns:
True if Test has been completed, false otherwise.

hasMoreLeftTests

public boolean hasMoreLeftTests()
Determine wether there are more Tests in the Project to run.

Returns:
True if there are more Tests left, false otherwise.

getPanel

public javax.swing.JPanel getPanel()
Returns the correct panel to show, depending on at which stage the run has come to. (Registration, Instructions, Practice, Real test etc.)

Returns:
A panel with which the user can interact.

getProjectManager

protected ProjectManager getProjectManager()
Gets the ProjectManager currently being used.

Returns:
The unique instace of the used ProjectManager.

getResultManager

protected ResultManager getResultManager()
Gets the ResultManager currently being used.

Returns:
The unique instace of the used ResultManager.