Class JDialogScriptRecorder

All Implemented Interfaces:
ScriptRecordingListener, DialogDefaultsInterface, ActionListener, FocusListener, ItemListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class JDialogScriptRecorder extends JDialogBase implements ScriptRecordingListener, ActionListener, WindowListener
This is the "record script" dialog. While it's running, when scriptable commands happen they show up in the text area. The text area can be changed to be editable (which pauses the recording) or uneditable (default uneditable). Script recording can be paused and resumed; when paused, commands will not show up in the script. There is a file menu that allows the user to open a script file (this dumps the contents of the script file to the text area), save a script file, and exit. Right now open and save don't request specific extensions, but this could change in the future.
Author:
Neva Cherniavsky
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • editButton

      private JButton editButton
      DOCUMENT ME!
    • instructionLabel

      private JLabel instructionLabel
      DOCUMENT ME!
    • message

      private String message
      DOCUMENT ME!
    • pauseButton

      private JButton pauseButton
      DOCUMENT ME!
    • pauseButton2

      private JButton pauseButton2
      DOCUMENT ME!
    • scriptTextArea

      private JTextArea scriptTextArea
      DOCUMENT ME!
    • scriptRecorder

      private ScriptRecorder scriptRecorder
      A reference to the global MIPAV script recorder. This dialog listens to changes in its status and script.
  • Constructor Details

    • JDialogScriptRecorder

      public JDialogScriptRecorder()
      Constructs a new script recorder dialog and turns recording on.
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Reacts to the following actions:
      Open - asks the user to choose a script file and dumps the contents to the text area
      Save - saves the script to a file
      Exit - calls windowClosing
      Pause - pauses or resumes the script recording by setting isRecording appropriately
      Edit - makes the text area editable or uneditable.
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class JDialogBase
      Parameters:
      event - Event that triggers this function.
    • windowActivated

      public void windowActivated(WindowEvent event)
      Do nothing.
      Specified by:
      windowActivated in interface WindowListener
      Overrides:
      windowActivated in class JDialogBase
      Parameters:
      event - Window event.
    • windowClosed

      public void windowClosed(WindowEvent event)
      Do nothing.
      Specified by:
      windowClosed in interface WindowListener
      Overrides:
      windowClosed in class JDialogBase
      Parameters:
      event - Window event.
    • windowClosing

      public void windowClosing(WindowEvent event)
      Closes the dialog and stop the script recorder.
      Specified by:
      windowClosing in interface WindowListener
      Overrides:
      windowClosing in class JDialogBase
      Parameters:
      event - Window event (null if we are closing the window programmatically).
    • windowDeactivated

      public void windowDeactivated(WindowEvent event)
      Do nothing.
      Specified by:
      windowDeactivated in interface WindowListener
      Overrides:
      windowDeactivated in class JDialogBase
      Parameters:
      event - Window event.
    • windowDeiconified

      public void windowDeiconified(WindowEvent event)
      Do nothing.
      Specified by:
      windowDeiconified in interface WindowListener
      Overrides:
      windowDeiconified in class JDialogBase
      Parameters:
      event - Window event.
    • windowIconified

      public void windowIconified(WindowEvent event)
      Do nothing.
      Specified by:
      windowIconified in interface WindowListener
      Overrides:
      windowIconified in class JDialogBase
      Parameters:
      event - Window event.
    • windowOpened

      public void windowOpened(WindowEvent event)
      Do nothing.
      Specified by:
      windowOpened in interface WindowListener
      Overrides:
      windowOpened in class JDialogBase
      Parameters:
      event - Window event.
    • initGUI

      private void initGUI()
      Initializes the dialog box and adds the components.
    • open

      private void open() throws IOException
      Opens the script as a text file and dumps it to the text area.
      Throws:
      IOException - If the open fails for some reason
    • save

      private void save() throws IOException
      Saves the script as a text file; calls the appropriate save dialogs to do so.
      Throws:
      IOException - If the save fails for some reason.
    • setUserInstructions

      private void setUserInstructions(String message)
      Sets the instruction label to the message. Used mostly for Pause/Resume.
      Parameters:
      message - Text to set the label to.
    • changeScriptEditingAbility

      private void changeScriptEditingAbility(boolean doAllowEditing)
      Changes whether the current script can be edited by hand (which pauses the script recording while the editing is being done.
      Parameters:
      doAllowEditing - Whether the ability to edit the script should be enabled.
    • updateScript

      public void updateScript(String newScriptText)
      Alerts the listener to a change in the text of the script currently being recorded.
      Specified by:
      updateScript in interface ScriptRecordingListener
      Parameters:
      newScriptText - The text of the script (the whole text, not just any additions).
    • changeRecordingStatus

      public void changeRecordingStatus(int recorderStatus)
      Alerts the listener to a change in whether the ScriptRecorder is currently recording a script.
      Specified by:
      changeRecordingStatus in interface ScriptRecordingListener
      Parameters:
      recorderStatus - The new status of the scriptRecorder (PAUSED, RECORDING, or STOPPED).