net.sourceforge.pavlov.main.standalone
Class SwingUIFactory

java.lang.Object
  extended by net.sourceforge.pavlov.main.AbstractUIFactory
      extended by net.sourceforge.pavlov.main.standalone.SwingUIFactory
All Implemented Interfaces:
ActionListener, EventListener, HyperlinkListener, LogonListener

public class SwingUIFactory
extends AbstractUIFactory
implements ActionListener, HyperlinkListener, LogonListener

The purpose of this class and AbstractUIFactory is to separate user-interface details and program logic so that Pavlov can easily be reimplemented in user interface environments other than Swing. As of 1.0 that separation has not been accomplished. There needs to be a greater level of abstraction here and throughout the code. For example, many classes throughout Pavlov are subclasses of JI_nternalFrame and JComponent. Reimplementation of these classes as Model-View-Controller would allow porting to consist of writing a view, and a UIFactory that couples that view with the controller.


Field Summary
protected  PlugletLoader feedbackPlugins
          Describe variable feedbackPlugins here.
protected  JFrame MYFRAME
          Describe variable MYFRAME here.
protected  Pavlov pavlov
          Describe variable pavlov here.
protected  Quiz quiz
          Describe variable quiz here.
protected  QuizController quizController
          Describe variable quizController here.
protected  JSplitPane SPLITTER
          Describe variable SPLITTER here.
protected  StrategyLoader strategyPluglets
          Describe variable strategyPluglets here.
protected  SteelmeTheme theme
          Describe variable theme here.
protected  File themeDirectory
          Describe variable themeDirectory here.
protected  PlugletLoader toolPluglets
          Describe variable toolPluglets here.
protected  VelocityPlugletLoader velocityPlugins
          Describe variable velocityPlugins here.
 
Constructor Summary
SwingUIFactory(Pavlov thePavlov, JFrame base)
          Creates a new SwingUIFactory instance.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Describe actionPerformed method here.
 void applyTheme()
          Apply the current theme.
 void closeSplashScreen()
          Null implementation here, since StartupWindow closes itself.
 boolean confirmQuit()
          Describe confirmQuit method here.
 JMenuBar createMenuBar(JComponent rootPane)
          Describe createMenuBar method here.
 void createQuizSelector(User user, AbstractLibrary library)
          Describe createQuizSelector method here.
 JComponent getMain()
          Gets the main attribute of the SwingUIFactory object
 Quiz getQuiz()
          Describe getQuiz method here.
 String getResourceString(String a, String b)
          Describe getResourceString method here.
 void hyperlinkUpdate(HyperlinkEvent e)
          Describe hyperlinkUpdate method here.
 void logonAttempt(LogonEvent event)
          The LoginController calls this when the user has finished logging in.
protected  void makeFeedbackMenu(JMenuBar menuBar)
          Describe makeFeedbackMenu method here.
protected  void makeFileMenu(JMenuBar menuBar)
          Describe makeFileMenu method here.
protected  void makeHelpMenu(JMenuBar menuBar)
          Describe makeHelpMenu method here.
 ImageIcon makeImageIcon(String key, String def, int size)
          Describe makeImageIcon method here.
protected  void makePreferencesMenu(JMenuBar menuBar, JComponent targ)
          Describe makePreferencesMenu method here.
protected  void makeSkinMenu(JMenu men)
          Describe makeSkinMenu method here.
protected  void makeStrategyMenu(JMenuBar menuBar)
          Describe makeStrategyMenu method here.
protected  void makeToolsMenu(JMenuBar menuBar)
          Describe makeToolsMenu method here.
 void saveQuiz()
          Saves the current quiz.
 void setFeedbackPluglets(PlugletLoader loader)
          Describe setFeedbackPluglets method here.
 void setQuiz(Quiz quiz)
          Describe setQuiz method here.
 void setStatus(int percent, String msg)
          Sets the message and status number in startup window.
 void setStrategyPluglets(StrategyLoader loader)
          Describe setStrategyPluglets method here.
 void setTemplateToolkit(Skin kit)
          Describe setTemplateToolkit method here.
 void setToolPluglets(PlugletLoader loader)
          Describe setToolPluglets method here.
 void setVelocityPluglets(VelocityPlugletLoader loader)
          Describe setVelocityPluglets method here.
 int showConfirmDialog(Object message)
          Describe showConfirmDialog method here.
 void showErrorDialog(String message, Exception ex)
          Description of the Method
 int showFileChooser(JFileChooser chooser, boolean openMode)
          Describe showFileChooser method here.
 void showIncorrectDialog(String msg)
          Describe showIncorrectDialog method here.
 void showInfoDialog(String msg, String title)
          Description of the Method
 String showInputDialog(Object message, String title, int messageType)
          Describe showInputDialog method here.
 void showLoginController(LogonListener lis)
          Creates the login widget and shows it to the user.
 void showMessageDialog(Object message, String title, int messageType)
          Describe showMessageDialog method here.
 int showOptionDialog(Object message, String title, int optionType, int messageType, Icon icon, Object[] options, Object initialValue)
          Describe showOptionDialog method here.
 void showSplashScreen(JFrame frame)
          Shows the startup window.
 void startQuiz(User user, ChapterReference ref)
          Describe startQuiz method here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MYFRAME

