net.sourceforge.pavlov.pluglets.strategy
Class StrategyLoader

java.lang.Object
  extended by net.sourceforge.pavlov.pluglets.PlugletLoader
      extended by net.sourceforge.pavlov.pluglets.strategy.StrategyLoader
All Implemented Interfaces:
ActionListener, EventListener

public class StrategyLoader
extends PlugletLoader
implements ActionListener

A plugin loader for question selection strategies.


Field Summary
protected  Vector<StrategyListener> strategyListeners
          Objects that want to be notified when user selects a new strategy.
 
Fields inherited from class net.sourceforge.pavlov.pluglets.PlugletLoader
cat, pluglets
 
Constructor Summary
StrategyLoader(String baseClassName, String directory)
          Creates a new StrategyLoader instance.
 
Method Summary
 void actionPerformed(ActionEvent evt)
          User has clicked a JRadioButtonMenuItem on my menu.
 void addStrategyListener(StrategyListener l)
          Adds a listener.
 ButtonGroup addToJMenuAsRadioButtons(JMenu menu)
          Describe addToJMenuAsRadioButtons method here.
 AbstractStrategy getCurrentStrategy()
          Lets a non-listener know what current strategy is.
 void notify(AbstractStrategy newStrategy)
          Notify all my listeners that the strategy has changed.
 
Methods inherited from class net.sourceforge.pavlov.pluglets.PlugletLoader
addToAnswerEventProducer, addToContainer, addToJMenuAsCheckboxes, getPluginByName, isAJarFile, mungeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

strategyListeners

protected Vector<StrategyListener> strategyListeners
Objects that want to be notified when user selects a new strategy.

Constructor Detail

StrategyLoader

public StrategyLoader(String baseClassName,
                      String directory)
Creates a new StrategyLoader instance.

Parameters:
baseClassName - a String value
directory - a String value
Method Detail

addStrategyListener

public void addStrategyListener(StrategyListener l)
Adds a listener.

Parameters:
l - a StrategyListener value

notify

public void notify(AbstractStrategy newStrategy)
Notify all my listeners that the strategy has changed.

Parameters:
newStrategy - an AbstractStrategy value

getCurrentStrategy

public AbstractStrategy getCurrentStrategy()
Lets a non-listener know what current strategy is.

Returns:
an AbstractStrategy value

addToJMenuAsRadioButtons

public ButtonGroup addToJMenuAsRadioButtons(JMenu menu)
Describe addToJMenuAsRadioButtons method here.

Overrides:
addToJMenuAsRadioButtons in class PlugletLoader
Parameters:
menu - a JMenu value
Returns:
a ButtonGroup value

actionPerformed

public void actionPerformed(ActionEvent evt)
User has clicked a JRadioButtonMenuItem on my menu. Set the current strategy as requested and notify listeners.

Specified by:
actionPerformed in interface ActionListener
Parameters:
evt - an ActionEvent value