jAudioFeatureExtractor.actions
Class AddRecordingAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by jAudioFeatureExtractor.actions.AddRecordingAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

public class AddRecordingAction
extends javax.swing.AbstractAction

Action for importing audio files into jAudio.

Author:
Daniel McEnnis
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
AddRecordingAction()
          Generic constructor that provides menu item text.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Instantiates a JFileChooser for the load_recording_chooser field if one does not already exist.
 void addRecording(java.io.File[] toBeAdded)
          Adds the given files to the table display and stores a reference to them.
 void setModel(Controller c)
          AddRecordingAction requires access to the table where recordings are stored.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddRecordingAction

public AddRecordingAction()
Generic constructor that provides menu item text.

Method Detail

setModel

public void setModel(Controller c)
AddRecordingAction requires access to the table where recordings are stored. This method supplies that context.

Parameters:
c - near global controller object

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Instantiates a JFileChooser for the load_recording_chooser field if one does not already exist. This dialog box allows the user to choose one or more files to add to the recording_list list of references to audio file and display the added files on the recordings_table.

Only audio files of known types (i.e. with known extensions) are displayed in the file chooser.

Verifies that the files are valid audio files that can be read if the validate_recordings_when_load_them_check_box checkbox is selected. Only stores the actual samples if the store_audio_samples_check_box check box is selected (otherwise just stores file references).

If a selected file path corresponds to a file that does not exist, then an error message is displayed.


addRecording

public void addRecording(java.io.File[] toBeAdded)
                  throws java.lang.Exception
Adds the given files to the table display and stores a reference to them. Ignores files that have already been added to the table.

Verifies that the files are valid audio files that can be read if the validate_recordings_when_load_them_check_box checkbox is selected. Only stores the actual samples if the store_audio_samples_check_box check box is selected (otherwise just stores file references).

If a given file path corresponds to a file that does not exist, then an error message is displayed.

Parameters:
toBeAdded - The files to add to the table.
Throws:
java.lang.Exception