protected final JFrame MYFRAME
Describe variable MYFRAME here.


SPLITTER

protected final JSplitPane SPLITTER
Describe variable SPLITTER here.


pavlov

protected final Pavlov pavlov
Describe variable pavlov here.


quiz

protected Quiz quiz
Describe variable quiz here.


quizController

protected QuizController quizController
Describe variable quizController here.


theme

protected SteelmeTheme theme
Describe variable theme here.


themeDirectory

protected File themeDirectory
Describe variable themeDirectory here.


feedbackPlugins

protected PlugletLoader feedbackPlugins
Describe variable feedbackPlugins here.


velocityPlugins

protected VelocityPlugletLoader velocityPlugins
Describe variable velocityPlugins here.


strategyPluglets

protected StrategyLoader strategyPluglets
Describe variable strategyPluglets here.


toolPluglets

protected PlugletLoader toolPluglets
Describe variable toolPluglets here.

Constructor Detail

SwingUIFactory

public SwingUIFactory(Pavlov thePavlov,
                      JFrame base)
Creates a new SwingUIFactory instance.

Parameters:
thePavlov - a Pavlov value
base - a JComponent value
Method Detail

getMain

public JComponent getMain()
Gets the main attribute of the SwingUIFactory object

Returns:
The main value

confirmQuit

public boolean confirmQuit()
Describe confirmQuit method here.

Specified by:
confirmQuit in class AbstractUIFactory
Returns:
a boolean value

setQuiz

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

Parameters:
quiz - The new quiz value

getQuiz

public Quiz getQuiz()
Describe getQuiz method here.

Returns:
a Quiz value

setFeedbackPluglets

public void setFeedbackPluglets(PlugletLoader loader)
Describe setFeedbackPluglets method here.

Parameters:
loader - The new feedbackPluglets value

setVelocityPluglets

public void setVelocityPluglets(VelocityPlugletLoader loader)
Describe setVelocityPluglets method here.

Parameters:
loader - The new velocityPluglets value

setStrategyPluglets

public void setStrategyPluglets(StrategyLoader loader)
Describe setStrategyPluglets method here.

Parameters:
loader - The new strategyPluglets value

setToolPluglets

public void setToolPluglets(PlugletLoader loader)
Describe setToolPluglets method here.

Parameters:
loader - The new toolPluglets value

applyTheme

public void applyTheme()
Apply the current theme.


setTemplateToolkit

public void setTemplateToolkit(Skin kit)
Describe setTemplateToolkit method here.

Parameters:
kit - an AbstractTemplateKit value

createQuizSelector

public void createQuizSelector(User user,
                               AbstractLibrary library)
Describe createQuizSelector method here.

Specified by:
createQuizSelector in class AbstractUIFactory
Parameters:
user - an User value
library - an AbstractLibrary value

startQuiz

public void startQuiz(User user,
                      ChapterReference ref)
Describe startQuiz method here.

Specified by:
startQuiz in class AbstractUIFactory
Parameters:
user - an User value
ref - a ChapterReference value

saveQuiz

public void saveQuiz()
Saves the current quiz.


getResourceString

public String getResourceString(String a,
                                String b)
Describe getResourceString method here.

Parameters:
a - a String value
b - a String value
Returns:
a String value

closeSplashScreen

public void closeSplashScreen()
Null implementation here, since StartupWindow closes itself.

Specified by:
closeSplashScreen in class AbstractUIFactory

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

setStatus

public void setStatus(int percent,
                      String msg)
Sets the message and status number in startup window.

Specified by:
setStatus in class AbstractUIFactory
Parameters:
msg - a String value
percent - The new status value

