net.sourceforge.pavlov.main
Class AbstractPavlovApplication

java.lang.Object
  extended by net.sourceforge.pavlov.main.AbstractPavlovApplication
All Implemented Interfaces:
LogonListener
Direct Known Subclasses:
Pavlov

public abstract class AbstractPavlovApplication
extends Object
implements LogonListener

An abstract class that handles most of the work of a Pavlov Application, whether it be applet, servlet, client-server, or standalone.


Field Summary
protected  PlugletLoader feedbackPlugins
          Manages non-Velocity feedback pluglets.
protected  AbstractLibrary library
          Describe variable library here.
protected  String libraryFile
          The directory containing book files.
protected  String password
          The user's password, used before login.
protected  Quiz quiz
          Describes the quiz in progress, if any.
protected  ResourceBroker rb
           
protected  StrategyLoader strategyPlugins
          Manages question selection strategy pluglets.
protected  PlugletLoader toolPluglets
          Manages tool pluglets.
protected  User user
          The current user.
protected  String userName
          The user's name, used before login.
protected  VelocityPlugletLoader velocityPlugins
          Manages Velocity feedback pluglets.
 
Constructor Summary
protected AbstractPavlovApplication(String[] args)
          Creates a new AbstractPavlovApplication instance.
 
Method Summary
protected abstract  void closeSplashScreen()
          Called when startup is finished, delegates to UIBuilder's closeSplashScreen.
protected abstract  boolean confirmQuit()
          Asks the user if he's sure he wants to quit.
abstract  void createQuizSelector()
          Creates the UI widget that allows the user to select a chapter to start a quiz.
 AbstractLibrary getLibrary()
          Returns the library which is supplying questions.
 Quiz getQuiz()
          Describe getQuiz method here.
 String getResourceString(String key, String def)
          Returns the named resource value or the given default, if the resource value is unavailable.
 User getUser()
          Returns the active user.
protected  AbstractLibrary loadLibrary()
          Reads in the library.
abstract  void loadPluglets()
          Loads all the feedback, strategy, and tool pluglets.
protected abstract  void loginFinished()
          Describe loginFinished method here.
 void logonAttempt(LogonEvent event)
          The LoginController calls this when the user has finished logging in.
abstract  void newSetStatus(int pos, String key)
           
 void niceQuit(boolean confirm)
          Ask the user if he really wants to quit.
 void processArguments(String[] args)
          Process command line arguments.
 void registerFeedbackPlugins(Quiz theQuiz)
          Sets the feedbackpluglets as answerListeners for the quiz.
 void saveUser()
          Save's the user's progress.
 void setPassword(String na)
          Sets the user password, useful only before login.
 void setQuiz(Quiz q)
          Describe setQuiz method here.
abstract  void setStatus(int pos, String msg)
          Shows the user startup status, delegates to getUIBuilder()'s setStatus.
protected  void setup()
           
 void setUserName(String na)
          Sets the user name, useful only before login.
abstract  void showIncorrectDialog(String msg)
          Show the user that his answer was incorrect.
protected abstract  void showLoginController(AbstractPavlovApplication abs)
           
protected abstract  void showSplashScreen()
          Keep the user entertained and informed during startup.
protected  void validate(User u, AbstractLibrary l)
          Coordinates the users question data with question in the active library.
protected  void warn(String key, Exception ex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

user

protected User user
The current user.


userName

protected String userName
The user's name, used before login.


password

protected String password
The user's password, used before login.


libraryFile

protected String libraryFile
The directory containing book files.


library

protected AbstractLibrary library
Describe variable library here.


quiz

protected Quiz quiz
Describes the quiz in progress, if any.


velocityPlugins

protected VelocityPlugletLoader velocityPlugins
Manages Velocity feedback pluglets.


feedbackPlugins

protected PlugletLoader feedbackPlugins
Manages non-Velocity feedback pluglets.


strategyPlugins

protected StrategyLoader strategyPlugins
Manages question selection strategy pluglets.


toolPluglets

protected PlugletLoader toolPluglets
Manages tool pluglets.


rb

protected ResourceBroker rb
Constructor Detail

AbstractPavlovApplication

protected AbstractPavlovApplication(String[] args)
Creates a new AbstractPavlovApplication instance.

Parameters:
args[] - a String value
Method Detail

setup

protected void setup()

loginFinished

protected abstract void loginFinished()
Describe loginFinished method here.


showLoginController

protected abstract void showLoginController(AbstractPavlovApplication abs)

warn

protected void warn(String key,
                    Exception ex)

logonAttempt

public void logonAttempt(LogonEvent event)
The LoginController calls this when the user has finished logging in.

Specified by:
logonAttempt in interface LogonListener
Parameters:
event - a LogonEvent value

getQuiz

public Quiz getQuiz()
Describe getQuiz method here.

Returns:
a Quiz value

setQuiz

public void setQuiz(Quiz q)
Describe setQuiz method here.

Parameters:
q - a Quiz value

getLibrary

public AbstractLibrary getLibrary()
Returns the library which is supplying questions.

Returns:
an AbstractLibrary value

confirmQuit

protected abstract boolean confirmQuit()
Asks the user if he's sure he wants to quit. Delegates to getUIBuilder.confirmQuit().

Returns:
a boolean value

createQuizSelector

public abstract void createQuizSelector()
Creates the UI widget that allows the user to select a chapter to start a quiz.


getUser

public final User getUser()
Returns the active user.

Returns:
an User value

validate

protected void validate(User u,
                        AbstractLibrary l)
Coordinates the users question data with question in the active library.

Parameters:
u - an User value
l - an AbstractLibrary value

loadLibrary

protected final AbstractLibrary loadLibrary()
Reads in the library.

Returns:
an AbstractLibrary value

getResourceString

public String getResourceString(String key,
                                String def)
Returns the named resource value or the given default, if the resource value is unavailable.

Parameters:
key - a String value
def - a String value
Returns:
a String value

loadPluglets

public abstract void loadPluglets()
Loads all the feedback, strategy, and tool pluglets.


setStatus

public abstract void setStatus(int pos,
                               String msg)
Shows the user startup status, delegates to getUIBuilder()'s setStatus.

Parameters:
pos - an int value
msg - a String value

newSetStatus

public abstract void newSetStatus(int pos,
                                  String key)

showSplashScreen

protected abstract void showSplashScreen()
Keep the user entertained and informed during startup.


closeSplashScreen

protected abstract void closeSplashScreen()
Called when startup is finished, delegates to UIBuilder's closeSplashScreen.


setUserName

public final void setUserName(String na)
Sets the user name, useful only before login.

Parameters:
na - a String value

setPassword

public final void setPassword(String na)
Sets the user password, useful only before login.

Parameters:
na - a String value

registerFeedbackPlugins

public void registerFeedbackPlugins(Quiz theQuiz)
Sets the feedbackpluglets as answerListeners for the quiz.

Parameters:
theQuiz - a Quiz value

processArguments

public void processArguments(String[] args)
Process command line arguments.

Parameters:
args - a String[] value

saveUser

public final void saveUser()
Save's the user's progress.


niceQuit

public final void niceQuit(boolean confirm)
Ask the user if he really wants to quit.

Parameters:
confirm - a boolean value

showIncorrectDialog

public abstract void showIncorrectDialog(String msg)
Show the user that his answer was incorrect.

Parameters:
msg - a String value