package com.abl.gui; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.*; //SurveyController: /** part of Model-View-Controller (and contains Model; may need to separate for complicated applications) @version 1/19/2001 @author I made this. -- prie, 8/15/98 */ final public class SurveyController implements ActionListener { private SurveyView view = null; public SurveyController() { Frame system = Console.getFrame(); if (system != null) { view = new SurveyView(system); view.connectTo(this); } //else use command-line interface } public void actionPerformed(ActionEvent evt) { String command = evt.getActionCommand().intern(); if (command.equals("Next")) view.setVisible(false); } public String askUser(String defaultStr) { String response = null; if (view != null) { //if available, use GUI: view.displayModelData(defaultStr); //clean the slate and get user changes response = view.getModelData(); } else { //command-line interface: unsupported.... response = defaultStr; } /*response = defaultStr; /* for profiling, uncomment this and comment out the above */ return response; } }