showLoginController

public void showLoginController(LogonListener lis)
Creates the login widget and shows it to the user.

Specified by:
showLoginController in class AbstractUIFactory
Parameters:
lis - a LogonListener value

showSplashScreen

public void showSplashScreen(JFrame frame)
Shows the startup window.

Parameters:
frame - Description of the Parameter

showIncorrectDialog

public void showIncorrectDialog(String msg)
Describe showIncorrectDialog method here.

Specified by:
showIncorrectDialog in class AbstractUIFactory
Parameters:
msg - a String value

showFileChooser

public int showFileChooser(JFileChooser chooser,
                           boolean openMode)
Describe showFileChooser method here.

Specified by:
showFileChooser in class AbstractUIFactory
Parameters:
chooser - a JFileChooser value
openMode - a boolean value
Returns:
an int value

makeImageIcon

public ImageIcon makeImageIcon(String key,
                               String def,
                               int size)
Describe makeImageIcon method here.

Parameters:
key - a String value
def - a String value
size - an int value
Returns:
an ImageIcon value

showConfirmDialog

public int showConfirmDialog(Object message)
Describe showConfirmDialog method here.

Parameters:
message - an Object value
Returns:
an int value

showMessageDialog

public void showMessageDialog(Object message,
                              String title,
                              int messageType)
Describe showMessageDialog method here.

Parameters:
message - an Object value
title - a String value
messageType - an int value

showInputDialog

public String showInputDialog(Object message,
                              String title,
                              int messageType)
                       throws HeadlessException
Describe showInputDialog method here.

Parameters:
message - an Object value
title - a String value
messageType - an int value
Returns:
a String value
Throws:
HeadlessException - if an error occurs

showOptionDialog

public int showOptionDialog(Object message,
                            String title,
                            int optionType,
                            int messageType,
                            Icon icon,
                            Object[] options,
                            Object initialValue)
                     throws HeadlessException
Describe showOptionDialog method here.

Parameters:
message - an Object value
title - a String value
optionType - an int value
messageType - an int value
icon - an Icon value
options - an Object[] value
initialValue - an Object value
Returns:
an int value
Throws:
HeadlessException - if an error occurs

showErrorDialog

public void showErrorDialog(String message,
                            Exception ex)
Description of the Method

Parameters:
message - Description of the Parameter
ex - Description of the Parameter

showInfoDialog

public void showInfoDialog(String msg,
                           String title)
Description of the Method

Parameters:
msg - Description of the Parameter
title - Description of the Parameter

createMenuBar

public JMenuBar createMenuBar(JComponent rootPane)
Describe createMenuBar method here.

Parameters:
rootPane - Description of the Parameter
Returns:
Description of the Return Value

makeFileMenu

protected void makeFileMenu(JMenuBar menuBar)
Describe makeFileMenu method here.

Parameters:
menuBar - Description of the Parameter

makeFeedbackMenu

protected void makeFeedbackMenu(JMenuBar menuBar)
Describe makeFeedbackMenu method here.

Parameters:
menuBar - Description of the Parameter

makeToolsMenu

protected void makeToolsMenu(JMenuBar menuBar)
Describe makeToolsMenu method here.

Parameters:
menuBar - Description of the Parameter

makePreferencesMenu

protected void makePreferencesMenu(JMenuBar menuBar,
                                   JComponent targ)
Describe makePreferencesMenu method here.

Parameters:
menuBar - Description of the Parameter
targ - Description of the Parameter

makeSkinMenu

protected void makeSkinMenu(JMenu men)
Describe makeSkinMenu method here.

Parameters:
men - a JMenu value

makeStrategyMenu

protected void makeStrategyMenu(JMenuBar menuBar)
Describe makeStrategyMenu method here.

Parameters:
menuBar - Description of the Parameter

makeHelpMenu

protected void makeHelpMenu(JMenuBar menuBar)
Describe makeHelpMenu method here.

Parameters:
menuBar - Description of the Parameter

actionPerformed

public void actionPerformed(ActionEvent e)
Describe actionPerformed method here.

Specified by:
actionPerformed in interface ActionListener
Parameters:
e - a java.awt.event.ActionEvent value

hyperlinkUpdate

public void hyperlinkUpdate(HyperlinkEvent e)
Describe hyperlinkUpdate method here.

Specified by:
hyperlinkUpdate in interface HyperlinkListener
Parameters:
e - a HyperlinkEvent value