/** * This is the controller for the Unit Converter application. */ public class UnitConvController { // TODO: Declare attributes as needed. ; /** * Initialises this controller with the passed model and view. * @param model the model to associate with this controller * @param view the view to associate with this controller */ public UnitConvController(UnitConvModel model, UnitConvView view) { // TODO: Initialize this controller as needed. ; } // TODO: Implement public methods as needed. ; /** * Abstract base class for classes that listen for conversion events. */ private abstract class ConversionListener implements ActionListener { /** * Defines how to perform the conversion. * @param inputValue the value to convert */ protected abstract void doOperation(double inputValue); /** * Parses the user's input, delegates to doOperation, then updates * the result value. If the user's input is not parsable as a double, * use Double.NaN instead. */ @Override public void actionPerformed(ActionEvent action) { // TODO: Parse the user's input, delegate to doOperation, // then update the result value. ; } } private class CToFListener extends ConversionListener { @Override protected void doOperation(double userValue) { // TODO: Delegate to the appropriate method in the model. ; } } // TODO: Implement other private listener classes for each conversion. ; /** * Abstract base class for classes that listen for menu events */ private abstract class MenuListener implements ActionListener { ; // Nothing here. } private class SaveListener extends MenuListener { @Override public void actionPerformed(ActionEvent action) { // TODO: Get the file chooser result and delegate to // the appropriate method in the model. ; } } // TODO: Implement other private listener classes for each menu item. ; }