haifa.shopsim.UI
Class MainGUI.AlgorithmSelectionAction
java.lang.Object
|
+--javax.swing.AbstractAction
|
+--haifa.shopsim.UI.MainGUI.AlgorithmSelectionAction
- All Implemented Interfaces:
- javax.swing.Action, java.awt.event.ActionListener, java.lang.Cloneable, java.util.EventListener, java.io.Serializable
- Enclosing class:
- MainGUI
- abstract class MainGUI.AlgorithmSelectionAction
- extends javax.swing.AbstractAction
This class implements an action that occurs when a new algorithm is selected.
The action first stops the simulation if it is running. It then removes the
simulation and gc's what it can. A new algorithm is then created.
The class is abstract in the sense of the allocateAlgorithm method. It is best
if this class be extended by an anonymous inner class within listeners such that
the allocateAlgorithm method is extended and allocates the proper algorithm.
This design prevents allocating all of the available algorithms at start up.
- See Also:
- Serialized Form
Inner classes inherited from class javax.swing.AbstractAction |
javax.swing.AbstractAction.ArrayTable |
Fields inherited from class javax.swing.AbstractAction |
arrayTable, changeSupport, enabled |
Fields inherited from interface javax.swing.Action |
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON |
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent ae)
Does what is specified at the class explanation above. |
abstract ShopAlgorithm |
allocateAlgorithm()
This method is to be overriden by implementations such that it allocates
the desired algorithm and returns a reference. |
Methods inherited from class javax.swing.AbstractAction |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getValue, isEnabled, putValue, readObject, removePropertyChangeListener, setEnabled, writeObject |
Methods inherited from class java.lang.Object |
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
shopAlgorithm
private ShopAlgorithm shopAlgorithm
- A reference to the shopAlgorithm which this class handles.
MainGUI.AlgorithmSelectionAction
MainGUI.AlgorithmSelectionAction(java.lang.String algName)
- The constructor uses an algorithm name.
allocateAlgorithm
public abstract ShopAlgorithm allocateAlgorithm()
- This method is to be overriden by implementations such that it allocates
the desired algorithm and returns a reference.
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent ae)
- Does what is specified at the class explanation above.
- Overrides:
actionPerformed
in class javax.swing.AbstractAction