Package controller
Class MainScreenController
java.lang.Object
controller.MainScreenController
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.util.EventListener
,javax.swing.event.DocumentListener
public class MainScreenController
extends java.lang.Object
implements java.awt.event.ActionListener, javax.swing.event.DocumentListener, java.awt.event.WindowListener
Class providing the controller for the processes related to the main screen of the system
(namely, the probing and diagnosis per se, together with the display of the technical logs)
-
Constructor Summary
Constructors Constructor Description MainScreenController(MainScreen scr, PrologJavaRunner expert)
Creates a controller object with the main screen GUI and the expert system as parameters -
Method Summary
Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
Invoked when an action occursvoid
changedUpdate(javax.swing.event.DocumentEvent e)
Gives notification that an attribute or set of attributes changedboolean
checkResponse(java.lang.String responseStr)
Returnstrue
if the patient's vital sign, as supplied by the user, is a nonnegative number;false
, otherwisevoid
displayDiagnosis()
Displays the final diagnosis of the medical expert systemvoid
displayEmergency()
Updates the log and displays a popup message should the patient report experiencing a symptom that is indicative of an emergencyvoid
insertUpdate(javax.swing.event.DocumentEvent e)
Gives notification that there was an insert into the documentvoid
removeUpdate(javax.swing.event.DocumentEvent e)
Gives notification that a portion of the document has been removedvoid
setQuestionNature(java.lang.String symptom)
Enables and disables buttons on the screen depending on the nature of the question, given the current symptom being probedvoid
windowActivated(java.awt.event.WindowEvent e)
Invoked when the Window is set to be the active Windowvoid
windowClosed(java.awt.event.WindowEvent e)
Invoked when a window has been closed as the result of calling dispose on the windowvoid
windowClosing(java.awt.event.WindowEvent e)
Invoked when the user attempts to close the window from the window's system menuvoid
windowDeactivated(java.awt.event.WindowEvent e)
Invoked when a window is no longer the active windowvoid
windowDeiconified(java.awt.event.WindowEvent e)
Invoked when a window is changed from a minimized to a normal statevoid
windowIconified(java.awt.event.WindowEvent e)
Invoked when a window is changed from a normal to a minimized statevoid
windowOpened(java.awt.event.WindowEvent e)
Invoked when a window is made visible
-
Constructor Details
-
MainScreenController
Creates a controller object with the main screen GUI and the expert system as parameters- Parameters:
scr
- graphical user interface for the main screenexpert
- expert system featuring a Java interface and a Prolog knowledge base
-
-
Method Details
-
windowClosing
public void windowClosing(java.awt.event.WindowEvent e)Invoked when the user attempts to close the window from the window's system menu- Specified by:
windowClosing
in interfacejava.awt.event.WindowListener
- Parameters:
e
- window event indicative of a change in status
-
windowActivated
public void windowActivated(java.awt.event.WindowEvent e)Invoked when the Window is set to be the active Window- Specified by:
windowActivated
in interfacejava.awt.event.WindowListener
- Parameters:
e
- window event indicative of a change in status
-
windowClosed
public void windowClosed(java.awt.event.WindowEvent e)Invoked when a window has been closed as the result of calling dispose on the window- Specified by:
windowClosed
in interfacejava.awt.event.WindowListener
- Parameters:
e
- window event indicative of a change in status
-
windowDeactivated
public void windowDeactivated(java.awt.event.WindowEvent e)Invoked when a window is no longer the active window- Specified by:
windowDeactivated
in interfacejava.awt.event.WindowListener
- Parameters:
e
- window event indicative of a change in status
-
windowDeiconified
public void windowDeiconified(java.awt.event.WindowEvent e)Invoked when a window is changed from a minimized to a normal state- Specified by:
windowDeiconified
in interfacejava.awt.event.WindowListener
- Parameters:
e
- window event indicative of a change in status
-
windowIconified
public void windowIconified(java.awt.event.WindowEvent e)Invoked when a window is changed from a normal to a minimized state- Specified by:
windowIconified
in interfacejava.awt.event.WindowListener
- Parameters:
e
- window event indicative of a change in status
-
windowOpened
public void windowOpened(java.awt.event.WindowEvent e)Invoked when a window is made visible- Specified by:
windowOpened
in interfacejava.awt.event.WindowListener
- Parameters:
e
- window event indicative of a change in status
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)Invoked when an action occurs- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Parameters:
e
- semantic event indicative that a component-defined action occurred
-
insertUpdate
public void insertUpdate(javax.swing.event.DocumentEvent e)Gives notification that there was an insert into the document- Specified by:
insertUpdate
in interfacejavax.swing.event.DocumentListener
- Parameters:
e
- document event corresponding to a document change
-
removeUpdate
public void removeUpdate(javax.swing.event.DocumentEvent e)Gives notification that a portion of the document has been removed- Specified by:
removeUpdate
in interfacejavax.swing.event.DocumentListener
- Parameters:
e
- document event corresponding to a document change
-
changedUpdate
public void changedUpdate(javax.swing.event.DocumentEvent e)Gives notification that an attribute or set of attributes changed- Specified by:
changedUpdate
in interfacejavax.swing.event.DocumentListener
- Parameters:
e
- document event corresponding to a document change
-
setQuestionNature
public void setQuestionNature(java.lang.String symptom)Enables and disables buttons on the screen depending on the nature of the question, given the current symptom being probedIn particular, if the question is of a dichotomous nature, only the yes and no buttons are enabled. If the question is open-ended (for example, it is asking for the body temperature or the heart rate), then only the submit button is enabled.
- Parameters:
symptom
- current symptom being probed
-
displayDiagnosis
public void displayDiagnosis()Displays the final diagnosis of the medical expert system -
displayEmergency
public void displayEmergency()Updates the log and displays a popup message should the patient report experiencing a symptom that is indicative of an emergency -
checkResponse
public boolean checkResponse(java.lang.String responseStr)Returnstrue
if the patient's vital sign, as supplied by the user, is a nonnegative number;false
, otherwise- Parameters:
responseStr
- patient's vital sign, as supplied by the user- Returns:
true
if the patient's vital sign, as supplied by the user, is a nonnegative number;false
, otherwise
-